[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: xsl:call-template question
Subject: Re: xsl:call-template question
From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx>
Date: Thu, 24 Aug 2006 00:00:51 +0530
|
I gave a solution to this problem two days back, after testing it.
Didn't that solve the problem? Haven't recieved any comments from
you..
But if you want to write the code yourself, I encourage you to do so.
It's worth learning the language.
On 8/23/06, Lin, Jessica <jlin@xxxxxxxxxxx> wrote:
Here is the block of xml file. I want to repeat stream twice in
stream_loop and change the SCID to PID with differenct start number by
using xsl:call-template.
<stream_loop>
<stream_definition>
<stream_type>2</stream_type>
<SCID>100</SCID>
<descriptors_loop_length>compute</descriptors_loop_length>
<descriptor_loop>
<about_descriptor>some description</about_descriptor>
<additional_descriptor>other description</additional_descriptor>
</descriptor_loop>
</stream_definition>
</stream_loop>
Here is the expected result:
<stream_loop>
<stream>
<stream_type>2</stream_type>
<PID>4112</SCID>
<ECM>4113</ECM>
<descriptors_loop_length>compute</descriptors_loop_length>
<descriptor_loop>
<about_descriptor>some description</about_descriptor>
<additional_descriptor>other description</additional_descriptor>
</descriptor_loop>
</stream>
<stream>
<stream_type>2</stream_type>
<PID>4114</SCID>
<ECM>4115</ECM>
<descriptors_loop_length>compute</descriptors_loop_length>
<descriptor_loop>
<about_descriptor>some description</about_descriptor>
<additional_descriptor>other description</additional_descriptor>
</descriptor_loop>
</stream>
</stream_loop>
Here is my xslt block:
<xsl:template name="repeat twice">
<xsl:param name="base" select="4112"/>
<xsl:param name="start" select="0"/>
<xsl:choose>
<xsl:when test="$start < 2">
<stream>
<xsl:for-each select="node()">
<xsl:choose>
<xsl:when test="local-name(.)='SCID'">
<PID>
<xsl:value-of select="$base"/>
</PID>
<ECM>
<xsl:value-of select="$base+1"/>
</ECM>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</stream>
<xsl:call-template name="calculate">
<xsl:with-param name="base" select="$base+$start*2" />
<xsl:with-param name="start" select="$start+1"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:template>
But the real result is not as what I am expecting. Can anyone tell me
what's wrong in my xslt block? Thank a lot.
--- Jessica
--
Regards,
Mukul Gandhi
http://gandhimukul.tripod.com
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|