- From: Claude JABOT <claude.jabot@iupmime.univ-lemans.fr>
- Date: Fri, 14 May 2004 10:09:23 +0200 (MEST)
- To: <www-forms@w3.org>
Hello
I'm a french studend so please excuse my english.
I'm new to XForms and I have a problem when trying to get XForm with a
client-side transformation in Javascript.
* Environnement :
- IE 6
- MSXML 4.0
- FormsPlayer or XForms Processor Control (IBM)
* Process
- an xml document with business data (without any presentation data)
is transformed with an XSL stylesheet (with the presentation data :
table, forms element)
- trandformation is done using a javascript function called at the onLoad
event.
- result of transformation is then put in the html document still using
javascript
Have a look on the existing source :
*** page.html***
<html>
<head>
<script language="JavaScript" type="text/javascript">
function init(){
//*// Load XML
var xml = new ActiveXObject("Msxml2.DOMDocument.4.0")
xml.async = false;
xml.resolveExternals = false;
xml.validateOnParse = false;
xml.load("ctx.xml");
//*// Load XSL
var xsl = new ActiveXObject("Msxml2.DOMDocument.4.0");
xsl.async = false;
xsl.load("InstanceNewCF.xsl");
// Transformation
document.getElementById("NouvelleInstance").innerHTML =
xml.transformNode(xsl);
}
</script>
</head>
<body onLoad="init();">
<div id="NouvelleInstance">
</div>
</body>
</html>
*** ctx.xml (sample)***
<?xml version="1.0" encoding="ISO-8859-1"?>
<ADT>
<ID></ID>
<L/>
<ETA-ID>1</ETA-ID>
<ETA-L>Ouvert</ETA-L>
<ID-CRT/>
<PRN-CRT/>
<NOM-CRT/>
<ID-STR-CRT/>
<ID-AG/>
<L-CRT-AG/>
<L-LG-AG>1234</L-LG-AG>
</ADT>
*** InstanceNewCF.xsl (sample) ***
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="ADT">
<!-- Description -->
<table>
<colgroup>
<col width="45%"></col>
<col width="30%"></col>
<col width="25%"></col>
</colgroup>
<tr id="TRApporteur">
<xsl:choose>
<xsl:when test="//TPO-APP[. >= 100]">
<td>
<label class="obligatoire">Mandataire : </label>
<input id="INIDApporteur" name="value"><xsl:value-of
select="ID-AG"/></xsl:attribute></input>
</td>
</xsl:when>
<xsl:otherwise>
<td>
<label class="obligatoire">Mandataire : </label>
<span id="IdAgence" tabindex="1"><xsl:value-of
select="ID-AG"/></span> 
<span id="SELLibLongAgence" tabindex="2"><xsl:value-of
select="L-LG-AG"/></span>
</td>
</xsl:otherwise>
</xsl:choose>
</tr>
</table>
</xsl:template>
What I want to do is use xforms with this existing architecture :
- create the xforms model in the xslt using <xsl:copy-of select="."/> in
the xsl:template matching ADT node
- use xforms user interface element instead html forms
The proble is it doesn't work :
- code is not interpreted with the IBM's XForms Processor Control
- with FormsPlayer, if the model is hard-coded in the HTML page, Xforms
controls are display but they don't bind to the model (even if I use
binding.
It seems the XForms code *must* be write at the page load. Is there any
method to load the plugin dynamically ?
Does anybody have this problem ? Is it possible to do, with the actual
technologie, a client-side transformation using XSLT to produce a valide
XForms code who will be interpreted by an Xforms plugin ??
Thanks for your help
Best Regards
Claude
Received on Friday, 14 May 2004 04:20:14 UTC