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: <xsl:apply-templates select="." mode="class.attribute" />


Could someone explain to me what this does:
 
 <xsl:apply-templates select="." mode="class.attribute"/>
 
 I'm confused about how it transforms <programlisting> elements from docbook to html.
 
 I wanted to add a role attribute to my programlisting, so I have an element like this:
 
 
 <programlisting role="solution">
   something that has a solution
 </programlisting>
 
 But it seems that when it is processed by the rule in html/verbatim.xsl, the element gets replaced by
 
  <pre class="programlisting">
 
And the "solution" attribute is lost.

I would like to modify the template for programlisting to check the role, and if it exists, set the class= attrib of the resultant <pre> element to be the same thing. But i'm not sure where the best place is to put it in my customization layer. Any suggestions?

Here is the template for programlisting from verbatim.xsl:
   
<xsl:template match="programlisting|screen|synopsis">
  <xsl:param name="suppress-numbers" select="'0'"/>
  <xsl:variable name="id">
    <xsl:call-template name="object.id"/>
  </xsl:variable>

  <xsl:call-template name="anchor"/>

  <xsl:if test="$shade.verbatim != 0">
    <xsl:message>
      <xsl:text>The shade.verbatim parameter is deprecated. </xsl:text>
      <xsl:text>Use CSS instead,</xsl:text>
    </xsl:message>
    <xsl:message>
      <xsl:text>for example: pre.</xsl:text>
      <xsl:value-of select="local-name(.)"/>
      <xsl:text> { background-color: #E0E0E0; }</xsl:text>
    </xsl:message>
  </xsl:if>

  <xsl:choose>
    <xsl:when test="$suppress-numbers = '0'
            and @linenumbering = 'numbered'
            and $use.extensions != '0'
            and $linenumbering.extension != '0'">
      <xsl:variable name="rtf">
    <xsl:call-template name="apply-highlighting"/>
      </xsl:variable>
      <pre>
        <xsl:apply-templates select="." mode="class.attribute"/>
    <xsl:call-template name="number.rtf.lines">
      <xsl:with-param name="rtf" select="$rtf"/>
    </xsl:call-template>
      </pre>
    </xsl:when>
    <xsl:otherwise>
      <pre>
        <xsl:apply-templates select="." mode="class.attribute"/>
    <xsl:call-template name="apply-highlighting"/>
      </pre>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>
   



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