Re: [Xpath] Deux contextes à la fois ?

Eric van der Vlist <[email protected]>
Newsgroups gmane.text.xml.french.tech
Organization Dyomedea (http://dyomedea.com)
Message-ID <[email protected]>
Le lundi 13 février 2006 à 16:51 +0100, Stephane Bortzmeyer a écrit :
> Je cherche à faire une expression Xpath (c'est pour Schematron) qui 
> vérifie si un élément a la même valeur qu'un autre élément. En XSLT,
> ça donne :
> 
>   <xsl:template match="domain">
>       <!-- Y a t-il un <contact> dont le <handle> soit identique à 
>            mon <holder> ? -->
>       <xsl:if test="/zone/contact[handle=holder]"/>
> 
> Mon problème est que je voudrais que "handle" soit évalué dans le
> contexte du <contact> et "holder" dans celui du <domain>. À lire la
> norme Xpath, je pense que je suis mal parti, tout est évalué dans le
> contexte du noeud courant, ici <contact>. En XSLT, la solution serait
> :
> 
>     <xsl:variable name="holder"><axsl:value-of select="holder"/></xsl:variable>
>     <xsl:if test="/zone/contact[handle=$holder]"/>
> 
> mais cela ne marche pas pour Schematron où l'expression Xpath doit
> être auto-suffisante (pas de variable).
> 
> Une idée ?
La fonction "current()" est faite pour cela!

<xsl:if test="/zone/contact[handle=current()/holder]"/>

cf http://xmlfr.org/documentations/faq/010626-0003

Cordialement,

Eric van der Vlist

-- 
GPG-PGP: 2A528005
If you have a XML document, you have its schema.
                                                  http://examplotron.org
------------------------------------------------------------------------
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)

iD8DBQBD8Kv1Dvn+ZCpSgAURAmnZAJ4kZL/RfoSwTy8ZPW9SAkMpm4mnZgCfWmW8
WH9bEKceTeWArdAzs1Ol+Uw=
=BuDk
-----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.