GNOME Bugzilla – Bug 59212
"write" Redirect extension should be an XPath expression not an attribute value template
Last modified: 2009-08-15 18:40:50 UTC
According to the Apache Xalan-Java documentation, the "select" attribute on the "write" Redirect extension element should be interpreted as an XPath expression, but it is handled as an attribute value template by libxslt-1.0.2. From http://xml.apache.org/xalan-j/extensionslib.html#redirect: Each of these elements includes a file attribute and/or a select attribute to designate the output file. The file attribute takes a string, so you can use it to directly specify the output file name. The select attribute takes an XPath expression, so you can use it to dynamically generate the output file name. If you include both attributes, the Redirect extension first evaluates the select attribute, and falls back to the file attribute if the select attribute expression does not return a valid file name. The session shown below illustrates the problem when the XSLT stylesheet below (saved as "write-test.xsl") is evaluated using xsltproc from libxslt-1.0.2 and Xalan-Java from Java 2 SDK v1.4beta. According to the Apache Xalan-Java documentation, the new filename should be "2" and not "1+1". ======================================================================== $ xsltproc write-test.xsl write-test.xsl <?xml version="1.0"?> <output> Nothing to see here, move along. </output> $ ls 1+1 write-test.xsl $ rm -f 1+1 $ java org.apache.xalan.xslt.Process -IN write-test.xsl -XSL write-test.xsl <?xml version="1.0" encoding="UTF-8"?> <output> Nothing to see here, move along. </output> $ ls 2 write-test.xsl ======================================================================== ======================================================================== <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:lxslt="http://xml.apache.org/xslt" xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect" extension-element-prefixes="redirect" exclude-result-prefixes="lxslt redirect"> <xsl:preserve-space elements="*"/> <xsl:output method="xml"/> <xsl:template match="/"> <output> Nothing to see here, move along. <redirect:write select="1+1"> <output>Not much here either.</output> </redirect:write> </output> </xsl:template> </xsl:stylesheet> ========================================================================
Fixed, but what a piece of crap, Attribute Value Templates were explicitely designed for that. But seems some people prefers to develop incogherent extensions ... Anyway, done: orchis:~/tmp/test -> ls write-test.xsl orchis:~/tmp/test -> xsltproc write-test.xsl write-test.xsl <?xml version="1.0"?> <output> Nothing to see here, move along. </output> orchis:~/tmp/test -> ls 2 write-test.xsl orchis:~/tmp/test -> thanks for the report it will be in the next release, Daniel
Should be closed in release 1.0.3, thanks, Daniel