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=4355>.
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=4355

xsl:import with relative URIs doesn't work consistently

           Summary: xsl:import with relative URIs doesn't work consistently
           Product: XalanJ2
           Version: 2.2.x
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: org.apache.xalan.processor
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I have a few XSL files in the following directory structure:

junk
main_import.xsl
junk2
--->main_import.xsl
--->junk3
------->main_template.xsl
------->main_import.xsl

The main_template.xsl in junk3 imports main_import.xsl in junk3 using
<xsl:import href="main_import.xsl"/>

The main_import.xsl in junk3 imports the main_import.xsl in junk2 using
<xsl:import href="../main_import.xsl"/>

The main_import.xsl in junk2 imports the main_import.xsl in junk using
<xsl:import href="../main_import.xsl"/>

When I use main_template.xsl to transform an XML document, xalan throws an 
error saying main_import.xsl is directly or indirectly importing itself.

I went thru the source code for ProcessorInclude in org.apache.xalan.processor 
and found that when checking for duplicate template imports it uses 
importStackContains(hrefUrl) with the attribute value of href for the 
xsl:import element. Since the attribute value is exactly the same it throws 
that error.

I changed the ProcessorInclude's startElement method to use attribute value 
with the base identifier when checking for duplicate imports, it seemed to work.

Here's what I changed. In line 171 of ProcessorInclude

changed
String hrefUrl = getHref();

to
String hrefUrl = handler.getBaseIdentifier() + getHref();

If it doesn't affect any other part of xalan, can we have this in the next 
release/build?

Thank you,
Vikranth

Reply via email to