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: wanting to understand the use of attributes in xsl templates


I'm hoping to get a better understanding of the role of attributes when writing templates in my customisation layers.  I'll use and example of what I have done.

With the <phrase> element I am using the role attribute to specify one of a list of colours, which for html output I use CSS to colour the text.  So for <phrase role="red"> I get <span class="red"> for html output.  No problems there.

Now that I'm trying to achieve the same result for my PDF output, things are a bit different.  The default template for <phrase> in fo/inline.xsl is:
<xsl:template match="phrase">
  <xsl:call-template name="inline.charseq"/>

If I create a new template in my customisation layer as:
<xsl:template match="phrase[@role='red']">
  <fo:inline color="red">
  <xsl:call-template name="inline.charseq"/>

I get the text wrapped in <phrase role="red"> as red text *and* the same text in black.  Removing the call to inline.charseq seems to work.

Question 1.  If I have 
    <para>Blah blah <phrase role="red">some text</phrase> blah <phrase>other text</phrase>.</para>
will the first <phrase> only call the template that has [@role='red'] or will it call both templates?

Question 2.  What named colours are supported by FOP?  For my html output I'm using CSS with the basic 16 named colours (aqua, black, blue, fuschia, etc) and I would like to use the same names in my PDF output.

Question 3.  Assuming everything will work as I hope, how do I reference the role attribute as a variable instead of creating 16 almost identical templates (1 for each colour)?

Thanks for your help,


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