]> git.stg.codes - stg.git/blob - doc/xslt/params/use.role.as.xrefstyle.xml
Parse admins list.
[stg.git] / doc / xslt / params / use.role.as.xrefstyle.xml
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">
7 <refmeta>
8 <refentrytitle>use.role.as.xrefstyle</refentrytitle>
9 <refmiscinfo class="other" otherclass="datatype">boolean</refmiscinfo>
10 </refmeta>
11 <refnamediv>
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>
15 </refnamediv>
16
17 <refsynopsisdiv>
18 <src:fragment xml:id="use.role.as.xrefstyle.frag">
19 <xsl:param name="use.role.as.xrefstyle" select="1"/>
20 </src:fragment>
21 </refsynopsisdiv>
22
23 <refsection><info><title>Description</title></info>
24
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>
27
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>
34
35 </refsection>
36
37 <refsection><info><title>Example</title></info>
38
39 <para>The following small stylesheet shows how to configure the
40 stylesheets to make use of the cross reference style:</para>
41
42 <programlisting>&lt;?xml version="1.0"?&gt;
43 &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
44                 version="1.0"&gt;
45
46 &lt;xsl:import href="../xsl/html/docbook.xsl"/&gt;
47
48 &lt;xsl:output method="html"/&gt;
49
50 &lt;xsl:param name="local.l10n.xml" select="document('')"/&gt;
51 &lt;l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"&gt;
52   &lt;l:l10n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" language="en"&gt;
53    &lt;l:context name="xref"&gt;
54       &lt;l:template name="chapter" style="title" text="Chapter %n, %t"/&gt;
55       &lt;l:template name="chapter" text="Chapter %n"/&gt;
56     &lt;/l:context&gt;
57   &lt;/l:l10n&gt;
58 &lt;/l:i18n&gt;
59
60 &lt;/xsl:stylesheet&gt;</programlisting>
61
62 <para>With this stylesheet, the cross references in the following document:</para>
63
64 <programlisting>&lt;?xml version="1.0" encoding="utf-8"?&gt;
65 &lt;!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
66                   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"&gt;
67 &lt;book id="book"&gt;&lt;title&gt;Book&lt;/title&gt;
68
69 &lt;preface&gt;
70 &lt;title&gt;Preface&lt;/title&gt;
71
72 &lt;para&gt;Normal: &lt;xref linkend="ch1"/&gt;.&lt;/para&gt;
73 &lt;para&gt;Title: &lt;xref xrefstyle="title" linkend="ch1"/&gt;.&lt;/para&gt;
74
75 &lt;/preface&gt;
76
77 &lt;chapter id="ch1"&gt;
78 &lt;title&gt;First Chapter&lt;/title&gt;
79
80 &lt;para&gt;Irrelevant.&lt;/para&gt;
81
82 &lt;/chapter&gt;
83 &lt;/book&gt;</programlisting>
84
85 <para>will appear as:</para>
86
87 <informalexample>
88 <para>Normal: Chapter 1.</para>
89 <para>Title: Chapter 1, <emphasis>First Chapter</emphasis>.</para>
90 </informalexample>
91 </refsection>
92
93 </refentry>