Reputation: 27011
My xslt template looks like this:
<xsl:template match="text()">
<xsl:param name="precedingPStyle" select="preceding-sibling::aic:pstyle[position()=1]/@name"/>
</xsl:template>
Is above a valid xslt template? How/when can this template be called? it has no name, only a match and the match has a parameter.
Upvotes: 0
Views: 204
Reputation: 122364
It will be called by xsl:apply-templates
when it is the most appropriate template for the node selected. In the absence of any other more specific templates such as match="text()[normalize-space(.)]"
this template would be applied for all text nodes.
For parameters, apply-templates
supports with-param
in exactly the same way as call-template
does.
<xsl:apply-templates select="*/text()">
<xsl:with-param name="precedingPStyle" select="'normal'"/>
</xsl:apply-templates>
The with-param
select expression is evaluated in the context of the call, not the target node to which the template applies. As with call-template
, any parameters that are not set with an explicit with-param
will take the default value specified by the select
expression on the xsl:param
element in the template (which is evaluated in the context of the target, not the call)
Upvotes: 1