Hi Gary,

Thanks for your quick response.

> Re 1:  How are you kicking off your transform?  You might need to
> setSystemId on your XSLT Source.

I've verified that the system IDs of both the stylesheet and source document
have been set.

> Re 2:  See bug 1762.  I believe this is a match.

Yes, that does look like a match.

I originally tried use 2.2.D8 but I had to revert to 2.1.0, because of
reasons I can't quite remember.

At this point, all of my code is JAXP, except for two things I need that
JAXP doesn't necessarily expose. They can be summed up by the following
code, which I'm using now.

I need to figure out how to implement the following simple interface using
2.2.D9. Do you know how it would be done?


import java.util.Hashtable;
import javax.xml.transform.Source;

public interface ProcessorSpecific
{
    public Source getPreparedSource(Source source)
        throws Exception;

    public Object getNodeSet(Hashtable database)
        throws Exception;
}

The first method gets me the processor's preferred, lightweight
representation of source trees, wrapped in a Source object.

The second method gets me the Java object that the processor uses to
represent an XPath node-set, for purposes of passing it as a global
parameter to an XSLT transformation.

My implementation of this interface using Xalan 2.1.0 is as follows:

import java.util.Hashtable;
import java.util.Enumeration;

import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;

import org.w3c.dom.Node;

import org.apache.xpath.SourceTreeManager;
import org.apache.xpath.NodeSet;
import org.apache.xpath.objects.XNodeSet;

import org.apache.xml.utils.SAXSourceLocator;

public class Xalan210Specific implements ProcessorSpecific
{
    private SourceTreeManager treeMgr = new SourceTreeManager();

    public Source getPreparedSource(Source source)
        throws Exception
    {
        Node doc = treeMgr.getSourceTree(source, new SAXSourceLocator());
        return new DOMSource(doc);
    }

    public Object getNodeSet(Hashtable database)
        throws Exception
    {
        XNodeSet nodeSet = new XNodeSet();
        NodeSet mns = nodeSet.mutableNodeset();

        Enumeration e = database.elements();
        while (e.hasMoreElements())
        {
            DOMSource source = (DOMSource)e.nextElement();
            mns.addElement(source.getNode());
        }

        return nodeSet;
    }
}

This implies that I'll need to implement a new Source object to encapsulate
a DTM. The hashtable passed to getNodeSet() would consist only of instances
of this Source implementation.

Any guidance here would be greatly appreciated.

Evan Lenz
XYZFind Corp.

> -----Original Message-----
> From: Gary L Peskin [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 16, 2001 8:51 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Two show-stopping bugs re: the document() function, in
> Xalan 2.1.0
>
>
> These both sound familiar and should be fixed in current releases.  The
> current 2.2.D9 build should be pretty stable.  You might want to test
> out your stuff on there and see if it handles your requirements.
>
> Re 1:  How are you kicking off your transform?  You might need to
> setSystemId on your XSLT Source.
>
> Re 2:  See bug 1762.  I believe this is a match.
>
> Gary
>
> Evan Lenz wrote:
> >
> > 1. document(node-set) should resolve relative to the base URI
> of nodes in
> > the node-set. However Xalan 2.1.0 tries to resolve it relative
> to the base
> > URI of the stylesheet. This is in violation of the XSLT specification.
> >
> > 2. Custom URIResolvers (TrAX) are honored for xsl:import, but
> not for the
> > document() function. My URIResolver is being ignored! This is
> in violation
> > of the JAXP specification.
> >
> > Both of these are severe show-stoppers for the project I'm working on.
> > Hopefully there's been a fix for this in a stable build.
> >
> > Is anyone aware of these bugs and/or fixed releases?
> >
> > Thanks,
> >
> > Evan Lenz
> > XYZFind Corp.

Reply via email to