Reputation: 168
Fairly new to XSLT and saw the with-param as a way to get something done.
<xsl:variable name="PQB_ID">
<!-- <xsl:value-of select="wd:SSN"/> -->
<xsl:value-of>123</xsl:value-of>
</xsl:variable>
<xsl:call-template name="testing">
<xsl:with-param name="PQB_ID"></xsl:with-param>
</xsl:call-template>
And my template name is below:
<xsl:template name="testing">
<xsl:param name="PQB_ID"></xsl:param>
<xsl:value-of select="$PQB_ID"></xsl:value-of>
</xsl:template>
At a minimum, I would expect to see 123. Or, when my <xsl:value-of select="wd:SSN"/>
is uncommented, I would expect to see the value in my program. As it is, I get nothing back.
What am I missing?
Upvotes: 1
Views: 2064
Reputation: 163595
Note also, it's a really good idea in XSLT 2.0 to declare the type of the expected parameter in xsl:param. Are you expecting a string? an integer? I don't expect you are expecting a document node, which is what you are carefully creating with the code
<xsl:variable name="PQB_ID">
<xsl:value-of>123</xsl:value-of>
</xsl:variable>
If the template wants an integer, then you don't need a whole new document to contain it; just write
<xsl:variable name="PQB_ID" select="123"/>
Upvotes: 0
Reputation: 122414
<xsl:with-param name="PQB_ID"></xsl:with-param>
will pass an empty value for the parameter. If you want to pass through the value of the global PQB_ID variable, you need to do so explicitly
<xsl:with-param name="PQB_ID" select="$PQB_ID"/>
Upvotes: 6