🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: distinct

#444
From: Alain Ketterlin
Date: Mon, 02 Apr 2007 08:08
39 lines
2333 bytes
Jean-Charles Gibier <j-c.gibier@wanadoo.withoutthis.fr.invalid>
writes:

> Dans un format xhtml comment parser avec xslt 2.0 le groupe d'�l�ments
> 'input' de type="radio" en faisant un "distinct" en fonction de
> l'attribut "name" ?
>
> <patati ...>
> <patata ...>
> ...
> <input type="radio" name="nom1" value="Non" />
> <input type="radio" name="nom1" value="Oui" />
> <input type="radio" name="nom2" value="Non" />
> <input type="radio" name="nom2" value="Oui" />
> <input type="radio" name="nom2" value="Peut �tre" />
> ...
> </patata ...>
> </patati ...>

En 1.0 :

  <xsl:for-each select="xh:input[not(@name=preceding::xh:input/@name)]"/>
      <xsl:variable name="distinct" select="@name"/>
      ...
  </for-each>

(ou xh est le prefixe associ� au namespace XHTML). Si tous les <input
.../> sont freres, tu peux remplacer preceding par preceding-sibling. 
Le corps de la boucle est ex�cut� une fois pour la premi�re valeur
distincte. Si tu veux la derni�re, remplace preceding par following.

Si tu veux restreindre la distinction � l'int�rieur d'un �l�ment
particulier (au hasard le <form> container), c'est une chouia plus
compliqu�.

En 2.0 je ne sais pas, mais for-each-group et compagnie sont s�rement
l� pour �a (et probablement plus efficaces).

-- Alain.
Technical Details
Message-ID: <87odm75hcl.fsf@dpt-info.u-strasbg.fr>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.cs.univ-paris8.fr!jussieu.fr!not-for-mail
References: <46102a35$0$27371$ba4acef3@news.orange.fr>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114f60,c042a3fd192464af
X-Google-Attributes: gid114f60,public
X-Google-Language: FRENCH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.cs.univ-paris8.fr!jussieu.fr!not-for-mail
From: Alain Ketterlin <alain@dpt-info.u-strasbg.fr>
Newsgroups: fr.comp.text.xml
Subject: Re: distinct
Date: Mon, 02 Apr 2007 10:08:10 +0200
Organization: Universites Paris VI/Paris VII - France
Lines: 39
Message-ID: <87odm75hcl.fsf@dpt-info.u-strasbg.fr>
References: <46102a35$0$27371$ba4acef3@news.orange.fr>
NNTP-Posting-Host: icps-laptop-ketterlin.u-strasbg.fr
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: vishnu.jussieu.fr 1175501290 23972 130.79.192.170 (2 Apr 2007 08:08:10 GMT)
X-Complaints-To: usenet@vishnu.jussieu.fr
NNTP-Posting-Date: Mon, 2 Apr 2007 08:08:10 +0000 (UTC)
User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.19 (linux)
Cancel-Lock: sha1:qxnn3zvng8xG5ttzcB+csrku4f8=