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

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

New Here ,
Dec 06, 2020 Dec 06, 2020

Copy link to clipboard

Copied

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 😮  )

TOPICS
Type

Views

892

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Dec 09, 2020 Dec 09, 2020

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>

...

Votes

Translate

Translate
New Here ,
Dec 06, 2020 Dec 06, 2020

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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
Community Expert ,
Dec 06, 2020 Dec 06, 2020

Copy link to clipboard

Copied

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

 

Votes

Translate

Translate

Report

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
New Here ,
Dec 06, 2020 Dec 06, 2020

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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
New Here ,
Dec 06, 2020 Dec 06, 2020

Copy link to clipboard

Copied

Hmmmm... I cleat the buffer... Still the same, it's very strange 😮 !
I'm using Chrome, as usual 😮 ...

Votes

Translate

Translate

Report

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
New Here ,
Dec 06, 2020 Dec 06, 2020

Copy link to clipboard

Copied

Cleared*

Votes

Translate

Translate

Report

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
Community Expert ,
Dec 06, 2020 Dec 06, 2020

Copy link to clipboard

Copied

There might be some useful suggestions on this online video tutorial (you can get 30-days free access):

https://www.linkedin.com/learning/creating-an-indesign-booklet-using-xml?trk=learning-serp_learning_...

 

Votes

Translate

Translate

Report

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
Community Expert ,
Dec 06, 2020 Dec 06, 2020

Copy link to clipboard

Copied

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. @derek 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 😉

Votes

Translate

Translate

Report

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
New Here ,
Dec 06, 2020 Dec 06, 2020

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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
Community Expert ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

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%20documen....

 

 

Votes

Translate

Translate

Report

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
New Here ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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
Guide ,
Dec 08, 2020 Dec 08, 2020

Copy link to clipboard

Copied

What you attribute to PHP is just an accident - PHP outputs the text as is, even if it contains HTML formatting instructions. These instructions then do their thing in the web browser. InDesign is no web browser, so it will render anything including the HTML formatting instructions as plain text.

You can run a post processing script after data merge that finds such text sequences - your various tags - and applies character styles accordingly, or performs other formatting. Coming from Web Development, you can actually write such a script yourself, InDesign understands an ancient dialect of JavaScript …

Beyond Data Merge, InDesign supports various other text formats - tagged text and ICML. These also support text formatting via proprietary tags, but lack some convenience processing that you have seen from Data Merge. Again a script can be used to glue things together.

Votes

Translate

Translate

Report

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
Community Expert ,
Dec 09, 2020 Dec 09, 2020

Copy link to clipboard

Copied

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.

 

Votes

Translate

Translate

Report

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
Explorer ,
Jan 13, 2021 Jan 13, 2021

Copy link to clipboard

Copied

LATEST

Hi 😉 ,


Indeed, I used GREP Styles, and, it works !

I even been able to create "autosized text" inside text box 😄 ! (By counting the number of character and changing the size. But I had a dilemma/quandry : autosize, or adding "return to the line" fonction, I chose autosize).

Subject closed 😉 !

Votes

Translate

Translate

Report

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