Subject: Re: For-each-group problem
From: hajduk@xxxxxxxx
Date: Mon, 2 Oct 2006 14:42:06 -0700
|
(using Saxon 8 and XSLT 2)
Sorry about the earlier xml sample I wasn't paying attention and it doesn't do
justice to the content I'm working with.
Thanks for the insights Andrew and Mukul
Please take a second look at the content as you'll notice I need to grab all the
following elements before the next instance of <li> and the same for
<anotherhead>. I guess this is why I want to use for-each-group as it seems to
be a good solution.
So any ideas on how to best do this or a good sample of for-each-group would be
greatly appreciated.
Input
<root>
<body>
<heading>content</heading>
<p>content</p>
<p>content</p>
<li>content</li>
<div>
<p>content</p>
<p>content</p>
</div>
<p>content</p>
<li>content</li>
<div>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
</div>
<li>content</li>
<div>
<p>content</p>
</div>
<anotherhead>content</anotherhead>
<div>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
</div>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<anotherhead>content</anotherhead>
<another>
<p>content</p>
<li>content<li>
<div>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
</div>
</another>
<p>content</p>
<footer>content</footer>
</body>
</root>
---------------------
Output
<root>
<body>
<heading>content</heading>
<p>content</p>
<p>content</p>
<ul>
<li>
<p>content</p>
<div>
<p>content</p>
<p>content</p>
</div>
<p>content</p>
</li>
<li>
<p>content</p>
<div>
<p>content</p>
<p>content</p>
<p>content</p>
</div>
</li>
<li>
<p>content</p>
<div>
<p>content</p>
</div>
</li>
</ul>
<div>
<anotherhead>content</anotherhead>
<another>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
</another>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
</div>
<div>
<anotherhead>content</anotherhead>
<another>
<p>content</p>
<ul>
<li>
<p>content</p>
<div>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
</div>
</li>
</ul>
</another>
</div>
<p>content</p>
<footer>content</footer>
</body>
</root>
Thanks
Mario
|