aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/xpath/functions/lang
diff options
context:
space:
mode:
authorFlorian Merz <me@fiji-flo.de>2021-02-11 12:36:08 +0100
committerFlorian Merz <me@fiji-flo.de>2021-02-11 12:36:08 +0100
commit39f2114f9797eb51994966c6bb8ff1814c9a4da8 (patch)
tree66dbd9c921f56e440f8816ed29ac23682a1ac4ef /files/fr/web/xpath/functions/lang
parent8260a606c143e6b55a467edf017a56bdcd6cba7e (diff)
downloadtranslated-content-39f2114f9797eb51994966c6bb8ff1814c9a4da8.tar.gz
translated-content-39f2114f9797eb51994966c6bb8ff1814c9a4da8.tar.bz2
translated-content-39f2114f9797eb51994966c6bb8ff1814c9a4da8.zip
unslug fr: move
Diffstat (limited to 'files/fr/web/xpath/functions/lang')
-rw-r--r--files/fr/web/xpath/functions/lang/index.html56
1 files changed, 56 insertions, 0 deletions
diff --git a/files/fr/web/xpath/functions/lang/index.html b/files/fr/web/xpath/functions/lang/index.html
new file mode 100644
index 0000000000..6ce39f2dc1
--- /dev/null
+++ b/files/fr/web/xpath/functions/lang/index.html
@@ -0,0 +1,56 @@
+---
+title: lang
+slug: Web/XPath/Fonctions/lang
+tags:
+ - Référence_XSLT
+translation_of: Web/XPath/Functions/lang
+---
+<p>
+{{ XsltRef() }}
+</p><p><br>
+La fonction <code>lang</code> détermine si le nœud de contexte correspond à la langue indiquée et retourne le booléen <code>true</code> ou <code>false</code>.
+</p>
+<h3 id="Syntaxe" name="Syntaxe"> Syntaxe </h3>
+<pre class="eval">lang( <i>chaîne</i> )
+</pre>
+<h3 id="Arguments" name="Arguments"> Arguments </h3>
+<dl><dt><code><i>chaîne</i></code>
+</dt><dd>Le code de langue ou de localisation (langue et pays) à vérifier.
+</dd></dl>
+<h3 id="Retour" name="Retour"> Retour </h3>
+<p><code>true</code> si le noeud de contexte est dans la langue donnée, <code>false</code> autrement.
+</p>
+<h3 id="Notes" name="Notes"> Notes </h3>
+<ul><li> La langue d'un nœud est déterminée par son attribut <code>xml:lang</code>. Si le nœud courant ne possède pas cet attribut, alors la valeur de l'attribut <code>xml:lang</code> du plus proche ancêtre le possédant déterminera la langue du nœud courant. Si la langue ne peut être déterminée (aucun ancêtre avec un attribut <code>xml:lang</code>), cette fonction retourne le booléen <code>false</code>.
+</li></ul>
+<ul><li> Si la <code><i>chaîne</i></code> donnée ne spécifie pas de code de pays, cette fonction sélectionnera les nœuds dans la langue spécifiée, suivie éventuellement de n'importe quel code de pays. La réciproque n'est pas vraie.
+</li></ul>
+<p>Regardons le code XML suivant :
+</p>
+<pre>&lt;p xml:lang="en"&gt;I went up a floor.&lt;/p&gt;
+&lt;p xml:lang="en-GB"&gt;I took the lift.&lt;/p&gt;
+&lt;p xsl:lang="en-US"&gt;I rode the elevator.&lt;/p&gt;</pre>
+<p>et ce modèle XSL :
+</p>
+<pre class="eval">&lt;xsl:value-of select="count(//p[lang('en')])" /&gt;
+&lt;xsl:value-of select="count(//p[lang('en-GB')])" /&gt;
+&lt;xsl:value-of select="count(//p[lang('en-US')])" /&gt;
+&lt;xsl:value-of select="count(//p[lang('de')])" /&gt;
+</pre>
+<p>La sortie sera :
+</p>
+<pre class="eval">3
+1
+1
+0
+</pre>
+<h3 id="D.C3.A9finition" name="D.C3.A9finition"> Définition </h3>
+<p><a href="http://www.w3.org/TR/xpath#function-lang" class="external">XPath 1.0, section 4.3</a>.
+</p>
+<h3 id="Support_Gecko" name="Support_Gecko"> Support Gecko </h3>
+<p>Supporté.
+</p><p><span class="comment">Interwiki Languages Links</span>
+</p>
+<div class="noinclude">
+</div>
+{{ languages( { "en": "en/XPath/Functions/lang", "ja": "ja/XPath/Functions/lang", "pl": "pl/XPath/Funkcje/lang" } ) }}