Re: [xsl] document('') and URIResolver

Subject: Re: [xsl] document('') and URIResolver
From: omprakash.v@xxxxxxxxxxxxx
Date: Wed, 18 May 2005 12:46:23 +0530
Hi,
          Someone here had said something to the effect that the document
('') does cause the stylesheet to be processed twice. But I don't know the
underlying mechanics of this. And in case you didn't know, passing the
empty param "" to the document function causes the function to process the
current stylesheet.

Cheers,
Omprakash.V








                                                                                                                   
                    jpk                                                                                            
                    <jopaki@yahoo        To:     xsl-list@xxxxxxxxxxxxxxxxxxxxxx                                   
                    .com>                cc:     (bcc: omprakash.v/Polaris)                                        
                                         Subject:     [xsl] document('') and URIResolver                           
                    05/18/2005                                                                                     
                    03:41 AM                                                                                       
                    Please                                                                                         
                    respond to                                                                                     
                    xsl-list                                                                                       
                                                                                                                   
                                                                                                                   




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






This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

Current Thread