- From: Eric van der Vlist <vdv@dyomedea.com>
- Date: Thu, 19 Sep 2013 15:20:18 +0200
- To: public-xformsusers@w3.org
To differentiate between Orbeon Forms,betterFORM and XSLTForms the
following seems to be working:
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events">
<head>
<title>Implementation/version sniffing</title>
<xf:model id="model">
<xf:instance id="instance" xmlns="">
<snif>
<tests>
<xpath10></xpath10>
<context></context>
</tests>
<implementations>
<betterform></betterform>
<xsltforms></xsltforms>
<orbeon></orbeon>
</implementations>
<implementation></implementation>
</snif>
</xf:instance>
<xf:bind ref="instance()">
<xf:bind nodeset="tests">
<xf:bind nodeset="xpath10" calculate="'1' =
'1.0'"></xf:bind>
<xf:bind nodeset="context"
id="context-bind"></xf:bind>
</xf:bind>
<xf:bind nodeset="implementations">
<xf:bind nodeset="betterform"
calculate="/snif/tests/xpath10='false' and
not(/snif/tests/context = 'true')"></xf:bind>
<xf:bind nodeset="xsltforms"
calculate="/snif/tests/xpath10"></xf:bind>
<xf:bind nodeset="orbeon"
calculate="/snif/tests/xpath10='false' and /snif/tests/context = 'true'"
></xf:bind>
</xf:bind>
<xf:bind nodeset="implementation"
calculate="name(/snif/implementations/*[. = 'true'])"></xf:bind>
</xf:bind>
<xf:dispatch ev:event="xforms-ready" name="context-event"
targetid="model">
<xxf:context name="context"
select="true()"></xxf:context>
</xf:dispatch>
<xf:setvalue ev:event="context-event" bind="context-bind"
value="event('context')"></xf:setvalue>
</xf:model>
</head>
<body>
<xf:output ref="implementation">
<xf:label>implementation: </xf:label>
</xf:output>
<ul>
<xf:repeat nodeset="*/*">
<li>
<xf:output ref=".">
<xf:label>
<xf:output value="concat(name(), ':
')"></xf:output>
</xf:label>
</xf:output>
</li>
</xf:repeat>
</ul>
</body>
</html>
(http://xformsunit.org/trac/browser/resources/sandbox/sniffing.xhtml )
Reminds me of the ugliness of browsers sniffing though and I wish we
could have something better ;) ...
Thanks,
Eric
Le jeudi 19 septembre 2013 à 11:38 +0200, Eric van der Vlist a écrit :
> Hi,
>
> My test framework (http://xformsunit.org/) is trying hard to work with
> several XForms implementations using generic/standard XForms features
> but I get a number of interoperability issues and I would need to test
> if extension functions are available in the implementation that's
> running a form (or a test suite) and/or to identify the implementation.
>
> The mechanism to do so in XForms 1.1
> (http://www.w3.org/TR/xforms11/#expr-lib-extension ) seems to be rather
> "destructive" as it would stop any processing when a function is not
> available.
>
> Do you have any idea on how I can achieve this kind of things?
>
> Thanks,
>
> Eric
>
>
>
>
Received on Thursday, 19 September 2013 13:20:49 UTC