Subversion Repositories DevTools

Rev

Blame | Last modification | View Log | RSS feed

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<!-- 
    This XSL stylesheet merges one or more 'files' into the release_note xml
    The 'files' are expected to have the form
    <files>
        <file name="" path="" size="" crc="" .../>
        <file name="" path="" size="" crc="" .../>
    </files>
    Only the content of the 'files/file' nodes are inserted

    The source XML being processed is expected to have an empty '/package_data/files' node

    Paramaters: fileList    - Comma seperated list of files to merge 
-->


<!-- A comma delimited list of files to mege into the output document -->
<xsl:param name="fileList" select="'filelist.xml'"/>

<!-- Identity template : copy all text nodes, elements and attributes -->   
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()" />
    </xsl:copy>
</xsl:template>

<!-- Replace the files sections with that from the external file -->
 <xsl:template match="/package_data/files">
         <!-- Copy the element -->
    <xsl:copy>
      <!-- And everything inside it -->
      <xsl:apply-templates select="@* | *"/> 
      <!-- Add new nodes from the data within the named files -->
      <xsl:for-each select="tokenize($fileList, ',')">
          <xsl:copy-of select="document(.)/files/file"/>
      </xsl:for-each>

    </xsl:copy>
 </xsl:template>

</xsl:stylesheet>