我很抱歉無法很好地瞭解xsl,但是我有一個我想轉換的xml文檔,並且我一直無法找到適用於我的示例。我想將這些位置合併爲一個元素。我有以下文件:與合併相鄰節點的幫助
<?xml version="1.0" encoding="UTF-8"?><tfs_events>
<title>Referees Events</title>
<event>
<id>256</id>
<name>SB-V,SB-JV vs McKinley HS</name>
<time_start>2011-04-12 17:00:00</time_start>
<time_end>2011-04-12 19:00:00</time_end>
<status>Active</status>
<locations>
<id>116</id>
<name>Lake Athletic Complex</name>
</locations>
</event>
<event>
<id>257</id>
<name>SB-V,SB-JV vs Jackson HS</name>
<time_start>2011-04-14 17:00:00</time_start>
<time_end>2011-04-14 19:00:00</time_end>
<status>Active</status>
<locations>
<id>116</id>
<name>Athletic Complex</name>
</locations>
<locations>
<id>6</id>
<name>HS Baseball Field</name>
</locations>
</event>
我試圖使它像這樣:
<?xml version="1.0" encoding="UTF-8"?><tfs_events>
<title>Referees Events</title>
<event>
<id>256</id>
<name>SB-V,SB-JV vs McKinley HS</name>
<time_start>2011-04-12 17:00:00</time_start>
<time_end>2011-04-12 19:00:00</time_end>
<status>Active</status>
<location_name>Lake Athletic Complex</location_name>
</event>
<event>
<id>257</id>
<name>SB-V,SB-JV vs Jackson HS</name>
<time_start>2011-04-14 17:00:00</time_start>
<time_end>2011-04-14 19:00:00</time_end>
<status>Active</status>
<location_name>Athletic Complex, HS Baseball Field</location_name>
</event>
問得好,+1。查看我的答案,找到不使用任何模式或任何XSLT條件指令的解決方案。 :) – 2011-04-13 03:50:27