[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Combining para role templates
Hi Peter, Am Freitag, 12. Oktober 2018, 16:16:13 CEST schrieb Peter Fleck: > 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: > [...] What about this (untested): <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> Apart from the XSLT solution above, your role looks like you've (ab)used it as an admonition element. ;) Have you tried one of the admonition elements like warning, caution etc.? <caution> <para>...</para> </caution> Not sure if that can be applied to your document. However, it seems to me, it could simplify your customization even more. -- GruÃ/Regards Thomas Schraitle
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]