|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl sort: using element attribute as sort key!
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 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
|
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
|

Cart








