I have an XML structure and I'd like to transform this with XSLT. However, it's important to make this as dynamic as possible. I believe it's possible to make a copy of the feed, and then just select a specific section and transform this. When a new node is added to the original XML, no changed should be necessary in the XSLT to have this new node included in the output of the XSLT.
Example of original XML:
<?xml version="1.0" encoding="UTF-8"?>
<catalog week_id="629" generated_at="15.11.2017 23:53" version="2">
<item>
<lot>
<id>2982641</id>
<title_local><![CDATA[Title]]></title_local>
<sub_title_local>Subtitle</sub_title_local>
<promo>false</promo>
</lot>
<lot_specifics>
<case_material>
<name_local>Materiaal kast</name_local>
<name_en>Case material</name_en>
<slug>s-10-materiaal-kast</slug>
<option>
<value_local>Verguld</value_local>
<value_en>Gold-plated</value_en>
<slug_value>1750-verguld</slug_value>
</option>
<option>
<value_local>Zilver</value_local>
<value_en>Silver</value_en>
<slug_value>1751-silver</slug_value>
</option>
</case_material>
</lot_specifics>
<associations>
<category_id>1</category_id>
<auction_id>2</auction_id>
</associations>
</item>
</catalog>
Desired output:
<?xml version="1.0" encoding="UTF-8"?>
<catalog week_id="629" generated_at="15.11.2017 23:53" version="2">
<item>
<lot>
<id>2982641</id>
<title_local><![CDATA[Title]]></title_local>
<sub_title_local>Subtitle</sub_title_local>
<promo>false</promo>
</lot>
<lot_specifics>
<case_material>
<name_local>Materiaal kast</name_local>
<name_en>Case material</name_en>
<slug>s-10-materiaal-kast</slug>
<value_local>Verguld,Silver</value_local>
<value_en>Gold-plated,Silver</value_en>
</case_material>
</lot_specifics>
<associations>
<category_id>1</category_id>
<auction_id>2</auction_id>
</associations>
</item>
</catalog>
I came across a SO question that pretty much does what I'm aiming for, but I need to define the complete XML structure in this XSLT. As we might add other XML nodes in a later stage and this XSLT will be used in various places, I want to make this as low maintenance as possible.
I think this SO question shows a low maintenance version but frankly I'm not able to understand how the second xsl:template
works.
All help is much appreciated. If XSLT is provided, I'd appreciate it if you could include some comments of what you're doing where.