only for RuBoard |
xsl:call-template calls a named template.
The xsl:call-template element defines template rules that perform as functions in C# or Visual Basic .NET. It can also contain xsl: with-param child elements to be used as parameters to the template rule.
Attribute Name | Enforced | Description | Values |
---|---|---|---|
name | Required | The name of the template rule to call | QName |
Given the XML instance document, links.xml :
<?xml version="1.0" encoding="utf-8" ?> <links> <link name="NewRiders.com" lastevaluated="2001-09-08T19:01:55"/> </links>
The following stylesheet would parse the last evaluated attribute to display in mm/dd/yyyy format:
<?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template name="sqlserver_date"> <xsl:param name="date" /> <xsl:value-of select="substring($date, 6, 2)" /> <xsl:text>/</xsl:text> <xsl:value-of select="substring($date, 9, 2)" /> <xsl:text>/</xsl:text> <xsl:value-of select="substring($date, 1, 4)" /> </xsl:template> <xsl:template match="/"> <xsl:apply-templates select="links/link" /> </xsl:template> <xsl:template match="link"> <tr> <td> <xsl:call-template name="sqlserver_date"> <xsl:with-param name="date"> <xsl:value-of select="@lastevaluated" /> </xsl:with-param> </xsl:call-template> </td> </tr> </xsl:template> </xsl:stylesheet>
This results in the following output:
<?xml version="1.0" encoding="UTF-16"?><tr><td>09/08/2001</td></tr>
xsl:attribute, xsl:comment, xsl:copy, xsl:element, xsl:for-each, xsl:if, xsl:otherwise, xsl:param, xsl:processing-instruction, xsl:template, xsl:variable, xsl:when, xsl:with-param, output elements
xsl:with-param, output elements
only for RuBoard |