views:

7

answers:

1

It looks like if the data files fetched from data source already contain

<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
 <cd>
  <title>Empire Burlesque</title>
 ...

then the correct way to make the data displayable on a browser is to create a .xsl file, and then make the .xml file contain one more line (the second line below):

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="format.xsl"?>
<catalog>
 <cd>
  <title>Empire Burlesque</title>
 ...

but, how would you usually add this line to an .xml file? If there are 200 data files, then we need to modify all 200 files to contain that line? And if we change format.xsl to supergoodlooking.xsl, then we have to change all the .xml files to reflect that?

Is there also a way to somehow link an XML file with a XSL file, perhaps on the URL or using a 3rd file?

A: 

Some browsers will render the display given the xml with an embedded (and accessible) stylesheet, but most wont (and all will do it slightly differently).

If you are not processing on your server to generate the html (ie, you know everyone accessing them is using internet explorer and has msxsl installed) you will have to add that tag to every file. How you do it is up to you, some text processing language like perl etc (whatever you are comfortable with). If you want to change the xsl, it is easier to change the xsl and save it with the same filename, so you don't need to retag your 200 xml files.

An easier way is (as Dubas says) generate the html from the xml on the server, that way you can ensure that everyone sees the same thing, and you need not add an xsl tag in the files, as you can generate it with any xsl file you want.

Woody