I want to test a value of an element then if there the result is true, I want to add a comment just inside the element in the result xml. How can I accomplish this?
For example in the code below I want to return <!-- "Last name not smith" --> if person/last <> "Smith"
INPUT
Code:
<root>
<people>
<person>
<first>Jane<first>
<last>Doe</last>
</person>
<person>
<first>Joe<first>
<last>S</last>
</person>
<person>
<first>Bob<first>
<last>Smith</last>
</person>
</people>
</root>
DESIRED OUTPUT
Code:
<root>
<people>
<person>
<first>Jane<first>
<last><!-- "Last name not smith" -->Doe</last>
</person>
<person>
<first>Joe<first>
<last><!-- "Last name not smith" -->S</last>
</person>
<person>
<first>Bob<first>
<last>Smith</last>
</person>
</people>
</root>