RE: [xsl] is it possible to construct new xml with xsl ?

Subject: RE: [xsl] is it possible to construct new xml with xsl ?
From: "Michael Leditschke" <mike@xxxxxxxxxxx>
Date: Mon, 17 Jun 2002 20:54:10 +1000
> 3) Microsofts "WD-XSL" language (and this is what the builtin stylesheet
> uses) is not XSLT and does not use XPath (and this is why it can
> access the
> XML declaration).

That explains it. The referenced link is an attempt to convert
the WD-XSL one to XSLT, but shouldn't be construed as the
actual stylesheet used by IE. The referenced article from
the MSXML FAQ has a broken link to the "real" stylesheet which,
for anyone whose interested, is now located at

http://msdn.microsoft.com/code/default.asp?url=/msdn-files/026/002/045/XSL%2
0Files/defaultss_xsl.asp

Thanks.
Michael



> >
> >
> > I had a look at this stylesheet and have a concern about the
> > way in which the XML declaration is being generated.
> >
> >
> >
> > To my knowledge, the XML Declaration is not a PI per the XML 1.0
> > spec (section 2.6). Correct?
> >
> > Is it illegal for a parser to pass it through as a PI? I would
> > have thought it was illegal given the BNF in the XML 1.0 spec.
> >
> >
> > Conclusion -> No parser should pass the XML declaration to
> >               an application.
> >
> >
> >
> > The XPath 1.0 data model is explicit in section 5.5 that
> >
> > "The XML declaration is not a processing instruction.
> > Therefore, there is no processing instruction node
> > corresponding to the XML declaration."
> >
> > The XSL spec adopts the XPath data model without mention
> > of adding the XML declaration as a PI.
> >
> > Conclusion -> Even if a parser were allowed to pass the
> >               XML declaration through as a PI, it is not
> >               represented as such in the XSLT data model.
> >
> >
> >
> > Now, when displaying a file in IE using the referenced template,
> > it does show the xml declaration as provided in the file. If
> > no declaration in the file, there's none in the display, etc.
> >
> > The stylesheet has a template that starts
> >
> > <xsl:template match="pi('xml')">
> >
> > Given the above references, and the operation of IE,
> > am I correct in assuming
> >
> >
> > 1. MSXML is (incorrectly) passing through the XML declaration
> > as a PI in order to render it per the stylesheet.
> >
> >
> > OR
> >
> >
> > 2. It's not just the stylesheet contributing to the displayed
> > information. Some additional code must be being invoked to
> > detect this stylesheet, and somehow get at and render the XML
> > declaration information, which to my knowledge is supposed
> > to be hidden from the application by the parser.
> >
> >
> > I tried writing a stylesheet of my own looking
> > for an 'xml' PI and tested it with IE, the results of which
> > suggested MSXML is not passing through the declaration as a PI,
> > so 2) above looks more likely.
> >
> > Source document
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <?xml-stylesheet type="text/xsl" href="hello.xsl"?>
> > <greeting>Hello, world!</greeting>
> >
> >
> > Stylesheet
> >
> > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> >   <xsl:template match="/">
> >     <html>
> >       <head>
> >         <title>XML Declaration test</title>
> >       </head>
> >       <body>
> >         <p>
> >           <xsl:choose>
> >             <xsl:when test="processing-instruction('xml')">
> > XML Declaration passed through as PI.</xsl:when>
> >             <xsl:otherwise>
> > XML Declaration not passed through as PI.</xsl:otherwise>
> >           </xsl:choose>
> >         </p>
> >       </body>
> >     </html>
> >   </xsl:template>
> > </xsl:stylesheet>
> >
> >
> > Result
> >
> > <html>
> > <head>
> > <META http-equiv="Content-Type" content="text/html; charset=UTF-16">
> > <title>XML Declaration test</title>
> > </head>
> > <body>
> > <p>XML Declaration not passed through as PI.</p>
> > </body>
> > </html>
> >
> >
> > If the stylesheet authors/modifiers are out there (Nate Austin or
> > Jonathan Marsh), would you care to comment?
> >
> >
> > Regards
> > Michael
> >
> >
> >
> > BTW I tried the MS stylesheet out with SAXON 5.6.2, and as expected,
> > the xml declaration information was missing in the resulting
> > HTML.
> >
> >
> >
> >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> >
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>



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


Current Thread