473,327 Members | 2,069 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,327 software developers and data experts.

Is it possible to put XSL instructions inside JavaScript?

Is it possible to put XSL instructions inside JavaScript?
For example, pop up a message box with the xml value: alert(value in xml);

Approach #1:
<script type="text/javascript">
alert(<xsl:value-of select="@id"/>);
</script>

It will have javascript errors

Approach #2:

<xsl:text>&lt;script type="text/javascript"&gt;</xsl:text>
<xsl:text>alert(</xsl:text>
<xsl:value-of select="@id"/><xsl:text>)</xsl:text>
<xsl:text>&lt;/script&gt;</xsl:text>

If I try the following, it will display the javascript as text,
not the javascript message box in browser.

any ideas?? thanks!!
Jul 20 '05 #1
1 3314

Is it possible to put XSL instructions inside JavaScript?
The answer to that question would be a question about javascript but you
appear to be writing XSLT. (The actual character data being written by
xslt might be javascript, but XSLT doesn't care about that, it could
just as well be english or french.
For example, pop up a message box with the xml value: alert(value in xml);

Approach #1:
<script type="text/javascript">
alert(<xsl:value-of select="@id"/>);
</script>

This is the correct xslt syntax, once xslt has run the output will be
<script type="text/javascript">
alert(something);
</script>
which if passed to an html browswer will take the content of the script
and pass it to the javascript engine.depending what your javascript is
doing you might want alert("<xsl:value-of select="@id"/>"); so you end up with
alert("something");
It will have javascript errors

Approach #2:

<xsl:text>&lt;script type="text/javascript"&gt;</xsl:text>
<xsl:text>alert(</xsl:text>
<xsl:value-of select="@id"/><xsl:text>)</xsl:text>
<xsl:text>&lt;/script&gt;</xsl:text>

If I try the following, it will display the javascript as text,
not the javascript message box in browser.
Using &lt; quotes the < specifically so that it is taken as text not markup.
any ideas?? thanks!!

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: stan k. | last post by:
First of all let me clarify - I am not talking about having a bunch of images loaded all at once (or preloaded) and then controlling the display of the images after that point -- I know that can be...
39
by: Mark Johnson | last post by:
It doesn't seem possible. But would the following also seem a violation of the general notions behind css? You have a DIV, say asociated with class, 'topdiv'. Inside of that you have an anchor...
4
by: frogman042 | last post by:
My daughter is playing around trying to learn JavaScript and she wrote a small program that prints out a message in increasing and decreasing font size and color changes. She is using document...
14
by: Alex Molochnikov | last post by:
Is there any way to embed the HTML code inside FRAMESET? Something like this: <frameset cols="50%,*"> <frame src=" ... HTML code for the frame ... "> <frame src="Frame2.html" name="main">...
3
by: Earl Teigrob | last post by:
Can a Modal Dialog Box do forms ASP.NET forms validation from within the Modal Box? I want to pop up a dialog box to the user and have it do its own post backs with validation checking and then...
2
by: Nick Gilbert | last post by:
Hi I have a number of pages where it is valid for the user to enter HTML. On these pages, I have turned off RequestValidation ("ValidateRequest = false" in the page directive) so that the...
21
by: Ben | last post by:
Hello I have frames set up in an asp.net application and need one frame to refresh another. Seeing as events need to be registered at the time the page is sent from the server, I was wondering...
8
by: dbaplusplus | last post by:
I worked on web development using java script many many years, so I am now a newbie to javascript. I have a single html page, which is generated dynamically using some programming language. Web...
2
by: Daz | last post by:
Hi everyone. Sorry for the confusing subject, I couldn't think how best to word it. What I would like to know, is if there is an equivilant to this code, in using JSON. <script...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.