]> granicus.if.org Git - docbook-dsssl/commitdiff
Implemented capability for users to customize "refentry metadata
authorMichael Smith <xmldoc@users.sourceforge.net>
Tue, 5 Jul 2005 09:19:17 +0000 (09:19 +0000)
committerMichael Smith <xmldoc@users.sourceforge.net>
Tue, 5 Jul 2005 09:19:17 +0000 (09:19 +0000)
gathering" by specifying XPath expressions to use as "info
profiles" for gathering the data, and, in some cases, to suppress
parts of the data collected.

xsl/manpages/param.ent
xsl/manpages/param.xweb
xsl/params/refentry.date.profile.xml [new file with mode: 0644]
xsl/params/refentry.manual.fallback.profile.xml [new file with mode: 0644]
xsl/params/refentry.manual.profile.xml [new file with mode: 0644]
xsl/params/refentry.source.fallback.profile.xml [new file with mode: 0644]
xsl/params/refentry.source.name.profile.xml [new file with mode: 0644]
xsl/params/refentry.source.name.suppress.xml
xsl/params/refentry.version.profile.xml [new file with mode: 0644]
xsl/params/refentry.version.suppress.xml

index def66b94cb2069002245a645b7ce49c562cd9eba..577ec4458944f60c218f5150738596b8305807e4 100644 (file)
@@ -17,3 +17,9 @@
 <!ENTITY refentry.version.profile.enabled SYSTEM "../params/refentry.version.profile.enabled.xml">
 <!ENTITY refentry.source.name.suppress SYSTEM "../params/refentry.source.name.suppress.xml">
 <!ENTITY refentry.version.suppress SYSTEM "../params/refentry.version.suppress.xml">
+<!ENTITY refentry.date.profile SYSTEM "../params/refentry.date.profile.xml">
+<!ENTITY refentry.manual.fallback.profile SYSTEM "../params/refentry.manual.fallback.profile.xml">
+<!ENTITY refentry.manual.profile SYSTEM "../params/refentry.manual.profile.xml">
+<!ENTITY refentry.source.fallback.profile SYSTEM "../params/refentry.source.fallback.profile.xml">
+<!ENTITY refentry.source.name.profile SYSTEM "../params/refentry.source.name.profile.xml">
+<!ENTITY refentry.version.profile SYSTEM "../params/refentry.version.profile.xml">
index 55779ab0a648fce990efaf48766724efcbf1019f..c90e75043ef0ca566eb858cf7bcc50a511d47e3c 100644 (file)
   </reference>
   <reference id="charmap">
   <title>Refentry metadata gathering</title>
+&refentry.date.profile;
 &refentry.date.profile.enabled;
+&refentry.manual.profile;
 &refentry.manual.profile.enabled;
-&refentry.source.name.profile.enabled;
-&refentry.version.profile.enabled;
 &refentry.source.name.suppress;
+&refentry.source.name.profile;
+&refentry.source.name.profile.enabled;
 &refentry.version.suppress;
+&refentry.version.profile;
+&refentry.version.profile.enabled;
+&refentry.manual.fallback.profile;
+&refentry.source.fallback.profile;
   </reference>
   <appendix id="stylesheet">
     <title>The Stylesheet</title>
 <src:fragref linkend="refentry.version.profile.enabled.frag"/>
 <src:fragref linkend="refentry.source.name.suppress.frag"/>
 <src:fragref linkend="refentry.version.suppress.frag"/>
+<src:fragref linkend="refentry.date.profile.frag"/>
+<src:fragref linkend="refentry.manual.fallback.profile.frag"/>
+<src:fragref linkend="refentry.manual.profile.frag"/>
+<src:fragref linkend="refentry.source.fallback.profile.frag"/>
+<src:fragref linkend="refentry.source.name.profile.frag"/>
+<src:fragref linkend="refentry.version.profile.frag"/>
 </xsl:stylesheet>
     </src:fragment>
 
diff --git a/xsl/params/refentry.date.profile.xml b/xsl/params/refentry.date.profile.xml
new file mode 100644 (file)
index 0000000..96acfcc
--- /dev/null
@@ -0,0 +1,35 @@
+<refentry id="refentry.date.profile">
+<refmeta>
+<refentrytitle>refentry.date.profile</refentrytitle>
+<refmiscinfo role="type">string</refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>refentry.date.profile</refname>
+<refpurpose>Specifies profile for refentry "date" data</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<src:fragment id='refentry.date.profile.frag'>
+<xsl:param name="refentry.date.profile">
+  ($info/date
+  |$info/pubdate
+  |$parentinfo/date
+  |$parentinfo/pubdate)[1]/node()
+</xsl:param>
+</src:fragment>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>The value of <parameter>refentry.date.profile</parameter> is a
+string representing an XPath expression. It is evaluated at run-time
+and used only if <parameter>refentry.date.profile.enabled</parameter>
+is non-zero. Otherwise, the <tag>refentry</tag> metadata-gathering
+logic "hard coded" into the stylesheets is used.</para>
+
+<para> The <literal>man(7)</literal> man page describes this content
+as "the date of the last revision". In man pages, it is the content
+that is usually displayed in the center footer.</para>
+
+</refsect1>
+</refentry>
diff --git a/xsl/params/refentry.manual.fallback.profile.xml b/xsl/params/refentry.manual.fallback.profile.xml
new file mode 100644 (file)
index 0000000..ce13742
--- /dev/null
@@ -0,0 +1,43 @@
+<refentry id="refentry.manual.fallback.profile">
+<refmeta>
+<refentrytitle>refentry.manual.fallback.profile</refentrytitle>
+<refmiscinfo role="type">string</refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>refentry.manual.fallback.profile</refname>
+<refpurpose>Specifies profile of "fallback" for refentry "manual" data</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<src:fragment id='refentry.manual.fallback.profile.frag'>
+<xsl:param name="refentry.manual.fallback.profile">
+refmeta/refmiscinfo[1]/node()</xsl:param>
+</src:fragment>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>The value of
+<parameter>refentry.manual.fallback.profile</parameter> is a string
+representing an XPath expression. It is evaluated at run-time and
+used only if no "manual" data can be found by other means (that is,
+either using the <tag>refentry</tag> metadata-gathering logic "hard
+coded" in the stylesheets, or the value of
+<parameter>refentry.manual.profile</parameter>, if it is
+enabled).</para>
+
+<important>
+<para>Depending on which XSLT engine you run, either the EXSLT
+<function>dyn:evaluate</function> extension function (for xsltproc or
+Xalan) or <function>saxon:evaluate</function> extension function (for
+Saxon) are used to dynamically evaluate the value of
+<parameter>refentry.manual.fallback.profile</parameter> at
+run-time. If you don't use xsltproc, Saxon, Xalan -- or some other
+XSLT engine that supports <function>dyn:evaluate</function> -- you
+must manually disable fallback processing by setting an empty value
+for the <parameter>refentry.manual.fallback.profile</parameter>
+parameter.</para>
+</important>
+
+</refsect1>
+</refentry>
diff --git a/xsl/params/refentry.manual.profile.xml b/xsl/params/refentry.manual.profile.xml
new file mode 100644 (file)
index 0000000..33575f9
--- /dev/null
@@ -0,0 +1,67 @@
+<refentry id="refentry.manual.profile">
+<refmeta>
+<refentrytitle>refentry.manual.profile</refentrytitle>
+<refmiscinfo role="type">string</refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>refentry.manual.profile</refname>
+<refpurpose>Specifies profile for refentry "manual" data</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<src:fragment id='refentry.manual.profile.frag'>
+<xsl:param name="refentry.manual.profile">
+  ($parentinfo/title
+  |../title)[1]/node()
+</xsl:param>
+</src:fragment>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>The value of <parameter>refentry.manual.profile</parameter> is
+a string representing an XPath expression. It is evaluated at
+run-time and used only if
+<parameter>refentry.manual.profile.enabled</parameter> is
+non-zero. Otherwise, the <tag>refentry</tag> metadata-gathering logic
+"hard coded" into the stylesheets is used.</para>
+
+<para>In man pages, this content is usually displayed in the middle of
+the header of the page. The <literal>man(7)</literal> man page
+describes this as "the title of the manual (e.g., <citetitle>Linux
+Programmer's Manual</citetitle>)". Here are some examples from
+existing man pages:
+<itemizedlist>
+  <listitem>
+    <para><citetitle>dpkg utilities</citetitle>
+    (<command>dpkg-name</command>)</para>
+  </listitem>
+  <listitem>
+    <para><citetitle>User Contributed Perl Documentation</citetitle>
+    (<command>GET</command>)</para>
+  </listitem>
+  <listitem>
+    <para><citetitle>GNU Development Tools</citetitle>
+    (<command>ld</command>)</para>
+  </listitem>
+  <listitem>
+    <para><citetitle>Emperor Norton Utilities</citetitle>
+    (<command>ddate</command>)</para>
+  </listitem>
+  <listitem>
+    <para><citetitle>Debian GNU/Linux manual</citetitle>
+    (<command>faked</command>)</para>
+  </listitem>
+  <listitem>
+    <para><citetitle>GIMP Manual Pages</citetitle>
+    (<command>gimp</command>)</para>
+  </listitem>
+  <listitem>
+    <para><citetitle>KDOC Documentation System</citetitle>
+    (<command>qt2kdoc</command>)</para>
+  </listitem>
+</itemizedlist>
+</para>
+
+</refsect1>
+</refentry>
diff --git a/xsl/params/refentry.source.fallback.profile.xml b/xsl/params/refentry.source.fallback.profile.xml
new file mode 100644 (file)
index 0000000..d574ff5
--- /dev/null
@@ -0,0 +1,44 @@
+<refentry id="refentry.source.fallback.profile">
+<refmeta>
+<refentrytitle>refentry.source.fallback.profile</refentrytitle>
+<refmiscinfo role="type">string</refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>refentry.source.fallback.profile</refname>
+<refpurpose>Specifies profile of "fallback" for refentry "source" data</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<src:fragment id='refentry.source.fallback.profile.frag'>
+<xsl:param name="refentry.source.fallback.profile">
+refmeta/refmiscinfo[1]/node()</xsl:param>
+</src:fragment>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>The value of
+<parameter>refentry.source.fallback.profile</parameter> is a string
+representing an XPath expression. It is evaluated at run-time and used
+only if no "source" data can be found by other means (that is, either
+using the <tag>refentry</tag> metadata-gathering logic "hard coded" in
+the stylesheets, or the value of the
+<parameter>refentry.source.name.profile</parameter> and
+<parameter>refentry.version.profile</parameter> parameters, if those
+are enabled).</para>
+
+<important>
+<para>Depending on which XSLT engine you run, either the EXSLT
+<function>dyn:evaluate</function> extension function (for xsltproc or
+Xalan) or <function>saxon:evaluate</function> extension function (for
+Saxon) are used to dynamically evaluate the value of
+<parameter>refentry.source.fallback.profile</parameter> at
+run-time. If you don't use xsltproc, Saxon, Xalan -- or some other
+XSLT engine that supports <function>dyn:evaluate</function> -- you
+must manually disable fallback processing by setting an empty value
+for the <parameter>refentry.source.fallback.profile</parameter>
+parameter.</para>
+</important>
+
+</refsect1>
+</refentry>
diff --git a/xsl/params/refentry.source.name.profile.xml b/xsl/params/refentry.source.name.profile.xml
new file mode 100644 (file)
index 0000000..8252210
--- /dev/null
@@ -0,0 +1,91 @@
+<refentry id="refentry.source.name.profile">
+<refmeta>
+<refentrytitle>refentry.source.name.profile</refentrytitle>
+<refmiscinfo role="type">string</refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>refentry.source.name.profile</refname>
+<refpurpose>Specifies profile for refentry "source name" data</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<src:fragment id='refentry.source.name.profile.frag'>
+<xsl:param name="refentry.source.name.profile">
+  ($info/productname
+  |$parentinfo/productname
+  |$info/orgname
+  |$parentinfo/orgname
+  |$info/corpname
+  |$parentinfo/corpname
+  |$info/corpcredit
+  |$parentinfo/corpcredit
+  |$info/corpauthor
+  |$parentinfo/corpauthor
+  |$info/author/orgname
+  |$parentinfo/author/orgname
+  |$info//publishername
+  |$parentinfo//publishername)[1]/node()
+</xsl:param>
+</src:fragment>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>The value of <parameter>refentry.source.name.profile</parameter>
+is a string representing an XPath expression. It is evaluated at
+run-time and used only if
+<parameter>refentry.source.name.profile.enabled</parameter> is
+non-zero. Otherwise, the <tag>refentry</tag> metadata-gathering logic
+"hard coded" into the stylesheets is used.</para>
+
+<para>A "source name" is one part of a (potentially) two-part
+<replaceable>Name</replaceable>&#160;<replaceable>Version</replaceable>
+"source" field. In man pages, it is usually displayed in the left
+footer of the page. The <literal>man(7)</literal> man page describes
+this as "the source of the command", and provides the following
+examples:
+<itemizedlist>
+  <listitem>
+    <para>For binaries, use something like: GNU, NET-2, SLS
+    Distribution, MCC Distribution.</para>
+  </listitem>
+  <listitem>
+    <para>For system calls, use the version of the kernel that you
+    are currently looking at: Linux 0.99.11.</para>
+  </listitem>
+  <listitem>
+    <para>For library calls, use the source of the function: GNU, BSD
+    4.3, Linux DLL 4.4.1.</para>
+  </listitem>
+</itemizedlist>
+</para>
+
+<para>In practice, there are many pages that simply have a Version
+number in the "source" field. So, it looks like what we have is a
+two-part field,
+<replaceable>Name</replaceable>&#160;<replaceable>Version</replaceable>,
+where:
+<variablelist>
+  <varlistentry>
+    <term>Name</term>
+    <listitem>
+      <para>product name (e.g., BSD) or org. name (e.g., GNU)</para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>Version</term>
+    <listitem>
+      <para>version number</para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+Each part is optional. If the <replaceable>Name</replaceable> is a
+product name, then the <replaceable>Version</replaceable> is probably
+the version of the product. Or there may be no
+<replaceable>Name</replaceable>, in which case, if there is a
+<replaceable>Version</replaceable>, it is probably the version
+of the item itself, not the product it is part of. Or, if the
+<replaceable>Name</replaceable> is an organization name, then there
+probably will be no <replaceable>Version</replaceable>.</para>
+</refsect1>
+</refentry>
index 00ba71acdf9882b28e7ad11d9d3d16fb01daa51e..c5f8733963b4384cb991280b9f2fcd04cb81d2b7 100644 (file)
@@ -30,7 +30,7 @@ page -- then you might consider setting a non-zero value for
 
 <para>Note that the terms "source", "source name", and "version" have
 special meanings in this context. For details, see the documentation
-for the <parameter>refentry.source.profile</parameter>
+for the <parameter>refentry.source.name.profile</parameter>
 parameter.</para>
 
 </refsect1>
diff --git a/xsl/params/refentry.version.profile.xml b/xsl/params/refentry.version.profile.xml
new file mode 100644 (file)
index 0000000..b8e5a91
--- /dev/null
@@ -0,0 +1,39 @@
+<refentry id="refentry.version.profile">
+<refmeta>
+<refentrytitle>refentry.version.profile</refentrytitle>
+<refmiscinfo role="type">string</refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>refentry.version.profile</refname>
+<refpurpose>Specifies profile for refentry "version" data</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<src:fragment id='refentry.version.profile.frag'>
+<xsl:param name="refentry.version.profile">
+  ($info/productnumber
+  |$parentinfo/productnumber
+  |$info/edition
+  |$parentinfo/edition
+  |$info/releaseinfo
+  |$parentinfo/releaseinfo)[1]/node()
+</xsl:param>
+</src:fragment>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>The value of <parameter>refentry.version.profile</parameter> is
+a string representing an XPath expression. It is evaluated at
+run-time and used only if
+<parameter>refentry.version.profile.enabled</parameter> is
+non-zero. Otherwise, the <tag>refentry</tag> metadata-gathering logic
+"hard coded" into the stylesheets is used.</para>
+
+<para>A "source.name" is one part of a (potentially) two-part
+<replaceable>Name</replaceable>&#160;<replaceable>Version</replaceable>
+"source" field. For more details, see the documentation for the
+<parameter>refentry.source.name.profile</parameter> parameter.</para>
+
+</refsect1>
+</refentry>
index fd9cac495dbc0443916badac2d9e829c43de0bc3..1f447bd41e38c5a741a7f403c8f36b77f9cbc473 100644 (file)
@@ -31,7 +31,7 @@ then you might consider setting a non-zero value for
 
 <para>Note that the terms "source", "source name", and "version" have
 special meanings in this context. For details, see the documentation
-for the <parameter>refentry.source.profile</parameter>
+for the <parameter>refentry.source.name.profile</parameter>
 parameter.</para>
 
 </refsect1>