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 zo...@ca.ibm.com on 2003/01/02 18:32:13 UTC

Re: differences between URIResolver in Xalan and XSLTC

Hi Christos,

     It depends on the arguments to the document() function.

     According to section 12.1 of XSLT 1.0 [1], if the document() function 
has two arguments (in which case the second argument must be a node-set) 
the base URI for the reference is the base URI of the first node in the 
second argument in document order; if the document() function has one 
argument, and that argument is a node set, the result is the union of a 
number of references to document() with two arguments, as described in 
12.1.  In both of those cases, the base URI would likely be the base URI 
of a node in the XML document.

     If the reference to the document() function has no arguments or has 
one argument, and that argument is not a node-set, the base URI for the 
reference is, according to 12.1, the base URI of the node in the 
stylesheet that contains the reference to document().

     You might be encountering the same problem as Bug 15200.[2]  If it 
appears to be a distinct problem, please open a bug report in Bugzilla.

Thanks,

Henry
[1] http://www.w3.org/TR/xslt#document
[2] http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15200
------------------------------------------------------------------
Henry Zongaro      Xalan development
IBM SWS Toronto Lab   Tie Line 969-6044;  Phone (905) 413-6044
mailto:zongaro@ca.ibm.com




Christos Karras <ck...@capella.org>
12/23/2002 10:35 AM

 
        To:     xalan-j-users@xml.apache.org
        cc: 
        Subject:        differences between URIResolver in Xalan and XSLTC

 

I am modifying an application to use XSLTC instead of Xalan. The 
application uses a custom URIResolver to resolve document() refrences in 
stylesheets, and when the resolver is called, it gets different values 
for the "base" parameter depending on if I'm using Xalan or XSLTC:

- With Xalan, the base is the system id that was assigned to the 
*stylesheet's* Source
- However, with XSLTC, the base is the system id that was assigned to 
the *xml document's* Source

Which one, of Xalan or XSLTC, is calling my URIResolver the right way?

For exemple:
    StreamSource srcXSL = new StreamSource(inXSL); 
    srcXSL.setSystemId("stylesheet.xsl");
    Templates template = transformerFactory.newTemplates(srcXSL);

    Transformer transformer = template.newTransformer(); 
    transformer.setURIResolver(new TestURIResolver());

    StreamSource srcXML = new StreamSource(inXML);
    srcXML.setSystemId("document.xml");
    transformer.transform(srcXML, out);

When I use XSLTC, TestURIResolver.resolve() is called with 
"document.xml" as a base, and when I switch back to Xalan, it is called 
with "stylesheet.xsl" as a base.

I'm using Xalan 2.4.1

Thanks