我想弄清楚如何使用xslt將平面xml文件轉換爲嵌套xml文件。 下面是我試圖轉換的flat xml的一個例子。我使用xslt 2,所以我可以使用分組命令,但我不知道如何。將平面XML轉換爲嵌套XML
產生的結構我正在尋找的是:
<sources>
<sourcetype>
<sourcetypename>Career Fair</sourcetypename>
<sourcelist>
<source>
<sourcename>Ann Arbor News Fair</sourcename>
<sourceid>CFE-10001</sourceid>
<eventlist>
<event>
<eventname></eventname>
<eventid></eventid>
</event>
</eventlist>
</source>
</sourcelist>
</sourcetype>
</sources>
---平整的XML ----
<?xml version="1.0" encoding="UTF-8"?>
<ExportXML xmlns:ns1="http://www.taleo.com/ws/integration/toolkit/2005/07" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.taleo.com/ws/integration/toolkit/2005/07" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<record>
<field name="TypeName">Billboards</field>
<field name="SourceName">Billboard</field>
<field name="SourceID">BLD-200284</field>
<field name="EventName"></field>
<field name="EventID"></field>
<field name="State">Active</field>
</record>
<record>
<field name="TypeName">Career Fair</field>
<field name="SourceName">Ann Arbor News Fair</field>
<field name="SourceID">CFE-10001</field>
<field name="EventName"></field>
<field name="EventID"></field>
<field name="State">Active</field>
</record>
<record>
<field name="TypeName">Career Fair</field>
<field name="SourceName">Black Data Processing Association (BDPA) </field>
<field name="SourceID">CFE-10002</field>
<field name="EventName"></field>
<field name="EventID"></field>
<field name="State">Active</field>
</record>
<record>
<field name="TypeName">Career Fair</field>
<field name="SourceName">Career Concepts</field>
<field name="SourceID">CFE-10760</field>
<field name="EventName"></field>
<field name="EventID"></field>
<field name="State">Active</field>
</record>
</ExportXML>
你想如何分組?是否每個''都是新的''? –