xsl-list
[Top] [All Lists]

javax.xml.transform.TransformerException: xsl:stylesheet is not a llowed in this position in the stylesheet

2004-05-06 12:17:06
All,

I am using the Xalan-J TemplatesHandler via
javax.xml.transform.sax.TemplatesHandler. I am (now) parsing an 'empty'xsl
(as a test) with an XMLReader that has the TemplatesHandler set as its
ContentHandler (see code below). 

I keep getting a "javax.xml.transform.TransformerException: xsl:stylesheet
is not allowed in this position in the stylesheet!" error. I stripped
everything out of the xsl leaving only the <xsl:stylesheet> element and I
still get the error. Any ideas? I'm figuring this has to be a configuration
issue with the reader but I really don't have a clue....

Stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";>
</xsl:stylesheet>

Code:
 
TransformerFactory tfac = TransformerFactory.newInstance() ;
SAXTransformerFactory saxTfac = ((SAXTransformerFactory) tfac) ;

TemplatesHandler templatesHandler = saxTfac.newTemplatesHandler() ;

// Create an XMLReader and set its ContentHandler.
SAXParserFactory fac = SAXParserFactory.newInstance() ;
SAXParser parser = fac.newSAXParser() ;
XMLReader reader = parser.getXMLReader() ;
reader.setContentHandler( templatesHandler) ;

// Parse the stylesheet.
reader.parse( args[0]) ; <--- throws exception


<Prev in Thread] Current Thread [Next in Thread>
  • javax.xml.transform.TransformerException: xsl:stylesheet is not a llowed in this position in the stylesheet, Charles Macleod <=