Subject: [xsl] Parameterized sort From: "Kim Tran" <tav1210@xxxxxxxxxxx> Date: Tue, 01 Apr 2003 05:25:24 -0800 |
For example, here is my XML: <document> <row><column name="FirstName">John</column> <column name="LastName">Doo</column> </row> <row><column name="FirstName">Alice</column> <column name="LastName">Mulcaster</column> </row>
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xalan="http://xml.apache.org/xalan"> <xsl:output method="xml"/>
<xsl:param name="sortByColumn" select="'FirstName'"/> <xsl:template match="/"> <Document> <xsl:for-each select="Document/row"> <xsl:sort select="column[@name=*[name()=$sortByColumn]]"/> <row> <xsl:apply-templates select="column"/> </row> </xsl:for-each> </Document> </xsl:template>
<xsl:template match="column"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet>
If I say, <xsl:sort select="column[@name='FirstName']"/> then, it works properly.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How do you set the action, Ricardo Castillo | Thread | RE: [xsl] Parameterized sort, Michael Kay |
Re: [xsl] Referencing original root, Oleg Tkachenko | Date | RE: [xsl] Parameterized sort, Stuart Brown |
Month |