2

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 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.