TransformerConfigurationException Error
Added by Anonymous over 19 years ago
Legacy ID: #3091214 Legacy Poster: vanfleet (vanfleet)
Im getting a TransformerConfigurationException error when I process one of my existing stylesheets in Saxonb 8.4 (processing with JRE 1.5.0_01). Its been working fine in version 8.2. The error message Im getting is as follows: Error on line 1 XPDY0002: The context item is undefined at this point EXCEPTION: javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 1 error detected. javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 1 error detected. at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:124) at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:125) at net.sf.saxon.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:80) at XPSProcessor.processXML(Unknown Source) at XPSProcessor.makeEnv(Unknown Source) at XPSProcessor.startProcessor(Unknown Source) at XPSProcessor.main(Unknown Source) I was able to narrow the problem down to the following <xsl:number> elements in one of my functions: <xsl:number level="any" select="$theNode" format="1" count="/topicSet/bodyTopics/topic[@tocDisplay='show'][xps:variant(.)] | /topicSet/bodyTopics/part/topic[@tocDisplay='show'][xps:variant(.)]"/> Let me know if you need any other information. Thanks, David Vanfleet
Replies (3)
Please register to reply
RE: TransformerConfigurationException Error - Added by Anonymous over 19 years ago
Legacy ID: #3091238 Legacy Poster: Michael Kay (mhkay)
Thanks for reporting this. I think it's probably a side-effect of fixing another bug in 8.2 or 8.3 - there were some problems with xsl:number being moved out of loops because its dependencies weren't fully evaluated. I can't immediately see any reason why Saxon should decide that this xsl:number instruction has a dependency on the context item. Could you possibly send me enough of the stylesheet to reproduce the problem (it probably only needs to contain the function in which this error occurs) so I can analyze it? Thanks
RE: TransformerConfigurationException Error - Added by Anonymous over 19 years ago
Legacy ID: #3091315 Legacy Poster: vanfleet (vanfleet)
OK, here is a very watered down version of my stylesheet, notice that if you remove the [@tocDisplay='show'][xps:variant(.)] from the "count" attribute the error no longer occurs. Let me know if you need anything else from me. David Vanfleet ===================================== <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:saxon="http://saxon.sf.net/" xmlns:File="java:java.io.File" xmlns:xps="http://www.ugs.com" version="2.0" exclude-result-prefixes="xps xs File"> <xsl:template match="topicSet"> </xsl:template> <xsl:function name="xps:variant"> <xsl:param name="theNode"/> <xsl:sequence select="true()"/> </xsl:function> <xsl:function name="xps:getNumber"> <xsl:param name="theNode"/> <xsl:variable name="result"> <xsl:number level="any" select="$theNode" format="1" count="/topicSet/bodyTopics/topic[@tocDisplay='show'][xps:variant(.)]"/> </xsl:variable> <xsl:sequence select="if ($result) then ($result) else ('0')"/> </xsl:function> </xsl:transform>
RE: TransformerConfigurationException Error - Added by Anonymous over 19 years ago
Legacy ID: #3092112 Legacy Poster: Michael Kay (mhkay)
Thanks for the repro. As a workaround you can wrap the call on xsl:number in xsl:for-each, to set the context node (to something, it doesn't matter what): <xsl:for-each select="$theNode"> <xsl:number level="any" select="$theNode" format="1" count="/topicSet/bodyTopics/topic[@tocDisplay='show'][xps:variant(.)]"/> </xsl:for-each> But it's a bug, of course, and I will publish a source code fix. Michael Kay
Please register to reply