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>