Hi
Peter,
As you
discovered, XSLT selects only one template for each match,
even when more than one applies. You'll need to write a more
general template to handle all your permutations, something
like this:
<xsl:template
match="d:para[@role]">
 <fo:block>
ÂÂÂ <xsl:if test="contains(@role, 'bg-danger')">
ÂÂÂÂÂ <xsl:attribute
name="background-color">red</xsl:attribute>
ÂÂÂ </xsl:if>
ÂÂÂ <xsl:if test="contains(@role, 'xx-small')">
ÂÂÂÂÂ <xsl:attribute name="font-size">xx-small</xsl:attribute>
ÂÂÂ </xsl:if>
ÂÂÂ <xsl:apply-templates/>
 </fo:block>
</xsl:template>
Â
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net
On 10/12/2018 7:16 AM, Peter Fleck
wrote:
I have a
number of templates that add some formatting to xsl:fo, they are
in the format of:
Â<xsl:template match="d:para[contains(@role,'bg-danger')]"
priority="9">
ÂÂÂ <fo:block background-color="red">
ÂÂÂÂÂ <xsl:apply-templates/>
ÂÂÂ </fo:block>
 </xsl:template>
 <xsl:template match="d:para[contains(@role,'xx-small')]"
priority="9">
ÂÂÂ <fo:block font-size="xx-small">
ÂÂÂÂÂ <xsl:apply-templates/>
ÂÂÂ </fo:block>
 </xsl:template>
I want to be able to combine these various templates, something
like this:
<para role="bg-danger xx-small">..</para>
But only the last "role" in the list gets applied to the output.
Is this combining of roles feasible or do I need to write a combo
template (for each combination)?
 <xsl:template
match="d:para[contains(@role,'bg-danger_xx-small')]"
priority="9">
ÂÂÂ <fo:block background-color="red" font-size="xx-small">
ÂÂÂÂÂ <xsl:apply-templates/>
ÂÂÂ </fo:block>
 </xsl:template>
<para role="bg-danger_xx-small">..</para>
Thanks,
Peter
---------------------------------------------------------------------
To unsubscribe, e-mail:
docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail:
docbook-apps-help@lists.oasis-open.org
|