【问题标题】:Using XSLT to transform one XML with one kind of Schema into another XML File with different Schema使用 XSLT 将具有一种 Schema 的 XML 转换为具有不同 Schema 的另一个 XML 文件
【发布时间】:2018-03-27 17:59:42
【问题描述】:

因此,我的任务是将一种 XML 文件(具有一个架构)转换为具有不同架构的另一个 XML 文件,并且我需要根据各自的架构验证这两个文件。我(以某种方式)做到了,但如果有其他方法可以做到这一点,我很感兴趣,或者这很好。

我的输入 XML 架构位置是 http://www.example.org/example1,输出应该是 http://www.example.org/example2

所以我所做的是对两个命名空间(xmlns:first nad xmlns:second)都使用了标记,并将其添加到我的转换中:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cus="http://www.example.org/Customer1"
xmlns:two="http://www.example.org/Customer2">

我的输出文件是有效的,但它在根“描述”中有 xmlns:first="http://www.example.org/example1。从长远来看可以,还是我应该寻找不同的解决方案?

【问题讨论】:

    标签: xml xslt xsd schema transformation


    【解决方案1】:

    我猜您只是想在xsl:stylesheet 元素上添加exclude-result-prefixes="first",这样XSLT 创建的结果元素就不会显示您只需要输入元素选择的命名空间。

    【讨论】:

    • 成功了!太感谢了!我正在搜索该命令!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-22
    • 1970-01-01
    相关资源
    最近更新 更多