summaryrefslogtreecommitdiff
path: root/Build/tools/tpmupdate.xsl
blob: 0afad1990a1c5b3b0d3952342383dd615dce86d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
  xmlns:TPM="http://texlive.dante.de/"  
  version="1.0">

<xsl:param name="TMP"/>
<xsl:param name="binaries"/>
<xsl:param name="files"/>
<xsl:param name="Who"/>
<xsl:param name="When"/>
<xsl:output indent="yes" 
  method="xml" 
  omit-xml-declaration="yes"
  doctype-system="tpm.dtd"/>
<xsl:template match="*|@*|processing-instruction()">
 <xsl:copy>
  <xsl:apply-templates select="*|@*|processing-instruction()|comment()|text()"/>
 </xsl:copy>
</xsl:template>

<xsl:template match="TPM:Size"/>
<xsl:template match="TPM:Title">
  <xsl:copy-of select="."/>
  <TPM:Size><xsl:value-of select="sum(//TPM:*/@size)"/></TPM:Size>
</xsl:template>

<xsl:template match="TPM:Date">
  <TPM:Date><xsl:value-of select="$When"/></TPM:Date>
</xsl:template>

<xsl:template match="TPM:Creator">
  <TPM:Creator><xsl:value-of select="$Who"/></TPM:Creator>
</xsl:template>

<xsl:template match="text()">
    <xsl:value-of select="."/> <!-- could normalize() here -->
</xsl:template>

<xsl:template match="TPM:BinFiles">
<xsl:choose>
<xsl:when test="$binaries">
<xsl:if test="not(preceding-sibling::TPM:BinFiles)">
  <xsl:message>add binaries for <xsl:value-of select="../TPM:Name"/></xsl:message> 
 <xsl:for-each 
   select="document(concat('/texlive/Build/cdbuild/list.',../TPM:Name))/bin/*">
   <xsl:copy-of select="."/>
 </xsl:for-each>
</xsl:if>
</xsl:when>
<xsl:otherwise>
  <xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>


<xsl:template match="TPM:DocFiles">
<xsl:choose>
<xsl:when test="$files">
 <xsl:for-each 
   select="document(concat($TMP,'.doc'))/*">
   <xsl:copy-of select="."/>
 </xsl:for-each>
</xsl:when>
<xsl:otherwise>
  <xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="TPM:RunFiles">
<xsl:choose>
<xsl:when test="$files">
 <xsl:for-each 
   select="document(concat($TMP,'.run'))/*">
   <xsl:copy-of select="."/>
 </xsl:for-each>
</xsl:when>
<xsl:otherwise>
  <xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="TPM:SourceFiles">
<xsl:choose>
<xsl:when test="$files">
 <xsl:for-each 
   select="document(concat($TMP,'.src'))/*">
   <xsl:copy-of select="."/>
 </xsl:for-each>
</xsl:when>
<xsl:otherwise>
  <xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>



</xsl:stylesheet>