Xml 如何更改属性值
我想将XSD属性Xml 如何更改属性值,xml,xslt,xsd,Xml,Xslt,Xsd,我想将XSD属性@type的值从XSD:boolean更改为XSD:string 我的XSD是 <xsd:element name="Complete" nillable="true" type="xsd:boolean"/> <xsd:element name="taskno" nillable="true" type="xsd:integer"/> 改变 到 完整XSLT: <xsl:stylesheet xmlns:xsl="http://www.w
@type
的值从XSD:boolean
更改为XSD:string
我的XSD是
<xsd:element name="Complete" nillable="true" type="xsd:boolean"/>
<xsd:element name="taskno" nillable="true" type="xsd:integer"/>
改变
到
完整XSLT:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
version="1.0">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@type[ . = 'xsd:boolean']">
<xsl:attribute name="type">
<xsl:value-of select="'xsd:string'"/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
<xsl:template match="@type">
<xsl:template match="@type[ . = 'xsd:boolean']">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
version="1.0">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@type[ . = 'xsd:boolean']">
<xsl:attribute name="type">
<xsl:value-of select="'xsd:string'"/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>