docs-common/packaging strip-for-txt.xsl,NONE,1.1

Paul W. Frields (pfrields) fedora-docs-commits at redhat.com
Fri Feb 17 03:37:01 UTC 2006


Author: pfrields

Update of /cvs/docs/docs-common/packaging
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv7372/docs-common/packaging

Added Files:
	strip-for-txt.xsl 
Log Message:
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.




--- NEW FILE strip-for-txt.xsl ---
<!-- 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>




More information about the Fedora-docs-commits mailing list