Subject: Re: [xsl] Sorting a sequence and selecting the first element after sort From: "Jorge . chocolate.camera@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 8 May 2015 11:57:09 -0000 |
I answer both questions to myself: <xsl:sequence="*[local-name() eq 'foo' or descendant::foo or descendant::bar][1]"/> (unless I got something wrong again). Please, excuse me for the noise. On Fri, May 8, 2015 at 1:50 PM, Jorge . chocolate.camera@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > I now see that, on top of that, I am adding duplicate copies of nodes > that match both conditions to the sequence (-_-;). I would also > appreciate a hint on how to make that selection without dupes. > > On Fri, May 8, 2015 at 1:44 PM, Jorge . chocolate.camera@xxxxxxxxx > <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: >> I'd like to select the first child of the current node that either: >> >> 1. is a "foo" element >> 2. has "foo" or "bar" descendant(s) >> >> The following sequence returns me all nodes matching either or both of >> those conditions: >> >> <xsl:sequence select="foo, *[descendant::foo, descendant::bar]"/> >> >> but not necessarily ordered according to their position as children of >> the current node. As a result, the first element in that sequence, >> selected like this: >> >> <xsl:sequence select="(foo, *[descendant::foo, descendant::bar])[1]"/> >> >> is not necessarily the first matching child of the current node. >> >> How do I sort elements in that sequence according to their position as >> children of the current context, so that the first element in that >> sequence is actually the first matching child in the current node?
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Sorting a sequence and se, Jorge . chocolate.ca | Thread | Re: [xsl] Sorting a sequence and se, Imsieke, Gerrit, le- |
Re: [xsl] Sorting a sequence and se, Jorge . chocolate.ca | Date | Re: [xsl] Sorting a sequence and se, Imsieke, Gerrit, le- |
Month |