Subject: Re: [xsl] Different views of the same XML file From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Wed, 14 Feb 2001 15:45:50 +0000 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Different views of the same X, Marco Zennaro \(PATH | Thread | [xsl] HTML tags from XML content, Mingbo Qin |
RE: [xsl] need whitespace between a, Andrew Welch | Date | [xsl] [Zvon] Multimodal views, Refe, Miloslav Nic |
Month |