You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Donald Ball <ba...@webslingerZ.com> on 2001/09/06 21:25:56 UTC

problem with setting system id on StreamSource

hey guys. i'm having trouble using stylesheets imports when the
stylesheets are loaded from a java system resource. my code looks
basically like so:

InputStream input =
  Thread.currentThread().getContextClassLoader().getResourceAsStream(
  "com/example/resources/xslt/"+name+".xsl");
StreamSource source = new StreamSource(input,
  String.valueOf(Thread.currentThread().getContextClassLoader().getResource(
  "com/example/resources/xslt/"+name+".xsl")));
templates = factory.newTemplates(source);

and in my stylesheet, i import another stylesheet in the same directory
with:

<xsl:import href="base.xsl"/>

xalan fails with the following exception:

javax.xml.transform.TransformerException: Had IO Exception with stylesheet
file: base.xsl
        at
org.apache.xalan.processor.StylesheetHandler.error(StylesheetHandler.java:889)
        at
org.apache.xalan.processor.StylesheetHandler.error(StylesheetHandler.java:917)
        at
org.apache.xalan.processor.ProcessorInclude.parse(ProcessorInclude.java:316)
        at
org.apache.xalan.processor.ProcessorInclude.startElement(ProcessorInclude.java:189)
        at
org.apache.xalan.processor.StylesheetHandler.startElement(StylesheetHandler.java:654)
        at com.caucho.xml.XmlParser.addElement(XmlParser.java:2109)
        at com.caucho.xml.XmlParser.parseElement(XmlParser.java:607)
        at com.caucho.xml.XmlParser.parseNode(XmlParser.java:369)
        at com.caucho.xml.XmlParser.parseInt(XmlParser.java:254)
        at com.caucho.xml.AbstractParser.parse(AbstractParser.java:528)
        at
org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:931)

is this a xalan bug or a coding mistake on my part?

- donald