Subject: Re: [xsl] Attribute-based XML Sorting using XSL From: Peter Davis <pdavis152@xxxxxxxxx> Date: Mon, 17 Jun 2002 17:07:49 -0700 |
-----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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Attribute-based XML Sorti, Joerg Heinicke | Thread | RE: [xsl] Attribute-based XML Sorti, Saldate, DanielX |
Re: [xsl] Attribute-based XML Sorti, Joerg Heinicke | Date | [xsl] Template priority, Brian Grainger |
Month |