Hi Jirka,
Thanks for your advice. I was able to get it working with the following
solution, incorporating changes to the common.html.attributes template
as you suggested:
<xsl:import href="html/docbook.xsl" />
<!-- Apply common attributes such as class, lang, dir -->
<xsl:template name="common.html.attributes">
<xsl:param name="inherit" select="0"/>
<xsl:param name="class" select="local-name(.)"/>
<xsl:apply-templates select="." mode="common.html.attributes">
<xsl:with-param name="class" select="$class"/>
<xsl:with-param name="inherit" select="$inherit"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="*" mode="common.html.attributes">
<xsl:param name="class" select="local-name(.)"/>
<xsl:param name="inherit" select="0"/>
<xsl:call-template name="generate.html.lang"/>
<xsl:call-template name="generate.html.revision"/>
<xsl:call-template name="dir">
<xsl:with-param name="inherit" select="$inherit"/>
</xsl:call-template>
<xsl:apply-templates select="." mode="class.attribute">
<xsl:with-param name="class" select="$class"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template name="generate.html.revision">
<xsl:apply-templates select="."
mode="html.revision.attribute"/>
</xsl:template>
<xsl:template match="*" mode="html.revision.attribute">
<xsl:choose>
<xsl:when test="@revision and
$stylesheet.result.type = 'html'">
<xsl:attribute name="data-revision">
<xsl:value-of
select="@d:revision"/>
</xsl:attribute>
</xsl:when>
<xsl:when test="@revision and
$stylesheet.result.type = 'xhtml'">
<xsl:attribute name="data-revision">
<xsl:value-of
select="@revision"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
</xsl:template>
Thanks,
Graeme
On Wed, Jan 8, 2014, at 11:40, Jirka Kosek wrote:
> On 8.1.2014 12:29, [email protected] wrote:
> > So I created a similar set of templates. However, they don't seem to be
> > picking anything up, or adding the appropriate attributes to the created
> > HTML elements.
>
> Your templates will never be called. You must modify existing template
>
> <xsl:template name="common.html.attributes">
>
> to invoke your code for copying revision attributes.
>
> --
> ------------------------------------------------------------------
> Jirka Kosek e-mail: [email protected] http://xmlguru.cz
> ------------------------------------------------------------------
> Professional XML consulting and training services
> DocBook customization, custom XSLT/XSL-FO document processing
> ------------------------------------------------------------------
> OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 rep.
> ------------------------------------------------------------------
> Bringing you XML Prague conference http://xmlprague.cz
> ------------------------------------------------------------------
>
> Email had 1 attachment:
> + signature.asc
> 1k (application/pgp-signature)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]