html2xhtmlv2.xsl 1.9 KB
Newer Older
qaomia's avatar
fixes  
qaomia committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes"/>
    <xsl:key name="bits" match="p/node()[not(self::br)]" use="generate-id((..|preceding-sibling::br[1])[last()])"/>
    
    <xsl:template match="p">
        <p>
            <xsl:apply-templates select="key('bits', generate-id())"/>
        </p>
        <xsl:apply-templates select="br"/>
    </xsl:template>
    
    <xsl:template match="p/br">
        <p>
            <xsl:apply-templates select="key('bits', generate-id())"/>
        </p>
    </xsl:template>
qaomia's avatar
fix xsl  
qaomia committed
18
    <xsl:template match="li/br">
qaomia's avatar
qaomia committed
19
        <xsl:apply-templates/>
qaomia's avatar
fix xsl  
qaomia committed
20
    </xsl:template>
qaomia's avatar
fixes  
qaomia committed
21
22
23
24
25
    <xsl:template match="strong">
        <em>
            <xsl:apply-templates select="@*|node()"/>
        </em>
    </xsl:template>
26
27
28
29
30
    <xsl:template match="span[@data-color]">
        <em>
            <xsl:apply-templates select="node()"/>
        </em>
    </xsl:template>
qaomia's avatar
fixes  
qaomia committed
31
32
33
34
35
    <xsl:template match="s">
        <em>
            <xsl:apply-templates select="@*|node()"/>
        </em>
    </xsl:template>
qaomia's avatar
u added  
qaomia committed
36
37
38
39
40
    <xsl:template match="u">
        <em>
            <xsl:apply-templates select="@*|node()"/>
        </em>
    </xsl:template>
qaomia's avatar
fix xsl  
qaomia committed
41
42
43
44
45
46
47
48
49
50
    <xsl:template match="ul">
        <ul>
            <xsl:apply-templates select="*"/>
        </ul>
    </xsl:template>
    <xsl:template match="ol">
        <ol>
            <xsl:apply-templates select="*"/>
        </ol>
    </xsl:template>
51
52
53
54
    <xsl:template match="h1 | h2 | h3 | h4 | h5 | h6">
	Titre (non pris en compte pour l'instant) :
        <xsl:apply-templates select="@*|node()"/>
    </xsl:template>
NF29 Etudiant's avatar
NF29 Etudiant committed
55
    
qaomia's avatar
fixes  
qaomia committed
56
57
58
59
60
61
62
63
64
    <xsl:template match="page">
        <xsl:apply-templates select="@*|node()"/>
    </xsl:template>
    
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>
65
</xsl:stylesheet>