Copy link to clipboard
Copied
I REALLY hope someone will be able to help me here. I'm trying to import a XML file (which works fine), but if there's an empty XML tag, I want to hide the prefix text field or label if thats what its called. The XML looks like this:
<name>Bill Ipsum</name>
<phone></phone>
<email>bill@mail.com</email>
Everything works fine. In my Indesign template it ends up looking something like this:
Name: Bill Ipsum
Phone:
Email: bill@mail.com
But if a person haven't entered his/her phonenumber, I want to remove the entire line - including my prefix text. But how???
I hope this makes sense ![]()
Best regards
MadsRH
Copy link to clipboard
Copied
Hi PerG-Jammerbugt,
This can not be done directly in InDesign, however, some script might help you with this. Hence I will be moving this thread to InDesign Scripting Forum.
Also, you may try Data merge as an option to do this.
https://indesignsecrets.com/data-merge-remove-unwanted-lines.php
Regards
Srishti
Copy link to clipboard
Copied
Hi,
InDesign XML engin can handle this kind of scenarios with three conditions:
1) that all the line including label is tagged ( something like <line><label>Phone:</label><value>555</value></line>
2) that a carriage return is set just before the "line" closing tag. Next tag has to start just after the closing tag.
2) that the line node itself is missing in the incoming XML
Then choosing to remove elements that do not match the incoming structure will remove the indesign tagged content and so the carriage return.
It's a bit tricky and it may require XSLT to make the incoming xml compliant with the indesign xml structure but that will work.
FWIW
Loic
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more