<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="SortXML.xsl"?>
<button name="adtype" type="select" multi="true" onchange="submit" value="">
<option value="">文档类型</option>
<option value="档案盒">档案盒</option>
<option value="档案">档案</option>
<option value="收文">收文</option>
<option value="发文">发文</option>
</button>
SortXML.xsl
================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/button">
<xsl:choose>
<xsl:when test="@type = 'select'">
<select name="{@adtype}">
<xsl:if test="@multi ='true'"><xsl:attribute name="multi"/></xsl:if><!--
<xsl:if test="@onchange !=''"><xsl:attribute name="onchange"><xsl:value-of select="@onchange"/></xsl:attribute></xsl:if>
-->
<xsl:for-each select="option">
<xsl:copy-of select="."></xsl:copy-of>
</xsl:for-each>
</select>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
<xsl:for-each select="//item[contains(name,'1')]">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
<?xml-stylesheet type="text/xsl" href="SortXML.xsl"?>
<button name="adtype" type="select" multi="true" onchange="submit" value="">
<option value="">文档类型</option>
<option value="档案盒">档案盒</option>
<option value="档案">档案</option>
<option value="收文">收文</option>
<option value="发文">发文</option>
</button>
SortXML.xsl
================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/button">
<xsl:choose>
<xsl:when test="@type = 'select'">
<select name="{@adtype}">
<xsl:if test="@multi ='true'"><xsl:attribute name="multi"/></xsl:if><!--
<xsl:if test="@onchange !=''"><xsl:attribute name="onchange"><xsl:value-of select="@onchange"/></xsl:attribute></xsl:if>
-->
<xsl:for-each select="option">
<xsl:copy-of select="."></xsl:copy-of>
</xsl:for-each>
</select>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
<xsl:for-each select="//item[contains(name,'1')]">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
我提问时没有说清楚,sorry,做出来的效果应该是有“文档类型”这个标题,下面是四个选项(多选的,前面有一小框用来打勾),最后有一按钮用来点击确定的,你给我的代码只是把它读出来,可否再拉小弟一把,多谢了:)
<xs:schema id="NewDataSet" targetNamespace="http://tempuri.org/XMLFile11.xsd" xmlns:mstns="http://tempuri.org/XMLFile11.xsd" xmlns="http://tempuri.org/XMLFile11.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="button">
<xs:complexType>
<xs:sequence>
<xs:element name="option" nillable="true" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent msdata:ColumnName="option_Text" msdata:Ordinal="1">
<xs:extension base="xs:string">
<xs:attribute name="value" form="unqualified" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" form="unqualified" type="xs:string" />
<xs:attribute name="type" form="unqualified" type="xs:string" />
<xs:attribute name="multi" form="unqualified" type="xs:string" />
<xs:attribute name="onchange" form="unqualified" type="xs:string" />
<xs:attribute name="value" form="unqualified" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:Locale="zh-CN" msdata:EnforceConstraints="False">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element ref="button" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
上面的文档是自动生成的,你有了XML以后可以在VS2003里面使用XML菜单里面的Create Schema就可以了!