conditionally rename tags upon data/content
Posted: Sat Feb 02, 2008 1:11 am
hi,
i cannot figure out how write a XSLT to rename only specific tags and output as XML.
i received xml with "duplicate" xml-tags.
meaning: sometimes the xml-tag <field> should be <field1> and sometime <field2>.
this depends on the xml-tag <field_type> which is put just before <field>.
<field_type>A</fiel_type>
<field>textisenteredhere</field>
<field_type>B</field_type>
<field)textiseneterdherealso, but should have been labeled different</field>
So, if the content of <field_type> = "A" the following <field> should be renamed <field1>. if the content of <field_type> = "B" the following <field> should be renamed <field2>.
The XMl my client has gvenme contains close to 6000 lines, so i would prefer a XSLT to transform this and copy nodes with renamed tags.
thanks for any help
i cannot figure out how write a XSLT to rename only specific tags and output as XML.
i received xml with "duplicate" xml-tags.
meaning: sometimes the xml-tag <field> should be <field1> and sometime <field2>.
this depends on the xml-tag <field_type> which is put just before <field>.
<field_type>A</fiel_type>
<field>textisenteredhere</field>
<field_type>B</field_type>
<field)textiseneterdherealso, but should have been labeled different</field>
So, if the content of <field_type> = "A" the following <field> should be renamed <field1>. if the content of <field_type> = "B" the following <field> should be renamed <field2>.
The XMl my client has gvenme contains close to 6000 lines, so i would prefer a XSLT to transform this and copy nodes with renamed tags.
thanks for any help