Error with parameter. Why?

Discussion in 'XML' started by shapper, Oct 30, 2006.

  1. shapper

    shapper Guest

    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
     
    shapper, Oct 30, 2006
    #1
    1. Advertising

  2. Where does the matching xsl:parameter declaration appear?

    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
     
    Joseph Kesselman, Oct 30, 2006
    #2
    1. Advertising

  3. shapper wrote:

    > 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"/>)?


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Oct 30, 2006
    #3
  4. shapper

    shapper Guest

    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

    Martin Honnen wrote:
    > shapper wrote:
    >
    > > 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"/>)?
    >
    >
    > --
    >
    > Martin Honnen
    > http://JavaScript.FAQTs.com/
     
    shapper, Oct 30, 2006
    #4
  5. shapper wrote:
    > 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.

    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
     
    Joseph Kesselman, Oct 31, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    982
    Mark Rae
    Dec 21, 2006
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,228
    Smokey Grindel
    Dec 2, 2006
  3. Replies:
    4
    Views:
    548
    Matteo
    Mar 29, 2007
  4. Stuart Redmann
    Replies:
    5
    Views:
    528
    Stuart Redmann
    Dec 14, 2007
  5. Replies:
    5
    Views:
    662
Loading...

Share This Page