Re: [xsl] Modify Variable value

Subject: Re: [xsl] Modify Variable value
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Thu, 26 Apr 2007 14:10:09 +0200
Senthilkumaravelan K wrote:
Hi ,
cna you give me the example how I could do that?
Regards,
Senthil


I suggest you read any good tutorial book which explains how and when apply-templates, call-template, for-each etc are used, and more especially, why it is so useful not to be able to assign to variables, it will save you countless of headbanging hours ;-) One suggestion would be Jeni Tennisons book Beginning XSLT 2.0 (there's also a 1.0 version).


An example with an 'assigned' (not the right word) parameter:

<xsl:template match="/">
  <xsl:apply-templates select="my-selection">
     <xsl:with-param name="my-param" select="10" />
  </xsl:apply-templates>
</xsl:template>

<xsl:template match="my-selection">
  <xsl:param name="my-param" />
  <xsl:value-of select="$my-param" />
  <xsl:value-of select="." />
</xsl:template>

Will output whatever is the value of the node /my-selection with '10' prepended.

Cheers,
-- Abel

Current Thread