summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/stex/xsl/owl2post.xsl
blob: 530d9265c03d89aef557ca2e58af921a8513707e (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
<?xml version="1.0" encoding="utf-8"?>
<!-- this style sheet transforms the tex.xml file to OMDoc   -->
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:ltx="http://dlmf.nist.gov/LaTeXML"
  xmlns:omdoc="http://omdoc.org/ns"
  xmlns:stex="http://kwarc.info/ns/sTeX"
  xmlns="http://www.w3.org/2002/07/owl#"
  xmlns:owl="http://www.w3.org/2002/07/owl#"
  exclude-result-prefixes="xsl omdoc ltx stex owl"> 

<xsl:output method="xml" indent="yes" cdata-section-elements="data"/>
<xsl:strip-space elements="*"/>

<xsl:template match="/">
  <xsl:comment>This OWL2 ontology is generated from an sTeX-encoded one via LaTeXML, you may want to reconsider editing it.</xsl:comment>
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="*">
  <xsl:copy><xsl:copy-of select="@*"/><xsl:apply-templates/></xsl:copy>
</xsl:template>

<xsl:template match="omdoc:imports">
  <Import><xsl:value-of select="@from"/></Import>
</xsl:template>


<xsl:template match="owl:Axiom">
  <xsl:variable name="anno" select="*[2]"/>
  <xsl:apply-templates select="*[1]">
    <xsl:with-param name="anno" select="$anno"/>
  </xsl:apply-templates>
</xsl:template>

<xsl:template match="ltx:Math|ltx:XMath">
  <xsl:param name="anno"/>
  <xsl:apply-templates>
    <xsl:with-param name="anno" select="$anno"/>
  </xsl:apply-templates>
</xsl:template>

<xsl:template match="ltx:XMApp[ltx:XMTok[position()=1 and @meaning='list']]">
  <xsl:apply-templates select="*[position() &gt; 1]"/>
</xsl:template>

<xsl:template match="ltx:XMApp">
  <xsl:param name="anno"/>
  <xsl:element name="{ltx:XMTok[1]/@meaning}">
    <xsl:copy-of select="$anno"/>
    <xsl:apply-templates select="*[position() &gt; 1]"/>
  </xsl:element>
</xsl:template>

<xsl:template match="ltx:XMTok">
  <Class IRI="{@name}"/>
</xsl:template>

<xsl:template match="ltx:ERROR">
  <Class IRI="{substring-after(ltx:XMTok,'\')}"/>
</xsl:template>
</xsl:stylesheet>