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 712173 - xsl:number value=date:month-in-year() fails with xmlXPathCompOpEval in 1.1.28 but not 1.1.17
xsl:number value=date:month-in-year() fails with xmlXPathCompOpEval in 1.1.28...
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
1.1.x
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2013-11-12 19:01 UTC by Doug Burke
Modified: 2013-12-15 14:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
This stylesheet fails on Linux with v1.1.28 but works with 1.1.17 (901 bytes, text/xml)
2013-11-12 19:01 UTC, Doug Burke
Details
This is a re-worked version of the stylesheet that works with both 1.1.28 and 1.1.17 (1.06 KB, application/xml)
2013-11-12 19:04 UTC, Doug Burke
Details

Description Doug Burke 2013-11-12 19:01:52 UTC
Created attachment 259689 [details]
This stylesheet fails on Linux with v1.1.28 but works with 1.1.17

The attached stylesheet succeeds in 1.1.17 on CentoOS5 Linux but fails with 1.1.28 on CentOS6. It appears to be because of direct embedding of a EXSLT date routine in a xsl:number statement - e.g. in the definition of the month2 variable below

  <xsl:variable name="dt" select="date:date-time()"/>
  <xsl:variable name="month2"><xsl:number value="date:month-in-year($dt)" format="01"/></xsl:variable>

a) PASS

% xsltproc --version
Using libxml 20708, libxslt 10126 and libexslt 813
xsltproc was compiled against libxml 20626, libxslt 10117 and libexslt 813
libxslt 10126 was compiled against libxml 20708
libexslt 813 was compiled against libxml 20626
% xsltproc test-1.1.28-fails.xsl test-1.1.28-fails.xsl
A: 12 November 2013
B: 2013-11-12

b) FAIL

I show three runs, which were straight after each other, showing different behavior (including a successful run in the middle):

% xsltproc --version
Using libxml 20706, libxslt 10126 and libexslt 815
xsltproc was compiled against libxml 20706, libxslt 10126 and libexslt 815
libxslt 10126 was compiled against libxml 20706
libexslt 815 was compiled against libxml 20706
% xsltproc test-1.1.28-fails.xsl test-1.1.28-fails.xsl
xmlXPathCompOpEval: function day-in-month bound to undefined prefix date
XPath error : Invalid expression
A: 12 November 2013
B: 2013-11-
% xsltproc test-1.1.28-fails.xsl test-1.1.28-fails.xsl
A: 12 November 2013
B: 2013-11-12
% xsltproc test-1.1.28-fails.xsl test-1.1.28-fails.xsl
xmlXPathCompOpEval: function month-in-year bound to undefined prefix date
XPath error : Invalid expression
xmlXPathCompOpEval: function day-in-month bound to undefined prefix date
XPath error : Invalid expression
A: 12 November 2013
B: 2013--

You can work around this by moving the date routine to a separate variable and then using that in the xsl:number statement - e.g.

  <xsl:variable name="work-around1"><xsl:value-of select="date:month-in-year($dt)"/></xsl:variable>
  <xsl:variable name="month2"><xsl:number value="$work-around1" format="01"/></xsl:variable>
Comment 1 Doug Burke 2013-11-12 19:04:28 UTC
Created attachment 259690 [details]
This is a re-worked version of the stylesheet that works with both 1.1.28 and 1.1.17

Using this stylesheet I get

% xsltproc --version
Using libxml 20706, libxslt 10126 and libexslt 815
xsltproc was compiled against libxml 20706, libxslt 10126 and libexslt 815
libxslt 10126 was compiled against libxml 20706
libexslt 815 was compiled against libxml 20706

% xsltproc test-1.1.28-works.xsl test-1.1.28-works.xsl
A: 12 November 2013
B: 2013-11-12

(repeated runs do not show any xmlXPathCompOpEval errors)