xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Hodges <harmo...@swbell.net>
Subject Re: XSLT output question
Date Thu, 20 Apr 2000 13:42:10 GMT

----- Original Message -----
From: "Elaine Brennan" <elaine.brennan@worldnet.att.net>
To: <general@xml.apache.org>
Sent: Thursday, April 20, 2000 4:25 AM
Subject: Re: XSLT output question


> At 07:32 PM 4/19/00 (-0500), Eric Hodges wrote:
>
> >I'm trying to use the XSLTProcessor.process() method to apply an XSL
> >stylesheet to an XML document.  Here's the code:
> >
> >       XMLParserLiaisonDefault liaison = new XMLParserLiaisonDefault ();
> >       XSLTProcessor xsltp = XSLTProcessorFactory.getProcessor(liaison);
> >       XSLTResultTarget target = new XSLTResultTarget(out);
> >       xsltp.process(new XSLTInputSource(xml), new XSLTInputSource(xsl),
> > target);
> >'out' is a Writer. 'xml' and 'xsl' are Documents.
> >
> >The problem is that the data written to 'out' looks like the XSL input,
> >not the result of applying that XSL to the XML.  There is one warning:
> >
> >XSL Warning: xsl:stylesheet requires a 'version' attribute!
> >
> >but nothing else to indicate failure.  Any clues?
>
>
> I'd guess that what you're seeing isn't "output" at all ... that the
> processor has reverted to simply showing you the content of your XSL
> file.  Most likely, when you associated the stylesheet with the document
> you forgot to include the version number, like this:
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                        xmlns:fo="http://www.w3.org/1999/XSL/Format"
> version='1.0'   >
>
> The XSLT spec states that the xsl:stylesheet element *must* have a version
> attribute on it ... and good XML parsers will do the correct thing when
> they notice the missing version number: they'll fail.
>
> --ELaine

I'd hope that a good XSLT processor would throw an exception if it wasn't
going to do what I asked it to.  Putting the version attribute into my
stylesheet causes an error, I think.  That was the first thing I tried.




Mime
View raw message