Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

XSLT <xsl:with-param> elements


May 28, 2021 XSL T


Table of contents


XSLT -lt;xsl: with-param-gt; element

The value of the parameters passed to the template in XSLT is defined in the element of the .lt;xsl:with-param>


XSLT <xsl:with-param> elements Complete XSLT element reference manual

Definitions and usages

The element defines the value of the parameters passed to the template.

Note: The value of the name property of the element must match the name in the element, or the element will be ignored.

Note: The use of the elements is allowed in both the slt;xsl:apply-templates and the .lt;xsl:call-template>

Tip: You can assign values to parameters by the contents of the element or by the select property!


Grammar

<xsl:with-param
name="name"
select="expression">

<!-- Content:template -->

</xsl:with-param>

Property

Attributes value describe
name name Required.The name of the specified parameters.
select expression Optional.The XPath expression of the value of the parameters.

Instance 1

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:variable name="xx">
<html>
<body>
<xsl:call-template name="show_title">
<xsl:with-param name="title" />
</xsl:call-template>
</body>
</html>
</xsl:variable>

<xsl:template name="show_title" match="/">
<xsl:param name="title" />
<xsl:for-each select="catalog/cd">
<p>Title: <xsl:value-of select="$title" /></p>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

XSLT <xsl:with-param> elements Complete XSLT element reference manual