🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fr.comp.text.xml
Article #10140

Re: XSL: navigation

#10140
From: Tom.
Date: Mon, 11 Dec 2000 21:36
49 lines
1992 bytes
In article <3a350083.2847516542@news.usherb.ca>,
jeanfrancoisruel@iname.com  wrote:
> <parent>
> 	<enfant1>
> 	</enfant1>
> 	<enfant2>
> 	</enfant2>
> 	<enfant3>
> 	</enfant3>
> 
> 	<enfant1>
> 	</enfant1>
> 	<enfant2>
> 	</enfant2>
> 
> 	<enfant1>
> 	</enfant1>
> 	<enfant3>
> 	</enfant3>
> </parent>
> 
> Le fait est que pour que le document soit valide, seul <enfant1> est
> obligatoire alors que ses noeuds fr�res sont optionnels. Je veux donc
> avoir acc�s � <enfant1>(1) puis <enfant2>(1) puis <enfant3>(1) et
> ensuite <enfant1>(2) puis <enfant2>(2)... etc ...

Pour avoir les �l�ments dans l'ordre du document,
<xsl:apply-templates/> ou, si tu tiens � une boucle :
<xsl:for-each select="*"><!-- tous les fils -->
  <xsl:choose>
  <xsl:when test="name() = 'enfant1'">
    <!-- enfant1 -->
  </xsl:when>
  <xsl:when test="name() = 'enfant2'">
    <!-- enfant2 -->
  </xsl:when>
  <xsl:when test="name() = 'enfant3'">
    <!-- enfant3 -->
  </xsl:when>
  <xsl:otherwise>
    <!-- erreur -->
  </xsl:otherwise>
  </xsl:choose>
</xsl:for-each>

Il est toujours plus ais� de travailler avec des templates que des
boucles.

Tom.
Technical Details
Message-ID: <tmf319.gu4.ln@ptittom.free.fr>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!proxad.net!feeder2.proxad.net!nnrp1.proxad.net.POSTED!debian!ptittom
References: <3a350083.2847516542@news.usherb.ca>

Show Full Headers
Complete Article Headers
X-Google-Language: FRENCH,ASCII
X-Google-Thread: 114f60,d441bc33a9e00dfe
X-Google-Attributes: gid114f60,public
X-Google-ArrivalTime: 2000-12-11 13:36:17 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!proxad.net!feeder2.proxad.net!nnrp1.proxad.net.POSTED!debian!ptittom
From: "Tom." <ptittom@free.fr>
Subject: Re: XSL: navigation
Newsgroups: fr.comp.text.xml
Organization: -
References: <3a350083.2847516542@news.usherb.ca>
User-Agent: Pan/0.9.1 (Unix)
X-No-Productlinks: Yes
Message-ID: <tmf319.gu4.ln@ptittom.free.fr>
Lines: 49
Date: Mon, 11 Dec 2000 21:36:12 GMT
NNTP-Posting-Host: 213.228.43.47
X-Complaints-To: abuse@proxad.net
X-Trace: nnrp1.proxad.net 976570572 213.228.43.47 (Mon, 11 Dec 2000 22:36:12 MET)
NNTP-Posting-Date: Mon, 11 Dec 2000 22:36:12 MET