[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Selecting the first item from a tokenized string
Subject: Re: [xsl] Selecting the first item from a tokenized string From: David Carlisle <davidc@xxxxxxxxx> Date: Fri, 13 Jan 2006 13:37:20 GMT |
[resend!!! too many typing errors for even me to accept last time] Michael Kay wrote: > you can get the Nth item in a sequence using SEQ[N]. > In the rare cases where that's inconvenient because > it changes the evaluation context, you can use > subsequence(SEQ, N, 1). When can this happen? Can you show an example? Regards, --drkm Michael meant that to be a meta-expression with SEQ and N standing for Xpath expressions, but if you take them as real examples with SEQ and N being Xpath expressions selecting elements SEQ and N respectively then you have an example where SEQ[N] and subsequence(SEQ, N, 1) are not equivalent, as in the first N selects children of the SEQ node (and may have a different value for each SEQ element) and in the second N selects an N element child from the current node (which will then be a sibling not a child of SEQ) and this value will be cast to an integer. so <x> <N>2</N> <SEQ>1<N>6</N></SEQ> <SEQ>2</SEQ> <SEQ>3<N>3</N></SEQ> </x> SEQ[N] selects the first and third SEQ (as they have N children) SEQ[number(N)] selects the third SEQ (as that is the only one with an N child equal to its position()) subsequence(SEQ,N,1) selects the 2nd SEQ child (as N selects an element whose value can be cast to the integer 2.) David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Selecting the first item , David Carlisle | Thread | Re: [xsl] Selecting the first item , Florent Georges |
Re: [xsl] Selecting the first item , David Carlisle | Date | Re: [xsl] Selecting the first item , Florent Georges |
Month |
Keywords