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><?xml version="1.0"?>
|
---|
43 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
44 | version="1.0">
|
---|
45 |
|
---|
46 | <xsl:import href="../xsl/html/docbook.xsl"/>
|
---|
47 |
|
---|
48 | <xsl:output method="html"/>
|
---|
49 |
|
---|
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"/>
|
---|
56 | </l:context>
|
---|
57 | </l:l10n>
|
---|
58 | </l:i18n>
|
---|
59 |
|
---|
60 | </xsl:stylesheet></programlisting>
|
---|
61 |
|
---|
62 | <para>With this stylesheet, the cross references in the following document:</para>
|
---|
63 |
|
---|
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>
|
---|
68 |
|
---|
69 | <preface>
|
---|
70 | <title>Preface</title>
|
---|
71 |
|
---|
72 | <para>Normal: <xref linkend="ch1"/>.</para>
|
---|
73 | <para>Title: <xref xrefstyle="title" linkend="ch1"/>.</para>
|
---|
74 |
|
---|
75 | </preface>
|
---|
76 |
|
---|
77 | <chapter id="ch1">
|
---|
78 | <title>First Chapter</title>
|
---|
79 |
|
---|
80 | <para>Irrelevant.</para>
|
---|
81 |
|
---|
82 | </chapter>
|
---|
83 | </book></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>
|
---|