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