attachment_gather.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 style sheet takes the output of xml_attached file (which represents
ali@0
     4
     an attachment and it's MIME type), adds in the following extra nodes:
ali@0
     5
       date, desc & filename.
ali@0
     6
-->
ali@0
     7
ali@0
     8
<xsl:stylesheet version="1.0"
ali@0
     9
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
ali@0
    10
		xmlns:xi="http://www.w3.org/2001/XInclude">
ali@0
    11
ali@0
    12
<xsl:template match="attachment">
ali@0
    13
  <xsl:copy>
ali@0
    14
    <xsl:for-each select="@*">
ali@0
    15
      <xsl:copy/>
ali@0
    16
    </xsl:for-each>
ali@0
    17
    <xsl:apply-templates/>
ali@0
    18
    <xsl:element namespace="http://www.w3.org/2001/XInclude" name="include">
ali@0
    19
      <xsl:attribute name="href">
ali@0
    20
	<xsl:text>attachment-details.xml</xsl:text>
ali@0
    21
      </xsl:attribute>
ali@0
    22
      <xsl:attribute name="xpointer">
ali@0
    23
	<xsl:text>xpointer(/attachments/attachment[attachid='</xsl:text>
ali@0
    24
	<xsl:value-of select="attachid"/>
ali@0
    25
	<xsl:text>']/*)</xsl:text>
ali@0
    26
      </xsl:attribute>
ali@0
    27
    </xsl:element>
ali@0
    28
    <xsl:element namespace="http://www.w3.org/2001/XInclude" name="include">          <xsl:attribute name="href">
ali@0
    29
	<xsl:text>attachment-descriptions.xml</xsl:text>
ali@0
    30
      </xsl:attribute>
ali@0
    31
      <xsl:attribute name="xpointer">
ali@0
    32
	<xsl:text>xpointer(/attachments/attachment[attachid='</xsl:text>
ali@0
    33
	<xsl:value-of select="attachid"/>
ali@0
    34
	<xsl:text>']/desc)element(null)</xsl:text>
ali@0
    35
      </xsl:attribute>
ali@0
    36
    </xsl:element>
ali@0
    37
  </xsl:copy>
ali@0
    38
</xsl:template>
ali@0
    39
ali@0
    40
<!-- Drop the attachment ID to avoid duplication with the node included
ali@0
    41
     from attachment-details.xml -->
ali@0
    42
ali@0
    43
<xsl:template match="attachid"/>
ali@0
    44
ali@0
    45
<xsl:template match="*">
ali@0
    46
  <xsl:copy>
ali@0
    47
    <xsl:for-each select="@*">
ali@0
    48
      <xsl:copy/>
ali@0
    49
    </xsl:for-each>
ali@0
    50
    <xsl:apply-templates/>
ali@0
    51
  </xsl:copy>
ali@0
    52
</xsl:template>
ali@0
    53
ali@0
    54
</xsl:stylesheet>