🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: je voudrais le grand-père XPATH

#8730
From: Thomas Broyer
Date: Tue, 21 Aug 2001 16:01
51 lines
2541 bytes
In <Jkug7.266$aJ3.1169557@nnrp3.proxad.net>, Rapha�l THERY wrote:
> soit le flux xml suivant
> <dir>
>     <inclusion pattenr="*.java" mode="propag" />
>     ...
>     <dir>
>         <exclusion pattenr="*.bak" />
>         <dir>
>             <inclusion pattern="*.java" />
>         </dir>
>     </dir>
> </dir>
> 
> en �crivant une r�gle commune sur les inclusions, exclusions (xsl:template
> match="inclusion|exclusion")
> je souhaite d�tecter si un fils d'un anc�tre d�finis d�j� la m�me r�gle.
> 
> Question(s) :
> - Comment identifier tous les anc�tres � l'exculsion du parent m�me
> (ancestor - parent) ?

ancestor::*[position > 1]
Le parent est forc�ment le premier anc�tre, si on s�lectionne seuls les 
anc�tres dont la position n'est pas la premi�re on supprime bien le parent 
de la liste.

> - Dans la mesure o� la r�gle est commune comment �crire l'expression pour
> en d�duire le nom ?

???
name() ?

> Actuellement j'arrive � un truc comme cela :
> =>
> 
"ancestor::*/child::inclusion[@mode='propag'][@pattern=current()/@pattern]"

Utilise and plut�t que plusieurs pr�dicats, c'est en g�n�ral plus rapide, 
et �a correspond bien � ce que tu veux.

> =>
> 
"ancestor::*/child::exclusion[@mode='propag'][@pattern=current()/@pattern]"
> la fusion en
> =>  "ancestor::*/child::*[name() =
> current()/name()][@mode='propag'][@pattern=current()/@pattern]"
> provoque une erreur.

name() = name(current())

Tom.
Technical Details
Message-ID: <15601582.eYUQgxmLvF@ltgt.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!193.251.151.101!opentransit.net!wanadoo.fr!proxad.net!feeder2-1.proxad.net!nnrp4.proxad.net.POSTED!not-for-mail
References: <Jkug7.266$aJ3.1169557@nnrp3.proxad.net>

Show Full Headers
Complete Article Headers
X-Google-Language: FRENCH,ASCII
X-Google-Thread: 114f60,f74fa31dcdf12d11
X-Google-Attributes: gid114f60,public
X-Google-ArrivalTime: 2001-08-21 09:01:49 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!193.251.151.101!opentransit.net!wanadoo.fr!proxad.net!feeder2-1.proxad.net!nnrp4.proxad.net.POSTED!not-for-mail
Message-ID: <15601582.eYUQgxmLvF@ltgt.net>
From: Thomas Broyer <ptittom+news@free.fr>
Subject: Re: je voudrais le grand-père XPATH
Newsgroups: fr.comp.text.xml
Mail-Copies-To: nobody
References: <Jkug7.266$aJ3.1169557@nnrp3.proxad.net>
Lines: 51
Organization: </>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8Bit
Date: Tue, 21 Aug 2001 16:01:48 GMT
NNTP-Posting-Host: 217.128.160.79
X-Complaints-To: abuse@proxad.net
X-Trace: nnrp4.proxad.net 998409708 217.128.160.79 (Tue, 21 Aug 2001 18:01:48 CEST)
NNTP-Posting-Date: Tue, 21 Aug 2001 18:01:48 CEST