xsl-list
[Top] [All Lists]

Re: [xsl] Modify Variable value

2007-04-26 05:12:46
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



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>