Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Linking an stylesheet outside the XML instance

Reply
Thread Tools

Linking an stylesheet outside the XML instance

 
 
leosarasua@gmail.com
Guest
Posts: n/a
 
      12-14-2007
One of the great things about XML, I find, is that you can do lots of
things with an XML instance without modifying it. You can have any
kind of processing and displaying by writing a stylesheet separate
from the XML document.

However, the reference to the stylesheet has to be in the XML
document, which already forces you to modify it every time you want to
use a different XSL.This is really inconvenient: in my case, I have a
huge database of XML documents, and I need to process them with
different XSL's depending on the application. Obviously, I don't want
to modify all the XML documents each time.

My question is: what was the reason to design the use of XSL like
this?

Couldn't the XSL be chosen, for example, in the XML processor (i.e.
the browser)? Another possibility: the XSL reference in the XML
document is optional, and if it is missing then it is chosen the first
XSL file in the same directory of the XML document.

Would this be workable? And if so, does anyone know a reason why it
wasn't designed like this?
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      12-15-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> One of the great things about XML, I find, is that you can do lots of
> things with an XML instance without modifying it. You can have any
> kind of processing and displaying by writing a stylesheet separate
> from the XML document.
>
> However, the reference to the stylesheet has to be in the XML
> document, which already forces you to modify it every time you want to
> use a different XSL.This is really inconvenient: in my case, I have a
> huge database of XML documents, and I need to process them with
> different XSL's depending on the application. Obviously, I don't want
> to modify all the XML documents each time.
>
> My question is: what was the reason to design the use of XSL like
> this?
>
> Couldn't the XSL be chosen, for example, in the XML processor (i.e.
> the browser)?


You are right that client-side XSLT in the browser, where you want to
load the XML document in a browser window, depends on the xml-stylesheet
processing instruction. But XSLT in general does not, rather you have an
XSLT processor that has a command line feature to select both XML and
XSLT document and/or the processor has an API you can use to provide XML
and XSLT document. Even inside the browser XSLT processors have an API
exposed to script, for Mozilla, Opera 9 and Safari 3 see
<URL:http://developer.mozilla.org/en/docs/Using_the_Mozilla_JavaScript_interface_to_XSL_Tran sformations>,
for IE 6 and later see
<URL:http://msdn2.microsoft.com/en-us/library/ms762799.aspx>


--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      12-15-2007
(E-Mail Removed) wrote:

> However, the reference to the stylesheet has to be in the XML
> document, which already forces you to modify it every time you want to
> use a different XSL.This is really inconvenient: in my case, I have a
> huge database of XML documents, and I need to process them with
> different XSL's depending on the application. Obviously, I don't want
> to modify all the XML documents each time.
>
> My question is: what was the reason to design the use of XSL like
> this?


Also note that the specification of xml-stylesheet
<URL:http://www.w3.org/TR/xml-stylesheet/> allows for several of those
processing instruction to provide alternate stylesheet, only the major
browsers like Mozilla or IE do not implement that for XSLT stylesheets.


--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with pix inside->outside + dmz->outside + inside->outside->dmz Jack Cisco 0 09-19-2007 01:57 AM
xml:stylesheet use in document with multiple stylesheet options David Blickstein XML 3 08-02-2005 03:10 PM
have a stylesheet generate another stylesheet based on XML? Steven An XML 1 11-23-2004 01:07 PM
linking xml document to xsl stylesheet in C UndoMiel XML 1 09-21-2004 09:06 PM
Stylesheet referanse i stylesheet =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?= XML 3 07-04-2004 03:16 PM



Advertisments