transformation.xsl 2.44 KB
Newer Older
simei.yin's avatar
simei.yin committed
1 2
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
Baptiste Montange's avatar
Baptiste Montange committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:h="http://www.utc.fr/ics/hdoc/xhtml"
    exclude-result-prefixes="xs" version="2.0">

    <xsl:template match="h:html">
        <xsl:apply-templates mode="title"/>
    </xsl:template>

    <xsl:template match="h:head" mode="title">
        <titre>
            <xsl:value-of select="./h:title"/>
        </titre>
            <xsl:apply-templates select="./h:meta"/>
            
    </xsl:template>
simei.yin's avatar
simei.yin committed
17
    
Baptiste Montange's avatar
Baptiste Montange committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
    <xsl:template match="h:meta[@name='author']">
        <authors> 
           
                <xsl:for-each select="tokenize(@content,', \d')">
                    <xsl:if test="position() = 1">
                        <xsl:for-each select="tokenize(.,', ')">
                        <author>
                            <xsl:value-of select="."/>
                            
                        </author>
                        </xsl:for-each>
                    </xsl:if>
                </xsl:for-each>
            
        </authors>
    </xsl:template>

    <xsl:template match="h:body" mode="title">
        <sections>
           
                <xsl:apply-templates select="./h:section"/>
            
        </sections>
    </xsl:template>
simei.yin's avatar
simei.yin committed
42
    
Baptiste Montange's avatar
Baptiste Montange committed
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
    <xsl:template match="h:section">
        <section>
            <titresection>
                <xsl:value-of select="./h:header/h:h1"/>
            </titresection>
            <contenu>
                
                <paragraphes>
                    <xsl:apply-templates select="h:div"/>
                </paragraphes>
                <xsl:apply-templates select="h:section" mode="soussect"/>
            </contenu>
        </section>
    </xsl:template>
 
    <xsl:template match="h:section" mode="soussect">
        <soussection></soussection>
simei.yin's avatar
simei.yin committed
60 61
    </xsl:template>
    
Baptiste Montange's avatar
Baptiste Montange committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
    <xsl:template match="h:div" >
        
            <xsl:if test="h:p">
                <paragraphe>
                <xsl:value-of select="."/>
                </paragraphe>
            </xsl:if>
            <xsl:if test="h:ul">
                <xsl:apply-templates select="h:ul"></xsl:apply-templates>
            </xsl:if>
        
    </xsl:template>
    <xsl:template match="h:ul">
        <xsl:for-each select="h:li">
            <paragraphe>
                <xsl:value-of select="h:p"/>
            </paragraphe>
        </xsl:for-each>
        
    </xsl:template>
82
    
Baptiste Montange's avatar
Baptiste Montange committed
83 84 85


</xsl:stylesheet>