I'm importing XML into InDesign (with merge content mode) and using XSLT to pick specific XML elements from the XML file. Problem is that some of the text inside XML elements contain HTML entities (see the example below) which are converted as characters in Indesign and then show as HTML tags. I need to set correct character style for the text between HTML tags and remove the tags. I'm aware I can do this with GREP Find/Replace in InDesign after the XML import but is there a way I can do this already with XSLT? I'm guessing I should convert these HTML tags into XML elements so I can map character style to correct XML element in InDesign. Not sure if this is possible and how to do it. Or is there some other better way?


<TextElement>Just some random text with &lt;b&gt;HTML tags&lt;/b&gt; within.</TextElement>

Text in InDesign:

Just some random text with <b>HTML tags</b> within.
  • The example <b>HTML tags</b> is already an XML element. Perhaps you want to change it into a different XML element? You can certainly add a match="b" template rule to your XSLT to process it -- so long as you know what you want to do with it! May 18, 2018 at 9:31
  • Sorry, I wasn't clear with the HTML tags in XML. The HTML tags show as &lt; and &gt; in the text and when the XML is imported into InDesign, these entities are converted as < and > so there will be e.g. <b>text</b>
    – nqw1
    May 18, 2018 at 10:19
  • If the text node in the XML contains unparsed HTML, then you should put it through an HTML parser if you want to manipulate it. May 18, 2018 at 10:51


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.