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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="utf-8"/>
	<xsl:template match="/">
		<xsl:result-document href="fichier_sortie.txt" method="text">
			<xsl:text>
			</xsl:text>
			<xsl:text>Patron NOM PREP NOM PREP </xsl:text>
			<xsl:text>
</xsl:text>
			<xsl:for-each select="//item">
				<xsl:if test="starts-with(a[4],'NC') and ./following-sibling::item[1]/a[4]='P' and starts-with(./following-sibling::item[2]/a[4],'NC') and ./following-sibling::item[3]/a[4]='P'">
					<xsl:variable name="T1" select="a[2]"/>
					<xsl:variable name="T2" select="./following-sibling::item[1]/a[2]"/>
					<xsl:variable name="T3" select="./following-sibling::item[2]/a[2]"/>
					<xsl:variable name="T4" select="./following-sibling::item[3]/a[2]"/>
					<xsl:value-of select="$T1"/><xsl:text> </xsl:text><xsl:value-of select="$T2"/><xsl:text> </xsl:text><xsl:value-of select="$T3"/><xsl:text> </xsl:text><xsl:value-of select="$T4"/><xsl:text>
</xsl:text>
				</xsl:if>
			</xsl:for-each>

			<xsl:text>
			</xsl:text>
			<xsl:text>Patron VERBE DET NOM </xsl:text>
			<xsl:text>
</xsl:text>
			<xsl:for-each select="//item">
				<xsl:if test="a[4]='V' and starts-with(./following-sibling::item[1]/a[4],'DET') and starts-with(./following-sibling::item[2]/a[4],'NC')">
					<xsl:variable name="T1" select="a[2]"/>
					<xsl:variable name="T2" select="./following-sibling::item[1]/a[2]"/>
					<xsl:variable name="T3" select="./following-sibling::item[2]/a[2]"/>
					<xsl:value-of select="$T1"/><xsl:text> </xsl:text><xsl:value-of select="$T2"/><xsl:text> </xsl:text><xsl:value-of select="$T3"/><xsl:text>
</xsl:text>
				</xsl:if>
			</xsl:for-each>

			<xsl:text>
			</xsl:text>
			<xsl:text>Patron NOM-ADJ </xsl:text>
			<xsl:text>
</xsl:text>
			<xsl:for-each select="//item">
				<xsl:if test="starts-with(a[4],'NC') and starts-with(./following-sibling::item[1]/a[4],'ADJ')">
					<xsl:variable name="T1" select="a[2]"/>
					<xsl:variable name="T2" select="./following-sibling::item[1]/a[2]"/>
					<xsl:value-of select="$T1"/><xsl:text> </xsl:text><xsl:value-of select="$T2"/><xsl:text>
</xsl:text>
				</xsl:if>
			</xsl:for-each>
			<xsl:text>
			</xsl:text>
			<xsl:text>Patron ADJ-NOM </xsl:text>
			<xsl:text>
</xsl:text>
			<xsl:for-each select="//item">
				<xsl:if test="starts-with(a[4],'ADJ') and starts-with(./following-sibling::item[1]/a[4],'NC')">
					<xsl:variable name="T1" select="a[2]"/>
					<xsl:variable name="T2" select="./following-sibling::item[1]/a[2]"/>
					<xsl:value-of select="$T1"/><xsl:text> </xsl:text><xsl:value-of select="$T2"/><xsl:text>
</xsl:text>
				</xsl:if>
			</xsl:for-each>
		</xsl:result-document>
	</xsl:template>

</xsl:stylesheet>