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: Re: [docbook-apps] Match on Language

Thanks Bob, that worked perfect.


On 07/09/16 22:08, Bob Stayton wrote:
Hi Peter,
The complication here is the "all elements" requirement. Each element has its own template for general formatting before it gets down to the text where you could set a font. For example, a section element could have a lang attribute. All of the nested elements inside a section have their own templates. I doubt you would want to customize a whole raft of elements to achieve this.

Fortunately, you don't have to. Since you are only changing the font, you can operate at the text level. Try this:

<xsl:template match="d:*[@lang = 'el']//text() | d:*[@xml:lang = 'el']//text()">

  <fo:inline font-family="FontName">


The match attribute on the template finds elements with the lang attribute, and then selects any descendant (using double slash) text() nodes, regardless of what the sequence of descendants is.

For the text node, it generates an fo:inline and sets the font-family.

This approach works if you are not adding other custom templates that match on text() nodes. Since the processor won't apply more than one matched template, this would have to coordinate with them.

I didn't test this, so let me know if it doesn't work.

Bob Stayton
Sagehill Enterprises

On 9/7/2016 9:41 AM, Peter Fleck wrote:
Hi all,

I'm trying to set all elements tagged with a particular language to a font.

I tried a few combinations of the below but I don't know what I'm doing.
Any help appreciated.

<xsl:template match="d:*[@lang = 'el'] | d:*[@xml:lang = 'el']">
    <xsl:attribute name="font-family">FontName</xsl:attribute>

Many thanks,


To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org

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