xsl:with-param

only for RuBoard

xsl: with-param

xsl:with-param passes a variable to a template.

Attributes

Attribute Name

Enforced

Description

Values

Name

Required

The condition to test. If the expression evaluates to Boolean True, the results are included in the output.

QName

Select

Optional

An expression to be matched against the current context.

Expression

Example

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> 

Parent Elements

 xsl:call-template, xsl:apply-templates 

Child Elements

 xsl:apply-templates, xsl:attribute, xsl:call-template, xsl:choose,  xsl:comment, xsl:copy, xsl:copy-of, xsl:element, xsl:for-each, xsl:if,  xsl:processing-instruction, xsl:text, xsl:value-of, xsl:variable 
only for RuBoard


XML and ASP. NET
XML and ASP.NET
ISBN: B000H2MXOM
EAN: N/A
Year: 2005
Pages: 184

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net