Discussion:
<cite> with class and title
Peter Fleck
2014-08-14 09:11:57 UTC
Permalink
Hi,

I'm using a third-party javascript that requires the <cite> tag with the
class and title populated.
I can't work out how to do it in docbook.

I have used the below as a temporary work around which works but would
prefer it in docbook if possible.
<html:cite class="---" title="---">Cited Content</html:cite>

Thanks,

Peter
Bob Stayton
2014-08-14 20:58:43 UTC
Permalink
Hi Peter,
I think the appropriate element in DocBook would be <citetitle>. The
default formatting of citetitle is just italic, so you would need to
create a customized XSL template to generate <cite>. I would suggest
you copy the template named 'inline.italicseq' from inline.xsl to your
customization layer and modify it to match on "d:citetitle" and output
<cite> instead of <em>.

When you include the call to the template named
"common.html.attributes", that will add a class="citetitle" to the output.

For the title attribute, it has to be plain text, so that can be done
with something like this in the template:

<xsl:attribute name="title">
<xsl:variable name="formatted">
<xsl:apply-templates/>
</xsl:variable>
<xsl:value-of select="normalize-space($formatted)"/>
</xsl:attribute>

Taking the value-of removes any markup from the formatted text.

Bob Stayton
Sagehill Enterprises
Post by Peter Fleck
Hi,
I'm using a third-party javascript that requires the <cite> tag with the
class and title populated.
I can't work out how to do it in docbook.
I have used the below as a temporary work around which works but would
prefer it in docbook if possible.
<html:cite class="---" title="---">Cited Content</html:cite>
Thanks,
Peter
---------------------------------------------------------------------
Continue reading on narkive:
Loading...