Xslt XSL更改参数的值
看一下我的XML(简化):Xslt XSL更改参数的值,xslt,parameters,Xslt,Parameters,看一下我的XML(简化): 我要做的是将值“xs:double”更改为“doubleOrEmpty”,这是我的自定义类型,允许使用double和空字符串。可以使用XSL吗?如果不是,我如何实现这一点呢?当然,您可以编写XSLT来进行转换 <head xmlns:xs="http://www.w3.org/2001/XMLSchema"> <body> <xs:element type="xs:double"/> </body> </hea
我要做的是将值“xs:double”更改为“doubleOrEmpty”,这是我的自定义类型,允许使用double和空字符串。可以使用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="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>