summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/latex-web-companion/xmlstyle/isotabexa2.xsl
blob: 38ad5aa33e01e7a217e54b64514b91879341154f (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
<?xml version='1.0' encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" 
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:date="http://www.jclark.com/xt/java/java.util.Date"
     xmlns:xt="http://www.jclark.com/xt"
     extension-element-prefixes="xt">

<xsl:template match="/">
 <xsl:call-template name="newfile">
  <xsl:with-param name="abc" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
 </xsl:call-template>
</xsl:template>

<xsl:template name="newfile">
 <xsl:param name="abc" />
 <xsl:variable name="letter" select="substring($abc,1,1)" />
 <xsl:variable name="file" select="concat($letter,'-currency.txt')"/>
 <xt:document method="text" href="{$file}" encoding="ISO-8859-1">
  <xsl:for-each select="//country[starts-with(isocurrency, $letter)]">
   <xsl:sort select="shortname"/>
   <xsl:sort select="currency"/>
   <xsl:variable name="Currency" select="normalize-space(string(currency))"/>
   <xsl:if test="($Currency != '-') and ($Currency != '')">
    <xsl:text>The </xsl:text>
    <xsl:value-of select="currency"/>
    <xsl:text> is used by </xsl:text>
    <xsl:variable name="L1" select="substring(citizen,1,1)"/>
    <xsl:choose>
     <xsl:when test="$L1 = 'A' or $L1 = 'E' or $L1 = 'I' or 
                     $L1 = 'O' or $L1 = 'U'">
      <xsl:text>an </xsl:text>
     </xsl:when>
     <xsl:otherwise>
      <xsl:text>a </xsl:text>
     </xsl:otherwise>
    </xsl:choose>
    <xsl:value-of select="citizen"/>
    <xsl:text> living in </xsl:text>
    <xsl:value-of select="shortname"/>
    <xsl:text>.&#xA;</xsl:text><!-- new line -->
   </xsl:if>
  </xsl:for-each>
  <xsl:call-template name="footer"/>
 </xt:document>
  
 <xsl:if test="string-length($abc) != 1">
  <xsl:call-template name="newfile">
   <xsl:with-param name="abc" select="substring($abc, 2)" />
  </xsl:call-template>
 </xsl:if>
</xsl:template>

<xsl:template name="footer">
 <xsl:text>Last modification : Michel Goossens, </xsl:text>
 <xsl:choose>
  <xsl:when test="function-available('date:to-string') and 
                  function-available('date:new')">
   <!-- date format : Fri Dec 31 23:59:59 PDT 1999 -->
   <!--               1234567890123456789012345678 -->
   <xsl:variable name="datetemp" select="date:to-string(date:new())"/>
   <xsl:variable name="month" select="substring($datetemp,5,3)"/>
   <xsl:variable name="day" select="substring($datetemp,9,2)"/>
   <xsl:variable name="year" select="substring($datetemp,string-length($datetemp)-3,4)"/>
   <xsl:variable name="Date" select="concat($day,' ',$month,'. ',$year)"/>
   <xsl:value-of select="$Date"/>
  </xsl:when>
  <xsl:otherwise>
   <xsl:text>11 Nov. 1999</xsl:text>
  </xsl:otherwise>
 </xsl:choose>
</xsl:template>

</xsl:stylesheet>