View Single Post
  #2 (permalink)  
Old May 24th, 2006, 04:09 AM
mhkay's Avatar
mhkay mhkay is offline
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You just need to call your template, for example

<xsl:variable name="$result">
  <xsl:call-template name="common_js_escape">
    <xsl:with-param name="text" select="description"/>
  </xsl:call-template>
</xsl:variable>

<xsl:value-of select="$result"/>

will output the value "description" after doing the relevant substitutions.

(In fact, you only need the variable if you are doing something with the result other than xsl:value-of. If you do the call-template without a variable, the result will simply be written to the result tree.)

It's a lot easier in XSLT 2.0 which has a replace() function.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference