After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 59212 - "write" Redirect extension should be an XPath expression not an attribute value template
"write" Redirect extension should be an XPath expression not an attribute val...
Status: VERIFIED FIXED
Product: libxslt
Classification: Platform
Component: general
unspecified
Other Linux
: Normal minor
: ---
Assigned To: Daniel Veillard
Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2001-08-18 22:03 UTC by cpitcher
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description cpitcher 2001-08-18 22:03:51 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>
========================================================================
Comment 1 Daniel Veillard 2001-08-23 23:11:09 UTC
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
Comment 2 Daniel Veillard 2001-08-24 10:35:14 UTC
Should be closed in release 1.0.3,

  thanks,

Daniel