html2xhtmlv2.xsl 1.66 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 19 20 21 22
    <xsl:template match="li/br">
        <p>
            <xsl:apply-templates select="key('bits', generate-id())"/>
        </p>
    </xsl:template>
qaomia's avatar
fixes  
qaomia committed
23 24 25 26 27 28 29 30 31 32
    <xsl:template match="strong">
        <em>
            <xsl:apply-templates select="@*|node()"/>
        </em>
    </xsl:template>
    <xsl:template match="s">
        <em>
            <xsl:apply-templates select="@*|node()"/>
        </em>
    </xsl:template>
qaomia's avatar
u added  
qaomia committed
33 34 35 36 37
    <xsl:template match="u">
        <em>
            <xsl:apply-templates select="@*|node()"/>
        </em>
    </xsl:template>
qaomia's avatar
fix xsl  
qaomia committed
38 39 40 41 42 43 44 45 46 47 48
    <xsl:template match="ul">
        <ul>
            <xsl:apply-templates select="*"/>
        </ul>
    </xsl:template>
    <xsl:template match="ol">
        <ol>
            <xsl:apply-templates select="*"/>
        </ol>
    </xsl:template>
    
qaomia's avatar
fixes  
qaomia committed
49 50 51 52 53 54 55 56 57 58 59
    
    <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>
</xsl:stylesheet>