[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: JAXP URIResolver is being called twice?
The XSLT processor you are using is Xalan; I suggest you raise this on the Xalan list. Mike Kay > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of > Taras Tielkes > Sent: 18 September 2001 17:13 > To: Xsl-List (E-mail) > Subject: JAXP URIResolver is being called twice? > > > Hi, > > I'm registering a custom URI resolver in the XSLT processor > that shipped > with JAXP 1.1(.1?). > > Here's the source: > ------------------------ > import java.io.StringReader; > import java.io.FileOutputStream; > > import javax.xml.transform.stream.StreamSource; > import javax.xml.transform.stream.StreamResult; > import javax.xml.transform.*; > import javax.xml.transform.dom.*; > > public class CustomURIResolver implements URIResolver > { > public static void main(String[] args) > { > try > { > String sourceXML = "<x/>"; > > StreamSource xsl = new > StreamSource("resolve.xsl"); > StreamSource xml = new StreamSource(new > StringReader(sourceXML)); > > TransformerFactory tf = > TransformerFactory.newInstance(); > > Transformer t = tf.newTransformer(xsl); > t.setURIResolver(new CustomURIResolver()); > > StreamResult r = new StreamResult(new > FileOutputStream("c:\\out.xml")); > > t.transform(xml, r); > } > catch(Exception e) > { > e.printStackTrace(); > } > } > > public Source resolve(String relURI, String base) > { > System.err.println("[resolve] relURI = " + > relURI + " + base > = " + base); > > return null; > } > } > ------------------------ > > The XSL is very simple: > ------------------------ > <?xml version="1.0"?> > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > <xsl:template match="/"> > <xsl:apply-templates select="document('dummy')"/> > </xsl:template> > > </xsl:stylesheet> > ------------------------- > > The output however, is unexpected: > ------------------------- > [resolve] relURI = dummy + base = file:/C://resolve.xsl > [resolve] relURI = dummy + base = file:/C://resolve.xsl > file:/C://resolve.xsl; Line 5; Column -1; Can not load requested doc: > C:\dummy (The system cannot find the file specified) > > Of course, I understand the last line, but why is my resolver > called twice? > Even when I actually return a valid Source subclass instance, the same > behaviour can be observed. > > Am I missing something abvious? > > Thanks in advance, > Taras Tielkes > > > > > > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|