Subject: Re: [xsl] Fwd: XSLT 2.0 Determining Position of Sequence Item During "for expression" evaluation From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx> Date: Fri, 16 Mar 2007 15:14:27 -0700 |
I want to write a expression that does something like this...
takes a sequence like this
("Page1","Page2","Page3")
and outputs
Page1 > Page2 > Page3
so, assuming the sequence is in a variable $pages we try something like this...
for $p in $pages return concat( $p, ' > ')
but of course, this causes a trailing ' > ' which we don't want...
for $cnt in count( $pages ) return ( ( for $cnt2 in $cnt, $p in 1 to $cnt2 - 1 return ($pages[$p], '>') ), $pages[$cnt] )
-- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence. --------------------------------------- To invent, you need a good imagination and a pile of junk ------------------------------------- You've achieved success in your field when you don't know whether what you're doing is work or play
> is not absolutely clear what you want to do, something like the > following may be useful: > > > for $k in 1 to 10 > return (4 to 13)[$k] > > > To put it simply, an indexing variable in the range > > 1 to count($someSequence) >
I'll try to explain a little better what I'm getting at...
I want to write a expression that does something like this...
takes a sequence like this
("Page1","Page2","Page3")
and outputs
Page1 > Page2 > Page3
so, assuming the sequence is in a variable $pages we try something like this...
for $p in $pages return concat( $p, ' > ')
but of course, this causes a trailing ' > ' which we don't want...
so something like is what I'm looking for
for $p in $pages return concat($p, if (---sometest---) then '' else ' > ' )
problem is, I can't figure out how to write an expression that can tell if this is the last item in the sequence.
Does that explain it a little better?
-- John McGowan Seven A C Consulting, Inc.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Fwd: XSLT 2.0 Determining, Abel Braaksma | Thread | Re: [xsl] Fwd: XSLT 2.0 Determining, John McGowan |
Re: [xsl] Sequential numbers in pur, Dimitre Novatchev | Date | [xsl] Performance Loss by dateTime , Mack |
Month |