Bonjour,
voici un schéma xml :
je souhaiterai grâce a un schema xslt obtenir la profondeur des elements phr pour obtenir une structure de la sorte :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <phr function="Subj"> <w type="det" lemma="le">Le</w> <w type="adj" lemma="joli">joli</w> <w type="nom" lemma="chat">chat</w> <phr function="DO"> <w type="pro" lemma="que">que</w> </phr> <phr function="Subj"> <w type="nom" lemma="je">j'</w> </phr> <phr function="predicate"> <w type="aux" lemma="avoir">ai</w> <phr function="CC"> <w type="adv" lemma="gentiment">gentiment</w> </phr> <w type="partpass" lemma="adopter">adopté</w> </phr> </phr> <phr function="predicate"> <w type="aux" lemma="avoir">a</w> <phr function="CC"> <w type="adv" lemma="bien">bien</w> </phr> <w type="partpass" lemma="donner">donné</w> </phr>
en effet si on part d'un phr a la racine on a un niveau 0
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <span class="Subj0"> <span class="det" title="det - lemme : le">Le</span> <span class="adj" title="adj - lemme : joli">joli</span> <span class="nom" title="nom - lemme : chat">chat</span> <span class="DO1"> <span class="pro" title="pro - lemme : que">que</span> </span> <span class="Subj1"> <span class="nom" title="nom - lemme : je">j'</span> </span> <span class="predicate1"> <span class="aux" title="aux - lemme : avoir">ai</span> <span class="CC2"> <span class="adv" title="adv - lemme : gentiment">gentiment</span> </span> <span class="partpass" title="partpass - lemme : adopter">adopté</span> </span> </span> <span class="predicate0"> <span class="aux" title="aux - lemme : avoir">a</span> <span class="CC1"> <span class="adv" title="adv - lemme : bien">bien</span> </span> <span class="partpass" title="partpass - lemme : donner">donné</span> </span>
ensuite si on a un fils phr alors on est au niveau 1
et ainsi de suite.
j'ai ma feuille de style et je souhaiterai integrer cette étape pour obtenir mon resultat
merci de votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" version="1.0"> <xsl:output method="html" encoding="UTF-8" indent="yes"/> <xsl:template match="tei:div"> <xsl:apply-templates/> </xsl:template> <xsl:template match="tei:teiHeader"> <xsl:comment> <xsl:apply-templates select="node()"/> </xsl:comment> </xsl:template> <xsl:template match="tei:phr"> <xsl:element name="span"> <xsl:attribute name="class"> <xsl:value-of select="@function"/> </xsl:attribute> <xsl:apply-templates select="node()"/> </xsl:element> </xsl:template> <xsl:template match="tei:w"> <xsl:element name="span"> <xsl:attribute name="class"> <xsl:value-of select="@type"/> </xsl:attribute> <xsl:attribute name="title"> <xsl:value-of select="@type"/> <xsl:text> - lemme : </xsl:text> <xsl:value-of select="@lemma"/> </xsl:attribute> <xsl:apply-templates select="node()"/> </xsl:element> </xsl:template> </xsl:stylesheet>
Partager