473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 12591
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Peter | last post by:
Hello, Two newbie questions: 1) I have a javascript file with a function in it. From this function I want to access a variable in another javascript file -which is not inside a function. I...
6
by: Chris Styles | last post by:
Dear All, I've been using some code to verify form data quite happily, but i've recently changed the way my form is structured, and I can't get it to work now. Originally : The form is...
1
by: CS Wong | last post by:
Hi, I have a page form where form elements are created dynamically using Javascript instead of programatically at the code-behind level. I have problems accessing the dynamically-created...
19
by: k.karthikit | last post by:
Hello all, In some hidden variable (<input type="hidden" name="hiddenId" value="test" /> ,i stored some value.I accessed the value "test" using var id = document.getElementById( 'hiddenId' );...
6
by: leppert | last post by:
Hello, I am trying to access a javascript variable on another site. The site requires the user to be logged in, so what I am doing is submitting a form and redirecting the output to an IFRAME,...
2
by: ksr | last post by:
Hello, I have a HTML page, which loads an activeX control in the browser. In the <HEADsection, I have javascript similar to the following, <SCRIPT language="JavaScript"> var Index = ""; //...
3
by: BAnderton | last post by:
Hello all, Question: Is there any way to access a javascript variable from within psp code? I'm aware of how to do the reverse of this (js_var='<%=psp_var%>'). Here's a non-working...
2
by: Zuhaib Hyder | last post by:
please remove double quote error in accessing javascript variable in c# , Page.RegisterStartupScript("MyScript", "<script language=javascript> var thumb = null;thumb =...
2
Frinavale
by: Frinavale | last post by:
Hi! I am dynamically generating external .js JavaScript resources to be used with a Tab control I created (using VB.NET). Originally, the JavaScript was written directly into the <head> of the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.