PDA

View Full Version : [SOLVED] xforms doesn't returned correctly


li72
01-17-08, 11:52 AM
Hi.
I’m new to XForms society and struggling with a basic concepts. However, I’m trying to transform an xml doc into XForms using XSLT. The browser renders the Xforms just fine but there is no effect to bind element. For instance the third UI control should be rendered as a calendar because its type is xs:date
However, I got a normal input box instead. Also property required= “true()” has no effect.
Any help is much appreciated.
Here is my xml document

<?xml version='1.0'?>
<?xml-stylesheet type="text/xsl" href="stylesheet101.xsl"?>
<data>
<name> Name </name>
<id > User id </id>
<gender> Sex </gender>
<age> Date of Birth </age>
</data>
And here is my xslt stylesheet
<?xml version='1.0'?>
<xsl:stylesheet version="2.0" xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xforms="http://www.w3.org/2002/xforms/cr" xmlns:xmml="http://www.xmml.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:output method="xhtml" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />


<xsl:template match="/">

<html >
<head> <title>Title comes here </title>
<xforms:model>
<xforms:submission action="URL" method="post" />

<xforms:instance>
<xsl:apply-templates select="data" />
</xforms:instance>
<xforms:bind nodeset="data/id" required="true()" type="xs:integer"/>
<xforms:bind nodeset="data/name" required="true()" />
<xforms:bind nodeset="data/age" required="true()" type="xs:date"/>
</xforms:model>
</head>
<body>

<p>
<xforms:input ref="data/id" style="width:100pt"> <xforms:label> <xsl:value-of select="data/id" /> </xforms:label> </xforms:input>
</p>
<p>
<xforms:input ref="data/name" style="width:100pt"> <xforms:label> <xsl:value-of select="data/name" /> </xforms:label> </xforms:input>
</p>
<p>
<xforms:input ref="age" style="width:100pt"> <xforms:label> <xsl:value-of select="data/age" /> </xforms:label> </xforms:input>
</p>
<p> <xforms:submit> <xforms:label> Click here to submit </xforms:label> </xforms:submit> </p>

</body>
</html>
</xsl:template>


<xsl:template match="data">
<xsl:copy>
<xsl:copy-of select="data/id"/>
<xsl:copy-of select="data/name"/>
<xsl:copy-of select="data/age"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

UnrealEd
01-24-08, 06:04 AM
have a look at this article:
http://www.formsplayer.com/node/1271

That guy had the same problem, and it seems like it's fixed now :)

li72
02-20-08, 11:06 AM
Thanks to all
problem is sorted out

UnrealEd
02-21-08, 04:52 AM
would you mind sharing your solution? Maybe someone else faces the same problem, and wants to know the answer as well :)