I have a customization for styling <emphasis>, <quote> and <literal> elements that are contained in <primary> index elements.

Typical markup is:

<indextermclass="startofrange"xml:id="abstract">
<primary><literal>abstract</literal>element/tag</primary>
</indexterm>

In the autoindex, I only want to style the text contained within the <literal> tags as font-family "monospace", but all of the text within the <primary> element is styled as monospace.

My customization in <xsl:templatematch="d:indexterm"mode="index-primary"> is:

<xsl:choose>
<xsl:whentest="d:primary/d:emphasis">
<fo:inlinefont-style="italic">
<xsl:value-ofselect="d:primary"/>
</fo:inline>
</xsl:when>
<xsl:whentest="d:primary/d:literal">
<fo:inlinefont-family="monospace">
<xsl:value-ofselect="d:primary/d:literal"/>
</fo:inline>
<xsl:value-ofselect="d:primary[not(child::d:literal)]"/>
</xsl:when>
<xsl:whentest="d:primary/d:quote">
<xsl:variablename="content">
<xsl:call-templatename="gentext.startquote"/>
<xsl:value-ofselect="d:primary"/>
<xsl:call-templatename="gentext.endquote"/>
</xsl:variable>
<fo:inline>
<xsl:copy-ofselect="$content"/>
</fo:inline>
</xsl:when>
<xsl:otherwise>
<xsl:value-ofselect="d:primary"/>
</xsl:otherwise>
</xsl:choose>

As you can see, for d:primary/d:literal, I'm attempting to style only d:literal as monospace, and for any text following that (within d:primary) as normal text. So, I'm trying to separate text in d:primary/d:literal from all other text within d:primary so I can apply two types of font styles. The expression "d:primary[not(child::d:literal)]" doesn't generate the text outside of d:literal. Is there an XPath expression to achieve this?

--
*Dave Gardiner*

Reply via email to