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
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:exsl="http://exslt.org/common"
exclude-result-prefixes="exsl"
extension-element-prefixes="exsl"
xmlns:TPM="http://texlive.dante.de/"
version="1.0">
<xsl:output method="text" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="Master">/texlive/Master/texmf-dist/tpm/lists/</xsl:variable>
<xsl:variable name="TPM">/texlive/Master/texmf-dist/tpm/package/</xsl:variable>
<xsl:variable name="COL">texmf-dist/tpm/scheme/</xsl:variable>
<xsl:variable name="LISTS">texmf-dist/tpm/lists/</xsl:variable>
<xsl:template match="/">
<xsl:message>Write <xsl:value-of select="concat($Master,.//TPM:Name)"/>.scheme</xsl:message>
<exsl:document href="{concat($Master,//TPM:Name)}.scheme" method="text">
<xsl:text>*Title: </xsl:text>
<xsl:value-of select="normalize-space(.//TPM:Title)"/>
<xsl:text> </xsl:text>
<xsl:variable name="foo">
<xsl:apply-templates select=".//TPM:Requires" mode="size"/>
</xsl:variable>
<xsl:text>*Size: </xsl:text>
<xsl:variable name="S">
<xsl:value-of select="sum(exsl:node-set($foo)/S/size)"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$S='NaN'">1</xsl:when>
<xsl:when test="contains($S,'.')">
<xsl:value-of select="substring-before($S,'.')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$S"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
<xsl:apply-templates select=".//TPM:Requires"/>
<xsl:apply-templates select=".//TPM:DocFiles"/><xsl:text> </xsl:text>
<xsl:apply-templates select=".//TPM:SourceFiles"/><xsl:text> </xsl:text>
<xsl:apply-templates select=".//TPM:RunFiles"/><xsl:text> </xsl:text>
<xsl:apply-templates select=".//TPM:BinFiles"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$COL"/>
<xsl:value-of select=".//TPM:Name"/><xsl:text>.tpm </xsl:text>
<xsl:text> </xsl:text>
<xsl:value-of select="$LISTS"/>
<xsl:value-of select=".//TPM:Name"/>
<xsl:text>.scheme </xsl:text>
</exsl:document>
</xsl:template>
<xsl:template match="TPM:DocFiles|TPM:SourceFiles|TPM:RunFiles">
<xsl:value-of select="translate(normalize-space(.),' ',' ')"/>
</xsl:template>
<xsl:template match="TPM:BinFiles">
<xsl:message>Write <xsl:value-of
select="concat($Master,//TPM:Name)"/>
<xsl:text>.vlist.</xsl:text>
<xsl:value-of select="@arch"/></xsl:message>
<exsl:document method="text" href="{$Master}{//TPM:Name}.vlist.{@arch}">
<xsl:value-of select="translate(normalize-space(.),' ',' ')"/>
<xsl:text> </xsl:text>
<xsl:value-of select="concat($LISTS,//TPM:Name)"/>
<xsl:text>.vlist.</xsl:text>
<xsl:value-of select="@arch"/>
<xsl:text> </xsl:text>
</exsl:document>
</xsl:template>
<xsl:template match="TPM:Requires">
<xsl:for-each select="TPM:Package|TPM:Binary">
<xsl:text>+</xsl:text>
<xsl:value-of select="translate(normalize-space(@name),' ',' ')"/>
<xsl:text> </xsl:text>
</xsl:for-each>
<xsl:for-each select="TPM:Collection">
<xsl:text>-</xsl:text>
<xsl:value-of select="translate(normalize-space(@name),' ',' ')"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
<xsl:template match="TPM:Requires" mode="size">
<S>
<xsl:for-each select="TPM:Package">
<size><xsl:value-of select="document(concat($TPM,concat(@name,'.tpm')))//TPM:DocFiles/@size div 1000"/></size>
<size><xsl:value-of select="document(concat($TPM,concat(@name,'.tpm')))//TPM:RunFiles/@size div 1000"/></size>
<size><xsl:value-of select="document(concat($TPM,concat(@name,'.tpm')))//TPM:SourceFiles/@size div 1000"/></size>
</xsl:for-each>
</S>
</xsl:template>
</xsl:stylesheet>
|