Skip to main content
Participating Frequently
December 6, 2020
Answered

How formatting a text with "tags" (in XML ?)

  • December 6, 2020
  • 3 replies
  • 4187 views

Hi,
I come from the Web Development world, so when I read "Tag" and "Bold", I think "<b>This is a bold text example</b>".

But, in InDesign, even if I read that you were able to make it working with XML, it seems we are not talking about the same thing.

I will give you the context of my asking for more intel :
I'm working with a Merged Data CSV file, so I cant format my text in a "regular" way (WYSIWYG), I need a way to write some words in Bold, some other in Italic, and even return to the line sometimes (or else everything is on the same line xD haha, it's weird 😛 !

Any idea please 😄 ?

Thx you for your time and attention 😉 !

(I tagged this topic as "Type" but I dont know if it's a right choice 😮  )

This topic has been closed for replies.
Correct answer Eugene Tyson

As I said, the content CANT be inside the XML file, since it's inside the CSV file, because InDesign can only work with CSV/TXT file when it's about Data Merging.


That is a quandry! 

 

Is it possible to pre-format the merged data. 

So your CSV file should contain only the text of the merge, nothing else.

 

In InDesign, you can set your Data Merge items into the layout, and you can style those anyway you want. 

 

For instance, CSV says -

Name

John Smith

 

In InDesign you'd see

<Name> - and you can pre-style this with what you need.

 

What it won't do is if you have in the CSV file

Name

John Smith

 

You can't split

<Name> into two 

 

You'd Need

<Firstname> <Last Name>

 

If you're introducing a sentence it will be very difficult to split it where you need bold text and italics etc. very hard to do.

 

But InDesign paragraph styles can contain GREP styles. 

 

So you can make a paragraph style that instructs the text to go something like this.

Now is the winter of our discontent. Made glorious summer by this sun of York; and all the clouds that lour'd upon our house in the deep bosom of the ocean buried.
 
As your paragraph style could have a trigger in it to say after ; use italic text for 1 word.
Applying the italics to one word after a ;
 
If that makes sense.

 

3 replies

hammer0909
Community Expert
Community Expert
December 6, 2020

Coming from the web development world, you're familiar with the HTML tags which are predefined tags within the HTML language. XML has no predefined tags. You can literally invent the tags you need as you go or you can use standard HTML tags. Either way, XML by itself doesn't know what to do with those tags. In InDesign, you'll need to use the "Map Tags to styles feature" or you can use the "aid" attribute in the XML file to tell InDesign how to format those tags. @540812 posted a link to my course on LinkedIn Learning that will give you more details on the process. How XML works with InDesign can be tricky at first, but once you get it, magic happens 😉

Participating Frequently
December 6, 2020

I watched other tutorials ('cause I cant access to the LinkedIn thing), and... Are you sure we are speaking about the same "tags" ?

Maybe we should take it from the beginning :

1 - I dont want to import or export anything IN "XML" and/or outside of InDesign.
2 - I dont want to "TAG" my final text, nor create structure or math(s) or paragraph or style or anything like that.
3 - I want to "TAG" the text inside my CSV file, and that file must be "interpreted" (like a PHP server which compute the tags and create a result) inside a kind of text box (probably a special one ?), which give me the "final text".

4 - I only need "bold", "italic", "sublined", "return to the line carriage".

I will give an example because I feel we are not understanding each others :

 

The CSV file contain :

 

Hi, I'm a <bold>BOLD</bold> word, nice to meet you.

The final text box of InDesign must show :

Hi, I'm a BOLD word, nice to meet you.


I didnt saw it on the web, but I know it's possible.

Community Expert
December 7, 2020

So you'll need styles built in InDesign - specifically character styles.

When  you import your text - it will have to be an XML file that you import using File>Import XML

And then you MAP your <bold> tags to the character styles or relevant styles you want. 

 

CSV files cannot contain formating - they are text only and don't retain bold etc. 

So you'll need to work with XML files - or save your CSV files as XML.

 

I posted links earlier to XML workflows.

 

It's a bit of a learning curve - but you have the background to follow it 

https://helpx.adobe.com/ie/indesign/using/importing-xml.html#:~:text=Open%20the%20InDesign%20document%20that,Select%20Show%20XML%20Import%20Options.

 

 

Derek Cross
Community Expert
Community Expert
December 6, 2020
Participating Frequently
December 6, 2020

(Where is the edit button on this forum oO ?)

Community Expert
December 6, 2020

Usually, you can click the More button to edit - what do you want to edit I can do that for you.

 

https://www.adobe.com/accessibility/products/indesign/mapping.html

 

https://helpx.adobe.com/ie/indesign/using/tagging-content-xml.html

 

Participating Frequently
December 6, 2020

When I click on "more", there is a "white" space 😮 .
Maybe it's the buffer, I will try to reset it.