xslt - Split XML element's names into multiple names -
this question exact duplicate of:
- split xml element many 1 answer
i want transform xml format
<ctp> <name>absa bank</name> <bas.ba>bank|sector|issuer</bas.ba> <altids.altid_label_altsystem>absb_bbg|asb_reuters</altids.altid_label_altsystem> </ctp>
to format, can use in integration project while migrating 1 system another.
<ctp> <name>absa bank</name> <bas> <ba>bank</ba> <ba>sector</ba> <ba>issuer</ba> </bas> <altids> <aldid> <label>absb</label> <altsystem>bbg</altsystem> </aldid> <aldid> <label>asb</label> <altsystem>reuters</altsystem> </aldid> </altids> </ctp>
my main problem how split these element's names multiple elements.
how that?
the searchterm work done tokenize.
xslt 1.0 recursive template, search tokenize xslt 1.0
on so.
xslt 2.0 use function tokenize
, see https://www.w3.org/tr/xpath-functions/#func-tokenize
to name of element can use name()
.
now "just" have code it. split after .
, _
create desired result.
[describe question words, helps well, cause there case 'a|b|c' stored in 3 instead of 2 child elements?!]
Comments
Post a Comment