471,338 Members | 1,063 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,338 software developers and data experts.

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!
Jul 23 '05 #1
5 12459
In article <42**********@127.0.0.1>, we****@yahoo.com enlightened us with...
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?


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.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
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:attribute name="value"> <xsl:value-of
select="ffe:XML/ffe:Contact/ffe:Telephone"/>
</xsl:attribute>
</input>
<script language="javascript">
var fone= formatPhone(document.all.txtPhone.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!
Jul 23 '05 #3
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:attribute name="value"> <xsl:value-of
select="ffe:XML/ffe:Contact/ffe:Telephone"/>
</xsl:attribute>
</input>
<script language="javascript">
var fone= formatPhone(document.all.txtPhone.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!
Jul 23 '05 #4
In article <42**********@127.0.0.1>, we****@yahoo.com enlightened us with...
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:attribute name="value"> <xsl:value-of
select="ffe:XML/ffe:Contact/ffe:Telephone"/>
</xsl:attribute>
</input>
<script language="javascript">
<script type="text/javascript">
var fone= formatPhone(document.all.txtPhone.value);
Where is the function formatPhone? I see no other script tags importing it.
Also, document.all is MSIE specific. Use document.formname.fieldname.value.
</script>

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


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?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #5

"ms_chika" <we****@yahoo.com> wrote in message news:42********@127.0.0.1...

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.


Hi,

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

http://lists.mulberrytech.com/xsl-list/archives/

Good luck,

Michèle Ouellet
Stelvio Inc.
Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Chris Styles | last post: by
19 posts views Thread by k.karthikit | last post: by
2 posts views Thread by ksr | last post: by
3 posts views Thread by BAnderton | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.