I am trying to filter out unwanted data from an XML file.
I have the following XML:
<Client>
<Address>
</Address>
<Documents>
<Invoice>
<Document></Document>
<No>9999<No>
<Content>H4s==</Content>
</Invoice>
<Invoice>
<Document>
<File>
<Code>THIS IS THE ONE<Code>
<Name>
<value locale="en">Invoice for January</value>
</Name>
</File>
</Document>
<No>7777</No>
<Content>H4sIAA1XyDQA=</Content>
</Invoice>
</Documents>
</Client>
And I don’t want to have in the result all the <Invoice> where the <Document> tag is empty.
So in a sense the result would look like:
<Client>
<Address>
</Address>
<Documents>
<Invoice>
<Document>
<File>
<Code>THIS IS THE ONE<Code>
<Name>
<value locale="en">Invoice for January</value>
</Name>
</File>
</Document>
<No>7777</No>
<Content>H4sIAA1XyDQA=</Content>
</Invoice>
</Documents>
</Client>
Thanks,
You would do this by overriding an identity template.
This XSLT:
Applied against your XML input (fixed to be well-formed):
Produces the following output: