W3C home > Mailing lists > Public > www-voice@w3.org > January to March 2013

RE: SCXML test 147: transition contains empty condition

From: Jim Barnett <Jim.Barnett@genesyslab.com>
Date: Fri, 29 Mar 2013 01:24:15 +0000
To: Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de>
CC: "VBWG Public (www-voice@w3.org)" <www-voice@w3.org>
Message-ID: <57A15FAF9E58F841B2B1651FFE16D2810337A2@GENSJZMBX02.msg.int.genesyslab.com>
Stefan,
 I think it's possible that a change has slipped into your version of test147.txml

I have found two kinds of problems with xslt files. 1) If the .xsl file doesn't have any transformation matching a given conf item, the conf item ends up untransformed in the scxml file (and the interpreter chokes on it or ignores it).  However, when a conf item gets transformed into the empty string, it means 2) that the transformation contains a regexp that isn't matching for some reason.  Here's the definition of conf:idVal.  As you can see it has an <xsl:analyze-string ...> followed by a <xsl:matching-substring...>  If the regex matches nothing, then you'll get an empty string in the output (because there's no matching substring).  So the first thing I would do is to look at test147.txml to make sure that in idVal="somestring", the 'somestring' expression matches the 'regex'.  If any extraneous character has crept in, it could block the match and cause this problem.

<xsl:template match="//@conf:idVal">
		<xsl:attribute name="cond">
		<xsl:analyze-string select="."
			regex="([0-9]+)([=&lt;&gt;]=?)(.*)">
					<xsl:matching-substring>Var<xsl:value-of select="regex-group(1)"/>
						<xsl:variable name="op"><xsl:value-of select="regex-group(2)"/></xsl:variable>
						<xsl:choose>
							<xsl:when test="$op='='">==</xsl:when>
							<xsl:otherwise><xsl:value-of select="$op"/></xsl:otherwise>
					 </xsl:choose>
					 	<xsl:value-of select="regex-group(3)"/>
					</xsl:matching-substring>

		</xsl:analyze-string>
	</xsl:attribute>
</xsl:template>

P.S.  I am using xerces and running on windows 

-----Original Message-----
From: Stefan Radomski [mailto:radomski@tk.informatik.tu-darmstadt.de] 
Sent: Thursday, March 28, 2013 8:22 PM
To: Jim Barnett
Cc: VBWG Public (www-voice@w3.org)
Subject: Re: SCXML test 147: transition contains empty condition

I'd like to add that xsltproc gives me the same output - it is linked against libxslt.so (version1.1.27 here) as well. So it seems to be an issue with anything that uses libxslt to do the XSLT processing.

Regards
Stefan

On Mar 29, 2013, at 1:17 AM, Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de>
 wrote:

> Hi Jim,
> 
> thanks for clarifying this. I am using XML::LibXSLT[1] and I am somewhat confused because the rest is looking good. Could it be a bug in libxslt? Which XSLT implementation are you using to transform the txml files?
> 
> Best regards
> Stefan
> 
> [1] 
> https://github.com/tklab-tud/uscxml/blob/master/test/samples/w3c/conve
> rt-tests.pl
> 
> On Mar 28, 2013, at 11:23 PM, Jim Barnett <Jim.Barnett@genesyslab.com> wrote:
> 
>> Hmm, I'm not sure what the problem is.  I get the right result when I 
>> transform 147.txml into the ECMAScript data model using
>> confECMA.xsl:
>> 
>> <transition event="bar" cond="Var1==1" target="pass"/> <transition 
>> event="*" target="fail"/>
>> 
>> In the section  on the ECMAScript datamodel, it says that the processor must convert conds to Booleans using ToBoolean.  I assume that would yield 'false', but in any case it looks like you're having problems with the XSLT transformation.   
>> 
>> - Jim
>> 
>> -----Original Message-----
>> From: Stefan Radomski [mailto:radomski@tk.informatik.tu-darmstadt.de]
>> Sent: Thursday, March 28, 2013 6:11 PM
>> To: VBWG Public (www-voice@w3.org)
>> Subject: SCXML test 147: transition contains empty condition
>> 
>> Hey there,
>> 
>> I transformed the SCXML tests with XSLT for ecmascript[1]. As I was stepping through them, I realized that the generated test 147 contains a transition with an empty condition [1], which ought to be true for the test to be passed. Empty strings evaluate to false with my ecmascript implementation, so the test fails.
>> 
>>> From txml:
>> <transition event="bar" conf:idVal="1=1" conf:targetpass=""/>
>> 
>>> From generated SCXML test:
>> <transition event="bar" cond="" target="pass"/>
>> 
>> My XSLT knowledge is limited, I used perl's libxslt wrapper XML::LibXSLT and the official stylesheet provided at [3].
>> 
>> I guess the implied question (assuming the XSLT went fine) is, whether the empty condition really ought to evaluate to true?
>> Stefan
>> 
>> [1] 
>> https://github.com/jbeard4/scxml-test-framework/blob/master/test/w3c-
>> ecma/ [2] 
>> https://github.com/jbeard4/scxml-test-framework/blob/master/test/w3c-
>> ecma/test147.txml.scxml#L23 [3] 
>> http://www.w3.org/Voice/2013/scxml-irp/
>> 
> 
> 
Received on Friday, 29 March 2013 01:24:44 UTC

This archive was generated by hypermail 2.3.1 : Friday, 29 March 2013 01:24:50 UTC