xsl-list
[Top] [All Lists]

[xsl] grouping issue (part 2)

2010-04-22 17:09:15
     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.
--~------------------------------------------------------------------
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>