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

RE: {java} JNDI lookup for a file - returning a Stream

Subject: RE: {java} JNDI lookup for a file - returning a StreamSource to URIResolver and xalan, saxon, jd.xslt, resin
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Fri, 29 Aug 2003 09:17:59 +0100
jndi lookup
I suspect you aren't doing a setSystemId() on the StreamSource. In
theory it should be possible to supply a Source with no known systemID,
so long as it doesn't contain any xsl:includes or other things that
depend on its base URI. But it tends to be fragile - the general
assumption in XSLT is that the base URI of nodes, in both source
documents and stylesheets, is known.

I'll go into more detail of the Saxon crash if you tell me which version
you are using.

Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Robert Koberg
> Sent: 29 August 2003 04:27
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx; resin-interest@xxxxxxxxxx
> Subject:  {java} JNDI lookup for a file - returning a 
> StreamSource to URIResolver and xalan, saxon, jd.xslt, resin
> 
> 
> Hi,
> 
> I am seeing inconsistent behavior when getting file based 
> resources through JNDI lookups and then returning a 
> StreamSource to an URIResolver. When using the same XSLs in a 
> non-JNDI based setup all processors work correctly. When 
> using JNDI and 'pre-building' the Source, Xalan recognizes 
> the Source and performs the transformation without errors -- 
> Saxon, jd.xslt and Resin fail.
> 
> In my live webapp I am strictly file system based, but I want 
> to abstract that so I can plug in different repositories like 
> Tamino, LDAP, etc.
> 
> I am trying something like the following in a custom URIReolver:
> 
> public Source resolve( String href, String base )
> {
>   StreamSource source  = null;
>   if ( href.startsWith( "xsl_" ) ) {
>     source = this.project.openSource( href ); 
> System.out.println( href + " = " + source );
>   }
>   return source;
> }
> 
> The lookup for the primary XSL (the one that does the 
> xsl:includes) is resolved correctly in all processors.
> 
> The resolver that is set on the TransformerFactory. The 
> source variable is being returned to the transformation(?) 
> or, definitely, at least the resolver... 
> 
> (FWIW, I have the latest Xalan in my $JAVA_HOME/libs/endorsed 
> directory, Saxon and jd.xslt are in the webapp's lib directory)
> 
> For the JNDI provider I am using: 
> javax.naming.Context.INITIAL_CONTEXT_FACTORY="com.sun.jndi.fsc
> ontext.RefFSCo
> ntextFactory"
> 
> The javax.naming.Context.PROVIDER_URL is set correctly and 
> the DirContext is available.
> 
> I have tried the following in Caucho's Resin:
> <system-property 
> javax.xml.transform.TransformerFactory="com.icl.saxon.Transfor
> merFactoryImpl
> "/> 
>   <system-property 
> javax.xml.transform.TransformerFactory="jd.xml.xslt.trax.Trans
> formerFactoryI
> mpl"/>
>   <system-property 
> javax.xml.transform.TransformerFactory="org.apache.xalan.proce
> ssor.Transform
> erFactoryImpl"/>
> 
> Xalan recognizes the Source and performs the transformation 
> without errors.
> 
> Saxon, jd.xslt and Resin fail giving the errors below 
> ('xsl_global_definitions' is the first 'identifier' that 
> comes into the resolver).
> 
> Any ideas on what I am doing wrong or how I can fix this?
> 
> Thanks,
> -Rob
> 
> (the default Resin 2.1.10 implementation fails, but only 
> gives a NullPointerException on my servlet filter)
> 
>    -oO  Saxon  Oo-
> 
> xsl_global_definitions = 
> javax.xml.transform.stream.StreamSource@1536eec
> TransformPreviewSiteXmlFilter.navigate:java.lang.NullPointerException
> java.lang.NullPointerException
>         at 
> com.icl.saxon.style.XSLGeneralIncorporate.getIncludedStyleShee
> t(XSLGeneralIn
> corporate.java:104)
>         at
> com.icl.saxon.style.XSLStyleSheet.spliceIncludes(XSLStyleSheet
> .java:421)
>         at
> com.icl.saxon.style.XSLStyleSheet.preprocess(XSLStyleSheet.java:346)
>         at 
> com.icl.saxon.PreparedStyleSheet.setStyleSheetDocument(Prepare
> dStyleSheet.ja
> va:176)
>         at
> com.icl.saxon.PreparedStyleSheet.prepare(PreparedStyleSheet.java:133)
>         at 
> com.icl.saxon.TransformerFactoryImpl.newTemplates(TransformerF
> actoryImpl.jav
> a:127)
> <snip why="going into my code"/>
> -----------------------------------------------------------
> 
>    -oO  jd.xslt  Oo-
> 
> xsl_global_definitions = 
> javax.xml.transform.stream.StreamSource@8990e4
> TransformPreviewSiteXmlFilter.navigate:javax.xml.transform.Tra
> nsformerConfig
> urationException: jd.xml.xslt.parser.XsltPar
> seException: '' includes directly or indirectly itself 
> (baseUri='' Element=xsl:include (line 15))
> javax.xml.transform.TransformerConfigurationException:
> jd.xml.xslt.parser.XsltParseException: '' includes directly 
> or in directly itself (baseUri='' Element=xsl:include (line 15))
>         at 
> jd.xml.xslt.trax.TransformerFactoryImpl.getException(Unknown
> Source)
>         at 
> jd.xml.xslt.trax.TransformerFactoryImpl.newTemplates(Unknown
> Source)
>         at 
> jd.xml.xslt.trax.TransformerFactoryImpl.newTemplates(Unknown
> Source)
> <snip why="going into my code"/>
> 
> 
>  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.