Hi there,
I'm trying to convert an initial flat XML to a nested XML but got stuck on the final bits and pieces. I now have the following XML code :
<li><dl><dt>blabla</dt></dl></li>
<dd>blablabla</dd>
<dt>blablabla</dt>
.. much more <dd> and <dt> elements
<li><dl><dt>blabla2</dt></dl></li>
<dd>blablabla2</dd>
<dt>blablabla2</dt>
.. much more <dd> and <dt> elements
<p>some other element</>
And I would like to achieve the following
...
<li>
<dl>
<dt>blabla</dt>
<dd>blablabla</dd>
<dt>blablabla</dt>
.. much more <dd> and <dt> elements
</dl>
</li>
<li>
<dl>
<dt>blabla2</dt>
<dd>blablabla2</dd>
<dt>blablabla2</dt>
.. much more <dd> and <dt> elements
</dl>
</li>
<p>some other element</p>
Or in other words : Whenever I have a List element that contains a <dl> element I want to insert all the following <dt> and <dd> elements following on the <li> element up until the first element that's neither <dt> or <dd>
Anyone that could put me on the right track ? I'm using xslt 2.0 so I assume I need to use some combination of grouping and following sibling, but it's a bit too complex for me to comprehend. Thanks in advance !
I'm trying to convert an initial flat XML to a nested XML but got stuck on the final bits and pieces. I now have the following XML code :
<li><dl><dt>blabla</dt></dl></li>
<dd>blablabla</dd>
<dt>blablabla</dt>
.. much more <dd> and <dt> elements
<li><dl><dt>blabla2</dt></dl></li>
<dd>blablabla2</dd>
<dt>blablabla2</dt>
.. much more <dd> and <dt> elements
<p>some other element</>
And I would like to achieve the following
...
<li>
<dl>
<dt>blabla</dt>
<dd>blablabla</dd>
<dt>blablabla</dt>
.. much more <dd> and <dt> elements
</dl>
</li>
<li>
<dl>
<dt>blabla2</dt>
<dd>blablabla2</dd>
<dt>blablabla2</dt>
.. much more <dd> and <dt> elements
</dl>
</li>
<p>some other element</p>
Or in other words : Whenever I have a List element that contains a <dl> element I want to insert all the following <dt> and <dd> elements following on the <li> element up until the first element that's neither <dt> or <dd>
Anyone that could put me on the right track ? I'm using xslt 2.0 so I assume I need to use some combination of grouping and following sibling, but it's a bit too complex for me to comprehend. Thanks in advance !