Connecting Tech Pros Worldwide Help | Site Map

Link to XML with an XSL

Newbie
 
Join Date: Feb 2009
Posts: 4
#1: Mar 4 '09
Hiya

On my web server i have an XSL file.
But I have a program (not written by me) that is generating xml files onto the web server too, these xml files dont reference the XSL.
How can i create a page to display the xml files using my XSL ?

If possible something like:

<a href="myxmlfile.xml" usexsl="myxslfile.xsl">

(i know thats wrong but you get the idea!)

It seems you cannot tell the browser where the XSL is located, it has to be specified in the xml file right ?
Moderator
 
Join Date: Mar 2006
Posts: 1,103
#2: Mar 4 '09

re: Link to XML with an XSL


You can write a secondary file which loads both of these files up. See http://www.w3schools.com/xsl/xsl_client.asp
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,641
#3: Mar 5 '09

re: Link to XML with an XSL


another way of including an XSL Stylesheet is (directly in the xml file):
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" ?>
  2. <?xml-stylesheet type="text/xsl" href="path/to/myxslfile.xsl" ?>
  3. <root>...</root>
which way to prefer depends on your needs, but I recommend using jkmyoung's way (using a script to combine xml and xsl file).
Reply