[Yanel-dev] [FYI] SAXTransformerFactory#newTransformerHandler
returning null
Guillaume Déflache
guillaume.deflache at wyona.com
Tue Apr 20 09:13:53 CEST 2010
Michael Wechner schrieb:
> Guillaume Déflache wrote:
>> Hi!
Hi!
>> When using XSLT via the JAXP API, you may use the
>> SAXTransformerFactory#newTransformerHandler(Source) method
>> (<http://java.sun.com/javase/6/docs/api/javax/xml/transform/sax/SAXTransformerFactory.html#newTransformerHandler(javax.xml.transform.Source)>).
>>
>
> instead of what?
Describing an alternative way was not the point here, we just used
what's in
http://svn.wyona.com/repos/public/yanel/trunk/src/resources/navigation/src/java/org/wyona/yanel/impl/resources/navigation/NavigationResource.java
>> Please be aware than with Xalan (2.7.1 at least) this method may only
>> return null if your XSLT is incorrect for some reason (in our case
>> this was a namespace used in XPath that never got declared),
>
> can you give a more concrete example?
In
http://svn.wyona.com/repos/public/yanel/trunk/src/resources/navigation/src/java/org/wyona/yanel/impl/resources/navigation/NavigationResource.java
there is:
xsltHandlers[i] = tf.newTransformerHandler(new
StreamSource(repo.getNode(xsltPath[i]).getInputStream()));
The variable is set to null when e.g. the Yanel NS namespace has not
been associated with the 'yanel' prefix in e.g. <xsl:value-of
select="yanel:foo"/>
>> instead of complaining loudly, which can be extremly confusing.
>
> which method didn't complain?
SAXTransformerFactory#newTransformerHandler as written above.
Cheers,
Guillaume
More information about the Yanel-development
mailing list