Mobile app version of vmapp.org
Login or Join
Cugini998

: Building tag structure when exporting to XML from InDesign I have to export a lot of InDesign documents to HTML. I need to have total control over exported tags, attributes etc., so I've decided

@Cugini998

Posted in: #AdobeIndesign #Export #Xml

I have to export a lot of InDesign documents to HTML. I need to have total control over exported tags, attributes etc., so I've decided to use XML features (HTML export is just too "weak" for this task). After mapping the styles, everything looks quite good. But two major problems appear:


Some of the elements (like paragraphs) have to be wrapped in tags
like DIV. It can be done manually in structure panel, but is there a way to do it automatically? It would save me a lot of time since the documents are quite long. As far as I see, only character styles are automatically nested.
Some of my tags have to have attributes. Is there any way to tell InDesign to set them automatically? And unfortunately I'm not talking only about "class" attribute.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Cugini998

1 Comments

Sorted by latest first Latest Oldest Best

 

@Odierno310

You can use XSLT on XML export.

Save this as an XSL file and pick it up on the XML export process…

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="1.0">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>

<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>

<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>


<xsl:template match="p">
<div>
<xsl:copy-of select="."/>
</div>
</xsl:template>

<xsl:template match="attributes">
<xsl:copy>
<xsl:attribute name="toto">tutu</xsl:attribute>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme