Re: [xsl] custom xsl sorting

Subject: Re: [xsl] custom xsl sorting
From: omprakash.v@xxxxxxxxxxxxx
Date: Thu, 8 Sep 2005 09:26:52 +0530
     The following stylesheet should do what you want.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"

<xsl:output method="text"></xsl:output>

      <xsl:key name="tp" match="val" use="."/>
      <xsl:variable name="tps" select="document('xamp2.xml')/Timeperiods"/>

      <xsl:template match="/dynamicpage">

      <xsl:for-each select="$tps/*">
      <xsl:sort select="."/>

            <xsl:variable name="outp" select="key('tp', @period)"/>
            <xsl:value-of select="$outp"/>

            <xsl:if test="not(position() = last()) and $outp">





                      srinivas vemuri                                                                                                  
                      <s_vas98@xxxxxxx         To:      xsl-list@xxxxxxxxxxxxxxxxxxxxxx                                                
                      om>                      cc:      (bcc: omprakash.v/Polaris)                                                     
                                               Subject: [xsl] custom xsl sorting                                                       
                      09/08/2005 08:31                                                                                                 
                      Please respond                                                                                                   
                      to xsl-list                                                                                                      


I have to perform xsl sorting based on time period
instead of regular ascii or integer based sorting. For
ex: According to ascii, BYZANTINE  comes before MIDDLE
BRONZE. But, according to this sort(time period):

My initial idea is like this. A separate xml:
'period.xml' has this period to ascii mapping.
<entry period="middlebronze">1</entry>
<entry period="byzantine">2</entry>
<entry period="Roman">3</entry>
<entry period="islamic">4</entry>
Now, my stylesheet should be applied to a dynamic xml
page & should order period values occur in that page.

<val> byzantine </val>

desired output after xslt application:

byzantine,  Roman, Islamic

Please help regarding how xslt should look like?

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around

This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at

Current Thread