|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Select elements between others
A classic "positional grouping" problem: try a search for "XSLT positional grouping". In XSLT 2.0 this is easily handled using <xsl:for-each-group group-starting-at="block">. In 1.0, there are two main approaches: (a) apply-templates to the block elements; for each block element, apply-templates to the items related to that block, which you can select as following-sibling::item[generate-id(preceding-sibling::block[1]) = generate-id(current())] (b) treat it as a value-based grouping exercise, using Muenchian grouping with the generate-id of the block element as the grouping key. Michael Kay > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of > Joe Fawcett > Sent: 20 January 2004 09:29 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: Select elements between others > > > I have received, what I consider to be, a badly designed xml > file: <data> > <block/> > <item>One</item> > <item>Two</item> > <block/> > <item>One</item> > <item>Two</item> > <item>Three</item> > <block/> > <item>One</item> > </data> > > I want to turn this into a more normal form to make it easier > to manage: > > <data> > <block> > <item>One</item> > <item>Two</item> > </block> > <block> > <item>One</item> > <item>Two</item> > <item>Three</item> > </block> > <block> > <item>One</item> > </block> > </data> > > Thanks > > Joe > > _________________________________________________________________ > Sign-up for a FREE BT Broadband connection today! > http://www.msn.co.uk/specials/btbroadband > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








