1 <refentry xmlns="http://docbook.org/ns/docbook"
\r
2 xmlns:xlink="http://www.w3.org/1999/xlink"
\r
3 xmlns:xi="http://www.w3.org/2001/XInclude"
\r
4 xmlns:src="http://nwalsh.com/xmlns/litprog/fragment"
\r
5 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
\r
6 version="5.0" xml:id="use.role.as.xrefstyle">
\r
8 <refentrytitle>use.role.as.xrefstyle</refentrytitle>
\r
9 <refmiscinfo class="other" otherclass="datatype">boolean</refmiscinfo>
\r
12 <refname>use.role.as.xrefstyle</refname>
\r
13 <refpurpose>Use <tag class="attribute">role</tag> attribute for
\r
14 <tag class="attribute">xrefstyle</tag> on <tag>xref</tag>?</refpurpose>
\r
18 <src:fragment xml:id="use.role.as.xrefstyle.frag">
\r
19 <xsl:param name="use.role.as.xrefstyle" select="1"/>
\r
23 <refsection><info><title>Description</title></info>
\r
25 <para>In DocBook documents that conform to a schema older than V4.3, this parameter allows
\r
26 <tag class="attribute">role</tag> to serve the purpose of specifying the cross reference style.</para>
\r
28 <para>If non-zero, the <tag class="attribute">role</tag> attribute on
\r
29 <tag>xref</tag> will be used to select the cross reference style.
\r
30 In DocBook V4.3, the <tag class="attribute">xrefstyle</tag> attribute was added for this purpose.
\r
31 If the <tag class="attribute">xrefstyle</tag> attribute is present,
\r
32 <tag class="attribute">role</tag> will be ignored, regardless of the setting
\r
33 of this parameter.</para>
\r
37 <refsection><info><title>Example</title></info>
\r
39 <para>The following small stylesheet shows how to configure the
\r
40 stylesheets to make use of the cross reference style:</para>
\r
42 <programlisting><?xml version="1.0"?>
\r
43 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
\r
46 <xsl:import href="../xsl/html/docbook.xsl"/>
\r
48 <xsl:output method="html"/>
\r
50 <xsl:param name="local.l10n.xml" select="document('')"/>
\r
51 <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
\r
52 <l:l10n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" language="en">
\r
53 <l:context name="xref">
\r
54 <l:template name="chapter" style="title" text="Chapter %n, %t"/>
\r
55 <l:template name="chapter" text="Chapter %n"/>
\r
60 </xsl:stylesheet></programlisting>
\r
62 <para>With this stylesheet, the cross references in the following document:</para>
\r
64 <programlisting><?xml version="1.0" encoding="utf-8"?>
\r
65 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
\r
66 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
\r
67 <book id="book"><title>Book</title>
\r
70 <title>Preface</title>
\r
72 <para>Normal: <xref linkend="ch1"/>.</para>
\r
73 <para>Title: <xref xrefstyle="title" linkend="ch1"/>.</para>
\r
77 <chapter id="ch1">
\r
78 <title>First Chapter</title>
\r
80 <para>Irrelevant.</para>
\r
83 </book></programlisting>
\r
85 <para>will appear as:</para>
\r
88 <para>Normal: Chapter 1.</para>
\r
89 <para>Title: Chapter 1, <emphasis>First Chapter</emphasis>.</para>
\r