I want send a message encoded as application/x-www-form-urlencoded, and the message is validated by a XML schema, so i find a way to generate a html form from a XML Schema using XSLT.
the xsd is below:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:m="http://dongfang- china.com#" targetNamespace="http://dongfang-china.com#" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="SwitchingSchedule">
<xs:sequence>
<xs:element name="endDateTime" type="xs:dateTime">
</xs:element>
<xs:element name="reason" type="xs:string">
</xs:element>
<xs:element name="startDateTime" type="xs:dateTime">
</xs:element>
</xs:sequence>
</xs:complexType>
and the xslt is below:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath- functions">
<xsl:output method="html"/>
<xsl:template match="xs:schema">
<xsl:for-each select="xs:complexType/xs:sequence/xs:element">
<br/>
<label><xsl:value-of select="@name"/></label>
<input type="text" name=""/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
the result is:
<br><label>endDateTime</label><input type="text"><br><label>reason</label><input type="text"><br><label>startDateTime</label><input type="text">
But i can't find a way to set the input name from the xsd, or should i use javascript?