[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: For-each-group problem

Subject: Re: For-each-group problem
From: hajduk@xxxxxxxx
Date: Mon, 2 Oct 2006 14:42:06 -0700
for each group problem
(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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.