[XSL]Probleme fonction recursive
Salut a tous,
j'essaye de recuperer des infos precises d'un fichier xml a l'aide d'une fonction recursive.
Mon soucis, c'est que la fonction s'appelle indefiniment.
Voici le fichier xml:
Code:
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
| <Row ss:AutoFitHeight="0">
<Cell ss:MergeAcross="1" ss:StyleID="s29"><Data ss:Type="String">el</Data></Cell>
</Row>
<Row>
<Cell ss:StyleID="s22"><Data ss:Type="String">Indication of the product: </Data></Cell>
<Cell ss:StyleID="s22"><Data ss:Type="String">Ρολόγια χειρός</Data></Cell>
</Row>
<Row>
<Cell ss:StyleID="s22"><Data ss:Type="String">Indication of the product: </Data></Cell>
<Cell ss:StyleID="s22"><Data ss:Type="String">Κεφαλόφωνα</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:MergeAcross="1" ss:StyleID="s29"><Data ss:Type="String">en</Data></Cell>
</Row>
<Row>
<Cell ss:StyleID="s22"><Data ss:Type="String">Indication of the product: </Data></Cell>
<Cell ss:StyleID="s22"><Data ss:Type="String">Wrist watches</Data></Cell>
</Row>
<Row>
<Cell ss:StyleID="s22"><Data ss:Type="String">Indication of the product: </Data></Cell>
<Cell ss:StyleID="s22"><Data ss:Type="String">Headphones</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:MergeAcross="1" ss:StyleID="s29"><Data ss:Type="String">es</Data></Cell>
</Row>
<Row>
<Cell ss:StyleID="s22"><Data ss:Type="String">Indication of the product: </Data></Cell>
<Cell ss:StyleID="s22"><Data ss:Type="String">Relojes de pulsera</Data></Cell>
</Row>
<Row>
<Cell ss:StyleID="s22"><Data ss:Type="String">Indication of the product: </Data></Cell>
<Cell ss:StyleID="s22"><Data ss:Type="String">Auriculares de casco</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:MergeAcross="1" ss:StyleID="s29"><Data ss:Type="String">et</Data></Cell>
</Row>
<Row>
<Cell ss:StyleID="s22"><Data ss:Type="String">Indication of the product: </Data></Cell>
<Cell ss:StyleID="s22"><Data ss:Type="String">Käekellad</Data></Cell>
</Row>
<Row>
<Cell ss:StyleID="s22"><Data ss:Type="String">Indication of the product: </Data></Cell>
<Cell ss:StyleID="s22"><Data ss:Type="String">Kõrvaklapid</Data></Cell>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:MergeAcross="1" ss:StyleID="s29"><Data ss:Type="String">fi</Data></Cell>
</Row>
<Row>
<Cell ss:StyleID="s22"><Data ss:Type="String">Indication of the product: </Data></Cell>
<Cell ss:StyleID="s22"><Data ss:Type="String">Rannekellot</Data></Cell>
</Row>
<Row>
<Cell ss:StyleID="s22"><Data ss:Type="String">Indication of the product: </Data></Cell>
<Cell ss:StyleID="s22"><Data ss:Type="String">Kuulokkeet</Data></Cell>
</Row> |
et ma fonction xsl:
Code:
1 2 3 4 5 6 7 8 9 10 11
| <xsl:template name="Titre">
<xsl:param name="noeud" select="." />
<xsl:if test="string-length($noeud) > 2">
<titre>
<xsl:value-of select="substring-after($noeud,'Indication of the product:')"/>
</titre>
<xsl:call-template name="Titre">
<xsl:with-param name="noeud" select="following-sibling::*" />
</xsl:call-template>
</xsl:if>
</xsl:template> |
Premiere appel de la fonction:
Code:
1 2 3 4 5 6 7
| <xsl:if test = ". = 'en'">
<titres>
<xsl:call-template name="Titre">
<xsl:with-param name="noeud" select="following-sibling::*" />
</xsl:call-template>
</titres>
</xsl:if> |
Je ne trouve pas pourquoi la fonction s'appelle indefiniment et ne passe pas dans le test.
Edit: je vais quqnd meme un peu expliquer ce que je cherche a faire.
Je cherche a recuperer les titres en anglais de mon document xml qui a été enregistré à partir d'une feuille excel. Comme vous pouvez le voir il peut y avoir plusieurs langue et le nombre de titre peut varier d'un xml à l'autre.
Je parcours tous les noeud de mon document xml, et quand je tombe sur le noeud "en", le lance la routine permettant de recuperer les infos.