diff options
Diffstat (limited to 'packaging')
-rw-r--r-- | packaging/get-all-workers.xsl | 12 | ||||
-rw-r--r-- | packaging/get-worker.xsl | 30 | ||||
-rw-r--r-- | packaging/insert-changelog.xsl | 65 | ||||
-rw-r--r-- | packaging/insert-colophon.xsl | 69 |
4 files changed, 176 insertions, 0 deletions
diff --git a/packaging/get-all-workers.xsl b/packaging/get-all-workers.xsl new file mode 100644 index 0000000..254f61e --- /dev/null +++ b/packaging/get-all-workers.xsl @@ -0,0 +1,12 @@ +<!-- Get a list of all workers (full name and email address) --> + +<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"/> + + <xsl:template match="/"> + <xsl:for-each select="/rpm-info/colophon/worker"><xsl:value-of + select="@email"/>:<xsl:value-of select="@wholename"/> + </xsl:for-each> + </xsl:template> + +</xsl:stylesheet> diff --git a/packaging/get-worker.xsl b/packaging/get-worker.xsl new file mode 100644 index 0000000..732d902 --- /dev/null +++ b/packaging/get-worker.xsl @@ -0,0 +1,30 @@ +<!-- + +Get a worker attribute by name for a specific worker. + pos : param, integer for position (default: 1) + att : stringparam, name of attribute to fetch (default: email) +N.B.: xml:space attribute not set to avoid output ugliness + +--> + +<xsl:stylesheet version="1.0" 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"/> + + <xsl:param name="pos" select="1"/> + <xsl:param name="att" select="'email'"/> + <xsl:strip-space elements="*"/> + + <xsl:template match="/"> + <xsl:for-each select="/rpm-info/colophon/worker[$pos]"> + <xsl:choose> + <xsl:when test="$att='email'"><xsl:value-of select="@email"/></xsl:when> + <xsl:when test="$att='wholename'"><xsl:value-of + select="@wholename"/></xsl:when> + <xsl:when test="$att='id'"><xsl:value-of select="@id"/></xsl:when> + <xsl:otherwise><xsl:text>ERROR</xsl:text></xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:template> + +</xsl:stylesheet> diff --git a/packaging/insert-changelog.xsl b/packaging/insert-changelog.xsl new file mode 100644 index 0000000..2391f1f --- /dev/null +++ b/packaging/insert-changelog.xsl @@ -0,0 +1,65 @@ +<!-- + +Add a RPM changelog entry to a document's rpm-info.xml file. +The following stringparam values are expected in this file: + detail : Text describing the change + date : Date of change, formatted properly: + For role="rpm", date format is +"%a %b %d %Y" + For role="doc", date format is +"%Y-%m-%d" + number : Number for change, formatted properly: + For role="rpm", integer release number + For role="doc", version number for document + person : ID for responsible entity, drawn from current <colophon> + role : "doc" or "rpm", indicating type of change + +--> + +<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"/> + + <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::changelog"><xsl:call-template name="clog"/></xsl:when> + <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:element> + </xsl:template> + + <xsl:template name="clog"> + <xsl:element name="changelog" use-attribute-sets="clog"> + <xsl:element name="revision" use-attribute-sets="rev"> + <xsl:element name="author" use-attribute-sets="auth"/> + <xsl:comment>PLEASE SET "lang" ATTRIBUTE IN DETAILS WHERE NEEDED</xsl:comment> + <xsl:element name="details"><xsl:value-of + select="$detail"/></xsl:element> + </xsl:element> + <xsl:copy-of select="*"/> + </xsl:element> + </xsl:template> + + + <xsl:attribute-set name="clog"> + <xsl:attribute name="order">newest-first</xsl:attribute> + </xsl:attribute-set> + + <xsl:attribute-set name="rev"> + <xsl:attribute name="date"><xsl:value-of select="$date"/></xsl:attribute> + <xsl:attribute name="number"><xsl:value-of + select="$number"/></xsl:attribute> + <xsl:attribute name="role"><xsl:value-of select="$role"/></xsl:attribute> + </xsl:attribute-set> + + <xsl:attribute-set name="auth"> + <xsl:attribute name="worker"><xsl:value-of + select="$person"/></xsl:attribute> + </xsl:attribute-set> + +</xsl:stylesheet> 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> |