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