XSL and Params with Sort-By [modified]
-
Hi all! I have created an XLS file but I am confused over a particular part of the language syntax. If I want to sort by an element attribute I can do the following (and it works):
<xsl:sort-by select="@columnName" order="ascending" data-type="text" />
I want to add a paramater which allows me to input which column is to be sorted by. So I tried the following:
<xsl:param name="sortColumn" />
<!-- Other XSL stuff goes here... -->
<xsl:sort-by select="$sortColumn" order="ascending" data-type="text" />
But this did not work, so I tried the following which also did not work:
<xsl:param name="sortColumn" />
<!-- Other XSL stuff goes here... -->
<xsl:sort-by select="@$sortColumn" order="ascending" data-type="text" />
Could someone please advise me on how to do this? To offer some clarity the input XML documents are structured as follows:
<root>
<entry columnA="value1" columnB="value2" columnC="value3" />
<entry columnA="value4" columnB="value5" columnC="value6" />
<entry columnA="value7" columnB="value8" columnC="value9" />
</root>Many thanks! Lea Hayes
modified on Sunday, August 3, 2008 9:30 PM
-
Hi all! I have created an XLS file but I am confused over a particular part of the language syntax. If I want to sort by an element attribute I can do the following (and it works):
<xsl:sort-by select="@columnName" order="ascending" data-type="text" />
I want to add a paramater which allows me to input which column is to be sorted by. So I tried the following:
<xsl:param name="sortColumn" />
<!-- Other XSL stuff goes here... -->
<xsl:sort-by select="$sortColumn" order="ascending" data-type="text" />
But this did not work, so I tried the following which also did not work:
<xsl:param name="sortColumn" />
<!-- Other XSL stuff goes here... -->
<xsl:sort-by select="@$sortColumn" order="ascending" data-type="text" />
Could someone please advise me on how to do this? To offer some clarity the input XML documents are structured as follows:
<root>
<entry columnA="value1" columnB="value2" columnC="value3" />
<entry columnA="value4" columnB="value5" columnC="value6" />
<entry columnA="value7" columnB="value8" columnC="value9" />
</root>Many thanks! Lea Hayes
modified on Sunday, August 3, 2008 9:30 PM