[xsl] document('') and URIResolver

Subject: [xsl] document('') and URIResolver
From: jpk <jopaki@xxxxxxxxx>
Date: Tue, 17 May 2005 15:11:20 -0700 (PDT)
Hi all,

I implemented URIResolver to handle import and
document() refs in my xsl:

// set uri resolver to resolve xsl import and
document() refs 
URIResolver uriResolver = new URIResolver() {
  public Source resolve(String href, String base)
  throws TransformerException {
    try {
      StringBuffer path = new
StringBuffer("test/com/cmt/tower/document/");
      if (href.indexOf(".xsl") > 0) {
        path.append("../../../../../resources/conf/");
      }
  
      path.append(href);
      File file = new File(path.toString());
      if(file.exists()) return new StreamSource(file);
      return null;
    }
    catch(Exception e) {
      throw new TransformerException(e);
    }
  }
};
tFactory.setURIResolver(uriResolver);

When the transformer.transform(...) runs into a
document('') ref, URIResolver.resolve(href, base) gets
called twice.  First time the href param is "", the
second time the href param is null.  The ultimate
exception that occurrs is:

java.lang.NullPointerException
	at
com.cmt.tower.document.fxslTest$1.resolve(fxslTest.java:67)

because the href param is null

Any ideas?

Thanks,

Jon 
jopaki@xxxxxxxxx


		
__________________________________ 
Do you Yahoo!? 
Read only the mail you want - Yahoo! Mail SpamGuard. 
http://promotions.yahoo.com/new_mail 

Current Thread