Accessing javascript variable in xsl

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ms_chika

    Accessing javascript variable in xsl

    Hi to all,
    I have this problem in xsl wherein i want to access a variable in
    javascript and use it my xsl. How would i access or use a javscript
    variable in my xsl file?

    Please help.



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • kaeli

    #2
    Re: Accessing javascript variable in xsl

    In article <4211761a$1_2@1 27.0.0.1>, wekwek@yahoo.co m enlightened us with...[color=blue]
    > Hi to all,
    > I have this problem in xsl wherein i want to access a variable in
    > javascript and use it my xsl. How would i access or use a javscript
    > variable in my xsl file?
    >[/color]

    Import the file where it is defined, same as html.
    You can also make a function and pass a variable, I would think.

    --
    --
    ~kaeli~
    Synonym: the word you use in place of a word you can't
    spell.



    Comment

    • ms_chika

      #3
      Re: Accessing javascript variable in xsl

      hi thanks for the reply, but i can't figure out the syntax for accessing
      the variable. I also tried the function but i have problems with it.

      this is my sample code:
      <input name="txtPhone" type="hidden" >
      <xsl:attribut e name="value"> <xsl:value-of
      select="ffe:XML/ffe:Contact/ffe:Telephone"/>
      </xsl:attribute>
      </input>
      <script language="javas cript">
      var fone= formatPhone(doc ument.all.txtPh one.value);
      </script>

      <xsl:variable name="cPhone"> <xsl:value-of select="$fone"/>
      </xsl:variable>

      In this sample code, i have xsl variable cPhone and the value of it
      should be the value of a javascript variable fone, but it doesnt work.
      waaahhhhhhh please help.

      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • ms_chika

        #4
        Re: Accessing javascript variable in xsl

        hi thanks for the reply, but i can't figure out the syntax for accessing
        the variable. I also tried the function but i have problems with it.

        this is my sample code:
        <input name="txtPhone" type="hidden" >
        <xsl:attribut e name="value"> <xsl:value-of
        select="ffe:XML/ffe:Contact/ffe:Telephone"/>
        </xsl:attribute>
        </input>
        <script language="javas cript">
        var fone= formatPhone(doc ument.all.txtPh one.value);
        </script>

        <xsl:variable name="cPhone"> <xsl:value-of select="$fone"/>
        </xsl:variable>

        In this sample code, i have xsl variable cPhone and the value of it
        should be the value of a javascript variable fone, but it doesnt work.
        waaahhhhhhh please help.

        *** Sent via Developersdex http://www.developersdex.com ***
        Don't just participate in USENET...get rewarded for it!

        Comment

        • kaeli

          #5
          Re: Accessing javascript variable in xsl

          In article <42129c40$1_2@1 27.0.0.1>, wekwek@yahoo.co m enlightened us with...[color=blue]
          > hi thanks for the reply, but i can't figure out the syntax for accessing
          > the variable. I also tried the function but i have problems with it.
          >
          > this is my sample code:
          > <input name="txtPhone" type="hidden" >
          > <xsl:attribut e name="value"> <xsl:value-of
          > select="ffe:XML/ffe:Contact/ffe:Telephone"/>
          > </xsl:attribute>
          > </input>
          > <script language="javas cript">[/color]

          <script type="text/javascript">
          [color=blue]
          > var fone= formatPhone(doc ument.all.txtPh one.value);[/color]

          Where is the function formatPhone? I see no other script tags importing it.
          Also, document.all is MSIE specific. Use document.formna me.fieldname.va lue.
          [color=blue]
          > </script>
          >
          > <xsl:variable name="cPhone"> <xsl:value-of select="$fone"/>[/color]

          I'm not all that great with XML/XSL yet. What's with the dollar sign?

          I think you wanted:
          <script type="text/javascript">
          document.write( "<xsl:value-of select=\""+fone +"\" />");
          </script>


          --
          --
          ~kaeli~
          If a turtle doesn't have a shell, is he homeless or naked?



          Comment

          • Michele Ouellet

            #6
            Re: Accessing javascript variable in xsl


            "ms_chika" <wekwek@yahoo.c om> wrote in message news:4212ba20_2 @127.0.0.1...
            [color=blue]
            >
            > In this sample code, i have xsl variable cPhone and the value of it
            > should be the value of a javascript variable fone, but it doesnt work.
            > waaahhhhhhh please help.
            >[/color]

            Hi,

            XSL developers are more likely to be knowledgeable about this kind of
            problem. I recommend:

            Mulberry Technologies, Inc. mailing list hosting provided by BIGLIST, https://www.biglist.com/


            Good luck,

            Michèle Ouellet
            Stelvio Inc.


            Comment

            Working...