[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Sorting revisited (<xsl:sort>)
I've searched through the archive and haven't found how to do the following dynamic sorting: I have a document like this: <doc> <orderdata> <item1> </item1> <item2> </item2> ..etc.. </orderdata> </doc> The tags <item1>, <item2>, can have any legal XML tag name, and there can be any number of them (I personally would like to re-write to XML document so I can make a DTD, but have to work with what I have). The XSL output I made so far is a table with the tag names as headers, and allows 'text ascending' sorting on any column. I need to extend this to allow ascending/descending switching and text/number switching. I'm currently passing in parameters into the template, but can't seem to get them to work for the data-type and order attributes of <xsl:sort> The params are passed into the template. <xsl:param name="sortby"></xsl:param> <xsl:param name="datatype">number</xsl:param> <xsl:param name="orderby">descending</xsl:param> <!-- the important part is as follows --> <xsl:template match="/"> <!-- snip --> <xsl:apply-templates /> <xsl:sort select="*[local-name()=string($sortby)]" data-type="{$datatype}" order="{$orderby}" /> <!-- snip --> </xsl:template> The XSL spec says that data-type and order can use attribute value templates, but the above code doesn't work (defaults are used instead). I'm using XT version 19991105, and have already tried the following: 1. remove { } 2. put quotes around param values 3. used select="descending" for param 4. used order="string($orderby)" 5. used order="string({$orderby})" 6. used order="{string($orderby)}" ... and probably some I've forgotten. What am I not understanding about attribute value templates? Thanks in advance, Rob McArthur r.mcarthur@xxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|