|
Subject: RE: [xsl] Grouping and Sorting on value inside group From: TSchutzerWeissmann@xxxxxxxxxxxxxxxx Date: Wed, 12 Jun 2002 11:16:48 +0100 |
Peter
I was just thinking about this and realised that Wendell was completely
right, of course.
Doesn't <xsl:for-each select="(//dataset/*/*[generate-id() =
generate-id(key('dataids', concat(local-name(..),@dataId)))])">
filter out most of the nodes you want because it only lets through one node
per value of @dataId?
But if it works...
Tom
> -----Original Message-----
> From: TSchutzerWeissmann@xxxxxxxxxxxxxxxx
> [mailto:TSchutzerWeissmann@xxxxxxxxxxxxxxxx]
> Sent: 12 June 2002 10:01
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] Grouping and Sorting on value inside group
>
>
> hello Peter
>
> If you want to avoid using "//dataset" you could have a key like this:
> <xsl:key name="dset" match="dataset" use="'all'"/>
> and access it using
> select="key('dataset','all')"
>
> > >>I finally found the answer. Your use of [@dataid =
> > current()/@dataid]
> > >>provided the missing clue:
> > >>
> > >> <xsl:for-each select="(//dataset/*/*[generate-id() =
> > >>generate-id(key('dataids', concat(local-name(..),@dataId)))])">
> > >> <xsl:sort select="parent::node()/*[local-name() =
> > $sortcol and
> > >>@dataId = current()/@dataId]/value"/>
>
>
> I agree with Wendell that the whole generate-id() malarkey is
> redundant, but
> it doesn't do the same thing as key('dataids',
> concat(local-name(..),@dataId))[1] because you will get every
> node that
> satisfies the predicate and not just the first one.
> And every node in //dataset/*/* that has a @dataid will be in
> the 'dataid'
> key and satisify the predicate.
>
> So won't this work just as well:
> <xsl:for-each select="key('dataset','all')/*/*">
>
> The sort looks really cunning and probably is doing all the
> hard work here
> ;)
>
> Regards,
> Tom
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Grouping and Sorting on v, TSchutzerWeissmann | Thread | RE: [xsl] Grouping and Sorting on v, Hunsberger, Peter |
| [xsl] FO questions about blocks in , Gustaf Liljegren | Date | RE: [xsl] Re: Date Parsing (Was: Do, Jarkko . Moilanen |
| Month |