diff options
author | Paul W. Frields <stickster@gmail.com> | 2006-02-17 03:36:48 +0000 |
---|---|---|
committer | Paul W. Frields <stickster@gmail.com> | 2006-02-17 03:36:48 +0000 |
commit | 6ce39645dfef3d8559cd742f79144add0cb3e47a (patch) | |
tree | eac4f1fcdd5e06e51ec70d787b0d5b563f586411 /packaging | |
parent | a5c58343d1098d5993ffe8e890e70eb2f52d5e59 (diff) | |
download | fedora-doc-utils-6ce39645dfef3d8559cd742f79144add0cb3e47a.tar.gz fedora-doc-utils-6ce39645dfef3d8559cd742f79144add0cb3e47a.tar.xz fedora-doc-utils-6ce39645dfef3d8559cd742f79144add0cb3e47a.zip |
Add "text" alias for "txt" for bad typists and lexihounds. Also strip
annoying revhistory and index elements from plain text builds. There
are very few instances where we will be providing txt builds --
e.g. release notes -- so this doesn't seem like a loss. If it is,
XSLT is cheap.
Diffstat (limited to 'packaging')
-rw-r--r-- | packaging/strip-for-txt.xsl | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/packaging/strip-for-txt.xsl b/packaging/strip-for-txt.xsl new file mode 100644 index 0000000..5691b76 --- /dev/null +++ b/packaging/strip-for-txt.xsl @@ -0,0 +1,79 @@ +<!-- Strip <revhistory> element from DocBook --> +<!-- Note this XSLT upgrades your DocBook to the V4.4 DTD! --> +<xsl:stylesheet version="1.0" xml:space="preserve" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output encoding="UTF-8" indent="no" method="xml" + omit-xml-declaration="no" standalone="no" version="1.0" + doctype-public="-//OASIS//DTD DocBook XML V4.4//EN" + doctype-system="http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" /> + + <xsl:template match="/"> + <xsl:apply-templates/> + </xsl:template> + + <xsl:template match="/book"> + <xsl:element name="book"> + <xsl:for-each select="*"> + <xsl:choose> + <xsl:when test="self::bookinfo"> + <xsl:call-template name="bookinfo"/> + </xsl:when> + <xsl:when test="self::index"> + <xsl:text/> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="."/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:element> + </xsl:template> + + <xsl:template match="/article"> + <xsl:element name="article"> + <xsl:for-each select="*"> + <xsl:choose> + <xsl:when test="self::articleinfo"> + <xsl:call-template name="articleinfo"/> + </xsl:when> + <xsl:when test="self::index"> + <xsl:text/> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="."/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:element> + </xsl:template> + + <xsl:template name="bookinfo"> + <xsl:element name="bookinfo"> + <xsl:for-each select="*"> + <xsl:choose> + <xsl:when test="self::revhistory"> + <xsl:text/> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="."/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:element> + </xsl:template> + + <xsl:template name="articleinfo"> + <xsl:element name="articleinfo"> + <xsl:for-each select="*"> + <xsl:choose> + <xsl:when test="self::revhistory"> + <xsl:text/> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="."/> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:element> + </xsl:template> + +</xsl:stylesheet> |