Tuesday, April 23, 2013

XSL - xsl:call-template or xsl:function


XSL version 1.0

There is no xsl:function in XSL version 1.0
<xsl:template name="helloWorld">
  <xsl:text>Hello World!</xsl:text>
</xsl:template>

(...)

<xsl:template match="something">
  <xsl:call-template name="helloWorld"/>
</xsl:template>
 
 
 
 

XSL version 2.0 

<xsl:function name="func:helloWorld">
  <xsl:text>Hello World!</xsl:text>
</xsl:function>
 
Then in template you can use it as
<xsl:template match="/">
<xsl:value-of select="func:helloWorld"/>
</xsl:template>

 

 

0 comments:

Post a Comment