GNOME Bugzilla – Bug 712173
xsl:number value=date:month-in-year() fails with xmlXPathCompOpEval in 1.1.28 but not 1.1.17
Last modified: 2013-12-15 14:01:35 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>
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)
Fixed with commit 0efc716c: https://git.gnome.org/browse/libxslt/commit/?id=0efc716c0cfbe4f8706865a92e9789cf8386f3b4