[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Best way to have user decide sort
This is fairly easy to do in DOM, but what is the best way to accomplish a dynamic sort in SAX? Here's what I want. When the user first comes to this page, it is blank except for a "Choose a letter A B C D..." at the top. There will also be an option for output via PDF (another page) and to list all categories. The user would click on a letter, example "A" and all categories starting with that letter will appear. I'd prefer to have this to use two XSLs (one for PDF and one for HTML output) but the more I play around I see that I may need 28 XSLs. I have yet been able to pass a parameter from one XSL to another. Is there anyother way out, or would having one web page for the "choose one" and one for the output be the best, even though the user can change his/her mind. (Select "A" and then choose to select "G".) I did enter the example in "http://www.topxml.com/snippetcentral/main.asp?view=viewsnippet&lang=&id=v20 010425122434" except that it is based on a run-time decision. And although is requires a parameter be passed from one web page to the XSL, it doesn't tell how to do so. Unfortunately, the page it refers to uses ASP to pass a parameter, which I am not using. In DOM, I would create a Javascript code to handle the processing, but my impression of SAX is that I should get away from that. (I am using Cocoon2). XSL: <xsl:template match="glossary"> .... Choose a letter <table><thead> <td align="center" width="25">A</td> <td align="center" width="25">B</td> ...... </thead> <xsl:apply-templates name="//category"> <xsl:sort select="*[name(.) = $sortfield]"/> </xsl:apply-templates> </table> </xsl:template> <xsl:template name="//category"> <xsl:value-of select="$sortfield"/> <xsl:for-each select="//glossaryitem[count(. | key('sort-by-category', category)[1]) = 1]"> <xsl:for-each select="category"> <xsl:sort select="." /> <xsl:if test="starts-with(category,$sortfield)"> <H2> <xsl:value-of select="." /> </H2> <xsl:value-of select="english_title"/> </xsl:if> </xsl:for-each> </xsl:for-each> </xsl:template> <xsl:template match="text()"> </xsl:template> **************************************************************************** *** XML File: <glossary> <glossaryitem> <category>Things</category> <english_title>Computer</english_title> </glossaryitem> <glossaryitem> <category>Things</category> <category>Animal</category> <english_title>Mouse</english_title> </glossaryitem> <glossaryitem> <category>People</category> <english_title>Doug Hewko</english_title> </glossaryitem> 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
|