xsl:sort ..why is it not working?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: xsl:sort ..why is it not working?

  1. #1
    Candy Guest

    xsl:sort ..why is it not working?


    Hi,

    If you have the following code, where do you insert this xsl:sort element
    line?

    <xsl:sort select="./softwaretitle" order="ascending" data-type="text"/>

    <xsl:template match="/tipsheets/tipsheet/softwaretitle">
    <xsl:variable name="curtitle" select="."/>
    <xsl:for-each select=".">
    <xsl:sort select="." order="ascending" data-type="text"/>
    <xsl:if test="not (preceding::softwaretitle[.=$curtitle])">
    <option><xsl:attribute name="value"><xsl:value-of select="$curtitle"/></xsl:attribute><xsl:value-of
    select="$curtitle"/></option>
    </xsl:if>
    </xsl:for-each>
    </xsl:template>

    I have tried it in all sorts of places and it won't work. This template displays
    softwaretitle in a drop down list and removes duplicates.

    Thank you,

    Candy

  2. #2
    S Guest

    Re: xsl:sort ..why is it not working?


    hi,
    the <xsl:sort> element should be direct child of either <xsl:template>
    or <xsl:foreach> template
    if u have MSDN loaded in ur m/c, pl go thro' help

    bye,
    S



    "Candy" <candy@apsc.ubc.ca> wrote:
    >
    >Hi,
    >
    >If you have the following code, where do you insert this xsl:sort element
    >line?
    >
    ><xsl:sort select="./softwaretitle" order="ascending" data-type="text"/>
    >
    ><xsl:template match="/tipsheets/tipsheet/softwaretitle">
    > <xsl:variable name="curtitle" select="."/>
    > <xsl:for-each select=".">
    > <xsl:sort select="." order="ascending" data-type="text"/>
    > <xsl:if test="not (preceding::softwaretitle[.=$curtitle])">
    > <option><xsl:attribute name="value"><xsl:value-of select="$curtitle"/></xsl:attribute><xsl:value-of
    >select="$curtitle"/></option>
    > </xsl:if>
    > </xsl:for-each>
    ></xsl:template>
    >
    >I have tried it in all sorts of places and it won't work. This template

    displays
    >softwaretitle in a drop down list and removes duplicates.
    >
    >Thank you,
    >
    >Candy



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center