attachment_post.xsl
author ali@yendor.vm.bytemark.co.uk
Thu Nov 16 08:30:26 2006 +0000 (2006-11-16)
changeset 0 ae7b3fa753dc
permissions -rw-r--r--
First cut. Distintly raw around the edges:
* Assumes it will be running in /home/ali/wk/slashem/web.scripts
* Assumes cache directory will be in topdir
* No build system (simple compiling and linking against libxml2)
* No configure system (eg., tagsoup)
* Output XML untested
* Doesn't set bugzilla maintainer or exporter
* Handling of artifact priorities and resolution is suspect
ali@0
     1
<?xml version="1.0"?>
ali@0
     2
ali@0
     3
<!-- This stylesheet does some post-processing on attachments. -->
ali@0
     4
ali@0
     5
<xsl:stylesheet version="1.0"
ali@0
     6
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
ali@0
     7
ali@0
     8
<xsl:template match="attachment">
ali@0
     9
  <!-- Avoid xsl:copy so that any attributes (including xml:base) are lost -->
ali@0
    10
  <attachment>
ali@0
    11
    <xsl:attribute name="ispatch">
ali@0
    12
      <xsl:value-of select="@ispatch"/>
ali@0
    13
    </xsl:attribute>
ali@0
    14
    <xsl:attribute name="isobsolete">
ali@0
    15
      <xsl:value-of select="isobsolete"/>
ali@0
    16
    </xsl:attribute>
ali@0
    17
    <xsl:apply-templates/>
ali@0
    18
  </attachment>
ali@0
    19
</xsl:template>
ali@0
    20
ali@0
    21
<xsl:template match="attachment/isobsolete"/>
ali@0
    22
ali@0
    23
<xsl:template match="attachment/desc[normalize-space(.)='']">
ali@0
    24
  <desc>
ali@0
    25
    <xsl:value-of select="../filename"/>
ali@0
    26
  </desc>
ali@0
    27
</xsl:template>
ali@0
    28
ali@0
    29
<xsl:template match="*">
ali@0
    30
  <xsl:copy>
ali@0
    31
    <xsl:for-each select="@*">
ali@0
    32
      <xsl:copy/>
ali@0
    33
    </xsl:for-each>
ali@0
    34
    <xsl:apply-templates/>
ali@0
    35
  </xsl:copy>
ali@0
    36
</xsl:template>
ali@0
    37
ali@0
    38
</xsl:stylesheet>