You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Sree P.N. Sreeram" <ps...@cas.org> on 2000/10/30 16:58:22 UTC
xsl:import problem
Hello
There seems to be a bug in resolving the relative URI when
using xsl:import. I am including the relevant xml and xsl
file.
Following are the details of my system:
SUN Solaris 2.6 using J2SE 1.2.2 JVM
xalan-j_1_2
In order to reproduce the bug:
(1) Go to xalan/samples/PureSAX
(2) Modify foo.xml as follows:
<?xml version="1.0"?>
<foo>
<doc>Hello</doc>
<txt>Hello</txt>
</foo>
(3) Modify foo.xsl as follows:
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:import href="bar.xsl"/>
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>
(4)Add a file named bar.xsl (this is imported in foo.xsl)
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="txt">
<txtout><xsl:value-of select="."/></txtout>
</xsl:template>
<xsl:template match="doc">
<docout><xsl:value-of select="."/></docout>
</xsl:template>
</xsl:stylesheet>
(5) Compile PureSAX.java and run "java PureSAX". I'm getting
the following error.
java PureSAX
file:/home/myself/xalan/samples/bar.xsl; Line 0; Column 0
Exception in thread "main" org.xml.sax.SAXParseException:
File "file:/home/myself/xalan/samples/bar.xsl" not found.
at java.lang.Throwable.fillInStackTrace(Native
Method)
at java.lang.Throwable.fillInStackTrace(Compiled
Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Exception.java:42)
at
org.xml.sax.SAXException.<init>(SAXException.java:78)
at
org.apache.xalan.xpath.xdom.XercesLiaison.parse(XercesLiaison.java:311)
at
org.apache.xalan.xpath.dtm.DTMLiaison.parse(DTMLiaison.java:289)
at
org.apache.xalan.xpath.xml.XMLParserLiaisonDefault.parse(XMLParserLiaisonDefault.java:523)
at
org.apache.xalan.xslt.XSLTEngineImpl.parseXML(XSLTEngineImpl.java:965)
at
org.apache.xalan.xslt.StylesheetHandler.processImport(Compiled
Code)
at
org.apache.xalan.xslt.StylesheetHandler.startElement(Compiled
Code)
at
org.apache.xerces.parsers.SAXParser.startElement(Compiled
Code)
at
org.apache.xerces.validators.common.XMLValidator.callStartElement(Compiled
Code)
at
org.apache.xerces.framework.XMLDocumentScanner.scanElement(Compiled
Code)
at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(Compiled
Code)
at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(Compiled
Code)
at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:900)
at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:939)
at PureSAX.main(PureSAX.java:105)
Question: Why is the xalan parser looking for bar.xsl in
..../xalan/samples instead of in ..../xalan/samples/PureSAX?
According to the spec (XSLT 2.6.2) ""A relative URI is
resolved relative to the base URI of the xsl:import element"
Is this a bug in xalan?
Thanks
Sree