By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,576 Members | 1,360 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,576 IT Pros & Developers. It's quick & easy.

Accessing javascript variable in xsl

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a

"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.