← Prev in month ← Prev in thread

Selecting text styles for elements within <indexterm>

From
Xmplar <>
Date
2012-09-01T07:42:09+00:00
ID
Thread
Selecting text styles for elements within <indexterm>
X-NONE
  X-NONE
  
   
   
   
   
   
   
   
   
   
   
   
  
  MicrosoftInternetExplorer4
  
   
   
   
   
   
   
   
   
   
   
   
  

    
 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
← Prev in month ← Prev in thread