Re: [xsl] Dynamic output method

Subject: Re: [xsl] Dynamic output method
From: Karl Stubsjoen <kstubs@xxxxxxxxx>
Date: Sat, 12 Feb 2005 14:31:30 -0700
Good Answer!  Thanks : )


On Sun, 13 Feb 2005 08:21:26 +1100, Dimitre Novatchev
<dnovatchev@xxxxxxxxx> wrote:
> Karl,
> 
> Even in XSLT 1.0 there's a way to get either
>   method="xml"
> or
>   method="html"
> 
> If a value for the "method" attribute is not explicitly specified and
> the generated top element by the transformation is with local-name
> "html", then the method used for serialisation will be "html",
> otherwise it will be "xml"
> 
> From the XSLT 1.0 specification (http://w3.org/TR/xslt#output):
> 
> "The default for the method attribute is chosen as follows. If
> 
> the root node of the result tree has an element child,
> 
> the expanded-name of the first element child of the root node (i.e.
> the document element) of the result tree has local part html (in any
> combination of upper and lower case) and a null namespace URI, and
> 
> any text nodes preceding the first element child of the root node of
> the result tree contain only whitespace characters,
> 
> then the default output method is html; otherwise, the default output
> method is xml. The default output method should be used if there are
> no xsl:output elements or if none of the xsl:output elements specifies
> a value for the method attribute"
> 
> Cheers,
> Dimitre Novatchev
> 
> 
> On Sat, 12 Feb 2005 10:55:22 -0700, Karl Stubsjoen <kstubs@xxxxxxxxx> wrote:
> > How abaout with MSXML and Ver. XSL 1.1?
> >
> >
> > On Sat, 12 Feb 2005 08:52:55 -0000, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> > > >
> > > > Is there a way to dynamically set the xsl:output method?  I'd like to
> > > > programmitcally set the output for HTML and/or XML.
> > > >
> > >
> > > Many APIs (e.g. JAXP) allow you to set the serialization parameters from the
> > > calling application.
> > >
> > > In 2.0 you can use xsl:result-document which allows dynamic serialization
> > > parameters.
> > >
> > > Michael Kay
> > > http://www.saxonica.com/

Current Thread