xsl-list
[Top] [All Lists]

Re: document('') and URIResolver

2005-05-18 00:16:23


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(_at_)yahoo        To:     
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com                                
   
                    .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(_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>
--~--






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

--~------------------------------------------------------------------
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>
--~--