refentry.xsl 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277
  1. <?xml version='1.0'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
  4. xmlns:date="http://exslt.org/dates-and-times"
  5. exclude-result-prefixes="doc date"
  6. version='1.0'>
  7. <!-- ********************************************************************
  8. $Id$
  9. ********************************************************************
  10. This file is part of the XSL DocBook Stylesheet distribution.
  11. See ../README or http://docbook.sf.net/release/xsl/current/ for
  12. copyright and other information.
  13. ******************************************************************** -->
  14. <!-- ==================================================================== -->
  15. <doc:reference xmlns="">
  16. <referenceinfo>
  17. <releaseinfo role="meta">
  18. $Id$
  19. </releaseinfo>
  20. <corpauthor>The DocBook Project</corpauthor>
  21. <copyright>
  22. <year>2005-2007</year>
  23. <holder>The DocBook Project</holder>
  24. </copyright>
  25. </referenceinfo>
  26. <title>Refentry Metadata-Gathering Template Reference</title>
  27. <partintro id="partintro">
  28. <title>Introduction</title>
  29. <para>This is technical reference documentation for the "refentry
  30. metadata gathering" templates in the DocBook XSL Stylesheets.</para>
  31. <para>This is not intended to be user documentation. It is provided
  32. for developers writing customization layers for the
  33. stylesheets.</para>
  34. <note>
  35. <para>Currently, only the manpages stylesheets make use of these
  36. templates. They are, however, potentially useful elsewhere.</para>
  37. </note>
  38. </partintro>
  39. </doc:reference>
  40. <!-- ==================================================================== -->
  41. <doc:template name="get.refentry.metadata" xmlns="">
  42. <refpurpose>Gathers metadata from a refentry and its ancestors</refpurpose>
  43. <refdescription>
  44. <para>Reference documentation for particular commands, functions,
  45. etc., is sometimes viewed in isolation from its greater "context". For
  46. example, users view Unix man pages as, well, individual pages, not as
  47. part of a "book" of some kind. Therefore, it is sometimes necessary to
  48. embed "context" information in output for each <sgmltag>refentry</sgmltag>.</para>
  49. <para>However, one problem is that different users mark up that
  50. context information in different ways. Often (usually), the
  51. context information is not actually part of the content of the
  52. <sgmltag>refentry</sgmltag> itself, but instead part of the content of a
  53. parent or ancestor element to the the <sgmltag>refentry</sgmltag>. And
  54. even then, DocBook provides a variety of elements that users might
  55. potentially use to mark up the same kind of information. One user
  56. might use the <sgmltag>productnumber</sgmltag> element to mark up version
  57. information about a particular product, while another might use
  58. the <sgmltag>releaseinfo</sgmltag> element.</para>
  59. <para>Taking all that in mind, the
  60. <function>get.refentry.metadata</function> function tries to gather
  61. metadata from a <sgmltag>refentry</sgmltag> element and its ancestor
  62. elements in an intelligent and user-configurable way. The basic
  63. mechanism used in the XPath expressions throughout this stylesheet
  64. is to select the relevant metadata from the *info element that is
  65. closest to the actual <sgmltag>refentry</sgmltag>&#160;– either on the
  66. <sgmltag>refentry</sgmltag> itself, or on its nearest ancestor.</para>
  67. <note>
  68. <para>The <function>get.refentry.metadata</function> function is
  69. actually just sort of a "driver" function; it calls other
  70. functions that do the actual data collection, then returns the
  71. data as a set.</para>
  72. </note>
  73. </refdescription>
  74. <refparameter>
  75. <variablelist>
  76. <varlistentry>
  77. <term>refname</term>
  78. <listitem>
  79. <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
  80. </listitem>
  81. </varlistentry>
  82. <varlistentry>
  83. <term>info</term>
  84. <listitem>
  85. <para>A set of info nodes (from a <sgmltag>refentry</sgmltag>
  86. element and its ancestors)</para>
  87. </listitem>
  88. </varlistentry>
  89. <varlistentry>
  90. <term>prefs</term>
  91. <listitem>
  92. <para>A node containing user preferences (from global
  93. stylesheet parameters)</para>
  94. </listitem>
  95. </varlistentry>
  96. </variablelist>
  97. </refparameter>
  98. <refreturn>
  99. <para>Returns a node set with the following elements. The
  100. descriptions are verbatim from the <literal>man(7)</literal> man
  101. page.
  102. <variablelist>
  103. <varlistentry>
  104. <term>title</term>
  105. <listitem>
  106. <para>the title of the man page (e.g., <literal>MAN</literal>)</para>
  107. </listitem>
  108. </varlistentry>
  109. <varlistentry>
  110. <term>section</term>
  111. <listitem>
  112. <para>the section number the man page should be placed in (e.g.,
  113. <literal>7</literal>)</para>
  114. </listitem>
  115. </varlistentry>
  116. <varlistentry>
  117. <term>date</term>
  118. <listitem>
  119. <para>the date of the last revision</para>
  120. </listitem>
  121. </varlistentry>
  122. <varlistentry>
  123. <term>source</term>
  124. <listitem>
  125. <para>the source of the command</para>
  126. </listitem>
  127. </varlistentry>
  128. <varlistentry>
  129. <term>manual</term>
  130. <listitem>
  131. <para>the title of the manual (e.g., <citetitle>Linux
  132. Programmer's Manual</citetitle>)</para>
  133. </listitem>
  134. </varlistentry>
  135. </variablelist>
  136. </para>
  137. </refreturn>
  138. </doc:template>
  139. <xsl:template name="get.refentry.metadata">
  140. <xsl:param name="refname"/>
  141. <xsl:param name="info"/>
  142. <xsl:param name="prefs"/>
  143. <title>
  144. <xsl:call-template name="get.refentry.title">
  145. <xsl:with-param name="refname" select="$refname"/>
  146. </xsl:call-template>
  147. </title>
  148. <section>
  149. <xsl:call-template name="get.refentry.section">
  150. <xsl:with-param name="refname" select="$refname"/>
  151. </xsl:call-template>
  152. </section>
  153. <date>
  154. <xsl:call-template name="get.refentry.date">
  155. <xsl:with-param name="info" select="$info"/>
  156. <xsl:with-param name="refname" select="$refname"/>
  157. <xsl:with-param name="prefs" select="$prefs/DatePrefs"/>
  158. </xsl:call-template>
  159. </date>
  160. <source>
  161. <xsl:call-template name="get.refentry.source">
  162. <xsl:with-param name="info" select="$info"/>
  163. <xsl:with-param name="refname" select="$refname"/>
  164. <xsl:with-param name="prefs" select="$prefs/SourcePrefs"/>
  165. </xsl:call-template>
  166. </source>
  167. <manual>
  168. <xsl:call-template name="get.refentry.manual">
  169. <xsl:with-param name="info" select="$info"/>
  170. <xsl:with-param name="refname" select="$refname"/>
  171. <xsl:with-param name="prefs" select="$prefs/ManualPrefs"/>
  172. </xsl:call-template>
  173. </manual>
  174. </xsl:template>
  175. <!-- ====================================================================== -->
  176. <doc:template name="get.refentry.title" xmlns="">
  177. <refpurpose>Gets title metadata for a refentry</refpurpose>
  178. <refdescription>
  179. <para>The <literal>man(7)</literal> man page describes this as "the
  180. title of the man page (e.g., <literal>MAN</literal>). This differs
  181. from <sgmltag>refname</sgmltag> in that, if the <sgmltag>refentry</sgmltag> has a
  182. <sgmltag>refentrytitle</sgmltag>, we use that as the <sgmltag>title</sgmltag>;
  183. otherwise, we just use first <sgmltag>refname</sgmltag> in the first
  184. <sgmltag>refnamediv</sgmltag> in the source.</para>
  185. </refdescription>
  186. <refparameter>
  187. <variablelist>
  188. <varlistentry>
  189. <term>refname</term>
  190. <listitem>
  191. <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
  192. </listitem>
  193. </varlistentry>
  194. </variablelist>
  195. </refparameter>
  196. <refreturn>
  197. <para>Returns a <sgmltag>title</sgmltag> node.</para></refreturn>
  198. </doc:template>
  199. <xsl:template name="get.refentry.title">
  200. <xsl:param name="refname"/>
  201. <xsl:choose>
  202. <xsl:when test="refmeta/refentrytitle">
  203. <xsl:copy>
  204. <xsl:apply-templates select="refmeta/refentrytitle/node()"/>
  205. </xsl:copy>
  206. </xsl:when>
  207. <xsl:otherwise>
  208. <xsl:copy-of select="$refname"/>
  209. </xsl:otherwise>
  210. </xsl:choose>
  211. </xsl:template>
  212. <!-- ==================================================================== -->
  213. <doc:template name="get.refentry.section" xmlns="">
  214. <refpurpose>Gets section metadata for a refentry</refpurpose>
  215. <refdescription>
  216. <para>The <literal>man(7)</literal> man page describes this as "the
  217. section number the man page should be placed in (e.g.,
  218. <literal>7</literal>)". If we do not find a <sgmltag>manvolnum</sgmltag>
  219. specified in the source, and we find that the <sgmltag>refentry</sgmltag> is
  220. for a function, we use the section number <literal>3</literal>
  221. ["Library calls (functions within program libraries)"]; otherwise, we
  222. default to using <literal>1</literal> ["Executable programs or shell
  223. commands"].</para>
  224. </refdescription>
  225. <refparameter>
  226. <variablelist>
  227. <varlistentry>
  228. <term>refname</term>
  229. <listitem>
  230. <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
  231. </listitem>
  232. </varlistentry>
  233. <varlistentry>
  234. <term>quiet</term>
  235. <listitem>
  236. <para>If non-zero, no "missing" message is emitted</para>
  237. </listitem>
  238. </varlistentry>
  239. </variablelist>
  240. </refparameter>
  241. <refreturn>
  242. <para>Returns a string representing a section number.</para></refreturn>
  243. </doc:template>
  244. <xsl:template name="get.refentry.section">
  245. <xsl:param name="refname"/>
  246. <xsl:param name="quiet" select="0"/>
  247. <xsl:choose>
  248. <xsl:when test="refmeta/manvolnum">
  249. <xsl:value-of select="refmeta/manvolnum"/>
  250. </xsl:when>
  251. <xsl:otherwise>
  252. <xsl:if test="$quiet = 0">
  253. <xsl:if test="$refentry.meta.get.quietly = 0">
  254. <xsl:call-template name="log.message">
  255. <xsl:with-param name="level">Note</xsl:with-param>
  256. <xsl:with-param name="source" select="$refname"/>
  257. <xsl:with-param
  258. name="message"
  259. >meta manvol : No manvolnum</xsl:with-param>
  260. </xsl:call-template>
  261. </xsl:if>
  262. </xsl:if>
  263. <xsl:choose>
  264. <xsl:when test=".//funcsynopsis">
  265. <xsl:if test="$quiet = 0">
  266. <xsl:if test="$refentry.meta.get.quietly = 0">
  267. <xsl:call-template name="log.message">
  268. <xsl:with-param name="level">Note</xsl:with-param>
  269. <xsl:with-param name="source" select="$refname"/>
  270. <xsl:with-param
  271. name="message"
  272. >meta manvol : Setting man section to 3</xsl:with-param>
  273. </xsl:call-template>
  274. </xsl:if>
  275. </xsl:if>
  276. <xsl:text>3</xsl:text>
  277. </xsl:when>
  278. <xsl:otherwise>
  279. <xsl:text>1</xsl:text>
  280. </xsl:otherwise>
  281. </xsl:choose>
  282. </xsl:otherwise>
  283. </xsl:choose>
  284. </xsl:template>
  285. <!-- ==================================================================== -->
  286. <doc:template name="get.refentry.date" xmlns="">
  287. <refpurpose>Gets date metadata for a refentry</refpurpose>
  288. <refdescription>
  289. <para>The <literal>man(7)</literal> man page describes this as "the
  290. date of the last revision". If we cannot find a date in the source, we
  291. generate one.</para>
  292. </refdescription>
  293. <refparameter>
  294. <variablelist>
  295. <varlistentry>
  296. <term>refname</term>
  297. <listitem>
  298. <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
  299. </listitem>
  300. </varlistentry>
  301. <varlistentry>
  302. <term>info</term>
  303. <listitem>
  304. <para>A set of info nodes (from a <sgmltag>refentry</sgmltag>
  305. element and its ancestors)</para>
  306. </listitem>
  307. </varlistentry>
  308. <varlistentry>
  309. <term>prefs</term>
  310. <listitem>
  311. <para>A node containing users preferences (from global stylesheet parameters)</para>
  312. </listitem>
  313. </varlistentry>
  314. </variablelist>
  315. </refparameter>
  316. <refreturn><para>Returns a <sgmltag>date</sgmltag> node.</para></refreturn>
  317. </doc:template>
  318. <xsl:template name="get.refentry.date">
  319. <xsl:param name="refname"/>
  320. <xsl:param name="info"/>
  321. <xsl:param name="prefs"/>
  322. <xsl:variable name="Date">
  323. <xsl:choose>
  324. <!-- * if profiling is enabled for date, and the date -->
  325. <!-- * profile is non-empty, use it -->
  326. <xsl:when test="not($prefs/@profileEnabled = 0) and
  327. not($prefs/@profile = '')">
  328. <xsl:call-template name="evaluate.info.profile">
  329. <xsl:with-param name="profile" select="$prefs/@profile"/>
  330. <xsl:with-param name="info" select="$info"/>
  331. </xsl:call-template>
  332. </xsl:when>
  333. <xsl:otherwise>
  334. <!-- * either profiling is not enabled for date, or the-->
  335. <!-- * date profile is empty, so we need to look for date -->
  336. <!-- * in *info -->
  337. <xsl:choose>
  338. <!-- * look for date or pubdate in *info -->
  339. <xsl:when test="$info/date/node()
  340. |$info/pubdate/node()">
  341. <xsl:apply-templates
  342. select="(($info[date])[last()]/date)[1]|
  343. (($info[pubdate])[last()]/pubdate)[1]"/>
  344. </xsl:when>
  345. <xsl:otherwise>
  346. <!-- * found no Date or Pubdate -->
  347. </xsl:otherwise>
  348. </xsl:choose>
  349. </xsl:otherwise>
  350. </xsl:choose>
  351. </xsl:variable>
  352. <xsl:choose>
  353. <xsl:when test="not($Date = '')">
  354. <xsl:value-of select="$Date"/>
  355. </xsl:when>
  356. <!-- * We couldn't find a date, so we generate a date. -->
  357. <!-- * And we make it an appropriately localized date. -->
  358. <xsl:otherwise>
  359. <xsl:if test="$refentry.meta.get.quietly = 0">
  360. <xsl:call-template name="log.message">
  361. <xsl:with-param name="level">Note</xsl:with-param>
  362. <xsl:with-param name="source" select="$refname"/>
  363. <xsl:with-param
  364. name="message"
  365. >meta date : No date. Using generated date</xsl:with-param>
  366. </xsl:call-template>
  367. </xsl:if>
  368. <xsl:call-template name="datetime.format">
  369. <xsl:with-param name="date">
  370. <xsl:choose>
  371. <xsl:when test="function-available('date:date-time')">
  372. <xsl:value-of select="date:date-time()"/>
  373. </xsl:when>
  374. <xsl:when test="function-available('date:dateTime')">
  375. <!-- Xalan quirk -->
  376. <xsl:value-of select="date:dateTime()"/>
  377. </xsl:when>
  378. </xsl:choose>
  379. </xsl:with-param>
  380. <xsl:with-param name="format">
  381. <xsl:call-template name="gentext.template">
  382. <xsl:with-param name="context" select="'datetime'"/>
  383. <xsl:with-param name="name" select="'format'"/>
  384. </xsl:call-template>
  385. </xsl:with-param>
  386. </xsl:call-template>
  387. </xsl:otherwise>
  388. </xsl:choose>
  389. </xsl:template>
  390. <!-- ==================================================================== -->
  391. <doc:template name="get.refentry.source" xmlns="">
  392. <refpurpose>Gets source metadata for a refentry</refpurpose>
  393. <refdescription>
  394. <para>The <literal>man(7)</literal> man page describes this as "the
  395. source of the command", and provides the following examples:
  396. <itemizedlist>
  397. <listitem>
  398. <para>For binaries, use something like: GNU, NET-2, SLS
  399. Distribution, MCC Distribution.</para>
  400. </listitem>
  401. <listitem>
  402. <para>For system calls, use the version of the kernel that you are
  403. currently looking at: Linux 0.99.11.</para>
  404. </listitem>
  405. <listitem>
  406. <para>For library calls, use the source of the function: GNU, BSD
  407. 4.3, Linux DLL 4.4.1.</para>
  408. </listitem>
  409. </itemizedlist>
  410. </para>
  411. <para>The <literal>solbook(5)</literal> man page describes
  412. something very much like what <literal>man(7)</literal> calls
  413. "source", except that <literal>solbook(5)</literal> names it
  414. "software" and describes it like this:
  415. <blockquote>
  416. <para>This is the name of the software product that the topic
  417. discussed on the reference page belongs to. For example UNIX
  418. commands are part of the <literal>SunOS x.x</literal>
  419. release.</para>
  420. </blockquote>
  421. </para>
  422. <para>In practice, there are many pages that simply have a version
  423. number in the "source" field. So, it looks like what we have is a
  424. two-part field,
  425. <replaceable>Name</replaceable>&#160;<replaceable>Version</replaceable>,
  426. where:
  427. <variablelist>
  428. <varlistentry>
  429. <term>Name</term>
  430. <listitem>
  431. <para>product name (e.g., BSD) or org. name (e.g., GNU)</para>
  432. </listitem>
  433. </varlistentry>
  434. <varlistentry>
  435. <term>Version</term>
  436. <listitem>
  437. <para>version name</para>
  438. </listitem>
  439. </varlistentry>
  440. </variablelist>
  441. Each part is optional. If the <replaceable>Name</replaceable> is a
  442. product name, then the <replaceable>Version</replaceable> is probably
  443. the version of the product. Or there may be no
  444. <replaceable>Name</replaceable>, in which case, if there is a
  445. <replaceable>Version</replaceable>, it is probably the version of the
  446. item itself, not the product it is part of. Or, if the
  447. <replaceable>Name</replaceable> is an organization name, then there
  448. probably will be no <replaceable>Version</replaceable>.
  449. </para>
  450. </refdescription>
  451. <refparameter>
  452. <variablelist>
  453. <varlistentry>
  454. <term>refname</term>
  455. <listitem>
  456. <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
  457. </listitem>
  458. </varlistentry>
  459. <varlistentry>
  460. <term>info</term>
  461. <listitem>
  462. <para>A set of info nodes (from a <sgmltag>refentry</sgmltag>
  463. element and its ancestors)</para>
  464. </listitem>
  465. </varlistentry>
  466. <varlistentry>
  467. <term>prefs</term>
  468. <listitem>
  469. <para>A node containing users preferences (from global
  470. stylesheet parameters)</para>
  471. </listitem>
  472. </varlistentry>
  473. </variablelist>
  474. </refparameter>
  475. <refreturn><para>Returns a <sgmltag>source</sgmltag> node.</para></refreturn>
  476. </doc:template>
  477. <xsl:template name="get.refentry.source">
  478. <xsl:param name="refname"/>
  479. <xsl:param name="info"/>
  480. <xsl:param name="prefs"/>
  481. <xsl:variable name="Name">
  482. <xsl:if test="$prefs/Name/@suppress = 0">
  483. <xsl:call-template name="get.refentry.source.name">
  484. <xsl:with-param name="info" select="$info"/>
  485. <xsl:with-param name="refname" select="$refname"/>
  486. <xsl:with-param name="prefs" select="$prefs/Name"/>
  487. </xsl:call-template>
  488. </xsl:if>
  489. </xsl:variable>
  490. <xsl:variable name="Version">
  491. <xsl:if test="$prefs/Version/@suppress = 0">
  492. <xsl:call-template name="get.refentry.version">
  493. <xsl:with-param name="info" select="$info"/>
  494. <xsl:with-param name="refname" select="$refname"/>
  495. <xsl:with-param name="prefs" select="$prefs/Version"/>
  496. </xsl:call-template>
  497. </xsl:if>
  498. </xsl:variable>
  499. <xsl:choose>
  500. <!-- * if we have a Name and/or Version, use either or both -->
  501. <!-- * of those, in the form "Name Version" or just "Name" -->
  502. <!-- * or just "Version" -->
  503. <xsl:when test="not($Name = '') or not($Version = '')">
  504. <xsl:choose>
  505. <xsl:when test="not($Name = '') and not($Version = '')">
  506. <xsl:copy-of select="$Name"/>
  507. <xsl:text> </xsl:text>
  508. </xsl:when>
  509. <xsl:otherwise>
  510. <xsl:copy-of select="$Name"/>
  511. </xsl:otherwise>
  512. </xsl:choose>
  513. <xsl:copy-of select="$Version"/>
  514. </xsl:when>
  515. <!-- * if no Name and no Version, use fallback (if any) -->
  516. <xsl:when test="not($prefs/@fallback = '')">
  517. <xsl:variable name="source.fallback">
  518. <xsl:call-template name="evaluate.info.profile">
  519. <xsl:with-param name="profile" select="$prefs/@fallback"/>
  520. <xsl:with-param name="info" select="$info"/>
  521. </xsl:call-template>
  522. </xsl:variable>
  523. <xsl:choose>
  524. <xsl:when test="not($source.fallback = '')">
  525. <xsl:value-of select="$source.fallback"/>
  526. </xsl:when>
  527. <xsl:otherwise>
  528. <xsl:if test="$refentry.meta.get.quietly = 0">
  529. <xsl:call-template name="log.message">
  530. <xsl:with-param name="level">Warn</xsl:with-param>
  531. <xsl:with-param name="source" select="$refname"/>
  532. <xsl:with-param
  533. name="message"
  534. >meta source : No valid fallback. Leaving empty</xsl:with-param>
  535. </xsl:call-template>
  536. </xsl:if>
  537. </xsl:otherwise>
  538. </xsl:choose>
  539. </xsl:when>
  540. <xsl:otherwise>
  541. <xsl:if test="$refentry.meta.get.quietly = 0">
  542. <xsl:call-template name="log.message">
  543. <xsl:with-param name="level">Warn</xsl:with-param>
  544. <xsl:with-param name="source" select="$refname"/>
  545. <xsl:with-param
  546. name="message"
  547. >meta source : No fallback specified; leaving empty.</xsl:with-param>
  548. </xsl:call-template>
  549. </xsl:if>
  550. </xsl:otherwise>
  551. </xsl:choose>
  552. </xsl:template>
  553. <!-- ==================================================================== -->
  554. <doc:template name="get.refentry.source.name" xmlns="">
  555. <refpurpose>Gets source-name metadata for a refentry</refpurpose>
  556. <refdescription>
  557. <para>A "source name" is one part of a (potentially) two-part
  558. <replaceable>Name</replaceable>&#160;<replaceable>Version</replaceable>
  559. source field. For more details, see the documentation for the
  560. <function>get.refentry.source</function> template.</para>
  561. </refdescription>
  562. <refparameter>
  563. <variablelist>
  564. <varlistentry>
  565. <term>refname</term>
  566. <listitem>
  567. <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
  568. </listitem>
  569. </varlistentry>
  570. <varlistentry>
  571. <term>info</term>
  572. <listitem>
  573. <para>A set of info nodes (from a <sgmltag>refentry</sgmltag>
  574. element and its ancestors)</para>
  575. </listitem>
  576. </varlistentry>
  577. <varlistentry>
  578. <term>prefs</term>
  579. <listitem>
  580. <para>A node containing users preferences (from global
  581. stylesheet parameters)</para>
  582. </listitem>
  583. </varlistentry>
  584. </variablelist>
  585. </refparameter>
  586. <refreturn><para>Depending on what output method is used for the
  587. current stylesheet, either returns a text node or possibly an element
  588. node, containing "source name" data.</para></refreturn>
  589. </doc:template>
  590. <xsl:template name="get.refentry.source.name">
  591. <xsl:param name="refname"/>
  592. <xsl:param name="info"/>
  593. <xsl:param name="prefs"/>
  594. <xsl:choose>
  595. <!-- * if profiling is enabled for source.name, and the -->
  596. <!-- * source.name profile is non-empty, use it -->
  597. <xsl:when test="not($prefs/@profileEnabled = 0) and
  598. not($prefs/@profile = '')">
  599. <xsl:call-template name="evaluate.info.profile">
  600. <xsl:with-param name="profile" select="$prefs/@profile"/>
  601. <xsl:with-param name="info" select="$info"/>
  602. </xsl:call-template>
  603. </xsl:when>
  604. <xsl:otherwise>
  605. <!-- * either profiling for source.name is not enabled, or-->
  606. <!-- * the source.name profile is empty; so we need to look -->
  607. <!-- * for a name to use -->
  608. <xsl:choose>
  609. <xsl:when test="refmeta/refmiscinfo[@class = 'source' or @class = 'software']">
  610. <xsl:apply-templates
  611. select="refmeta/refmiscinfo[@class = 'source' or @class='software'][1]/node()"/>
  612. </xsl:when>
  613. <xsl:otherwise>
  614. <xsl:choose>
  615. <xsl:when test="$info/productname">
  616. <xsl:call-template name="set.refentry.metadata">
  617. <xsl:with-param name="refname" select="$refname"/>
  618. <xsl:with-param
  619. name="info"
  620. select="($info[productname])[last()]"/>
  621. <xsl:with-param
  622. name="contents"
  623. select="(($info[productname])[last()]/productname)[1]"/>
  624. <xsl:with-param name="context">source</xsl:with-param>
  625. </xsl:call-template>
  626. </xsl:when>
  627. <xsl:when test="$info/corpname">
  628. <xsl:call-template name="set.refentry.metadata">
  629. <xsl:with-param name="refname" select="$refname"/>
  630. <xsl:with-param
  631. name="info"
  632. select="($info[corpname])[last()]"/>
  633. <xsl:with-param
  634. name="contents"
  635. select="(($info[corpname])[last()]/corpname)[1]"/>
  636. <xsl:with-param name="context">source</xsl:with-param>
  637. <xsl:with-param name="preferred">productname</xsl:with-param>
  638. </xsl:call-template>
  639. </xsl:when>
  640. <xsl:when test="$info/corpcredit">
  641. <xsl:call-template name="set.refentry.metadata">
  642. <xsl:with-param name="refname" select="$refname"/>
  643. <xsl:with-param
  644. name="info"
  645. select="($info[corpcredit])[last()]"/>
  646. <xsl:with-param
  647. name="contents"
  648. select="(($info[corpcredit])[last()]/corpcredit)[1]"/>
  649. <xsl:with-param name="context">source</xsl:with-param>
  650. <xsl:with-param name="preferred">productname</xsl:with-param>
  651. </xsl:call-template>
  652. </xsl:when>
  653. <xsl:when test="$info/corpauthor">
  654. <xsl:call-template name="set.refentry.metadata">
  655. <xsl:with-param name="refname" select="$refname"/>
  656. <xsl:with-param
  657. name="info"
  658. select="($info[corpauthor])[last()]"/>
  659. <xsl:with-param
  660. name="contents"
  661. select="(($info[corpauthor])[last()]/corpauthor)[1]"/>
  662. <xsl:with-param name="context">source</xsl:with-param>
  663. <xsl:with-param name="preferred">productname</xsl:with-param>
  664. </xsl:call-template>
  665. </xsl:when>
  666. <xsl:when test="$info//orgname">
  667. <xsl:call-template name="set.refentry.metadata">
  668. <xsl:with-param name="refname" select="$refname"/>
  669. <xsl:with-param
  670. name="info"
  671. select="($info[//orgname])[last()]"/>
  672. <xsl:with-param
  673. name="contents"
  674. select="(($info[//orgname])[last()]//orgname)[1]"/>
  675. <xsl:with-param name="context">source</xsl:with-param>
  676. <xsl:with-param name="preferred">productname</xsl:with-param>
  677. </xsl:call-template>
  678. </xsl:when>
  679. <xsl:when test="$info//publishername">
  680. <xsl:call-template name="set.refentry.metadata">
  681. <xsl:with-param name="refname" select="$refname"/>
  682. <xsl:with-param
  683. name="info"
  684. select="($info[//publishername])[last()]"/>
  685. <xsl:with-param
  686. name="contents"
  687. select="(($info[//publishername])[last()]//publishername)[1]"/>
  688. <xsl:with-param name="context">source</xsl:with-param>
  689. <xsl:with-param name="preferred">productname</xsl:with-param>
  690. </xsl:call-template>
  691. </xsl:when>
  692. <xsl:otherwise>
  693. <xsl:if test="$refentry.meta.get.quietly = 0">
  694. <xsl:call-template name="log.message">
  695. <xsl:with-param name="level">Note</xsl:with-param>
  696. <xsl:with-param name="source" select="$refname"/>
  697. <xsl:with-param
  698. name="message"
  699. >meta source : No productname or alternative</xsl:with-param>
  700. </xsl:call-template>
  701. <xsl:call-template name="log.message">
  702. <xsl:with-param name="level">Note</xsl:with-param>
  703. <xsl:with-param name="source" select="$refname"/>
  704. <xsl:with-param
  705. name="message"
  706. >meta source : No refmiscinfo@class=source</xsl:with-param>
  707. </xsl:call-template>
  708. </xsl:if>
  709. </xsl:otherwise>
  710. </xsl:choose>
  711. </xsl:otherwise>
  712. </xsl:choose>
  713. </xsl:otherwise>
  714. </xsl:choose>
  715. </xsl:template>
  716. <!-- ==================================================================== -->
  717. <doc:template name="get.refentry.version" xmlns="">
  718. <refpurpose>Gets version metadata for a refentry</refpurpose>
  719. <refdescription>
  720. <para>A "version" is one part of a (potentially) two-part
  721. <replaceable>Name</replaceable>&#160;<replaceable>Version</replaceable>
  722. source field. For more details, see the documentation for the
  723. <function>get.refentry.source</function> template.</para>
  724. </refdescription>
  725. <refparameter>
  726. <variablelist>
  727. <varlistentry>
  728. <term>refname</term>
  729. <listitem>
  730. <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
  731. </listitem>
  732. </varlistentry>
  733. <varlistentry>
  734. <term>info</term>
  735. <listitem>
  736. <para>A set of info nodes (from a <sgmltag>refentry</sgmltag>
  737. element and its ancestors)</para>
  738. </listitem>
  739. </varlistentry>
  740. <varlistentry>
  741. <term>prefs</term>
  742. <listitem>
  743. <para>A node containing users preferences (from global
  744. stylesheet parameters)</para>
  745. </listitem>
  746. </varlistentry>
  747. </variablelist>
  748. </refparameter>
  749. <refreturn><para>Depending on what output method is used for the
  750. current stylesheet, either returns a text node or possibly an element
  751. node, containing "version" data.</para></refreturn>
  752. </doc:template>
  753. <xsl:template name="get.refentry.version">
  754. <xsl:param name="refname"/>
  755. <xsl:param name="info"/>
  756. <xsl:param name="prefs"/>
  757. <xsl:choose>
  758. <!-- * if profiling is enabled for version, and the -->
  759. <!-- * version profile is non-empty, use it -->
  760. <xsl:when test="not($prefs/@profileEnabled = 0) and
  761. not($prefs/@profile = '')">
  762. <xsl:call-template name="evaluate.info.profile">
  763. <xsl:with-param name="profile" select="$prefs/@profile"/>
  764. <xsl:with-param name="info" select="$info"/>
  765. </xsl:call-template>
  766. </xsl:when>
  767. <xsl:otherwise>
  768. <!-- * either profiling for source.name is not enabled, or-->
  769. <!-- * the source.name profile is empty; so we need to look -->
  770. <!-- * for a name to use -->
  771. <xsl:choose>
  772. <xsl:when test="refmeta/refmiscinfo[@class = 'version']">
  773. <xsl:apply-templates
  774. select="refmeta/refmiscinfo[@class = 'version'][1]/node()"/>
  775. </xsl:when>
  776. <xsl:otherwise>
  777. <xsl:choose>
  778. <xsl:when test="$info/productnumber">
  779. <xsl:call-template name="set.refentry.metadata">
  780. <xsl:with-param name="refname" select="$refname"/>
  781. <xsl:with-param
  782. name="info"
  783. select="($info[productnumber])[last()]"/>
  784. <xsl:with-param
  785. name="contents"
  786. select="(($info[productnumber])[last()]/productnumber)[1]"/>
  787. <xsl:with-param name="context">version</xsl:with-param>
  788. </xsl:call-template>
  789. </xsl:when>
  790. <xsl:when test="$info/edition">
  791. <xsl:call-template name="set.refentry.metadata">
  792. <xsl:with-param name="refname" select="$refname"/>
  793. <xsl:with-param
  794. name="info"
  795. select="($info[edition])[last()]"/>
  796. <xsl:with-param
  797. name="contents"
  798. select="(($info[edition])[last()]/edition)[1]"/>
  799. <xsl:with-param name="context">version</xsl:with-param>
  800. <xsl:with-param name="preferred">productnumber</xsl:with-param>
  801. </xsl:call-template>
  802. </xsl:when>
  803. <xsl:when test="$info/releaseinfo">
  804. <xsl:call-template name="set.refentry.metadata">
  805. <xsl:with-param name="refname" select="$refname"/>
  806. <xsl:with-param
  807. name="info"
  808. select="($info[releaseinfo])[last()]"/>
  809. <xsl:with-param
  810. name="contents"
  811. select="(($info[releaseinfo])[last()]/releaseinfo)[1]"/>
  812. <xsl:with-param name="context">version</xsl:with-param>
  813. <xsl:with-param name="preferred">productnumber</xsl:with-param>
  814. </xsl:call-template>
  815. </xsl:when>
  816. <xsl:otherwise>
  817. <xsl:if test="$refentry.meta.get.quietly = 0">
  818. <xsl:call-template name="log.message">
  819. <xsl:with-param name="level">Note</xsl:with-param>
  820. <xsl:with-param name="source" select="$refname"/>
  821. <xsl:with-param
  822. name="message"
  823. >meta version: No productnumber or alternative</xsl:with-param>
  824. </xsl:call-template>
  825. <xsl:call-template name="log.message">
  826. <xsl:with-param name="level">Note</xsl:with-param>
  827. <xsl:with-param name="source" select="$refname"/>
  828. <xsl:with-param
  829. name="message"
  830. >meta version: No refmiscinfo@class=version</xsl:with-param>
  831. </xsl:call-template>
  832. </xsl:if>
  833. </xsl:otherwise>
  834. </xsl:choose>
  835. </xsl:otherwise>
  836. </xsl:choose>
  837. </xsl:otherwise>
  838. </xsl:choose>
  839. </xsl:template>
  840. <!-- ==================================================================== -->
  841. <doc:template name="get.refentry.manual" xmlns="">
  842. <refpurpose>Gets source metadata for a refentry</refpurpose>
  843. <refdescription>
  844. <para>The <literal>man(7)</literal> man page describes this as "the
  845. title of the manual (e.g., <citetitle>Linux Programmer's
  846. Manual</citetitle>)". Here are some examples from existing man pages:
  847. <itemizedlist>
  848. <listitem>
  849. <para><citetitle>dpkg utilities</citetitle>
  850. (<command>dpkg-name</command>)</para>
  851. </listitem>
  852. <listitem>
  853. <para><citetitle>User Contributed Perl Documentation</citetitle>
  854. (<command>GET</command>)</para>
  855. </listitem>
  856. <listitem>
  857. <para><citetitle>GNU Development Tools</citetitle>
  858. (<command>ld</command>)</para>
  859. </listitem>
  860. <listitem>
  861. <para><citetitle>Emperor Norton Utilities</citetitle>
  862. (<command>ddate</command>)</para>
  863. </listitem>
  864. <listitem>
  865. <para><citetitle>Debian GNU/Linux manual</citetitle>
  866. (<command>faked</command>)</para>
  867. </listitem>
  868. <listitem>
  869. <para><citetitle>GIMP Manual Pages</citetitle>
  870. (<command>gimp</command>)</para>
  871. </listitem>
  872. <listitem>
  873. <para><citetitle>KDOC Documentation System</citetitle>
  874. (<command>qt2kdoc</command>)</para>
  875. </listitem>
  876. </itemizedlist>
  877. </para>
  878. <para>The <literal>solbook(5)</literal> man page describes
  879. something very much like what <literal>man(7)</literal> calls
  880. "manual", except that <literal>solbook(5)</literal> names it
  881. "sectdesc" and describes it like this:
  882. <blockquote>
  883. <para>This is the section title of the reference page; for
  884. example <literal>User Commands</literal>.</para>
  885. </blockquote>
  886. </para>
  887. </refdescription>
  888. <refparameter>
  889. <variablelist>
  890. <varlistentry>
  891. <term>refname</term>
  892. <listitem>
  893. <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
  894. </listitem>
  895. </varlistentry>
  896. <varlistentry>
  897. <term>info</term>
  898. <listitem>
  899. <para>A set of info nodes (from a <sgmltag>refentry</sgmltag>
  900. element and its ancestors)</para>
  901. </listitem>
  902. </varlistentry>
  903. <varlistentry>
  904. <term>prefs</term>
  905. <listitem>
  906. <para>A node containing users preferences (from global
  907. stylesheet parameters)</para>
  908. </listitem>
  909. </varlistentry>
  910. </variablelist>
  911. </refparameter>
  912. <refreturn><para>Returns a <sgmltag>manual</sgmltag> node.</para></refreturn>
  913. </doc:template>
  914. <xsl:template name="get.refentry.manual">
  915. <xsl:param name="refname"/>
  916. <xsl:param name="info"/>
  917. <xsl:param name="prefs"/>
  918. <xsl:variable name="Manual">
  919. <xsl:choose>
  920. <!-- * if profiling is enabled for manual, and the manual -->
  921. <!-- * profile is non-empty, use it -->
  922. <xsl:when test="not($prefs/@profileEnabled = 0) and
  923. not($prefs/@profile = '')">
  924. <xsl:call-template name="evaluate.info.profile">
  925. <xsl:with-param name="profile" select="$prefs/@profile"/>
  926. <xsl:with-param name="info" select="$info"/>
  927. </xsl:call-template>
  928. </xsl:when>
  929. <xsl:otherwise>
  930. <xsl:choose>
  931. <xsl:when test="refmeta/refmiscinfo[@class = 'manual' or @class = 'sectdesc']">
  932. <xsl:apply-templates
  933. select="refmeta/refmiscinfo[@class = 'manual' or @class = 'sectdesc'][1]/node()"/>
  934. </xsl:when>
  935. <xsl:otherwise>
  936. <!-- * only in the case of choosing appropriate -->
  937. <!-- * "manual" content do we select the furthest -->
  938. <!-- * (first) matching element instead of the -->
  939. <!-- * closest (last) matching one -->
  940. <xsl:choose>
  941. <xsl:when test="ancestor::*/title">
  942. <xsl:call-template name="set.refentry.metadata">
  943. <xsl:with-param name="refname" select="$refname"/>
  944. <xsl:with-param
  945. name="info"
  946. select="(ancestor::*[title])[1]"/>
  947. <xsl:with-param
  948. name="contents"
  949. select="(ancestor::*[title])[1]/title"/>
  950. <xsl:with-param name="context">manual</xsl:with-param>
  951. </xsl:call-template>
  952. </xsl:when>
  953. <xsl:when test="$info/title">
  954. <xsl:call-template name="set.refentry.metadata">
  955. <xsl:with-param name="refname" select="$refname"/>
  956. <xsl:with-param
  957. name="info"
  958. select="($info[title])[1]"/>
  959. <xsl:with-param
  960. name="contents"
  961. select="(($info[title])[1]/title)[1]"/>
  962. <xsl:with-param name="context">manual</xsl:with-param>
  963. </xsl:call-template>
  964. </xsl:when>
  965. <xsl:otherwise>
  966. <xsl:if test="$refentry.meta.get.quietly = 0">
  967. <xsl:call-template name="log.message">
  968. <xsl:with-param name="level">Note</xsl:with-param>
  969. <xsl:with-param name="source" select="$refname"/>
  970. <xsl:with-param
  971. name="message"
  972. >meta manual : No ancestor with title</xsl:with-param>
  973. </xsl:call-template>
  974. <xsl:call-template name="log.message">
  975. <xsl:with-param name="level">Note</xsl:with-param>
  976. <xsl:with-param name="source" select="$refname"/>
  977. <xsl:with-param
  978. name="message"
  979. >meta manual : No refmiscinfo@class=manual</xsl:with-param>
  980. </xsl:call-template>
  981. </xsl:if>
  982. </xsl:otherwise>
  983. </xsl:choose>
  984. </xsl:otherwise>
  985. </xsl:choose>
  986. </xsl:otherwise>
  987. </xsl:choose>
  988. </xsl:variable>
  989. <xsl:choose>
  990. <xsl:when test="not($Manual = '')">
  991. <xsl:copy-of select="$Manual"/>
  992. </xsl:when>
  993. <!-- * if no Manual, use contents of specified Fallback (if any) -->
  994. <xsl:when test="not($prefs/@fallback = '')">
  995. <xsl:variable name="manual.fallback">
  996. <xsl:call-template name="evaluate.info.profile">
  997. <xsl:with-param name="profile" select="$prefs/@fallback"/>
  998. <xsl:with-param name="info" select="$info"/>
  999. </xsl:call-template>
  1000. </xsl:variable>
  1001. <xsl:choose>
  1002. <xsl:when test="not($manual.fallback = '')">
  1003. <xsl:value-of select="$manual.fallback"/>
  1004. </xsl:when>
  1005. <xsl:otherwise>
  1006. <xsl:if test="$refentry.meta.get.quietly = 0">
  1007. <xsl:call-template name="log.message">
  1008. <xsl:with-param name="level">Warn</xsl:with-param>
  1009. <xsl:with-param name="source" select="$refname"/>
  1010. <xsl:with-param
  1011. name="message"
  1012. >meta manual : No valid fallback. Leaving empty</xsl:with-param>
  1013. </xsl:call-template>
  1014. </xsl:if>
  1015. </xsl:otherwise>
  1016. </xsl:choose>
  1017. </xsl:when>
  1018. <xsl:otherwise>
  1019. <xsl:if test="$refentry.meta.get.quietly = 0">
  1020. <xsl:call-template name="log.message">
  1021. <xsl:with-param name="level">Warn</xsl:with-param>
  1022. <xsl:with-param name="source" select="$refname"/>
  1023. <xsl:with-param
  1024. name="message"
  1025. >meta manual : No fallback specified; leaving empty.</xsl:with-param>
  1026. </xsl:call-template>
  1027. </xsl:if>
  1028. </xsl:otherwise>
  1029. </xsl:choose>
  1030. </xsl:template>
  1031. <!-- ====================================================================== -->
  1032. <doc:template name="get.refentry.metadata.prefs" xmlns="">
  1033. <refpurpose>Gets user preferences for refentry metadata gathering</refpurpose>
  1034. <refdescription>
  1035. <para>The DocBook XSL stylesheets include several user-configurable
  1036. global stylesheet parameters for controlling <sgmltag>refentry</sgmltag>
  1037. metadata gathering. Those parameters are not read directly by the
  1038. other <sgmltag>refentry</sgmltag> metadata-gathering functions. Instead, they
  1039. are read only by the <function>get.refentry.metadata.prefs</function>
  1040. function, which assembles them into a structure that is then passed to
  1041. the other <sgmltag>refentry</sgmltag> metadata-gathering functions.</para>
  1042. <para>So the, <function>get.refentry.metadata.prefs</function>
  1043. function is the only interface to collecting stylesheet parameters for
  1044. controlling <sgmltag>refentry</sgmltag> metadata gathering.</para>
  1045. </refdescription>
  1046. <refparameter>
  1047. <para>There are no local parameters for this function; however, it
  1048. does rely on a number of global parameters.</para>
  1049. </refparameter>
  1050. <refreturn><para>Returns a <sgmltag>manual</sgmltag> node.</para></refreturn>
  1051. </doc:template>
  1052. <xsl:template name="get.refentry.metadata.prefs">
  1053. <DatePrefs>
  1054. <xsl:attribute name="profile">
  1055. <xsl:value-of select="$refentry.date.profile"/>
  1056. </xsl:attribute>
  1057. <xsl:attribute name="profileEnabled">
  1058. <xsl:value-of select="$refentry.date.profile.enabled"/>
  1059. </xsl:attribute>
  1060. </DatePrefs>
  1061. <SourcePrefs>
  1062. <xsl:attribute name="fallback">
  1063. <xsl:value-of select="$refentry.source.fallback.profile"/>
  1064. </xsl:attribute>
  1065. <Name>
  1066. <xsl:attribute name="profile">
  1067. <xsl:value-of select="$refentry.source.name.profile"/>
  1068. </xsl:attribute>
  1069. <xsl:attribute name="profileEnabled">
  1070. <xsl:value-of select="$refentry.source.name.profile.enabled"/>
  1071. </xsl:attribute>
  1072. <xsl:attribute name="suppress">
  1073. <xsl:value-of select="$refentry.source.name.suppress"/>
  1074. </xsl:attribute>
  1075. </Name>
  1076. <Version>
  1077. <xsl:attribute name="profile">
  1078. <xsl:value-of select="$refentry.version.profile"/>
  1079. </xsl:attribute>
  1080. <xsl:attribute name="profileEnabled">
  1081. <xsl:value-of select="$refentry.version.profile.enabled"/>
  1082. </xsl:attribute>
  1083. <xsl:attribute name="suppress">
  1084. <xsl:value-of select="$refentry.version.suppress"/>
  1085. </xsl:attribute>
  1086. </Version>
  1087. </SourcePrefs>
  1088. <ManualPrefs>
  1089. <xsl:attribute name="fallback">
  1090. <xsl:value-of select="$refentry.manual.fallback.profile"/>
  1091. </xsl:attribute>
  1092. <xsl:attribute name="profile">
  1093. <xsl:value-of select="$refentry.manual.profile"/>
  1094. </xsl:attribute>
  1095. <xsl:attribute name="profileEnabled">
  1096. <xsl:value-of select="$refentry.manual.profile.enabled"/>
  1097. </xsl:attribute>
  1098. </ManualPrefs>
  1099. </xsl:template>
  1100. <!-- ====================================================================== -->
  1101. <doc:template name="set.refentry.metadata" xmlns="">
  1102. <refpurpose>Sets content of a refentry metadata item</refpurpose>
  1103. <refdescription>
  1104. <para>The <function>set.refentry.metadata</function> function is
  1105. called each time a suitable source element is found for a certain
  1106. metadata field.</para>
  1107. </refdescription>
  1108. <refparameter>
  1109. <variablelist>
  1110. <varlistentry>
  1111. <term>refname</term>
  1112. <listitem>
  1113. <para>The first <sgmltag>refname</sgmltag> in the refentry</para>
  1114. </listitem>
  1115. </varlistentry>
  1116. <varlistentry>
  1117. <term>info</term>
  1118. <listitem>
  1119. <para>A single *info node that contains the selected source element.</para>
  1120. </listitem>
  1121. </varlistentry>
  1122. <varlistentry>
  1123. <term>contents</term>
  1124. <listitem>
  1125. <para>A node containing the selected source element.</para>
  1126. </listitem>
  1127. </varlistentry>
  1128. <varlistentry>
  1129. <term>context</term>
  1130. <listitem>
  1131. <para>A string describing the metadata context in which the
  1132. <function>set.refentry.metadata</function> function was
  1133. called: either "date", "source", "version", or "manual".</para>
  1134. </listitem>
  1135. </varlistentry>
  1136. </variablelist>
  1137. </refparameter>
  1138. <refreturn>
  1139. <para>Returns formatted contents of a selected source element.</para></refreturn>
  1140. </doc:template>
  1141. <xsl:template name="set.refentry.metadata">
  1142. <xsl:param name="refname"/>
  1143. <xsl:param name="info"/>
  1144. <xsl:param name="contents"/>
  1145. <xsl:param name="context"/>
  1146. <xsl:param name="preferred"/>
  1147. <xsl:if test="not($preferred = '')">
  1148. <xsl:if test="$refentry.meta.get.quietly = 0">
  1149. <xsl:call-template name="log.message">
  1150. <xsl:with-param name="level">Note</xsl:with-param>
  1151. <xsl:with-param name="source" select="$refname"/>
  1152. <xsl:with-param
  1153. name="message"
  1154. >meta <xsl:value-of
  1155. select="$context"/><xsl:call-template
  1156. name="copy-string">
  1157. <xsl:with-param name="string" select="'&#x20;'"/>
  1158. <xsl:with-param
  1159. name="count"
  1160. select="7 - string-length($context)"/>
  1161. </xsl:call-template>: No <xsl:value-of select="$preferred"
  1162. /></xsl:with-param>
  1163. </xsl:call-template>
  1164. <xsl:call-template name="log.message">
  1165. <xsl:with-param name="level">Note</xsl:with-param>
  1166. <xsl:with-param name="source" select="$refname"/>
  1167. <xsl:with-param
  1168. name="message"
  1169. >meta <xsl:value-of
  1170. select="$context"/><xsl:call-template
  1171. name="copy-string">
  1172. <xsl:with-param name="string" select="'&#x20;'"/>
  1173. <xsl:with-param
  1174. name="count"
  1175. select="7 - string-length($context)"/>
  1176. </xsl:call-template>: No refmiscinfo@class=<xsl:value-of
  1177. select="$context"/></xsl:with-param>
  1178. </xsl:call-template>
  1179. <xsl:call-template name="log.message">
  1180. <xsl:with-param name="level">Note</xsl:with-param>
  1181. <xsl:with-param name="source" select="$refname"/>
  1182. <xsl:with-param
  1183. name="message"
  1184. >meta <xsl:value-of
  1185. select="$context"/><xsl:call-template
  1186. name="copy-string">
  1187. <xsl:with-param name="string" select="'&#x20;'"/>
  1188. <xsl:with-param
  1189. name="count"
  1190. select="7 - string-length($context)"/>
  1191. </xsl:call-template>: Using <xsl:value-of
  1192. select="local-name($contents)"/></xsl:with-param>
  1193. </xsl:call-template>
  1194. </xsl:if>
  1195. </xsl:if>
  1196. <xsl:value-of select="$contents"/>
  1197. </xsl:template>
  1198. </xsl:stylesheet>