[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: flat xml structure parsing

Subject: RE: flat xml structure parsing
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 5 Sep 2006 10:22:06 +0100
flatten xml structure
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:  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.