More Visual Studio 2005 XSLT oddities: xsl:with-param and msxsl:node-set

So yesterday’s problem with attribute debugging on default-namespaced elements (which sort of applies to variables as well since they also have QNames) can be solved by not using a default namespace on the stylesheet element and resorting to explicit result element prefixes.
 
Yet for my inner Mort the next roadblock is right around the corner:
 
Given a template such as

<xsl:template match="v" mode="v">

<

xsl:param name="v">no v</xsl:param>

<

xsl:message>

<xsl:value-of select="$v"/>

</

xsl:message>

</

xsl:template>

 
then what’s wrong with this code?

<

xsl:template match="/">

<

xsl:variable name="v">

<

xsl:element name="v">

<xsl:attribute name="v">@v</xsl:attribute>

v

</

xsl:element>

</

xsl:variable>

<xsl:apply-templates select="msxsl:node-set($v)" mode="v">

<

xsl:with-param name="v" select="$v"/>

</

xsl:apply-templates>

</

xsl:template> 

The param value will not make it to the templates invoked.

<

xsl:apply-templates select="msxsl:node-set($v)/*" mode="v">

<

xsl:with-param name="v" select="$v"/>

</

xsl:apply-templates>

 

This works. See the subtle difference?
 
Back to school: What’s that node-set thing again?
Advertisements
This entry was posted in Software Development. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s