Topic Specialization Step 4-2: Create Templates For Specialized Elements
For the FAQ Question specialization, we need to modify the presentation of
<faq-question-statement>
and <faq-answer>
. We
don't need to do anything special for <faq-question>
because we just
want the normal topic processing. Thus we need to create match templates for
<faq-question-statement>
and <faq-question>
. In
addition, we will create a no-op template for <faq-question>
just to
demonstrate how to have a custom template and still use the base Toolkit-supplied
processing, even though we don't need it, at least based on our current formatting
specifications.
<xsl:template match="*[contains(@class, ' module/typename ')]">
Note the space characters before and after the module/typename pair.
This pattern for match expressions ensures that elements are always processed in terms of their specialization hierarchy and not their local tagnames. You can, of course, combine the "*[...]" matches together to match on elements in context, just as you would if you were using tagnames in the match statement.
<!-- =========================================================== HTML generation templates for the FAQ Question DITA topic specialization. Copyright (c) 2011 Your Name Here =========================================================== --> <xsl:template match="*[contains(@class, ' faq-question/faq-question ')]"> </xsl:template> <xsl:template match="*[contains(@class, ' faq-question/faq-question-statement ')]" > </xsl:template> <xsl:template match="*[contains(@class, ' faq-question/faq-answer ')]"> </xsl:template> </xsl:stylesheet>