Re: Variables dans document()

Eric van der Vlist <[email protected]>
Newsgroups gmane.text.xml.french.tech
Organization Dyomedea (http://dyomedea.com)
Message-ID <[email protected]>
Le jeudi 23 février 2006 à 15:40 +0100, [email protected] a écrit :
> Vous êtes un dieu vivant!
N'exagérons rien, le mérité revient à XPath (en son principal
concepteur, James Clark)! :-)

> Ca marche nickel. J'ai rajouté une ptit clause histoire de virer l'article
> que l'on compare. et voila.

Pour trier, il faut rajouter un xsl:sort (en plus de voter ptit
clause) :

<xsl:template match="liste">
        <xsl:for-each select="theme/fichier[document(.)/ARTICLE/motclefs//mot = document($article_origine)/ARTICLE/motclefs//mot">
                <xsl:sort select="count(document(.)/ARTICLE/motclefs//mot[.=document($article_origine)/ARTICLE/motclefs//mot])" order="descending"/>
                <p><font color="#FF0000"><b><xsl:value-of select="."/></b></p>
        </xsl:for-each>
</xsl:template>

Notez que je suis toujours très réservé sur le résultat que cela va
donner en terme de temps de réponse quand vous aurez "pas mal de gros
documents"!

> Je suis quand meme dégouté que cela marche en 3 lignes mais bon, ca
> m'aurait fait un petit peu reflechir pour pondre ce que j'avais fai
> auparavant.

Oui, c'était un bon exercise! 

C'est un peu comme en SQL : il faut penser à réfléchir de manière
"ensembliste" pour tirer le maximum de XPath...

Cordialement,

Eric van der Vlist
-- 
GPG-PGP: 2A528005
Le premier annuaire des apiculteurs 100% XML!
                                                http://apiculteurs.info/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(ISO) RELAX NG   ISBN:0-596-00421-4 http://oreilly.com/catalog/relax
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------


-- Attached file included as plaintext by Ecartis --

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQBD/csRDvn+ZCpSgAURAnwVAJ9thmAOL5+1X7ptW2mKRTAMzIslTQCggRmZ
qyfcktzVMIlhwhK21Dw/zFw=
=E21U
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.