Bonjour voici un bout de schema xml :
voici mon debut de code xslt :
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 <analyse> <s xml:lang="fr" id="0"> <phr type="DP" function="subj" level="0"> <w type="det" lemma="le">Le</w> <w type="adj" lemma="joli">joli</w> <w type="nom" lemma="chat">chat</w> <phr type="" function="D-obj" level="1"> <w type="pro" lemma="que">que</w> </phr> <phr type="" function="subj" level="1"> <w type="nom" lemma="je">j'</w> </phr> <phr type="" function="predicate" level="1"> <w type="aux" lemma="avoir">ai</w> <phr type="" function="CC" level="2"> <w type="adv" lemma="gentiment">gentiment</w> </phr> <w type="partpass" lemma="adopter">adopté</w> </phr> </phr> </analyse>
le resultat est :
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 <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tei="http://www.tei-c.org/ns/1.0" xmlns="http://www.tei-c.org/ns/1.0" version="1.0"> <xsl:output encoding="UTF-8" method="html" indent="yes" doctype-public=""/> <xsl:template match="analyse/s"> <html> <head> </head> <body> <div> <xsl:for-each select="phr"> <xsl:element name="span"> <xsl:attribute name="class"> <xsl:value-of select="@function"/> <xsl:value-of select="@level"/> </xsl:attribute> <xsl:apply-templates select="node()"/> </xsl:element> </xsl:for-each> </div> </body> </html> </xsl:template> </xsl:stylesheet>
le soucis est que je voudrai avoir ce resultat :
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 <span class="subj0"> Le joli chat que j' ai gentiment adopté </span>
je narrive pas a recuperer les noeud enfant de phr apparament
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 <span class="subj0"> Le joli chat <span class="D-obj1"> que</span> <span class="subj1">j'</span> <span class="predicate1"> ai <span class="CC2">gentiment</span> adopté </span> </span>
merci
Partager