有人可以解释一下xml,xsd和xsl(stylesheet)中定义的名称空间之间的关系吗?
如果我使用默认命名空间,我的XSL无效。
我使用的名称空间
在XSD中
<xs:schema xmlns="urn:iso:std:iso:20022:tech:xsd:acmt.010.001.01"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
targetNamespace="urn:iso:std:iso:20022:tech:xsd:acmt.010.001.01">
XML中的
<Document
xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:acmt.010.001.01 acmt010.xsd"
xmlns="urn:iso:std:iso:20022:tech:xsd:acmt.010.001.01"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
在XSL中
<xsl:stylesheet version="1.0"
xmlns:xsi="urn:iso:std:iso:20022:tech:xsd:acmt.010.001.01"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:acmt.010.001.01 file:/C:/xml/working/testing/acmt.010.001.01.xsd"
>
我的XSL转换无效。
但是,如果我将xml中的命名空间更改为
<Document
xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:acmt.010.001.01 acmt010.xsd"
xmlns:xsl="urn:iso:std:iso:20022:tech:xsd:acmt.010.001.01"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
然后转换正在运行,但是xml editior工具正在发出警告“cvc-elt.1:找不到根元素的元素声明”。
有人可以帮我这个吗?