mardi 4 août 2015

parse xml string with XSLT

I have a XML with an XML string inside

 <?xml version="1.0" encoding="UTF-8"?><body xmlns:ns0="http://ift.tt/1Iho3QG" xmlns:ns1="http://ift.tt/1gHepOD">
  <ns0:JMSTextBody_element>
    <ns1:value>&lt;delivery gduid="6395" sduid="2392"&gt;&#13;
    &lt;object type="issue" id="C0.ISS.1451" alt_id="BBG000BH7B07"&gt;&#13;
        &lt;attributes&gt;&#13;
            &lt;simple id="bb_global_id" changed="true"&gt;BBG000BH7B07&lt;/simple&gt;&#13;
            &lt;simple id="dv_source1" changed="true"&gt;BB&lt;/simple&gt;&#13;
            &lt;simple id="nominal_value" changed="true"&gt;0.1&lt;/simple&gt;&#13;
        &lt;/attributes&gt;&#13;
    &lt;/object&gt;&#13;
&lt;/delivery&gt;</ns1:value>
  </ns0:JMSTextBody_element>
</body>

I need to fetch the values from the inline XML reformat and create a new XML string

    <?xml version="1.0" encoding="UTF-8"?><body xmlns:ns0="http://ift.tt/1Iho3QG" xmlns:ns1="http://ift.tt/1gHepOD">
  <ns0:JMSTextBody_element>
    <ns1:value>
 <ac_connect_type>issue</ac_connect_type><ac_connect_id>C0.ISS.1451</ac_connect_id><ac_connect_alt_id>BBG000BH7B07</ac_connect_alt_id><bb_global_id>BBG000BH7B07</bb_global_id>
 <dv_source1>BB</dv_source1><nominal_value>0.1</nominal_value></ns1:value>
  </ns0:JMSTextBody_element>
</body>

I'm having trouble to get to the elements in the inline XML

<xsl:apply-templates select="/delivery/object/attributes/bb_global_id" />

doesn't seem to work, obviously I'm missing something here Thanks

Aucun commentaire:

Enregistrer un commentaire