XSLT question: how to use params as strings

D

David Blickstein

My XSLT stylesheet has the following top-level parmeter definition:

<xsl:param name="MethodName">&apos;Foobar&apos;</xsl:param>

Later in the stylesheet I try to base an xsl:if test on it:

<xsl:if test="normalize-space( @Method ) = normalize-space($MethodName)">

The test condition is never satisfied. Now if I substitute the value of
the parameter in:

<xsl:if test="normalize-space( @Method ) =
normalize-space(&apos;Foobar&apos;)">

The condition is satisfied. (And yes, there is a Method attribute in the
document with the value "Foobar".

Now I've tried all sorts of things like using quotes versus double quotes,
leaving the quotes out of the param definition and/or surrounding the
reference with quotes, etc.

None of it works... only using the VALUE of the parameter in place of the
$MethodName reference seems to work.

What am I not doing right?

Thanks
 
D

David Carlisle

David Blickstein said:
My XSLT stylesheet has the following top-level parmeter definition:

<xsl:param name="MethodName">&apos;Foobar&apos;</xsl:param>

This sets $MethodName to be a result tree fragment consisting of a
document node with text ndode child the string 'Foobar' with the quotes
being part of the string value, not delimiters.

You want

<xsl:param name="MethodName">Foobar</xsl:param>

or more efficiently bind to a string rather than a result tree fragment:

<xsl:param name="MethodName" select="'Foobar'"/>

This assumes you are not passing in a value to this parameter from
outside (if you are then the default value in the stylesheet is ignored)

David
 
D

David Blickstein

Thanks, that did it.

Apparantly Stylevision insists on putting parameters in as result trees
rather than attributes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,247
Members
46,844
Latest member
JudyGvh32

Latest Threads

Top