some help wanted with grouping following siblings

Discussion in 'XML' started by Wokoman, Apr 9, 2011.

  1. Wokoman

    Wokoman

    Joined:
    Apr 9, 2011
    Messages:
    1
    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 !
     
    Wokoman, Apr 9, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Harvey
    Replies:
    0
    Views:
    788
    Harvey
    Jul 16, 2004
  2. Harvey
    Replies:
    1
    Views:
    896
    Daniel
    Jul 16, 2004
  3. Rachel
    Replies:
    0
    Views:
    357
    Rachel
    Oct 15, 2003
  4. nobody
    Replies:
    4
    Views:
    1,395
    nobody
    Feb 15, 2004
  5. Dimitre Novatchev
    Replies:
    2
    Views:
    472
    Dimitre Novatchev [MVP XML]
    Feb 15, 2004
Loading...

Share This Page