xsl-list
[Top] [All Lists]

document('') and URIResolver

2005-05-17 15:11:20
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(_at_)yahoo(_dot_)com


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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>