我有xml:
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<med:PutEmployee xmlns:med="https://services">
<med:employees>
<med:Employee>
<med:Name xmlns:i="http://www.w3.org/2001/XMLSchema-instance" i:nil="true">Мария</med:Name>
<med:SNILS>111-111-111-11</med:SNILS>
</med:Employee>
</med:employees>
</med:PutEmployee>
</soapenv:Body>
我使用 xslt 删除了参数“@i:nill”:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
exclude-result-prefixes="i">
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*[name()!='i:nil']" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
运行 xslt,我得到了 xml:
<?xml version="1.0"?>
<?xml version="1.0"?>
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<med:PutEmployee xmlns:med="https://services">
<med:employees>
<med:Employee>
<med:Name xmlns:i="http://www.w3.org/2001/XMLSchema-instance">Мария</med:Name>
<med:SNILS>111-111-111-11</med:SNILS>
</med:Employee>
</med:employees>
</med:PutEmploy>
离开了xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
如何删除它?
我尝试添加exclude-result-prefixes = "i"
,它没有帮助