From: Benoît Barré (benoitbarre@free.fr)
Date: 12/09/2002 - 09:02
Avec cette FdS :
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<r>
<xsl:apply-templates select="//c"/>
</r>
</xsl:template>
<xsl:template match="c">
<c>
Child: <xsl:value-of select="position()"/> (parent:
<xsl:number count="p" format="(0)"/>)
</c>
</xsl:template>
</xsl:stylesheet>
et cette instance XML :
<t>
<p>
<c/>
</p>
<p>
<c/>
<c/>
<c/>
<c/>
</p>
<p>
<c/>
</p>
<p>
<c/>
</p>
<p>
<c/>
</p>
</t>
On obtient :
<?xml version="1.0" encoding="UTF-16"?>
<r>
<c>Child: 1 (parent: (1))</c>
<c>Child: 2 (parent: (2))</c>
<c>Child: 3 (parent: (2))</c>
<c>Child: 4 (parent: (2))</c>
<c>Child: 5 (parent: (2))</c>
<c>Child: 6 (parent: (3))</c>
<c>Child: 7 (parent: (4))</c>
<c>Child: 8 (parent: (5))</c>
</r>
A adapter mais ça ne doit pas être très difficile ;-).
Benoît
--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !
Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
Cette liste est a votre disposition pour discuter en francais de
tout sujet technique lie a XML.
Pour resilier votre abonnement, envoyez un message contenant
la commande "unsubscribe" a xml-tech-request@xmlfr.org
(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
Archive générée par hypermail 2.1.3 le 28/06/2004 - 11:06 UTC
webmaster@xmlfr.org
|