XML : Select and process all attributes in XSLT

I receive XML from the external system that uses attributes to communicate the values. Here is a fragment:

  <declaratieUnica  luna_r="01" nume_declar="aaa" prenume_declar="bbb">      <employer cif="1111" caen="0116">  </declaratieUnica>    

In order to process this input I have to convert each attribute into a real tag with value, for example, the fragment above should become:

  <declaratieUnica>      <luna_r>01</luna_r>       <nume_declar>aaa</nume_declar>      <prenume_declar>bbb</prenume_declar>      <employer>          <cif>1111</cif>           <caen>0116</caen>  </declaratieUnica>    

I don't know in advance neither number of attributes, nor their names. Is there a generic way to say in XSLT: "transform all attributes into tags with values"?

No comments:

Post a Comment