Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 如何更改属性值_Xml_Xslt_Xsd - Fatal编程技术网

Xml 如何更改属性值

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

我想将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.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>