| 4462 |
dpurdie |
1 |
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
|
2 |
<xsl:output omit-xml-declaration="yes" indent="yes"/>
|
|
|
3 |
<!--
|
|
|
4 |
This XSL stylesheet merges one or more 'files' into the release_note xml
|
|
|
5 |
The 'files' are expected to have the form
|
|
|
6 |
<files>
|
|
|
7 |
<file name="" path="" size="" crc="" .../>
|
|
|
8 |
<file name="" path="" size="" crc="" .../>
|
|
|
9 |
</files>
|
|
|
10 |
Only the content of the 'files/file' nodes are inserted
|
|
|
11 |
|
|
|
12 |
The source XML being processed is expected to have an empty '/package_data/files' node
|
|
|
13 |
|
|
|
14 |
Paramaters: fileList - Comma seperated list of files to merge
|
|
|
15 |
-->
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
<!-- A comma delimited list of files to mege into the output document -->
|
|
|
19 |
<xsl:param name="fileList" select="'filelist.xml'"/>
|
|
|
20 |
|
|
|
21 |
<!-- Identity template : copy all text nodes, elements and attributes -->
|
|
|
22 |
<xsl:template match="@*|node()">
|
|
|
23 |
<xsl:copy>
|
|
|
24 |
<xsl:apply-templates select="@*|node()" />
|
|
|
25 |
</xsl:copy>
|
|
|
26 |
</xsl:template>
|
|
|
27 |
|
|
|
28 |
<!-- Replace the files sections with that from the external file -->
|
|
|
29 |
<xsl:template match="/package_data/files">
|
|
|
30 |
<!-- Copy the element -->
|
|
|
31 |
<xsl:copy>
|
|
|
32 |
<!-- And everything inside it -->
|
|
|
33 |
<xsl:apply-templates select="@* | *"/>
|
|
|
34 |
<!-- Add new nodes from the data within the named files -->
|
|
|
35 |
<xsl:for-each select="tokenize($fileList, ',')">
|
|
|
36 |
<xsl:copy-of select="document(.)/files/file"/>
|
|
|
37 |
</xsl:for-each>
|
|
|
38 |
|
|
|
39 |
</xsl:copy>
|
|
|
40 |
</xsl:template>
|
|
|
41 |
|
|
|
42 |
</xsl:stylesheet>
|