I have a DOM object which I would like to sort various ways. The DOM object gets created after the user submits a form and looks something like this, with the values for sort1, sort3, and sort3 changing based on what was submitted on a previous form (i.e. the user gets to decide what order he wants the output in):
<orders>
<sorts><sort1>location</sort1><sort2>ID</sort2>
<sort3>date</sort3>
</sorts>
<order><location>Texas</location><ID>12</ID>
<date>12/01/2000</date></order>
<order><location> ... many more orders ...
</orders>
In my xslt document at the top I save the sort values in variables:
<xsl:variable name="sort1">
<xsl:value-of select="/orders/sorts/sort1" />
</xsl:variable>
<xsl:variable name="sort2">
<xsl:value-of select="/orders/sorts/sort2" />
</xsl:variable>
<xsl:variable name="sort3">
<xsl:value-of select="/orders/sorts/sort3" />
</xsl:variable>
Then I have other xslt to display and turn the xml into HTML:
<xsl:template match="orders">
... bunch of html
<xsl:for-each select="order">
<xsl:sort select = "$sort1"/>
<xsl:sort select = "$sort2"/>
<xsl:sort select = "$sort3"/>
<xsl:value-of select="Location"/></FONT></TD>
... many more lines
</xsl:for each>
</xsl:template>
The problem is that no matter what is put between the <sort> tags, the HTML output always gets created in the same order. Why aren't the XSL sort tags working to sort the information so that it is displayed in the correct order? If I hardcode values, like:
<xsl:sort select="Location" />
it works, so it looks like somehow it is not interpreting the variables. And the variables do have values because I have printed them out and checked them.
Any help would be greatly appreciated. I'm pretty new at this XML/XSL stuff!
Thanks for the help!
Brian
bcnice@mindspring.com [This message has been edited by Brian Nice (edited January 12, 2001).]