在子元素中需要重复的xmlns:xsi声明

时间:2016-06-06 13:43:35

标签: xslt namespaces

不能让这个工作。 将xml运行到xml xslt-transformation。

希望它也包含在AppHdr中(xml输出接收者的要求):

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xslt的样本:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1" >
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
<xsl:template match="/">
    <Env:RequestPayload xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Env="urn:xxxxx:xxxxx:xsd:benvelope" xsi:schemaLocation="xyz IBenvelope.xsd">
        <AppHdr xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:xxx:std:xxx:xxxxx:eee:xsd:hhh.01" xsi:schemaLocation="abc.xsd">
        </AppHdr>
        <Document xmlns="xxxxxxxxxxxxxx" xmlns:xs="http://www.w3.org/2001/XMLSchema">
        </Document>
    </Env:RequestPayload>
</xsl:template>
</xsl:stylesheet>

结果

<?xml version="1.0" encoding="utf-8"?>
<Env:RequestPayload xsi:schemaLocation="xyz IBenvelope.xsd" xmlns:Env="urn:xxxxx:xxxxx:xsd:benvelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <AppHdr xsi:schemaLocation="abc.xsd" xmlns="urn:xxx:std:xxx:xxxxx:eee:xsd:hhh.01" />
    <Document xmlns="xxxxxxxxxxxxxx" xmlns:xs="http://www.w3.org/2001/XMLSchema" />
</Env:RequestPayload>

0 个答案:

没有答案