[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
pankaj.c@xxxxxxxxxxxxxxxxxx wrote:
Write a named template with a param that is increased on each recursive call:
<xsl:output method="xml" indent="yes"/>
</xsl:stylesheet>
--
Re: [xsl] Adding child element based on attribute value [XSLT 1.0]
Subject: Re: [xsl] Adding child element based on attribute value [XSLT 1.0] From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Sat, 08 Jan 2011 13:57:02 +0100 |
pankaj.c@xxxxxxxxxxxxxxxxxx wrote:
AHA!!!! Thanks Ken but I am using 1.0.
Write a named template with a param that is increased on each recursive call:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="my_group"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:call-template name="make-group"> <xsl:with-param name="i" select="1"/> <xsl:with-param name="l" select="3"/> </xsl:call-template> </xsl:copy> </xsl:template>
<xsl:template name="make-group"> <xsl:param name="i"/> <xsl:param name="l"/> <xsl:if test="$i <= $l"> <group name="type{$i}"/> <xsl:call-template name="make-group"> <xsl:with-param name="i" select="$i + 1"/> <xsl:with-param name="l" select="$l"/> </xsl:call-template> </xsl:if> </xsl:template>
</xsl:stylesheet>
--
Martin Honnen http://msmvps.com/blogs/martin_honnen/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Adding child element base, pankaj . c | Thread | Re: [xsl] Adding child element base, G. Ken Holman |
Re: [xsl] Adding child element base, pankaj . c | Date | Re: [xsl] Adding child element base, G. Ken Holman |
Month |