Preface: There are many questions similar to this that I've scoured through profusely. Nothing can quite answer what I need to do.
Here is my data structure. (obviously simplified)
<Upload>
<tickets>
<ticket>
<ticket_number>123</ticket_number>
<clerk>001</clerk>
<property>
<item>
<item_number>1</item>
<jewelry_metal>GOLD</jewelry_metal>
</item>
<item>
<item_number>2</item>
<jewelry_metal>SILVER</jewelry_metal>
</item>
</property>
</ticket>
<ticket>
<ticket_number>456</ticket_number>
<clerk>001</clerk>
<property>
<item>
<item_number>1</item>
<jewelry_metal></jewelry_metal>
</item>
</property>
</ticket>
<tickets>
<Upload>
I need to check the first item in each ticket, and if the <jewelry_metal>
tag is empty, delete the entire <ticket>
. I'm open to any suggestions at this point.