Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 9th, 2006, 01:51 PM
Authorized User
Join Date: Jun 2006
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default xsl sorting

Processor-version.xsl,v 1.3 2000-05-01 18:52:42-04
Vendor: Microsoft
Processor version: Original IE5 (or old version of other processor)

following is my output for below xml and xsl code. In the following output, NaN is coming. i don't know why.

Thanks in advance. i appreciate your great help.

$0 - $49,999.00 4.000
$49,999.00 - $99,999.00 3.000
$99,999.00 - $249,999.00 2.250
$249,999.00 - $499,999.00 1.250
$499,999.00 - $999,999.00 0.800
NaN - $2,000,000.00 0.800
$2,000,000.00 - $3,000,000.00 0.640
$3,000,000.00 - $50,000,000.00 0.400
$50,000,000.00 - $100,000,000.00 0.200
$100,000,000.00+ 0.120


<?xml version="1.0" encoding="ISO-8859-1"?>
  <DealerCommission Seq="5">
   <Investment DocID="764548" StartOffset="90690">2000000</Investment>
   <Percentage DocID="764548" StartOffset="90643">0.80</Percentage>
  <DealerCommission Seq="6">
   <Investment DocID="764548" StartOffset="90717">3000000</Investment>
   <Percentage DocID="764548" StartOffset="90701">0.64</Percentage>
  <DealerCommission Seq="7">
   <Investment DocID="764548" StartOffset="90744">50000000</Investment>
   <Percentage DocID="764548" StartOffset="90728">0.40</Percentage>
  <DealerCommission Seq="8">
   <Investment DocID="764548" StartOffset="90773">100000000</Investment>
   <Percentage DocID="764548" StartOffset="90756">0.20</Percentage>
  <DealerCommission Seq="9">
   <Investment DocID="764548" StartOffset="90795">999999999</Investment>
   <Percentage DocID="764548" StartOffset="90789">0.12</Percentage>
  <DealerCommission Seq="0">
   <Investment DocID="766378" StartOffset="242761">49999</Investment>
   <Percentage DocID="766378" StartOffset="243057">4.00</Percentage>
  <DealerCommission Seq="1">
   <Investment DocID="766378" StartOffset="243157">99999</Investment>
   <Percentage DocID="766378" StartOffset="243400">3.00</Percentage>
  <DealerCommission Seq="2">
   <Investment DocID="766378" StartOffset="243519">249999</Investment>
   <Percentage DocID="766378" StartOffset="243816">2.25</Percentage>
  <DealerCommission Seq="3">
   <Investment DocID="766378" StartOffset="243917">499999</Investment>
   <Percentage DocID="766378" StartOffset="244160">1.25</Percentage>
  <DealerCommission Seq="4">
   <Investment DocID="766378" StartOffset="244279">999999</Investment>
   <Percentage DocID="766378" StartOffset="244578">0.80</Percentage>


       <xsl:for-each select="DATAEXPRESS/DealerCommissions/DealerCommission">
         <xsl:sort select="@Seq" data-type="number"/>
        <xsl:if test="Investment!=999999999 or (position()>1 and preceding-sibling::node()[position()=1]/Investment/@StartOffset!=Investment/@StartOffset) or (@Seq=0 and Percentage>0) or (@Seq=0 and Percentage=0)">
         <xsl:when test="position()>1">
           <xsl:value-of select="format-number(preceding-sibling::node()[position()=1]/Investment,'$#,##0.00')"/>
           <xsl:value-of select="$0"/>
         <xsl:when test="Investment=999999999">+
         <xsl:otherwise> -
           <xsl:value-of select="format-number(Investment,'$#,##0.00')"/>
           <xsl:value-of select="format-number(Percentage,'0.000')/>

Similar Threads
Thread Thread Starter Forum Replies Last Post
sorting decimal values in xsl SOMANATHAN10 XSLT 1 May 10th, 2007 07:47 AM
Sorting a xsl:if test="position()" charmaigne XSLT 2 April 12th, 2006 04:42 AM
Sorting element in xsl Sakubar Sathik XSLT 5 April 6th, 2006 04:23 AM
XSL Sorting using variable mannabaron XSLT 4 February 15th, 2006 06:13 AM
Sorting with XSL mannabaron XSLT 2 February 14th, 2006 10:25 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.