|
Subject: Re: [xsl] XSLT2: Keys vs. xsl:choose to distinguish groups From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 15 Mar 2007 12:40:49 GMT |
> <xsl:when test="current-group()[1] = A">
You prersumably didn't mean that (as it tests if the stribg value of the
current node is equal to the string value of its a child.
<xsl:when test="current-group()[1]/self::A">
would work.
>. My question is: Is it feasible (and reasonable) to avoid using
> xsl:choose here but instead select a group's treatment based on a key
It's not clear what you have in mind here. If you use keys instead of
for-each group (muenchian grouping) then the nodes returned by the key
are the nodes that are returned by current-group() when using
for-each-group.
> (because some groups might need the same kind of processing)?
You can make the xpath in the xsl:when clause as genearal as you need,
replacing
<xsl:when test="current-group()[1]/self::A">
by
<xsl:when test="not(current-group()[1]/self::Z[@foo='hmm'])">
if all groups except those starting with a Z foo="hmm" need the same
treatment.
> I think of having just a single call to the key function which would
> then dispatch the call to one out of a list of user-defined functions
key returns a sequence of nodes you still need to use a choose 9or apply
templates) to cause any action to be taken with those nodes.
David
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] XSLT2: Keys vs. xsl:choose to, Yves Forkl | Thread | Re: [xsl] XSLT2: Keys vs. xsl:choos, David Carlisle |
| [xsl] XSLT2: Keys vs. xsl:choose to, Yves Forkl | Date | Re: [xsl] XSLT2: Keys vs. xsl:choos, David Carlisle |
| Month |