summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/parades/example/udhr.xsl
blob: aa7a01f75f0b944d4aa9ad9c4ef5abea559de6a5 (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
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:udhr="http://www.unhchr.ch/udhr">
<!-- -->

<xsl:template match="/">
  <TeXML>
    <xsl:call-template name="latex-header"/>
    <xsl:apply-templates/>
  </TeXML>
</xsl:template>

<xsl:template match="*">
  <xsl:message>*** Unprocessed XML element <xsl:value-of select="local-name()"/></xsl:message>
</xsl:template>

<xsl:template match="udhr:udhr">
  <env name="document">
    <cmd name="UseParaDefault" gr="0" nl2="1" />
    <xsl:apply-templates/>
  </env>
</xsl:template>

<xsl:template match="udhr:article | udhr:preamble">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="udhr:udhr/udhr:title">
  <cmd name="HeadI" nl2="1">
    <parm><xsl:apply-templates/></parm>
  </cmd>
</xsl:template>

<xsl:template match="udhr:preamble/udhr:title | udhr:article/udhr:title">
  <spec cat="nl?"/>
  <spec cat="comment"/>
  <spec cat="nl"/>
  <cmd name="HeadII" nl2="1">
    <parm><xsl:apply-templates/></parm>
  </cmd>
</xsl:template>

<xsl:template match="udhr:para">
  <env name="para" nl2="0" nl3="0">
    <xsl:if test="parent::udhr:listitem">
      <xsl:attribute name="nl1">0</xsl:attribute>
      <xsl:attribute name="nl4">0</xsl:attribute>
    </xsl:if>
    <xsl:apply-templates/>
  </env>
</xsl:template>

<xsl:template match="udhr:listitem/udhr:para">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="udhr:orderedlist">
  <env name="udhrlist">
    <xsl:apply-templates/>
  </env>
</xsl:template>

<xsl:template match="udhr:listitem">
  <cmd name="listitem" nl2="1">
    <parm><xsl:value-of select="1+count(preceding-sibling::udhr:listitem)"/></parm>
    <parm><xsl:apply-templates select="*"/></parm>
  </cmd>
</xsl:template>

<xsl:template name="latex-header">
<TeXML escape="0" ws="1">\documentclass[a5paper]{article}
\usepackage{paravesp}
\usepackage{paras}
\usepackage[english]{babel}
\usepackage{hyperref}
</TeXML>
</xsl:template>

</xsl:stylesheet>