I apologize for not knowing xsl very well, but i have an xml document that I would like to transform and I’ve not been able to find an example that works for me. I would like to merge the locations into a single element. I have the following document:
<?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>
I am trying to make it like this:
<?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>
This XSLT 1.0 transformation doesn’t use modes and doesn’t have even a single conditional instruction:
When applied on the provided XML document (wrapped in a single top element to be made well-formed)”
the wanted, correct result is produced: