2
votes

I have a single xml document (data.xml), which I display as HTML using an XSLT document (transform.xsl) with the following line in data.xml.

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

Suppose, however, I want to display this information in two different ways, one at http://www.domain.com/data.xml and one at http://www.domain.com/data2.xml. Both of these displays will use the same xml document but with different xsl's. Is there a way to do this without duplicating the xml file?

1

1 Answers

2
votes

If you are going to use a XSLT linked directly in the XML file, you will have to duplicate your XML.

There are several options:

  • If you generate the XML dynamically, you can detect which URL is being used and link a different XSLT.

  • If your platform has an XSLT transformation class, you can specify a different XSLT. In .NET you can do this using the XslTransform class.