| Subject: RE: [xsl] flat xml structure parsing From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Tue, 5 Sep 2006 10:22:06 +0100 | 
For discussions of this type of problem, search for "XSLT positional
grouping". 
If there's only one start/end pair, try:
XSLT 2.0:
xsl:variable name="doc" select="document"
$doc/section[. >> $doc/section[paragraph/@name='start'] and . <<
$doc/section[paragraph/@name='end']/paragraph
XSLT 1.0:
xsl:variable name="doc" select="document"
$doc/section[paragraph/@name='start']/
 
following-sibling::section[following-sibling::section[paragraph/@name='end]]
/
     paragraph
Michael Kay
Saxonica Limited
> -----Original Message-----
> From: Jimmy [mailto:jimmy@xxxxxxxxxxxxxx] 
> Sent: 05 September 2006 10:02
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] flat xml structure parsing
> 
> I have a given flat xml structure of which I have to build a 
> hierarchical structure. Following situation:
> 
> <document>
>     <section>
>        <paragraph name="start">
>     </section>
>     <section>
>        <paragraph name="x">
>     </section>
>     <section>
>        <paragraph name="x">
>     </section>
>     <section>
>        <paragraph name="end">
>     </section>
>     <section>
>        <paragraph name="x">
>     </section>
> </document>
> 
> I'm starting from the paragraph with the name "start" and 
> have get all the "x" (unknown how many) until the paragraph 
> "end". So this leaves every "x" following the end. Anyone got 
> an idea how I can manage this?
> 
> Cheers
> Jimmy
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| [xsl] flat xml structure parsing, Jimmy | Thread | Re: [xsl] flat xml structure parsin, David Carlisle | 
| [xsl] flat xml structure parsing, Jimmy | Date | Re: [xsl] flat xml structure parsin, David Carlisle | 
| Month |