[xsl] instance a template from xsl:for-each-group

Subject: [xsl] instance a template from xsl:for-each-group
From: Andreas Peter <info@xxxxxxxxxx>
Date: Tue, 17 Nov 2009 21:29:38 +0100
Hello XSL-list,

I want to do a conversion from WordML to Docbook. I have the following xsl (as a sample):

<xsl:template match="w:body">
       <chapter>
           <xsl:call-template name="chapter"/>
       </chapter>
   </xsl:template>

<xsl:template name="chapter">
<xsl:param name="levelnr" select="1"/>
<xsl:param name="nodes" select="*"/>
<xsl:for-each-group select="$nodes"
group-starting-with="*[descendant-or-self::*[@w:val=concat('heading',$levelnr)]]">
<xsl:choose>
<xsl:when
test="current-group()[descendant-or-self::*[@w:val=concat('heading',$levelnr)]]">
<xsl:element name="sect{$levelnr}">
<xsl:apply-templates select="node()"/>
<xsl:choose>
<xsl:when test="not(current-group()[position()>1])">
<xsl:apply-templates select="current-group()"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="chapter">
<xsl:with-param name="levelnr" select="$levelnr+1"/>
<xsl:with-param name="nodes" select="current-group()[position!=1]"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:when>
</xsl:choose>
</xsl:for-each-group>
</xsl:template>


   <xsl:template match="w:p[descendant-or-self::*[@w:val='paragraph']]">
       <para>
           <xsl:apply-templates/>
       </para>
   </xsl:template>

I need to instance the third template from the <xsl:apply-templates select="current-group()"/> inside the second template.
I hope this problem could be solved without pasting the source xml -- this would be to long (WordML).



Thanks in advance Andreas

Current Thread