Subject: Re: [xsl] xsl:sort now working under unix From: Sylvia Murphy <murphys@xxxxxxxx> Date: Wed, 22 Dec 2004 15:54:12 -0700 |
<?xml version="1.0"?> <?xml-stylesheet type="text/xml" href="./status_style.xsl"?> <runs> <title>Summary of CCSM Production Runs</title> <case filename="./b30.043.xml"/> <case filename="./b30.999.xml"/> <case filename="./b30.100.02.xml"/> </runs>
an example of one of these xml files is: <case> <name>b30.999</name>
<!--running, completed, halted, or aborted--> <status>aborted</status>
<queue>csl_sp8</queue> </case>
<!-- this portion is actually what occurs in the middle of the table--> <xsl:template match="case"> <tr> <td><xsl:value-of select="name"/></td> <xsl:if test="status = 'aborted'"> <td bgcolor="red"><xsl:value-of select="status"/></td> </xsl:if> <xsl:if test="status = 'halted'"> <td bgcolor="#FFCE9C"><xsl:value-of select="status"/></td> </xsl:if> <xsl:if test="status = 'completed'"> <td bgcolor="#EFF8AD"><xsl:value-of select="status"/></td> </xsl:if> <xsl:if test="status = 'running'"> <td bgcolor="#CE84C6"><xsl:value-of select="status"/></td> </xsl:if> <td><xsl:value-of select="start_info"/></td> <td><xsl:value-of select="start_year"/></td> <td><xsl:value-of select="proj_end_year"/></td> <td><xsl:value-of select="res"/></td> <td><xsl:value-of select="tag"/></td> <td><xsl:value-of select="queue"/></td> <td><xsl:value-of select="description"/></td> <td><xsl:value-of select="history"/></td> </tr>
Hi Sylvia,
<xsl:for-each select="addressbook"> <!--descending or ascending (default) --> <xsl:sort select="age" data-type="number" order="descending"/> <xsl:apply-templates/> </xsl:for-each>
xsl:sort works on the for-each that precedes it, not on the apply-templates that follows it. So this code will sort the addressbook elements, instead of the address elements. That's why they appear in input-document order. Try replacing the above snippet with something like:
<xsl:for-each select="addressbook"> <xsl:apply-templates select="address"> <xsl:sort select="age" data-type="number" order="descending"/> </xsl:apply-templates> </xsl:for-each>
HTH, Anton
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl:sort now working unde, Anton Triest | Thread | Re: [xsl] xsl:sort now working unde, Anton Triest |
Re: [xsl] How to do an 'existence' , Dimtre Novatchev | Date | Re: [xsl] xsl:sort now working unde, Anton Triest |
Month |