-1
在我的XML看看(簡體):XSL變化值
<head>
<body>
<xs:element type="xs:double"/>
</body>
</head>
我想要做的是改變價值「XS:雙」到「doubleOrEmpty」這是我的自定義類型,它允許雙打和空弦。是否可以使用XSL?如果不是我怎麼能做到這一點?
在我的XML看看(簡體):XSL變化值
<head>
<body>
<xs:element type="xs:double"/>
</body>
</head>
我想要做的是改變價值「XS:雙」到「doubleOrEmpty」這是我的自定義類型,它允許雙打和空弦。是否可以使用XSL?如果不是我怎麼能做到這一點?
那麼你當然可以寫XSLT轉換
<head xmlns:xs="http://www.w3.org/2001/XMLSchema">
<body>
<xs:element type="xs:double"/>
</body>
</head>
到
<head xmlns:xs="http://www.w3.org/2001/XMLSchema">
<body>
<xs:element type="doubleOrEmtpy"/>
</body>
</head>
有:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="body/xs:element/@type[. = 'xs:double']">
<xsl:attribute name="type">doubleOrEmtpy</xsl:attribute>
</xsl:template>
</xsl:stylesheet>