summaryrefslogtreecommitdiffstats
path: root/packaging/insert-colophon.xsl
diff options
context:
space:
mode:
authorPaul W. Frields <stickster@gmail.com>2006-01-15 17:05:14 +0000
committerPaul W. Frields <stickster@gmail.com>2006-01-15 17:05:14 +0000
commite88daf0d5bf3f51a5d141b2d774fe82908992dda (patch)
tree1915b39a4d1df3bf33ac5ae1d17b38a9c87d7084 /packaging/insert-colophon.xsl
parentb1d82b32861b139655db1cf30146c1aeaed1c92b (diff)
downloadfedora-doc-utils-e88daf0d5bf3f51a5d141b2d774fe82908992dda.tar.gz
fedora-doc-utils-e88daf0d5bf3f51a5d141b2d774fe82908992dda.tar.xz
fedora-doc-utils-e88daf0d5bf3f51a5d141b2d774fe82908992dda.zip
These snippets will be useful in Makefile.common, since they enable:
1. inserting new worker and revision elements (both newest-first of course!) 2. querying the document for a tight listing of the entire colophon, so the user can choose who is responsible for a new revision 3. querying the document for a specific worker attribute The "make worker" target idea is simple enough, but more importantly, the use case for a "make clog" target would be: 1. User picks whether revision role is "rpm" or "doc", today's date is formatted properly for the role 2. User picks their name from the tight colophon listing 3. The make target automatically queries for the worker attribute appropriate for that revision role (e.g. initials for doc, email for rpm)
Diffstat (limited to 'packaging/insert-colophon.xsl')
-rw-r--r--packaging/insert-colophon.xsl69
1 files changed, 69 insertions, 0 deletions
diff --git a/packaging/insert-colophon.xsl b/packaging/insert-colophon.xsl
new file mode 100644
index 0000000..e0408ff
--- /dev/null
+++ b/packaging/insert-colophon.xsl
@@ -0,0 +1,69 @@
+<!--
+
+Add a worker to a document's colophon. The following stringparam values are
+required and expected:
+ firstname : Contributor's first name
+ surname : Contributor's family or surname
+ initials : Initials for use in document revision history
+ email : email address (should match Fedora Project email)
+
+The following stringparam values are optional:
+ othername : Middle initial
+
+The following stringparam values will be set in this stylesheet:
+ wholename : firstname + " " [ + othername + " " ] + surname
+ id : firstname + surname
+
+-->
+
+<xsl:stylesheet version="1.0" xml:space="preserve" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:output encoding="UTF-8" indent="yes" method="xml" omit-xml-declaration="yes" standalone="no" version="1.0"/>
+
+ <!-- Cope if no othername is provided -->
+ <xsl:param name="othername" select="''"/>
+
+ <xsl:template match="/">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="rpm-info">
+ <xsl:element name="rpm-info">
+ <xsl:for-each select="*">
+ <xsl:choose>
+ <xsl:when test="self::colophon">
+ <xsl:call-template name="colophon">
+ <xsl:with-param name="firstname"><xsl:value-of
+ select="$firstname"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:template name="colophon">
+ <xsl:element name="colophon">
+ <xsl:element name="worker" use-attribute-sets="person"/>
+ <xsl:copy-of select="*"/>
+ </xsl:element>
+ </xsl:template>
+
+ <xsl:attribute-set name="person">
+ <xsl:attribute name="firstname"><xsl:value-of
+ select="$firstname"/></xsl:attribute>
+ <xsl:attribute name="othername"><xsl:value-of
+ select="$othername"/></xsl:attribute>
+ <xsl:attribute name="surname"><xsl:value-of
+ select="$surname"/></xsl:attribute>
+ <xsl:attribute name="initials"><xsl:value-of
+ select="$initials"/></xsl:attribute>
+ <xsl:attribute name="email"><xsl:value-of select="$email"/></xsl:attribute>
+ <xsl:attribute name="wholename"><xsl:value-of select="$firstname"/> <xsl:if
+ test="$othername"><xsl:value-of select="$othername"/> </xsl:if><xsl:value-of select="$surname"/></xsl:attribute>
+ <xsl:attribute name="id"><xsl:value-of select="$firstname"/><xsl:value-of
+ select="$surname"/></xsl:attribute>
+ </xsl:attribute-set>
+
+</xsl:stylesheet>