|
Subject: RE: [xsl] variables in sort statements: (was Grouping and Sortin g on value inside group) From: TSchutzerWeissmann@xxxxxxxxxxxxxxxx Date: Wed, 12 Jun 2002 17:41:32 +0100 |
I think there's something strange going on with variables in sort
statemenents. I'm trying a simple version of what Peter was doing in the
previous thread.
The source looks like this:
<a>
<b id='1'>b1</b>
<d id='2'>2</d>
<b id='3'>b3</b>
<c id='1'>c1</c>
<c id='2'>c2</c>
<c id='3'>c3</c>
<b id='2'>b2</b>
<d id='1'>3</d>
<d id='3'>1</d>
</a>
and I want to group by @id, and order the grouping by the value of a
specific child of a, either b,c or d.
This doesn't work:
<xsl:variable name='sortcol' select='"d"'/>
<xsl:for-each select='a/*[generate-id() =
generate-id(key("key",@id))]'>
<xsl:sort select='../*[local-name() = $sortcol][@id
= current()/@id]'/>
<x><xsl:value-of select="@id"/></x>
The @ids come out 1, 2, 3
This does work:
<xsl:variable name='sortcol' select='"d"'/>
<xsl:for-each select='a/*[generate-id() =
generate-id(key("key",@id))]'>
<xsl:sort select='../*[local-name() = "d"][@id =
current()/@id]'/>
<x><xsl:value-of select="@id"/></x>
The @ids come out 3, 2, 1, as desired.
Anyone able to help?
Thanks,
Tom
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Detecting the last page o, DPawson | Thread | Re: [xsl] variables in sort statem, Jeni Tennison |
| RE: [xsl] Grouping and Sorting on v, Hunsberger, Peter | Date | RE: [xsl] Grouping and Sorting on v, McNally, David |
| Month |