xsl-list
[Top] [All Lists]

RE: [xsl] flat xml structure parsing

2006-09-05 02:22:22
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(_at_)outerlimits(_dot_)ch] 
Sent: 05 September 2006 10:02
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>