charmap.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <?xml version="1.0"?>
  2. <reference xml:id="charmap">
  3. <info>
  4. <title>Common » Character-Map Template Reference</title>
  5. <releaseinfo role="meta">
  6. $Id: charmap.xsl 7266 2007-08-22 11:58:42Z xmldoc $
  7. </releaseinfo>
  8. </info>
  9. <partintro xml:id="partintro">
  10. <title>Introduction</title>
  11. <para>This is technical reference documentation for the
  12. character-map templates in the DocBook XSL Stylesheets.</para>
  13. <note>
  14. <para>These templates are defined in a separate file from the set
  15. of “common” templates because some of the common templates
  16. reference DocBook XSL stylesheet parameters, requiring the
  17. entire set of parameters to be imported/included in any
  18. stylesheet that imports/includes the common templates.</para>
  19. <para>The character-map templates don’t import or include
  20. any DocBook XSL stylesheet parameters, so the
  21. character-map templates can be used without importing the
  22. whole set of parameters.</para>
  23. </note>
  24. <para>This is not intended to be user documentation. It is
  25. provided for developers writing customization layers for the
  26. stylesheets.</para>
  27. </partintro>
  28. <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="template.apply-character-map">
  29. <refnamediv>
  30. <refname>apply-character-map</refname>
  31. <refpurpose>Applies an XSLT character map</refpurpose>
  32. </refnamediv>
  33. <refsynopsisdiv>
  34. <synopsis>&lt;xsl:template name="apply-character-map"&gt;
  35. &lt;xsl:param name="content"/&gt;
  36. &lt;xsl:param name="map.contents"/&gt;
  37. ...
  38. &lt;/xsl:template&gt;</synopsis>
  39. </refsynopsisdiv>
  40. <refsect1><title>Description</title>
  41. <para>This template applies an <link xlink:href="http://www.w3.org/TR/xslt20/#character-maps">XSLT character map</link>; that is, it causes certain
  42. individual characters to be substituted with strings of one
  43. or more characters. It is useful mainly for replacing
  44. multiple “special” characters or symbols in the same target
  45. content. It uses the value of
  46. <parameter>map.contents</parameter> to do substitution on
  47. <parameter>content</parameter>, and then returns the
  48. modified contents.</para>
  49. <note>
  50. <para>This template is a very slightly modified version of
  51. Jeni Tennison’s <function>replace_strings</function>
  52. template in the <link xlink:href="http://www.dpawson.co.uk/xsl/sect2/StringReplace.html#d9351e13">multiple string replacements</link> section of Dave Pawson’s
  53. <link xlink:href="http://www.dpawson.co.uk/xsl/index.html">XSLT FAQ</link>.</para>
  54. <para>The <function>apply-string-subst-map</function>
  55. template is essentially the same template as the
  56. <function>apply-character-map</function> template; the
  57. only difference is that in the map that
  58. <function>apply-string-subst-map</function> expects, <tag class="attribute">oldstring</tag> and <tag class="attribute">newstring</tag> attributes are used
  59. instead of <tag class="attribute">character</tag> and <tag class="attribute">string</tag> attributes.</para>
  60. </note>
  61. </refsect1><refsect1><title>Parameters</title>
  62. <variablelist>
  63. <varlistentry><term>content</term>
  64. <listitem>
  65. <para>The content on which to perform the character-map
  66. substitution.</para>
  67. </listitem>
  68. </varlistentry>
  69. <varlistentry><term>map.contents</term>
  70. <listitem>
  71. <para>A node set of elements, with each element having
  72. the following attributes:
  73. <itemizedlist>
  74. <listitem>
  75. <simpara><tag class="attribute">character</tag>, a
  76. character to be replaced</simpara>
  77. </listitem>
  78. <listitem>
  79. <simpara><tag class="attribute">string</tag>, a
  80. string with which to replace <tag class="attribute">character</tag></simpara>
  81. </listitem>
  82. </itemizedlist>
  83. </para>
  84. </listitem>
  85. </varlistentry>
  86. </variablelist>
  87. </refsect1></refentry>
  88. <refentry xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="template.read-character-map">
  89. <refnamediv>
  90. <refname>read-character-map</refname>
  91. <refpurpose>Reads in all or part of an XSLT character map</refpurpose>
  92. </refnamediv>
  93. <refsynopsisdiv>
  94. <synopsis>&lt;xsl:template name="read-character-map"&gt;
  95. &lt;xsl:param name="use.subset"/&gt;
  96. &lt;xsl:param name="subset.profile"/&gt;
  97. &lt;xsl:param name="uri"/&gt;
  98. ...
  99. &lt;/xsl:template&gt;</synopsis>
  100. </refsynopsisdiv>
  101. <refsect1><title>Description</title>
  102. <para>The XSLT 2.0 specification describes <link xlink:href="http://www.w3.org/TR/xslt20/#character-maps">character maps</link> and explains how they may be used
  103. to allow a specific character appearing in a text or
  104. attribute node in a final result tree to be substituted by
  105. a specified string of characters during serialization. The
  106. <function>read-character-map</function> template provides a
  107. means for reading and using character maps with XSLT
  108. 1.0-based tools.</para>
  109. <para>This template reads the character-map contents from
  110. <parameter>uri</parameter> (in full or in part, depending on
  111. the value of the <parameter>use.subset</parameter>
  112. parameter), then passes those contents to the
  113. <function>apply-character-map</function> template, along with
  114. <parameter>content</parameter>, the data on which to perform
  115. the character substitution.</para>
  116. <para>Using the character map “in part” means that it uses only
  117. those <tag>output-character</tag> elements that match the
  118. XPath expression given in the value of the
  119. <parameter>subset.profile</parameter> parameter. The current
  120. implementation of that capability here relies on the
  121. <function>evaluate</function> extension XSLT function.</para>
  122. </refsect1><refsect1><title>Parameters</title>
  123. <variablelist>
  124. <varlistentry><term>use.subset</term>
  125. <listitem>
  126. <para>Specifies whether to use a subset of the character
  127. map instead of the whole map; boolean
  128. <literal>0</literal> or <literal>1</literal></para>
  129. </listitem>
  130. </varlistentry>
  131. <varlistentry><term>subset.profile</term>
  132. <listitem>
  133. <para>XPath expression that specifies what subset of the
  134. character map to use</para>
  135. </listitem>
  136. </varlistentry>
  137. <varlistentry><term>uri</term>
  138. <listitem>
  139. <para>URI for a character map</para>
  140. </listitem>
  141. </varlistentry>
  142. </variablelist>
  143. </refsect1></refentry>
  144. </reference>