我对 XML(销售订单)有疑问。我导入具有 XML 结构的文件 (csv)。我使用的工具自动从这个文件创建一个具有相同结构的 XML。所有标签都在同一级别。
<?xml version="1.0" encoding="UTF-8"?>
<ORDER>
<ENV>
<SenderCode>1234</SenderCode>
<Test>N</Test>
</ENV>
<HDR>
<OrderNumber>100</OrderNumber>
<OrderDate>201206080000</OrderDate>
</HDR>
<ROW>
<LineNumber>1</LineNumber>
<Article>A</Article>
</ROW>
<ROW>
<LineNumber>2</LineNumber>
<Article>B</Article>
</ROW>
<ROW>
<LineNumber>3</LineNumber>
<Article>C</Article>
</ROW>
<ROW>
<LineNumber>4</LineNumber>
<Article>D</Article>
</ROW>
<HDR>
<OrderNumber>101</OrderNumber>
<OrderDate>201206080000</OrderDate>
</HDR>
<ROW>
<LineNumber>1</LineNumber>
<Article>E</Article>
</ROW>
<ROW>
<LineNumber>2</LineNumber>
<Article>F</Article>
</ROW>
</ORDER>
我需要的输出是:
<?xml version="1.0" encoding="UTF-8"?>
<ORDER>
<ENV>
<SenderCode>1234</SenderCode>
<Test>N</Test>
</ENV>
<HDR>
<OrderNumber>100</OrderNumber>
<OrderDate>201206080000</OrderDate>
<ROW>
<LineNumber>1</LineNumber>
<Article>A</Article>
</ROW>
<ROW>
<LineNumber>2</LineNumber>
<Article>B</Article>
</ROW>
<ROW>
<LineNumber>3</LineNumber>
<Article>C</Article>
</ROW>
<ROW>
<LineNumber>4</LineNumber>
<Article>D</Article>
</ROW>
</HDR>
<ENV>
<SenderCode>1234</SenderCode>
<Test>N</Test>
</ENV>
<HDR>
<OrderNumber>101</OrderNumber>
<OrderDate>201206080000</OrderDate>
<ROW>
<LineNumber>1</LineNumber>
<Article>E</Article>
</ROW>
<ROW>
<LineNumber>2</LineNumber>
<Article>F</Article>
</ROW>
</HDR>
</ORDER>
我怎么能用 XSLT 做到这一点?当我尝试这个时,所有六个ROW
标签都在HDR
(1)和HDR
(2)下。
<?xml version="1.0" encoding="UTF-8"?>
<ORDER>
<ENV>
<SenderCode>1234</SenderCode>
<Test>N</Test>
</ENV>
<HDR>
<OrderNumber>100</OrderNumber>
<OrderDate>201206080000</OrderDate>
<ROW>
<LineNumber>1</LineNumber>
<Article>A</Article>
</ROW>
<ROW>
<LineNumber>2</LineNumber>
<Article>B</Article>
</ROW>
<ROW>
<LineNumber>3</LineNumber>
<Article>C</Article>
</ROW>
<ROW>
<LineNumber>4</LineNumber>
<Article>D</Article>
</ROW>
<ROW>
<LineNumber>1</LineNumber>
<Article>E</Article>
</ROW>
<ROW>
<LineNumber>2</LineNumber>
<Article>F</Article>
</ROW>
</HDR>
<ENV>
<SenderCode>1234</SenderCode>
<Test>N</Test>
</ENV>
<HDR>
<OrderNumber>101</OrderNumber>
<OrderDate>201206080000</OrderDate>
<ROW>
<LineNumber>1</LineNumber>
<Article>A</Article>
</ROW>
<ROW>
<LineNumber>2</LineNumber>
<Article>B</Article>
</ROW>
<ROW>
<LineNumber>3</LineNumber>
<Article>C</Article>
</ROW>
<ROW>
<LineNumber>4</LineNumber>
<Article>D</Article>
</ROW>
<ROW>
<LineNumber>1</LineNumber>
<Article>E</Article>
</ROW>
<ROW>
<LineNumber>2</LineNumber>
<Article>F</Article>
</ROW>
</HDR>
</ORDER>
有人可以帮助我吗?
谢谢