I have an XSL stylesheet with a param called "sort". I want to... er... sort my XML based on the param. However, the <xsl:sort select="$sort"/> statement is having no effect. I can display the value of the param successfully using <xsl:value-of select="$sort"/> so I know the param is getting populated. How can I sort my XML based on a param? (My entire XSL stylesheet is below.)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="xml"/>
<xslaram name="sort"/>
<xsl:template match="/">
<xsl:element name="formulary">
<xsl:for-each select="formulary/drug">
<xsl:sort select="$sort"/>
<xsl:element name = "drug">
<xsl:element name="sortedelement"><xsl:value-of select="$sort"/></xsl:element>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="xml"/>
<xslaram name="sort"/>
<xsl:template match="/">
<xsl:element name="formulary">
<xsl:for-each select="formulary/drug">
<xsl:sort select="$sort"/>
<xsl:element name = "drug">
<xsl:element name="sortedelement"><xsl:value-of select="$sort"/></xsl:element>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>