xslt生成所需的输出,如下所示

时间:2016-10-05 11:28:06

标签: xml xslt

我是XSLT的新手。我想基于 name和rno 匹配属性来显示要解析的xml数据,如下所示。 提前谢谢!

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<parent>
<child>
<name>test1</name>
<rno>101</rno>
<rating>2</rating>
</child>
<child>
<name>test2</name>
<rno>102</rno>
<rating>2</rating>
</child>
<child>
<name>test1</name>
 <rno>103</rno>
 <rating>2</rating>
 </child>
 <child>
 <name>test1</name>
 <rno>101</rno>
 <rating>1</rating>
 </child>
 </parent>

我希望输出如下:

 <parent>
 <child>
 <name>test1</name>
 <rno>101</rno>
 <sub-grp>
 <rating>2</rating>
 <rating>1</rating>
 <rating>2</rating>
 </sub-grp></child><child>
 <name>test2</name>
 <rno>102</rno> 
 <rating>2</rating>
 </child></parent>

0 个答案:

没有答案