Monday, November 2, 2009

XSL Parameters

Firstly, remember that once you assign content to a named parameter (xsl:param or xsl:variable), that element is immutable.

Assign value to xsl:param
<xsl:param name="last_name">Cagle</xsl:param>

Retrieve value of xsl:param
<last_name><xsl:value-of select="$last_name"/></last_name>

Assign XML tags to xsl:param
<xsl:param name="person">
<record>
<first_name>Kurt</first_name>
<last_name>Cagle</last_name>
<vocation>Writer</vocation>
</record>
</xsl:param>

If you use <xsl:value-of select="$person"/>, the output stream is: KurtCagleWriter

<xsl:copy-of select="$person"/> lets you output the whole XML Structure:
<record>
<first_name>Kurt</first_name>
<last_name>Cagle</last_name>
<vocation>Writer</vocation>
</record>

Reference & More on this topic: http://msdn.microsoft.com/en-us/library/ms950787.aspx

No comments:

Post a Comment