Subject: Re: [xsl] xsl sort: using element attribute as sort key! From: omprakash.v@xxxxxxxxxxxxx Date: Mon, 18 Apr 2005 09:22:47 +0530 |
Hi, Your stylesheet would work if you didn't have the "@column=$sort" in the select of xsl:sort. With the equals check, it is possibly ignoring the select completely and ordering all the df_data nodes based on its content and in the order specified by the order attribute. If you would like to sort on the df_data nodes having attribute 'column' it makes sense. If you would like to sort based on df_data nodes having attribute 'column' equals to 'name' then you need to have it in your apply-templates than in the xsl:sort instruction. You can get the desired result with <xsl:sort select="df_data/@column" order="$dir"/> Cheers, Omprakash.V "Adam J Knight" To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> <adam@brightid cc: (bcc: omprakash.v/Polaris) ea.com.au> Subject: [xsl] xsl sort: using element attribute as sort key! 04/18/2005 05:58 AM Please respond to xsl-list Hi all, I am trying to sort based on an elements attribute. Doesn't seem to work. Can i do this, and if so, what am i doing wrong? Replies greatly appreciated! $sort parameter = 'name' $dir parameter = 'descending' xml structure: <dfile> <df_data_row> <df_data column='name'>Value</df_data> </df_data_row> <df_data_row> <df_data column='phone'>Value2</df_data> </df_data_row> </dfile> <xsl:if test="$sort"> <xsl:apply-templates select="dfile/df_data_row"> <xsl:sort select="df_data/@column = $sort" order="$dir"></xsl:sort> </xsl:apply-templates> </xsl:if> Cheers, Adam This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited. Visit Us at http://www.polaris.co.in
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] xsl sort: using element attri, Adam J Knight | Thread | RE: [xsl] xsl sort: using element a, Michael Kay |
Re: [xsl] Measuring the complexity , Mukul Gandhi | Date | RE: [xsl] xsl sort: using element a, Michael Kay |
Month |