xsl-list
[Top] [All Lists]

[xsl] Positional grouping with exceptions

2006-12-20 07:48:02
I have the following xml:
 
<book>
  <header>title</header>
  <a>text</a>
  <a>text</a>
  <otherelement>title</otherelement>
  <a>text</a>
  <a>text</a>
  <a/>
  <a>text</a>
</book>
 
I want to group each block of consecutive <a> tags inside an <al> tag,
like this:
 
<book>
  <header>title</header>
  <al>
    <a>text</a>
    <a>text</a>
  </al>
  <otherelement>title</otherelement>
  <al>
    <a>text</a>
    <a>text</a>
  </al>
  <al>
    <a>text</a>
  </al>
</book>

And like you can see in the example, I want to start a new <al> block
when an empty <a> tag is found. That's the hard part. Well, the other
part also isn't that easy...

I can't use the technique described on
http://www.dpawson.co.uk/xsl/sect2/N4486.html#d5280e424, because the <a>
nodes are not always preceded by an element that marks a new group.

What would be the best technique to solve this? I'm using Saxon 8.7.1
and XSLT 2.0.

--
Fredrik Geers

--~------------------------------------------------------------------
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>