<xsl:template match="colophon">
<div class="{name(.)}">
+ <xsl:if test="$generate.id.attributes != 0">
+ <xsl:attribute name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:attribute>
+ </xsl:if>
+
<xsl:call-template name="component.separator"/>
<xsl:call-template name="component.title"/>
<xsl:call-template name="component.subtitle"/>
<xsl:template match="preface">
<div class="{name(.)}">
+ <xsl:if test="$generate.id.attributes != 0">
+ <xsl:attribute name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:attribute>
+ </xsl:if>
+
<xsl:call-template name="component.separator"/>
<xsl:call-template name="preface.titlepage"/>
<xsl:if test="$generate.preface.toc != '0'">
<xsl:template match="chapter">
<div class="{name(.)}">
+ <xsl:if test="$generate.id.attributes != 0">
+ <xsl:attribute name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:attribute>
+ </xsl:if>
+
<xsl:call-template name="component.separator"/>
<xsl:call-template name="chapter.titlepage"/>
<xsl:if test="$generate.chapter.toc != '0'">
<xsl:template match="appendix">
<div class="{name(.)}">
+ <xsl:if test="$generate.id.attributes != 0">
+ <xsl:attribute name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:attribute>
+ </xsl:if>
+
<xsl:call-template name="component.separator"/>
<xsl:call-template name="appendix.titlepage"/>
<xsl:if test="$generate.appendix.toc != '0'">
<xsl:template match="article/appendix">
<div class="{name(.)}">
+ <xsl:if test="$generate.id.attributes != 0">
+ <xsl:attribute name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:attribute>
+ </xsl:if>
+
<xsl:call-template name="section.heading">
<xsl:with-param name="level" select="2"/>
<xsl:with-param name="title">
<xsl:template match="article">
<div class="{name(.)}">
+ <xsl:if test="$generate.id.attributes != 0">
+ <xsl:attribute name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:attribute>
+ </xsl:if>
+
<xsl:call-template name="article.titlepage"/>
<xsl:if test="$generate.article.toc != '0'">
<xsl:call-template name="component.toc"/>
<xsl:template match="set">
<div class="{name(.)}">
+ <xsl:if test="$generate.id.attributes != 0">
+ <xsl:attribute name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:attribute>
+ </xsl:if>
+
<xsl:call-template name="set.titlepage"/>
<xsl:if test="$generate.set.toc != '0'">
<xsl:call-template name="set.toc"/>
<xsl:template match="book">
<div class="{name(.)}">
+ <xsl:if test="$generate.id.attributes != 0">
+ <xsl:attribute name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:attribute>
+ </xsl:if>
+
<xsl:call-template name="book.titlepage"/>
<xsl:apply-templates select="dedication" mode="dedication"/>
<xsl:if test="$generate.book.toc != '0'">
<xsl:template match="part">
<div class="{name(.)}">
+ <xsl:if test="$generate.id.attributes != 0">
+ <xsl:attribute name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:attribute>
+ </xsl:if>
+
<xsl:call-template name="part.titlepage"/>
<xsl:if test="not(partintro) and $generate.part.toc != '0'">
<xsl:call-template name="division.toc"/>
<xsl:template match="partintro">
<div class="{name(.)}">
+ <xsl:if test="$generate.id.attributes != 0">
+ <xsl:attribute name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:attribute>
+ </xsl:if>
+
<xsl:call-template name="partintro.titlepage"/>
<xsl:apply-templates/>
<xsl:if test="$generate.part.toc != '0'">
<!-- ==================================================================== -->
<xsl:template match="glossary">
- <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
+ <div class="{name(.)}">
+ <xsl:if test="$generate.id.attributes != 0">
+ <xsl:attribute name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:attribute>
+ </xsl:if>
- <div id="{$id}" class="{name(.)}">
<xsl:call-template name="glossary.titlepage"/>
<xsl:choose>
<!-- Glossary collection -->
<xsl:template match="glossary[@role='auto']" priority="2">
- <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
<xsl:variable name="terms" select="//glossterm[not(parent::glossdef)]|//firstterm"/>
<xsl:variable name="collection" select="document($glossary.collection, .)"/>
</xsl:message>
</xsl:if>
- <div id="{$id}" class="{name(.)}">
+ <div class="{name(.)}">
+ <xsl:if test="$generate.id.attributes != 0">
+ <xsl:attribute name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:attribute>
+ </xsl:if>
+
<xsl:call-template name="glossary.titlepage"/>
<xsl:choose>
<xsl:if test="count(*)>0 or $generate.index != '0'">
<div class="{name(.)}">
+ <xsl:if test="$generate.id.attributes != 0">
+ <xsl:attribute name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:attribute>
+ </xsl:if>
+
<xsl:call-template name="anchor"/>
<xsl:call-template name="index.titlepage"/>
<xsl:apply-templates/>
<xsl:template match="indexdiv">
<div class="{name(.)}">
+ <xsl:if test="$generate.id.attributes != 0">
+ <xsl:attribute name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:attribute>
+ </xsl:if>
+
<xsl:call-template name="anchor"/>
<xsl:apply-templates mode="not-indexentrys"/>
<dl>
<!ENTITY generate.chapter.toc SYSTEM "../params/generate.chapter.toc.xml">
<!ENTITY generate.component.toc SYSTEM "../params/generate.component.toc.xml">
<!ENTITY generate.division.toc SYSTEM "../params/generate.division.toc.xml">
+<!ENTITY generate.id.attributes SYSTEM "../params/generate.id.attributes.xml">
<!ENTITY generate.index SYSTEM "../params/generate.index.xml">
<!ENTITY generate.legalnotice.link SYSTEM "../params/generate.legalnotice.link.xml">
<!ENTITY generate.part.toc SYSTEM "../params/generate.part.toc.xml">
&make.valid.html;
&html.cleanup;
&draft.watermark.image;
+&generate.id.attributes;
</reference>
<reference><title>XSLT Processing</title>
<src:fragref linkend="generate.chapter.toc.frag"/>
<src:fragref linkend="generate.component.toc.frag"/>
<src:fragref linkend="generate.division.toc.frag"/>
+<src:fragref linkend="generate.id.attributes.frag"/>
<src:fragref linkend="generate.index.frag"/>
<src:fragref linkend="generate.legalnotice.link.frag"/>
<src:fragref linkend="generate.part.toc.frag"/>
--- /dev/null
+<refentry id="generate.id.attributes">
+<refmeta>
+<refentrytitle>generate.id.attributes</refentrytitle>
+<refmiscinfo role="type"></refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>generate.id.attributes</refname>
+<refpurpose></refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<src:fragment id='generate.id.attributes.frag'>
+<xsl:param name="generate.id.attributes" select="0"/>
+</src:fragment>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>If non-zero, the HTML stylesheet will generate ID attributes on
+containers. For example, the markup:</para>
+
+<screen><![CDATA[<section id="foo"><title>Some Title</title>
+<para>Some para.</para>
+</section>]]></screen>
+
+<para>might produce:</para>
+
+<screen><![CDATA[<div class="section" id="foo">
+<h2>Some Title</h2>
+<p>Some para.</p>
+</div>]]></screen>
+
+<para>The alternative is to generate anchors:</para>
+
+<screen><![CDATA[<div class="section">
+<h2><a name="foo"></a>Some Title</h2>
+<p>Some para.</p>
+</div>]]></screen>
+
+<para>Because the <sgmltag class="attribute">name</sgmltag> attribute of
+the <sgmltag>a</sgmltag> element and the <sgmltag class="attribute">id</sgmltag>
+attribute of other tags are both of type <quote>ID</quote>, producing both
+generates invalid documents.</para>
+
+<para>As of version 1.50, you can use this switch to control which type of
+identifier is generated. For backwards-compatibility, generating
+<sgmltag>a</sgmltag> anchors is preferred.</para>
+
+<para>Note: at present, this switch is incompletely implemented.
+Disabling ID attributes will suppress them, but enabling ID attributes
+will not suppress the anchors.</para>
+
+</refsect1>
+</refentry>