我在xsd文件中使用了这个枚举:
<xs:simpleType name="SO">
<xs:restriction base="xs:string">
<xs:enumeration value="Mac OS X"/>
<xs:enumeration value="Windows Server"/>
<xs:enumeration value="Windows Vista"/>
<xs:enumeration value="Windows XP"/>
<xs:enumeration value="Windows 7"/>
<xs:enumeration value="Windows 8"/>
<xs:enumeration value="Windows 8.1"/>
<xs:enumeration value="Ubuntu"/>
</xs:restriction>
</xs:simpleType>
我需要在XSL中使用它在javascript组合框中使用它。有没有办法做到这一点?
答案 0 :(得分:2)
此样式表将输出<option/>
s:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:template match="xs:simpleType[@name='SO']/xs:restriction">
<xsl:for-each select="xs:enumeration"><option><xsl:value-of select="@value"/></option></xsl:for-each>
</xsl:template>
</xsl:stylesheet>