1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/attachment_gather.xsl Thu Nov 16 08:30:26 2006 +0000
1.3 @@ -0,0 +1,54 @@
1.4 +<?xml version="1.0"?>
1.5 +
1.6 +<!-- This style sheet takes the output of xml_attached file (which represents
1.7 + an attachment and it's MIME type), adds in the following extra nodes:
1.8 + date, desc & filename.
1.9 +-->
1.10 +
1.11 +<xsl:stylesheet version="1.0"
1.12 + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1.13 + xmlns:xi="http://www.w3.org/2001/XInclude">
1.14 +
1.15 +<xsl:template match="attachment">
1.16 + <xsl:copy>
1.17 + <xsl:for-each select="@*">
1.18 + <xsl:copy/>
1.19 + </xsl:for-each>
1.20 + <xsl:apply-templates/>
1.21 + <xsl:element namespace="http://www.w3.org/2001/XInclude" name="include">
1.22 + <xsl:attribute name="href">
1.23 + <xsl:text>attachment-details.xml</xsl:text>
1.24 + </xsl:attribute>
1.25 + <xsl:attribute name="xpointer">
1.26 + <xsl:text>xpointer(/attachments/attachment[attachid='</xsl:text>
1.27 + <xsl:value-of select="attachid"/>
1.28 + <xsl:text>']/*)</xsl:text>
1.29 + </xsl:attribute>
1.30 + </xsl:element>
1.31 + <xsl:element namespace="http://www.w3.org/2001/XInclude" name="include"> <xsl:attribute name="href">
1.32 + <xsl:text>attachment-descriptions.xml</xsl:text>
1.33 + </xsl:attribute>
1.34 + <xsl:attribute name="xpointer">
1.35 + <xsl:text>xpointer(/attachments/attachment[attachid='</xsl:text>
1.36 + <xsl:value-of select="attachid"/>
1.37 + <xsl:text>']/desc)element(null)</xsl:text>
1.38 + </xsl:attribute>
1.39 + </xsl:element>
1.40 + </xsl:copy>
1.41 +</xsl:template>
1.42 +
1.43 +<!-- Drop the attachment ID to avoid duplication with the node included
1.44 + from attachment-details.xml -->
1.45 +
1.46 +<xsl:template match="attachid"/>
1.47 +
1.48 +<xsl:template match="*">
1.49 + <xsl:copy>
1.50 + <xsl:for-each select="@*">
1.51 + <xsl:copy/>
1.52 + </xsl:for-each>
1.53 + <xsl:apply-templates/>
1.54 + </xsl:copy>
1.55 +</xsl:template>
1.56 +
1.57 +</xsl:stylesheet>