[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Attribute-based XML Sorting using XSL
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday 17 June 2002 12:41, Matt Jones wrote: > <xsl:apply-templates select="ROW"> > <xsl:sort select="COLUMN[@value]"/> > </xsl:apply-templates> What you are saying here is, "Sort using all COLUMN children that have a 'value' attribute." This doesn't take into account the value of @value, so the sorting is effectively useless. As you might have guessed, the <xsl:sort/> here is where you need to specify on which column to sort. What you really wanted to say is, "Sort using the COLUMN for which @name is equal to the user's desired column, and sort using the value of @value from that COLUMN". This is pretty simple to do: <xsl:sort select="COLUMN[@name = $the-column-name]/@value"/> A previous responder posted a similar solution, but forgot the '/@value'. Without the '/@value', the sort will proceed using the text value of the <COLUMN/> element, which is empty and obviously not what you want. - -- Peter Davis -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9DnnVNSZCJx7tYycRAhuNAKC22QRyHhK/zh2YTyV+98lz+68xLACgoOQY sc5vHA7BB5W42gdoYHLxF2w= =Ejlz -----END PGP SIGNATURE----- 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
|