custom.css.source.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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="custom.css.source">
  7. <refmeta>
  8. <refentrytitle>custom.css.source</refentrytitle>
  9. <refmiscinfo class="other" otherclass="datatype">string</refmiscinfo>
  10. </refmeta>
  11. <refnamediv>
  12. <refname>custom.css.source</refname>
  13. <refpurpose>Name of a custom CSS input file</refpurpose>
  14. </refnamediv>
  15. <refsynopsisdiv>
  16. <src:fragment xml:id="custom.css.source.frag"><xsl:param name="custom.css.source"></xsl:param></src:fragment>
  17. </refsynopsisdiv>
  18. <refsection><info><title>Description</title></info>
  19. <para>The <parameter>custom.css.source</parameter>
  20. parameter enables you to add CSS styles to DocBook's
  21. HTML output.</para>
  22. <para>The parameter
  23. specifies the name of a file containing custom
  24. CSS styles. The file must be a well-formed XML file that
  25. consists of a single <tag>style</tag> root
  26. element that contains CSS styles as its text content.
  27. For example:</para>
  28. <programlisting><![CDATA[<?xml version="1.0"?>
  29. <style>
  30. h2 {
  31. font-weight: bold;
  32. color: blue;
  33. }
  34. ...
  35. </style>
  36. ]]></programlisting>
  37. <para>The filename specified by the parameter
  38. should have a <literal>.xml</literal>
  39. filename suffix, although that is not required.
  40. The default value of this parameter is blank.</para>
  41. <para>If <parameter>custom.css.source</parameter> is not blank, then
  42. the stylesheet takes the following actions.
  43. These actions take place regardless of the value of
  44. the <parameter>make.clean.html</parameter> parameter.</para>
  45. <orderedlist>
  46. <listitem>
  47. <para>The stylesheet uses the XSLT <literal>document()</literal>
  48. function to open the file specified by the parameter and
  49. load it into a variable.</para>
  50. </listitem>
  51. <listitem>
  52. <para>The stylesheet forms an output pathname consisting of the
  53. value of the <parameter>base.dir</parameter> parameter (if it is set)
  54. and the value of <parameter>custom.css.source</parameter>,
  55. with the <literal>.xml</literal> suffix stripped off.
  56. </para>
  57. </listitem>
  58. <listitem>
  59. <para>The stylesheet removes the <tag>style</tag>
  60. wrapper element and writes just the CSS text content to the output file.</para>
  61. </listitem>
  62. <listitem>
  63. <para>The stylesheet adds a <tag>link</tag> element to the
  64. HTML <tag>HEAD</tag> element to reference this external CSS stylesheet.
  65. For example:
  66. <programlisting>&lt;link rel="stylesheet" href="custom.css" type="text/css"&gt;
  67. </programlisting>
  68. </para>
  69. </listitem>
  70. </orderedlist>
  71. <para>If the <parameter>make.clean.html</parameter> parameter is nonzero
  72. (the default is zero),
  73. and if the <parameter>docbook.css.source</parameter> parameter
  74. is not blank (the default is not blank),
  75. then the stylesheet will also generate a default CSS file
  76. and add a <tag>link</tag> tag to reference it.
  77. The <tag>link</tag> to the custom CSS comes after the
  78. <tag>link</tag> to the default, so it should cascade properly
  79. in most browsers.
  80. If you do not want two <tag>link</tag> tags, and
  81. instead want your custom CSS to import the default generated
  82. CSS file, then do the following:
  83. </para>
  84. <orderedlist>
  85. <listitem>
  86. <para>Add a line like the following to your custom CSS source file:</para>
  87. <programlisting>@import url("docbook.css")
  88. </programlisting>
  89. </listitem>
  90. <listitem>
  91. <para>Set the <parameter>docbook.css.link</parameter> parameter
  92. to zero. This will omit the <tag>link</tag> tag
  93. that references the default CSS file.</para>
  94. </listitem>
  95. </orderedlist>
  96. <para>If you set <parameter>make.clean.html</parameter> to nonzero but
  97. you do not want the default CSS generated, then also set
  98. the <parameter>docbook.css.source</parameter> parameter to blank.
  99. Then no default CSS will be generated, and so
  100. all CSS styles must come from your custom CSS file.</para>
  101. <para>You can use the <parameter>generate.css.header</parameter>
  102. parameter to instead write the CSS to each HTML <tag>HEAD</tag>
  103. element in a <tag>style</tag> tag instead of an external CSS file.</para>
  104. </refsection>
  105. </refentry>