docs-common/packaging info2rpminfo.xsl,NONE,1.1

Paul W. Frields (pfrields) fedora-docs-commits at redhat.com
Mon Jan 2 22:37:18 UTC 2006


Author: pfrields

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

Added Files:
	info2rpminfo.xsl 
Log Message:
Initial version; mostly WORKSFORME


--- NEW FILE info2rpminfo.xsl ---
<!-- Transform bookinfo|articleinfo section into FDP's rpm-info -->
<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" standalone="yes"
  omit-xml-declaration="no" version="1.0" doctype-system="../docs-common/packaging/rpm-info.dtd"/>

  <xsl:template match="book|article">
    <xsl:apply-templates select="articleinfo|bookinfo"/>
  </xsl:template>

  <xsl:template match="bookinfo|articleinfo" name="info">
    <xsl:element name="rpm-info">
      <xsl:apply-templates select="authorgroup"/>
      <xsl:element name="license">
	<xsl:element name="rights">GNU FDL</xsl:element>
	<xsl:element name="version">1.0</xsl:element>
      </xsl:element>
      <xsl:element name="copyright">
	<xsl:for-each select="copyright">
	  <xsl:copy-of select="node()"/>
	</xsl:for-each>
      </xsl:element>
      <xsl:element name="titles">
	<xsl:apply-templates select="title"/>
      </xsl:element>
      <xsl:element name="changelog">
	<xsl:apply-templates select="revhistory"/>
      </xsl:element>
    </xsl:element>
  </xsl:template>


  <xsl:template match="authorgroup">
    <xsl:element name="colophon">
      <xsl:comment>Only author|editor|othercredit processed.</xsl:comment>
      <xsl:comment>PLEASE ADD EMAIL ADDRESSES.</xsl:comment>
      <xsl:comment>You may remove these comments after editing.</xsl:comment>
      <xsl:apply-templates select="author"/>
      <xsl:apply-templates select="editor"/>
    </xsl:element>
  </xsl:template>

  <xsl:template match="author|editor|othercredit">
    <xsl:call-template name="worker"/>
  </xsl:template>

  <xsl:template name="worker">
    <xsl:element name="worker" use-attribute-sets="worker-atts"/>
  </xsl:template>

  <xsl:attribute-set name="worker-atts">
    <xsl:attribute name="surname"><xsl:value-of	select="surname"/></xsl:attribute>
    <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="id"><xsl:value-of select="firstname"/><xsl:value-of select="surname"/></xsl:attribute>
    <xsl:attribute name="email"><xsl:if	test="email"><xsl:value-of select="email"/></xsl:if></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="initials"><xsl:value-of select="firstname"/><xsl:value-of select="surname"/></xsl:attribute>
  </xsl:attribute-set>


  <xsl:template match="/book/bookinfo/title|/article/articleinfo/title">
    <xsl:element name="translation" use-attribute-sets="translation-atts">
      <xsl:call-template name="translation"/>
    </xsl:element>
    <xsl:comment>PLEASE ADD TRANSLATIONS FOR TITLES.</xsl:comment>
  </xsl:template>

  <xsl:template name="translation">
    <xsl:element name="title"><xsl:value-of select="node()"/></xsl:element>
    <xsl:element name="desc">PLEASE ADD BOOK/ARTICLE DESCRIPTION TO RPM-INFO</xsl:element>
    <!-- Sorry, can't langify out of separate docs right now. -->
  </xsl:template>
    
  <xsl:attribute-set name="translation-atts">
    <xsl:attribute name="lang"><xsl:value-of select="../../@lang"/></xsl:attribute>
  </xsl:attribute-set>


  <xsl:template match="revhistory">
    <xsl:apply-templates select="revision"><xsl:sort select="date" order="descending"/></xsl:apply-templates>
  </xsl:template>

  <xsl:template match="revision">
    <xsl:element name="revision" use-attribute-sets="revision-atts">
      <xsl:element name="author" use-attribute-sets="revision-worker-atts"/>
      <xsl:for-each select="revdescription/para">
	<xsl:element name="details" use-attribute-sets="revision-detail-atts">
	  <xsl:value-of select="node()"/>
	</xsl:element>
      </xsl:for-each>
    </xsl:element>
  </xsl:template>

  <xsl:attribute-set name="revision-atts">
    <xsl:attribute name="date"><xsl:value-of select="date"/></xsl:attribute>
    <xsl:attribute name="version"><xsl:value-of select="revnumber"/></xsl:attribute>
    <xsl:attribute name="release">1</xsl:attribute><!-- For now, a hack -->
  </xsl:attribute-set>

  <xsl:attribute-set name="revision-worker-atts">
    <xsl:attribute name="worker"><xsl:value-of select="authorinitials"/></xsl:attribute>
  </xsl:attribute-set>

  <xsl:attribute-set name="revision-detail-atts">
    <xsl:attribute name="lang"><xsl:value-of select="../../../../../@lang"/></xsl:attribute>
  </xsl:attribute-set>

</xsl:stylesheet> 




More information about the Fedora-docs-commits mailing list