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

grouping issue (part 2)

Subject: grouping issue (part 2)
From: Terry Ofner <tdofner@xxxxxxxxx>
Date: Thu, 22 Apr 2010 18:08:18 -0400
 grouping issue (part 2)
     I am having group-adjacent problems. Here is a snippet of starting
document:


     <narrative name="1A">
      <para>Directions: Read the selection....</para>
      <para><b>Jason and the Golden Fleece</b></para>
      <para><i>....</i></para>
      <table>
      <!--lots of rows and cells-->
       </table>
    </narrative>


    Template
    <xsl:template match="narrative">
        <xsl:copy>
           <xsl:copy-of select="@*"/>
            <xsl:for-each-group select="*" group-adjacent="name()">
                <xsl:choose>
                    <xsl:when test="self::para | self::table">
                        <text>
                            <xsl:apply-templates select="current-group()"/>
                        </text>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:apply-templates select="current-group()"/>
                    </xsl:otherwise>
                </xsl:choose>

            </xsl:for-each-group>
        </xsl:copy>
    </xsl:template>


    Gives me this output:

   <narrative name="1A">
  <text>
    <para>Directions: Read the selection....</para>
    <para><b>Jason and the Golden Fleece</b></para>
    <para><i>....</i></para>
  </text>
  <text>
    <table>
      <!--lots of rows and cells-->
    </table>
  </text>
</narrative>

I am seeking this:

<narrative name="1A">
  <text>
    <para>Directions: Read the selection....</para>
    <para><b>Jason and the Golden Fleece</b></para>
    <para><i>....</i></para>
    <table>
      <!--lots of rows and cells-->
    </table>
  </text>
</narrative>

Thanks in advance for any hints.

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-2013 All Rights Reserved.