我只能访问 xpath 1.0 命令和函数。我需要将命名空间声明从根节点移动到开始使用该命名空间的子节点。
源 XML:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Accounts xmlns:test="http:example.com/test1">
<ParentAccount>10113146</ParentAccount>
<test1>test1</test1>
<test2>test2</test2>
<test:Siblings>
<test:CustomerNumber>10113146</test:CustomerNumber>
<test:CustomerNumber>120051520</test:CustomerNumber>
</test:Siblings>
</Accounts>
所需的 XML:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Accounts x>
<ParentAccount>10113146</ParentAccount>
<test1>test1</test1>
<test2>test2</test2>
<test:Siblings xmlns:test="http:example.com/test1">
<test:CustomerNumber>10113146</test:CustomerNumber>
<test:CustomerNumber>120051520</test:CustomerNumber>
</test:Siblings>
</Accounts>
有什么好主意吗?