xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Elaine Brennan <elaine.bren...@worldnet.att.net>
Subject Re: XSLT output question
Date Thu, 20 Apr 2000 09:25:46 GMT
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





----

Elaine M. Brennan
Principal XML Technologist
Inferdata Corporation
elaine@inferdata.com
512/306-8225

Mime
View raw message