Fot*_*gos 5 xml xslt xml-namespaces
我正在尝试为XML文档进行转换,但由于我不了解XSLT,因此无法找到解决方案.我有XML文档:
<?xml version="1.0" encoding="UTF-8"?>
<addresses xmlns="http://www.test.org/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation='http://whatever/test.xsd'>
<address>
<name>Joe Tester</name>
<street>Baker street 5</street>
</address>
</addresses>
Run Code Online (Sandbox Code Playgroud)
我想生产:
<?xml version="1.0" encoding="UTF-8"?>
<addresses xmlns="http://www.test.org/xml">
<address>
<name>Joe Tester</name>
<street>Baker street 5</street>
</address>
</addresses>
Run Code Online (Sandbox Code Playgroud)
(考虑到xsi:noNamespaceSchemaLocation ="..."已经在此之前使用另一个XSLT排除了).
有人可以帮我找到解决方案吗?
用于消除xsi:noNamespaceSchemaLocation的XSLT是:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="@xsi:noNamespaceSchemaLocation"/>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11036 次 |
| 最近记录: |