[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Different views of the same XML file

Subject: Re: Different views of the same XML file
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 14 Feb 2001 15:45:50 +0000
same xml different stylesheet
Hi Marco,

> I want different views of the same XML file. I.e. I want to apply
> different XSL on the same XML file. How can I do it?

It kinda depends on what you're doing the transformation with.  If
you're using a command-line processor, then you can specify whatever
stylesheet you want on the command line - you don't have to rely on
the xml-stylesheet processing instruction.

If you're doing client-side transformations (e.g. in IE) then you have
to use scripting to operate MSXML and get it to switch between
stylesheets. However, there's a nice utility from Chris Bayes
(http://www.bayes.co.uk/xml) that allows you to specify several
xml-stylesheet processing instructions and then switch between them
using the context menu.  Hopefully you'll get that kind of thing
embedded in browsers at some point.

If you don't want to go the scripting route, then rather than copying
the entire XML file twice, you could move the majority of it into a
common file and reference that with an entity in two different files:

--- firstview.xml ---
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="firstview.xsl"?>
<!DOCTYPE doc [
<!ENTITY common SYSTEM 'common.xml'>
]>
<doc>
  &common;
</doc>
---

--- secondview.xml ---
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="secondview.xsl"?>
<!DOCTYPE doc [
<!ENTITY common SYSTEM 'common.xml'>
]>
<doc>
  &common;
</doc>
---

Or finally, you could combine the two stylesheets and then use a
parameter to determine which of the views to show.  You could then set
the parameter through the command line, through scripting, or if
you're using something like Cocoon, then through the URL that you use
to access the file.

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.