Hello everybody, I have a question about adding hidden URLs to XML text in InDesign.
We use InDesign to create PDFs and to export XML. The latter is in turn converted to HTML by using an XLST. The problem is that we usually have a lot of one-off, unique URLs *behind the text* which are not included in the XML file. How can we add the hidden URLs to the XML text?
PS.: InDesign 16.4.1
I have a feeling that you'd need to give us a bit more info before we could actually answer your question. I mean, I have made a few test documents over here, but I don't know how your document is structured, so I can barely even guess at suggestions to make. Text or frames that are tagged should be included in XML export, even if they are hidden (either by moving the item to a new layer, then hiding the layer, or by selecting the object and going to Object -> Hide). At least, that's how it behaves over here when I test it.
How are your hidden URLs hidden? If you select 'em and go to Windows -> Utilities -> Tags, are they tagged? If not, tag 'em! Then they'll export with your XML.
thanks for your answer! With "hidden" URLs I meant that the link as such is not visible in the text but still working and part of the file, see "Screenshot_InDesign_XML.png" and the screenshot of the same file exported to PDF, see "Screenshot_PDF-png". We do not want our links to look like the last link in the text, however, this is the only way I have found so far that links get exported as XML, whereas the other links are not included in the exported XML file (see screenshot of XML file opened in a text editor, "Screenshot_XML_in_Text_Editor.png").
How do I tag links for XML that are only visible in the Hyperlinks panel but not in the text itself? I have searched quite extensively for a way to do this and not found an answer. Thanks in advance!
I am on my phone right now and so therefore I don't know for sure if this is the answer, but I am pretty sure that this discussion is an answer to your question. I'll be able to check it this evening to make sure, but you want both the displayed link text and the actual contents-of-the-hyperlink text to be included with your XML export, and the way to do that is apparently by scripting it! Or at least by some manual paste work on each hyperlink.
Thanks Joel! I came across the thread you referenced while Googling my problem, the thing is, I do not know how to tag URLs that are not included in the text itself, and have been unable to find any information on how to do this. Does this mean that I would have to copy each URL and insert it after the link text (manually (ugh!) or with a script)? This is precisely what we want to avoid, since we want to keep the text readable - with up to 30 - 40 links in one 2,000-word text. Or is there a possibility to copy/paste the URLs in the XML data, but not in the text? Thanks again in advance!
Well, yeah, it means manually, or with a script, but not manually like you mean. It's worse, actually; you'd have to go to each URL element in the Structure pane, and add the destination there. You'd need to add a new Attribute in the Structure panel. Right-click on the URL element in the Structure pane, choose "Add element..." and then add a destinationURL attribute with the contents of your link. So it'd wind up looking like this onscreen:
That's actually more clicks, I think, then trying to do it by hand in the XML output! But it's not hard to imagine a script that
1) runs through the doc until it finds a tagged URL that has no destinationURL attribute
2) extracts the Hyperlink Destination from the Hyperlink
3) adds a destinationURL Attribute to that tag
4) adds the hyperlink destination extracted in 2 above to the Value for the freshly created Attribute
Thanks again, Joel! We will have a look at both the Java Script and the AutoHotkey option. Just wondering if a Java Script would be able to extract the proper hyperlink destination for a given link, but I suppose that is a question for a new post.