473,569 Members | 2,791 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Viewing one XML using multiple XSL files

I started learning XML on Monday.

I have an XML file and have written an XSL file to render it to HTML for
formatted viewing in a browser. I'd like to create a second alternative
view of the same data. I am confused how:

If the following line, which dictates which XSL file should be
used to transform my XML document for me, is found *in the XML file
itself* then how can you use more than one XSL to present multiple views
of the same XML document?

<?xml-stylesheet type="text/xsl" href="myXSL.xsl "?>

Am I approaching this the wrong way?

--
-Toby
Add the word afiduluminag to the subject to circumvent my email filters.
Jan 25 '07 #1
13 9617
Toby Newman wrote:
If the following line, which dictates which XSL file should be
used to transform my XML document for me, is found *in the XML file
itself* then how can you use more than one XSL to present multiple views
of the same XML document?

<?xml-stylesheet type="text/xsl" href="myXSL.xsl "?>
The xml-stylesheet processing instruction is modelled after the HTML
link element so it should allow you (in theory) to have several such
processing instructions to suggest alternative stylesheets.
However in reality for XSLT stylesheet I don't think any of the major
desktop browsers like IE 6 and later, Mozilla/Firefox or Opera support that.
On the other hand such a processing instruction does not prevent you to
use script and an XSLT processor API on the server to apply different
stylesheet as you like or want.


--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 25 '07 #2
On 2007-01-25, Martin Honnen <ma*******@yaho o.dewrote:
Toby Newman wrote:
>If the following line, which dictates which XSL file should be
used to transform my XML document for me, is found *in the XML file
itself* then how can you use more than one XSL to present multiple views
of the same XML document?

<?xml-stylesheet type="text/xsl" href="myXSL.xsl "?>

The xml-stylesheet processing instruction is modelled after the HTML
link element so it should allow you (in theory) to have several such
processing instructions to suggest alternative stylesheets.
However in reality for XSLT stylesheet I don't think any of the major
desktop browsers like IE 6 and later, Mozilla/Firefox or Opera support that.
On the other hand such a processing instruction does not prevent you to
use script and an XSLT processor API on the server to apply different
stylesheet as you like or want.
Would it be possible to encode the filename of the XSL that I want to
use in the URL?
Like this:

http://www.domain.com/myxml.xml?XSLT=viewOne.xsl
http://www.domain.com/myxml.xml?XSLT=viewTwo.xsl

I've done this before in PHP and know how to get the variables from the
URL using PHP. I'm not using PHP files now, though, I'm using XML files.
XML files aren't server-side scripted, though, so can I fetch the
variable somehow in from the URL within XML?

--
-Toby
500 Nintendo Stars for trade: 2xWii Play
* * * * * * * * * * * * * * * * * * * * * * *
Add the word afiduluminag to the subject to circumvent my email filters.
Jan 25 '07 #3
Toby Newman wrote:
Would it be possible to encode the filename of the XSL that I want to
use in the URL?
Like this:

http://www.domain.com/myxml.xml?XSLT=viewOne.xsl
http://www.domain.com/myxml.xml?XSLT=viewTwo.xsl

I've done this before in PHP and know how to get the variables from the
URL using PHP. I'm not using PHP files now, though, I'm using XML files.
XML files aren't server-side scripted, though, so can I fetch the
variable somehow in from the URL within XML?
You need server-side scripting reading out the query string and running
the transformation e.g.
http://example.com/transform.php?xml...lt=viewOne.xsl
then transform.php reads out the file names, runs the transformation and
sends the transformation result to the client.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 25 '07 #4
On 2007-01-25, Martin Honnen <ma*******@yaho o.dewrote:
Toby Newman wrote:
>Would it be possible to encode the filename of the XSL that I want to
use in the URL?
Like this:

http://www.domain.com/myxml.xml?XSLT=viewOne.xsl
http://www.domain.com/myxml.xml?XSLT=viewTwo.xsl

I've done this before in PHP and know how to get the variables from the
URL using PHP. I'm not using PHP files now, though, I'm using XML files.
XML files aren't server-side scripted, though, so can I fetch the
variable somehow in from the URL within XML?

You need server-side scripting reading out the query string and running
the transformation e.g.
http://example.com/transform.php?xml...lt=viewOne.xsl
then transform.php reads out the file names, runs the transformation and
sends the transformation result to the client.
Ack - that's a shame. I don't have PHP or ASP on the server I'm using -
it's a Sharepoint server and ASP is blocked. Is there any other way?

--
-Toby
500 Nintendo Stars for trade: 2xWii Play
* * * * * * * * * * * * * * * * * * * * * * *
Add the word afiduluminag to the subject to circumvent my email filters.
Jan 25 '07 #5
In article <45************ ***********@new sspool2.arcor-online.net>,
ma*******@yahoo .de says...
You need server-side scripting reading out the query string and running
the transformation e.g.
http://example.com/transform.php?xml...lt=viewOne.xsl
then transform.php reads out the file names, runs the transformation and
sends the transformation result to the client.
Curiosity Question:
So, does this mean that the script needs to read the XML file and make
changes to it before sending it to the browser? Is this what is commonly
meant when you say "transform" ?

If that is so, then couldn't one write javascript code that reads the XML
file from wherever it is on the internet and converts (transforms) that
one line to whatever is needed then sends the rest on to the browser? I
know diddly about javascript, but from what I have gathered it can read
files from the internet and it can send HTML to the browser so that the
browser acts as if it just read it directly off of the web site. So, if
the javascript fed the browser an XML file with that one line modified
would the browser then act as if it just read that XML file directly off
of a web site and then do the XSL transformation itself?

Naturally, that would slow down the display because the XML file was
being processed twice but it might work.

Perhaps one could even embed the XML file permanently into the javascript
code. Then the XML would be transmitted at the same time as the
javascript code and would already be on the client's computer. This would
be like writing a program to display a page of text by simply writing a
bunch of cout statements (C++) rather than simply saving and opening the
text file. Naturally, the down side to this is that you no longer have a
true XML file that can be parsed. Maybe you could also write a little
utility that would automatically embed any XML file you wanted into a
similar javascript program to make it easy to generate these javascript
programs. But now I am making it way too complicated.
Jan 26 '07 #6
Grant Robertson wrote:
In article <45************ ***********@new sspool2.arcor-online.net>,
ma*******@yahoo .de says...
>You need server-side scripting reading out the query string and running
the transformation e.g.
http://example.com/transform.php?xml...lt=viewOne.xsl
then transform.php reads out the file names, runs the transformation and
sends the transformation result to the client.

Curiosity Question:
So, does this mean that the script needs to read the XML file and make
changes to it before sending it to the browser? Is this what is commonly
meant when you say "transform" ?
With transform I am talking about XSLT transformations , usually in the
context of the web XML is being transformed with an XSLT stylesheet to
HTML as that is what browsers can render.
If that is so, then couldn't one write javascript code that reads the XML
file from wherever it is on the internet and converts (transforms) that
one line to whatever is needed then sends the rest on to the browser? I
know diddly about javascript, but from what I have gathered it can read
files from the internet and it can send HTML to the browser so that the
browser acts as if it just read it directly off of the web site. So, if
the javascript fed the browser an XML file with that one line modified
would the browser then act as if it just read that XML file directly off
of a web site and then do the XSL transformation itself?
If you have ASP/J(ava)Script on the server then you can run the XSLT
transformation on the server (PHP was only mentioned as an example). It
would also be possible to simply change the xml-stylesheet processing
instruction and send the XML to the client but relying on client-side
XSLT support if the transformation can be done on the server does not
necessarily sound like a good idea.
However the original already pointed out that he does not have ASP on
his server.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 26 '07 #7
In article <45************ **********@news spool3.arcor-online.net>,
ma*******@yahoo .de says...
With transform I am talking about XSLT transformations , usually in the
context of the web XML is being transformed with an XSLT stylesheet to
HTML as that is what browsers can render.
Can't a browser open a raw XML file and apply the XSL itself? Or is XSL
different enough from XSLT that I am totally off base? When I open some
XML files with my browser I get a little bit of formatting over and above
just what a text file gets. But when I open some XML files I get a
message that says that there was no XSL file specified so the browser
just applied a default style.

Does XSLT perform transformations that can only be done on a server and
then send out the HTML to the browser or is it possible for a browser to
perform the transformations itself? I'm guessing older browsers couldn't
do it but could newer ones?
Jan 26 '07 #8
Grant Robertson wrote:
Can't a browser open a raw XML file and apply the XSL itself?
Yes, a good browser really should be able to do so; that was sorta the
original design point for stylesheets generally. I'm not sure which
browsers can do it these days; I've mostly been running stand-alone XSLT
engines.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Jan 26 '07 #9
Martin Honnen <ma*******@yaho o.dewrites:
Toby Newman wrote:
>If the following line, which dictates which XSL file should be
used to transform my XML document for me, is found *in the XML file
itself* then how can you use more than one XSL to present multiple views
of the same XML document?

<?xml-stylesheet type="text/xsl" href="myXSL.xsl "?>

The xml-stylesheet processing instruction is modelled after the HTML
link element so it should allow you (in theory) to have several such
processing instructions to suggest alternative stylesheets.
However in reality for XSLT stylesheet I don't think any of the major
desktop browsers like IE 6 and later, Mozilla/Firefox or Opera support
that.
On the other hand such a processing instruction does not prevent you
to use script and an XSLT processor API on the server to apply
different stylesheet as you like or want.
In some cases using trivial xml file for tying xsl and xml may help.

<?xml-stylesheet type="text/xsl" href="myXSL.xsl "?>
<xml-file href="myXML.xml " />

It will require your myXSL.xsl style-sheet to process myXML.xml file when
processing xml-file.
--
[pl>en: Andrew] Andrzej Adam Filip : an**@priv.onet. pl : an**@xl.wp.pl
Home site: http://anfi.homeunix.net/
Jan 27 '07 #10

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

Similar topics

3
4786
by: yogesh | last post by:
How to store the java applet emebedded in a web page for offline viewing? I saved the web page but it got saved without the applet.and also I searched for the corressponding .class file for the applet while I was viewing the webpage online but I got no reference of it on my local drive. regds, Yogesh Joshi
121
9969
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather...
5
2720
by: IkBenHet | last post by:
Hello, I use this script to upload image files to a folder on a IIS6 server: ******************* START UPLOAD.ASPX FILE ********************** <%@ Page Language="VB" Debug="true" %>
5
1302
by: aolson | last post by:
First of all i am pretty new to VB .NET as a whole so my answer may be silly as may my questions. Here is what i would like to do. I would like to open potentially multiple word documents for viewing only in a tab control. Each Word document should open in its own tab. Sometimes there may be only 1 document to open, sometimes there may be...
10
1521
by: David Lee Conley | last post by:
When I open the Data Sources window and create a new data source, everything works fine. But if I have a form showing in the IDE, the Data Sources window becomes disabled and doesn't display any of the database components. Yet, when I switch to code view, I can see everything just fine. Does anyone have any idea why the Data Sources window...
8
6083
by: Sheldon | last post by:
I just received a 2nd (configured as a dual) monitor but, for Access only, I can't seem to figure out, if it's possible, to view, say, Table1 on one monitor and Table2 on the other monitor. If I open Table1, then Table2, Table2 apparently sits directly over Table1 and seems anchored so that I cannot move it "out of the way". Is this...
14
1471
by: kmpathy | last post by:
I am new Sql Plus Want to know the command for viewing databases avaialble using default password and username on my co. server.. (example : dir command for viewing files) help me.
1
1147
by: =?Utf-8?B?TWFuaQ==?= | last post by:
I am using vista home premium. I am a new computer user. I could not view files in a CD/DVD. When i use the same CD in another computer with XP there is no problem in viewing the picture files. For example in a DVD i have some folders containing pictures. All the folders are displayed. But when i open a folder, it is empty.
1
1670
by: raul15791 | last post by:
Hi, I'm newbie in ASP. I am trying to view multiple pages by using a single file. For example, I have a few pages of product.asp (products.asp, products1.asp and so on). Now I want to create a single single (products.asp) but can view multiple pages. Try to search through google but not even sure what to search for.
0
7693
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7917
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7665
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6277
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1207
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.