473,509 Members | 2,857 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

applying 2 xslt to an xml via script?

Hi All

I am completely new to this, but I was wondering if I can apply 2 xslt's
subsequently to an xml, via the (client side) scripting method:

http://www.w3schools.com/xsl/xsl_client.asp

Like maybe:

<html>
<body>

<script type="text/javascript">

// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("cdcatalog.xml")

// Load XSL ---- 1 ----
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("cdcatalog.xsl")

// Transform ---- 1 ----
document.write(xml.transformNode(xsl))

// Load XSL ---- 2 -----
var xsl2 = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("cdcatalog2.xsl")

// Transform ---- 2 -----
document.write(xml.transformNode(xsl2))

</script>

</body>
</html>

Thaks for letting me know some scripting hints if anyone came across similar
situation.

Toby
Sep 20 '06 #1
3 1553

to*****@hotpop.com wrote:
I am completely new to this, but I was wondering if I can apply 2 xslt's
subsequently to an xml, via the (client side) scripting method:
[Explictly coded client-side JavaScript transforms via MSXML]
Yes, this is dead easy. Use two XSL documents and apply them one after
the other.

Remember to get the _results_ of the first transform as returned by the
..transformNode() method into a variable, rather than writing it back
directly. Then apply the second transform to _this_, not to your
original XML source.

Sep 21 '06 #2
Andy Dingley wrote:
to*****@hotpop.com wrote:

>>I am completely new to this, but I was wondering if I can apply 2 xslt's
subsequently to an xml, via the (client side) scripting method:
[Explictly coded client-side JavaScript transforms via MSXML]


Yes, this is dead easy. Use two XSL documents and apply them one after
the other.

Remember to get the _results_ of the first transform as returned by the
.transformNode() method into a variable, rather than writing it back
directly. Then apply the second transform to _this_, not to your
original XML source.
OK, I think I will be able to do this. However, from what I know, the script
would work only for MS IE and not for Firefox. Actually I think the entire
approach is useless, if it doesnt work for Firefox.
Sep 21 '06 #3

to*****@hotpop.com wrote:
However, from what I know, the script
would work only for MS IE and not for Firefox. Actually I think the entire
approach is useless, if it doesnt work for Firefox.
If you read the right tutorials (recent ones, probably mentioning AJAX)
then some slightly more sophisticated code will work on either.

It's not entirely web-portable, but it's usefully so.

Sep 21 '06 #4

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

Similar topics

0
2681
by: Sergio del Amo | last post by:
Hi, I use the xslt functions provided by php. I am running in my computer the package xampp(www.apachefriends.org) which includes php/apache/mysql .. In this package the php includes the sablotron...
2
2372
by: Jon Martin Solaas | last post by:
For java programmers there exist a framework called Millstone (www.millstone.org) for programming web user-interfaces in a component oriented way. Millstone uses xslt transformations to render...
7
4102
by: RC | last post by:
First, let me say I couldn't find a group discuss XML/XSLT. So I only choose the closest groups to post this message. Here is part of my *.xsl file <xsl:stylesheet...
6
4666
by: RC | last post by:
Hello World, I am try do call a JavaScript function from XSLT, but I got function not avaible error. See "????" below. Would someone out there tell me how? Thank Q! <xsl:stylesheet...
4
5227
by: Stephen | last post by:
I have the following that outputs an xml file to a div using ajax: <script type="text/javascript"> function ajaxXML(url,control_id){ if (document.getElementById) { var x =...
1
1625
by: John Moore | last post by:
I have a set of code that is called on every page load that loads an xslt file. The xslt file has an embedded <script> tag. Loading the page mutliple times causes aspnet_wp.exe to use all available...
3
1744
by: Simon Brooke | last post by:
I've been doing XSL transforms, converting XML to HTML, server side since 2000. In those days, clients which could do the transformation client side didn't exist, so whether to transform...
8
2065
by: toby989 | last post by:
Hi All I am completely new to this, but I was wondering if I can apply 2 xslt's subsequently to an xml, via the (client side) scripting method: http://www.w3schools.com/xsl/xsl_client.asp ...
2
2351
by: milecimm | last post by:
Hello, I need some help to solve the following problem (if it is possible, that's it): I'm using a xpath expression to programatically get data from my xml file. I want to transform ONLY the...
2
3088
by: Jonny B | last post by:
Hi all, I'm working on an a clientside xslt using jscript that passes a parameter to the xsl. I've got it working no problem in IE but cant get it to work in Mozilla. Can anyone help? This is...
0
7234
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7412
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7069
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5652
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4730
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3203
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.