tags:

views:

41

answers:

2

I'm banging my head against the wall trying to figure out why this won't work:

<xsl:call-template name="test-template">
    <xsl:with-param name="item" select="WTF" />
</xsl:call-template>

<xsl:template name="test-template">
    <xsl:param name="item" />
    -~<xsl:value-of select="$item" />~-
</xsl:template>

Output is: -~~- when what I want is -~WTF~-

+2  A: 

I haven't touched XSLT for quite some time - but I think your parameter names should match. Meaning:

<xsl:call-template name="test-template">
    <xsl:with-param name="is-item-page" select="WTF" />
</xsl:call-template>

<xsl:template name="test-template">
    <xsl:param name="is-item-page" />
    -~<xsl:value-of select="$item" />~-
</xsl:template>

Try it.

RonK
+6  A: 

First of all, as RonK said, your parameter names should match.

Also, if you want to pass the value "WTF" (instead of XML node "WTF"), you've to single-quote it:

<xsl:call-template name="test-template">
    <xsl:with-param name="item" select="'WTF'" />
</xsl:call-template>

<xsl:template name="test-template">
    <xsl:param name="item" />
    -~<xsl:value-of select="$item" />~-
</xsl:template>
AJPerez
+1 for noticing the 'WTF'
RonK