Error with parameter. Why?

S

shapper

Hello,

Inside my XSL file I have the following:

<xsl:element name="loc">
<xsl:value-of select="$MyParameter" />
<xsl:value-of select="substring(@url, 3)"/>
</xsl:element>

In line <xsl:value-of select="$MyParameter" /> I get an error saying:
The value of parameter MyParameter is either not defined or it is out
of scope.

Thanks,
Miguel
 
M

Martin Honnen

shapper said:
Inside my XSL file I have the following:

<xsl:element name="loc">
<xsl:value-of select="$MyParameter" />
<xsl:value-of select="substring(@url, 3)"/>
</xsl:element>

In line <xsl:value-of select="$MyParameter" /> I get an error saying:
The value of parameter MyParameter is either not defined or it is out
of scope.

So where you you have an
<xsl:param name="$MyParameter"/>
and where do you set its value (either from the outside if the param is
global or with an <xsl:with-param name="$MyParameter"
select="XPathexpression"/>)?
 
S

shapper

Sorry,

I am lost. This is my first XSL file. Inside my XSL file I have
something like this:

<xsl:element name="loc">
<xsl:text>HERE</xsl:text>
<xsl:value-of select="substring(@url, 3)"/>
</xsl:element>

What I want is to be able to change HERE to something else.
For this I tried to add the MyParameter as I described.

I set the parameter value in my VB.NET code on my Asp.Net web site.
I do that when I run a function to transform the XML file using the XSL
file.

Was this what you asked me?

Sorry, but I am just starting with XSL and XML.

Thanks,
Miguel
 
J

Joseph Kesselman

shapper said:
I set the parameter value in my VB.NET code on my Asp.Net web site.

The parameter's value has to be explicitly passed to your stylesheet
(see the XSLT implementation's documentation for the syntax, since it
varies from processor to processor) and has to be explicitly accepted by
a top-level xsl:param element in the stylesheet.

See the XSLT FAQ's section on variables and parameters, and/or find a
good tutorial.
 

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,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top