source: gs2-extensions/ngramj/src/wiki/wiki2xml/php/xhtml.xslt@ 25141

Last change on this file since 25141 was 25141, checked in by papitha, 12 years ago

NGRAMJ PERL MODULE ADDED /MAORI LANGUAGE GUESSING WORKING WELL!!

File size: 3.2 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3 XSLT for wiki2xml
4
5 usage: /usr/bin/xsltproc xhtml.xslt yourfile.xml
6
7 Given a wiki syntax article, use wiki2xml by Magnus Manke to convert it
8 as a XML document. Save the XML in a file (ex: yourfile.xml) then launch
9 xlstproc that will happylly apply this stylesheet to the xml document
10 and output some XHTML.
11
12
13 Author:
14 Ashar Voultoiz <[email protected]
15 License:
16 http://www.gnu.org/copyleft/gpl.html GNU General Public Licence 2.0 or later
17
18 Copyright © 2006 Ashar Voultoiz
19
20-->
21<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
22<xsl:output
23 method="html" indent="yes"
24 encoding="utf-8"
25 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
26 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
27/>
28
29<xsl:template match="/">
30 <xsl:apply-templates />
31</xsl:template>
32
33<xsl:template match="/articles">
34 <xsl:apply-templates />
35</xsl:template>
36
37<xsl:template match="/articles/article">
38<html>
39<head>
40 <title><xsl:value-of select="@title" /></title>
41 <style type="text/css" media="screen,projection">@import "http://en.wikipedia.org/w/skins-1.5/monobook/main.css";</style>
42</head>
43<body class="ns-0 ltr">
44<div id="globalWrapper">
45 <div id="column-content">
46 <div id="content">
47 <h1 class="firstHeading"><xsl:value-of select="@title" /></h1>
48 <div id="bodyContent">
49 <h3 id="siteSub">Generated with xhtml.xslt</h3>
50 <div id="contentSub"></div>
51 </div>
52 <xsl:apply-templates />
53 </div>
54 </div>
55</div>
56</body>
57</html>
58</xsl:template>
59
60<xsl:template match="paragraph">
61 <p><xsl:apply-templates /></p>
62</xsl:template>
63
64<xsl:template match="list">
65 <xsl:choose>
66 <xsl:when test="@type = numbered">
67 <ol><xsl:apply-templates/></ol>
68 </xsl:when>
69 <xsl:when test="@type = bullet">
70 <ul><xsl:apply-templates/></ul>
71 </xsl:when>
72 <xsl:otherwise>
73 <ul><xsl:apply-templates/></ul>
74 </xsl:otherwise>
75 </xsl:choose>
76</xsl:template>
77
78<xsl:template match="listitem">
79<li><xsl:apply-templates /></li>
80</xsl:template>
81
82<xsl:template match="space">
83<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:apply-templates />
84</xsl:template>
85
86<xsl:template match="italics">
87<i><xsl:apply-templates /></i>
88</xsl:template>
89
90<xsl:template match="link">
91 <xsl:choose>
92 <xsl:when test="@type='external'" >
93 <xsl:text disable-output-escaping="yes">&lt;a href="</xsl:text><xsl:value-of select="@href" />
94 <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
95 <xsl:value-of select="."/>
96 <xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>
97 </xsl:when>
98 <xsl:otherwise>
99 <xsl:text disable-output-escaping="yes">&lt;a href="http://yourhost/wiki/</xsl:text>
100 <xsl:apply-templates select="target"/>
101 <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
102 <xsl:choose>
103 <xsl:when test="child::part">
104 <xsl:apply-templates select="part"/>
105 </xsl:when>
106 <xsl:otherwise>
107 <xsl:apply-templates select="target"/>
108 </xsl:otherwise>
109 </xsl:choose>
110 <xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>
111 </xsl:otherwise>
112 </xsl:choose>
113</xsl:template>
114
115<xsl:template match="target">
116<xsl:apply-templates/>
117</xsl:template>
118
119<xsl:template match="part">
120<xsl:apply-templates/>
121</xsl:template>
122
123</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.