Hi,
I need help with transforming XML document.
I generate xml document from query using Oracle XSU (DBMS_XMLQUERY)
and the document I get is like this:
<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<MultiPAT>
<PAT>
<numreferencia>000000000000</numreferencia>
<tipo>1</tipo>
<trabajador>
<trabajador_row num="1">
<apellido>Rius</apellido>
<nombre>Jaume</nombre>
<naf null="YES"/>
<antiguedad>
<antiguedad_row num="1">
<meses>15</meses>
<dias>0</dias>
</antiguedad_row>
</antiguedad>
<atep null="YES"/>
<domicilio>CL.Barcelona, 27</domicilio>
<telefono null="YES"/>
</trabajador_row>
</trabajador>
</PAT>
</MultiPAT>
The problem is that the tags like <trabajador_row num="1"> are
redundant and I'd also like to eliminate attributes null="YES" (that
can be found within empty tags).
I'd like to get something like this:
<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<MultiPAT>
<PAT>
<numreferencia>000000000000</numreferencia>
<tipo>1</tipo>
<trabajador>
<apellido>Rius</apellido>
<nombre>Jaume</nombre>
<naf/>
<antiguedad>
<meses>15</meses>
<dias>0</dias>
</antiguedad>
<atep/>
<domicilio>CL.Barcelona, 27</domicilio>
<telefono/>
</trabajador>
</PAT>
</MultiPAT>
Any ideas how to do transformation?
Thanks!