Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Hidding prefix when importing empty XML tag

New Here ,
Sep 28, 2017 Sep 28, 2017

HI

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

TOPICS
Scripting
652
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Oct 04, 2017 Oct 04, 2017

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Oct 04, 2017 Oct 04, 2017
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines