<Orders xmlns="hi/hi" xmlns:shipping="hello/hi" xmlns:message="hello/hi" message:timestamp="2018-04-23T14:28:39Z">
<orderLineStatusUpdate orderNumber="CCORD002" line="0">
<orderLineStatus>inPicking</orderLineStatus>
<shipmentNumber>1</shipmentNumber>
<leadTime unit="days">
<shipping:min>1</shipping:min>
<shipping:max>1</shipping:max>
</leadTime>
</orderLineStatusUpdate>
</Orders>
预期产出:
<Orders message:timestamp="2018-04-23T14:28:39Z">
<orderLineStatusUpdate orderNumber="CCORD002" line="0">
<orderLineStatus>inPicking</orderLineStatus>
<shipmentNumber>1</shipmentNumber>
<leadTime unit="days">
<shipping:min>1</shipping:min>
<shipping:max>1</shipping:max>
</leadTime>
</orderLineStatusUpdate>
</Orders>
这是我正在使用的XSLT。它会从代码中删除shipping:min
和shipping:max
。我只想删除xmlns
。
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:template match="*">
<xsl:element name="{local-name(.)}">
<xsl:apply-templates select="@* | node()" />
</xsl:element>
</xsl:template>
<xsl:template match="@*">
<xsl:attribute name="{local-name(.)}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:template>
<xsl:template match="@*[local-name(.)='message']" />
</xsl:stylesheet>
但我的XSLT代码正在删除shipping:min
和shipping:max