[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] {java} JNDI lookup for a file - returning a StreamSource to URIResolver and xalan, saxon, jd.xslt, resin


Subject: [xsl] {java} JNDI lookup for a file - returning a StreamSource to URIResolver and xalan, saxon, jd.xslt, resin
From: "Robert Koberg" <rob@xxxxxxxxxx>
Date: Thu, 28 Aug 2003 20:26:33 -0700

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.fscontext.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.TransformerFactoryImpl
"/> 
  <system-property
javax.xml.transform.TransformerFactory="jd.xml.xslt.trax.TransformerFactoryI
mpl"/>
  <system-property
javax.xml.transform.TransformerFactory="org.apache.xalan.processor.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.getIncludedStyleSheet(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(PreparedStyleSheet.ja
va:176)
        at
com.icl.saxon.PreparedStyleSheet.prepare(PreparedStyleSheet.java:133)
        at
com.icl.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.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.TransformerConfig
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



Current Thread
Keywords
xsl