[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: JAXP URIResolver is being called twice?

Subject: RE: JAXP URIResolver is being called twice?
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Tue, 18 Sep 2001 17:54:00 +0100
javax.xml.transform xsl stylesheet resolver
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.