[Gestalt-users] Interaction between = operator and paramters handling
Status: Alpha
Brought to you by:
colin-adams
From: Florent G. <dar...@ya...> - 2006-12-18 22:59:23
|
Hi Colin, I just found a strange behaviour in Gexslt. It seems to be related to the parameter handling. Here is the test case. Note that using the string 'deep-equal' directly instead of using a parameter make the test to succeed. As well as using a variable instead of a parameter. So the last element in the result is: <expect select="$expect deep-equal $result"/> however I think it would have to be: <expect select="deep-equal($expect, $result)"/> (drkm)[75] ~/xslt/tests$ cat operator-equal.xml <test:suite xmlns:test="http://www.fgeorges.org/xslt/unit-test"> <test:tests id="hello-world-all"> <test:title>hello-world()</test:title> <test:test> <test:title>hello-world(), arity 0</test:title> <test:expect test="$test:result eq 'Hello, world!'"/> </test:test> <test:test> <test:title>hello-world(), arity 1</test:title> <test:expect select="'Hello, Jeni!'" pred="eq"/> </test:test> </test:tests> <test:tests id="false"> <test:title>False negative</test:title> <test:context select="$elem"/> <test:test> <test:expect as="element()+"> <elem2 id="id"/> </test:expect> </test:test> </test:tests> </test:suite> (drkm)[76] ~/xslt/tests$ cat operator-equal.xsl <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:test="http://www.fgeorges.org/xslt/unit-test" version="2.0"> <xsl:output indent="yes"/> <xsl:param name="expect.pred.default" select="'deep-equal'"/> <xsl:template match="/"> <root> <xsl:apply-templates/> </root> </xsl:template> <xsl:template match="node()"> <xsl:apply-templates/> </xsl:template> <xsl:template match="test:expect"> <xsl:variable name="pred-operators" select="'eq', 'is'"/> <xsl:variable name="pred" select=" if ( empty(@pred) ) then $expect.pred.default else @pred"/> <xsl:variable name="pred-call" select=" if ( $pred = $pred-operators ) then concat('$expect ', $pred, ' $result') else concat($pred, '($expect, $result)')"/> <expect select="{ $pred-call }"/> </xsl:template> </xsl:stylesheet> (drkm)[77] ~/xslt/tests$ gexslt operator-equal.xsl operator-equal.xml <?xml version="1.0" encoding="UTF-8"?> <root xmlns:test="http://www.fgeorges.org/xslt/unit-test"> <expect select="deep-equal($expect, $result)"/> <expect select="$expect eq $result"/> <expect select="$expect deep-equal $result"/> </root> Unfortunately, I wasn't able to reduce the test case furthemore. I hope it will help. Regards, --drkm ___________________________________________________________________________ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com |