Thursday 5 July 2007

XSLT Generating lists in InDesign Interchange

Lists within the INX format are wrapped in a <pcnt> element. Each list item is generated by a carriage return - there are no child elements to define a list item. This becomes an issue when processing inline elements from the source. The way I have overcome this is to have a two stage process. The template for a list applies templates in a given mode and hold the node-set in a variable, this variable is then transformed in another mode:
<xsl:template match="ul">
<xsl:variable name="list">
<xsl:apply-templates mode="inline"/>
</xsl:variable>
<xsl:apply-templates select="$list" mode="out"/>
</xsl:template>
Without this method the result contains elements for each list item.

No comments:

Post a Comment