You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/11/07 05:28:45 UTC
DO NOT REPLY [Bug 14325] New: -
Transformer fails when Templates constructed with "new StreamSource(new FileReader())"
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14325>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14325
Transformer fails when Templates constructed with "new StreamSource(new FileReader(<filepath>))"
Summary: Transformer fails when Templates constructed with "new
StreamSource(new FileReader(<filepath>))"
Product: XalanJ2
Version: 2.4
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Major
Priority: Other
Component: org.apache.xalan.transformer
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: sujansky@pacbell.net
Note the difference in the way that the Templates instance is created in the
following code snippet ("xslFile" is a String containing a file path):
TransformerFactory tf = TransformerFactory.newInstance();
//THIS ONE WORKS
Templates t = tf.newTemplates(new StreamSource(xslFile));
//THIS ONE THROWS AN ERROR: "Unknown error in XPath"
//Templates t = tf.newTemplates(new StreamSource(new FileReader(xslFile)));
Transformer transformer = t.newTransformer();
//Starts a server object whose methods are called from the xsl stylesheet
LocalTermServer tm = initLocalTermServer();
transformer.setParameter("te",tm);
transformer.transform(new StreamSource(inputFile), new
StreamResult(outputFile));
When the bad version is used, the Unknown XPath error is thrown at the time
transform() is called (all preceding statements succeed without apparent
error, and this code compiles without error).
This problem occurs only when a stylesheet is used that contains extension
functions and the "document()" function (simpler stylesheets work without
problem). Is this a known bug? Note that similar problems occur when an
InputStream instance is used to construct the StreamSource also (i.e. ->
//Templates t = tf.newTemplates(new StreamSource(anInputStream));
Obviously, TransformerFactory.getTemplates() should work the same regardless of
how the StreamSource that is its argument was created. That doesn't seem to be
the case, at least with certain kinds of stylesheets.