OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Selecting text styles for elements within <indexterm>


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

Typical markup is:

<indexterm class="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:template match="d:indexterm" mode="index-primary"> is:

 <xsl:choose>
       
<xsl:when test="d:primary/d:emphasis">
         
<fo:inline font-style="italic">
           
<xsl:value-of select="d:primary"/>           
         
</fo:inline>
       
</xsl:when>
       
<xsl:when test="d:primary/d:literal">
         
<fo:inline font-family="monospace">
           
<xsl:value-of select="d:primary/d:literal"/>           
         
</fo:inline>
         
<xsl:value-of select="d:primary[not(child::d:literal)]"/>
       
</xsl:when>
       
<xsl:when test="d:primary/d:quote">
         
<xsl:variable name="content">
            
<xsl:call-template name="gentext.startquote"/>
              
<xsl:value-of select="d:primary"/>   
            
<xsl:call-template name="gentext.endquote"/>
         
</xsl:variable>
         
<fo:inline>
           
<xsl:copy-of select="$content"/>
         
</fo:inline>
       
</xsl:when>
       
<xsl:otherwise>
         
<xsl:value-of select="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



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]