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

instance a template from xsl:for-each-group

Subject: instance a template from xsl:for-each-group
From: Andreas Peter <info@xxxxxxxxxx>
Date: Tue, 17 Nov 2009 21:29:38 +0100
 instance a template from xsl:for-each-group
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

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.