use.role.as.xrefstyle.xml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. <refsynopsisdiv>
  17. <src:fragment xml:id="use.role.as.xrefstyle.frag">
  18. <xsl:param name="use.role.as.xrefstyle" select="1"/>
  19. </src:fragment>
  20. </refsynopsisdiv>
  21. <refsection><info><title>Description</title></info>
  22. <para>In DocBook documents that conform to a schema older than V4.3, this parameter allows
  23. <tag class="attribute">role</tag> to serve the purpose of specifying the cross reference style.</para>
  24. <para>If non-zero, the <tag class="attribute">role</tag> attribute on
  25. <tag>xref</tag> will be used to select the cross reference style.
  26. In DocBook V4.3, the <tag class="attribute">xrefstyle</tag> attribute was added for this purpose.
  27. If the <tag class="attribute">xrefstyle</tag> attribute is present,
  28. <tag class="attribute">role</tag> will be ignored, regardless of the setting
  29. of this parameter.</para>
  30. </refsection>
  31. <refsection><info><title>Example</title></info>
  32. <para>The following small stylesheet shows how to configure the
  33. stylesheets to make use of the cross reference style:</para>
  34. <programlisting>&lt;?xml version="1.0"?&gt;
  35. &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  36. version="1.0"&gt;
  37. &lt;xsl:import href="../xsl/html/docbook.xsl"/&gt;
  38. &lt;xsl:output method="html"/&gt;
  39. &lt;xsl:param name="local.l10n.xml" select="document('')"/&gt;
  40. &lt;l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"&gt;
  41. &lt;l:l10n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" language="en"&gt;
  42. &lt;l:context name="xref"&gt;
  43. &lt;l:template name="chapter" style="title" text="Chapter %n, %t"/&gt;
  44. &lt;l:template name="chapter" text="Chapter %n"/&gt;
  45. &lt;/l:context&gt;
  46. &lt;/l:l10n&gt;
  47. &lt;/l:i18n&gt;
  48. &lt;/xsl:stylesheet&gt;</programlisting>
  49. <para>With this stylesheet, the cross references in the following document:</para>
  50. <programlisting>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  51. &lt;!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  52. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"&gt;
  53. &lt;book id="book"&gt;&lt;title&gt;Book&lt;/title&gt;
  54. &lt;preface&gt;
  55. &lt;title&gt;Preface&lt;/title&gt;
  56. &lt;para&gt;Normal: &lt;xref linkend="ch1"/&gt;.&lt;/para&gt;
  57. &lt;para&gt;Title: &lt;xref xrefstyle="title" linkend="ch1"/&gt;.&lt;/para&gt;
  58. &lt;/preface&gt;
  59. &lt;chapter id="ch1"&gt;
  60. &lt;title&gt;First Chapter&lt;/title&gt;
  61. &lt;para&gt;Irrelevant.&lt;/para&gt;
  62. &lt;/chapter&gt;
  63. &lt;/book&gt;</programlisting>
  64. <para>will appear as:</para>
  65. <informalexample>
  66. <para>Normal: Chapter 1.</para>
  67. <para>Title: Chapter 1, <emphasis>First Chapter</emphasis>.</para>
  68. </informalexample>
  69. </refsection>
  70. </refentry>