[public-qt-comments] <none>

Hello!

I'm posting with a couple of questions concerning multiple stylesheet
instructions that I originally posted to Michael Kay. At the end of this
posting you can find my original  email and Michael's reply. This version is a
bit shorter... Please copy replies to my email address, as I am not (yet) a
list subscriber.

1) What's the right way to handle multiple xml-stylesheet processing
instructions in an XML document? The specs are pretty vague, and the consensus
at the moment seems to be to treat them as if the document contained one
stylesheet instruction refrencing a 'virtual' stylesheet that imports each of
the referenced stylesheets in document order.
-> Is this everyone's experience, or is someone aware of an implementation that
handles it differently?
-> Any chance of getting this formalized in the XSLT spec, it seems a
significant issue for interoperability to me...

2) Are there any thoughts on how the handle the following:
  After a XSLT transformation the resulting XML document contains another
xml-stylesheet instruction as part of the output.
As far as I am aware there is no implementation that would 'iteratively' apply
the new stylesheet instruction, ie run a second transformation with the output
document of the first transformation as input to the second transformation.
-> Is anyone aware of such an implementation?
-> How do you think this should be handled?
-> Again, for interoperability, might it be worth defining this as a possible
transformer feature, or something like that?

Thank you for your time,

Richard Unger



Text of original email to Michael Kay, and his reply, follow:



> -----Original Message-----
> From: Richard Unger [mailto:runger@cim.mcgill.ca]
> Sent: 19 November 2004 18:09
> To: mike@saxonica.com
> Subject: Multiple Stylesheet Instructions
>
> Hi!
>
> I'm writing to you since you are the editor for the XSLT 2.0
> specification...
>
>
> My Questions are:
>
> 1) What is the correct way to handle multiple stylesheet instructions
> within an xml file? eg:
>
> <?xml version="1.0" charset="iso-8859-1"?>
> <?xml-stylesheet href="style1.xsl"?>
> <?xml-stylesheet href="style2.xsl"?>
> <?xml-stylesheet href="style3.xsl"?>
> <doc>...bla...</doc>
>
> The document "Associating Style Sheets with XML documents -
> Version 1.0
> - W3C Recommendation 29 June 1999" doesn't say anything except that it
> is legal to have multiple stylesheet instructions, and they
> are handled
> as specified in HTML 4.0 for the LINK instruction.
>
> HTML 4.0 says: "HTML allows authors to associate any number
> of external
> style sheets with a document. The style sheet language defines how
> multiple external style sheets interact (for example, the CSS
> "cascade"
> rules)." (Section 14.3.1)
>
> And the XSLT 2.0 specs don't say anything about it...
>
> So how to handle it?
>
> a) Does one treat this as if the first stylesheet had <xsl:include>'d
> the other stylesheets, in the order they are given? This would, as I
> understand it, give top priority to style2.xsl's templates (since they
> would appear first) which does not seem to be the intended effect to
> me...
>
> b) Perhaps it would be better to treat them as if the first stylesheet
> had <xsl:import>'d them?
>
> c) Or should the stylesheets be applied iteratively, ie,
> apply the first
> stylesheet to the source document, the second stylesheet to the
> resulting document of the first transformation, etc...
>
>
> 2) My second question: Is there any spec for handling the following
> case:
>
> A stylesheet is applied to a document, and the resulting xml document
> contains another stylesheet instruction.
>
> Is there any specifications for handling this? Is it
> reasonable to apply
> stylesheets iteratively until no stylesheet instruction applicable to
> the processor is found in the result document, or the
> output-type of the
> stylesheet is not xml?
>
> And how should one handle this in combination with question 1 - if
> multiple instructions are found in the source or intermediate result
> documents?
>
>
> Sorry to trouble you with all these questions,
>
> Regards from Austria,
>
> Richard Unger
>
>
> --
> Richard Unger <runger@cim.mcgill.ca>
>

Michael Kay's reply:

These are good questions. I suggest you post the questions to the comment
address for the spec in question, which is

www-xml-stylesheet-comments@w3.org

But since that list appears to be rather dormant, it might not do any harm
to copy the comment to public-qt-comments@w3.org

The interpretation in Saxon - which takes guidance from the JAXP
TransformerFactory#getAssociatedStylesheet method - is that it's equivalent
to doing a transformation using an imaginary stylesheet that imports each of
the specified stylesheets in order.

It would be entirely legitimate for an implementation to provide an option
to invoke a second transformation if the result document includes an
xml-stylesheet processing-instruction, but there's nothing in the specs to
say that it should do so.

Michael Kay

---------------------------
This mail sent through the
ungerground webmail system


---------------------------
This mail sent through the 
ungerground webmail system

Received on Sunday, 9 January 2005 03:11:54 UTC