<html>
<head>
<title>key() ֐</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="NAME">key() ֐</td>
<td valign="top" class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td valign="top" colspan="2" class="description">
<span class="LITERAL">&lt;xsl:key&gt;</span> vfŒ`ꂽ֌WQƂ܂BTOA<span class="LITERAL">key()</span> ֐ <span class="LITERAL">id()</span> ֐Ɠlɓ삵܂Å֐͂ ID _ȂĂ܂B</td></tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">
<p><span class="LITERAL">&lt;xsl:key&gt;</span> vfɂĒ`L[ƃIuWFNg̖OBIuWFNgm[hZbgłꍇA<span class="LITERAL">key()</span> ֐̓m[hZbg̊em[h̕lɂꎩ̂KpA炷ׂĂ <span class="LITERAL">key()</span> ֐Ăяǒʂ̃m[hZbgԂ܂BIuWFNgʂ̃^Cvłꍇ́A<span class="LITERAL">string()</span> ֐Ăяô悤ɕɕϊ܂B </p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">o</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>vL[p[^ƈvl̃ReLXgm[hƓhLg̃m[h܂ރm[hZbgB܂Ã݂hLĝׂĂ <span class="LITERAL">&lt;address&gt;</span> vf <span class="LITERAL">&lt;postalcode&gt;</span> qɊÂA<span class="LITERAL">postalcodes</span> ƂÕL[` <span class="LITERAL">&lt;xsl:key&gt;</span> vfX^CV[gɂꍇA֐Ăяo <span class="LITERAL">key(postalcodes, '34829')</span> ́Al <span class="LITERAL">34829</span> ł <span class="LITERAL">&lt;postalcode&gt;</span> vfׂĂ <span class="LITERAL">&lt;address&gt;</span> vf܂܂ꂽm[hZbgԂ܂B</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">`</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>XSLT 12.2 ߁uL[v</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">
<p><span class="LITERAL">key()</span> ֐̋͂ȋ@\߂ɁA<link linkend="xslt-CHP-5"> 5 </link>ŐpẂÃhLgp̏ȗo[Wgp܂B</p>
<span class="PROGRAMLISTING"><pre>
&lt;?xml version="1.0" ?&gt;
&lt;glossary&gt;
  &lt;glentry&gt;
    &lt;term id="applet"&gt;applet&lt;/term&gt;
    &lt;defn topic="Java" language="en"&gt;
      An application program,
      written in the Java programming language, that can be 
      retrieved from a web server and executed by a web browser. 
      A reference to an applet appears in the markup for a web 
      page, in the same way that a reference to a graphics
      file appears; a browser retrieves an applet in the same 
      way that it retrieves a graphics file. 
      For security reasons, an applet's access rights are limited
      in two ways: the applet cannot access the filesystem of the 
      client upon which it is executing, and the applet's 
      communication across the network is limited to the server 
      from which it was downloaded. 
      Contrast with &lt;xref refid="servlet"/&gt;.
    &lt;/defn&gt;
<!--<?troff .Nd 10?>-->
    &lt;defn topic="Java" language="it"&gt;
      [Pretend this is an Italian definition of applet.]
    &lt;/defn&gt;
    &lt;defn topic="Java" language="es"&gt;
      [Pretend this is a Spanish definition of applet.]
    &lt;/defn&gt;
  &lt;/glentry&gt;

  &lt;glentry&gt;
    &lt;term id="DMZlong" xreftext="demilitarized zone"&gt;demilitarized 
      zone (DMZ)&lt;/term&gt;
    &lt;defn topic="security" language="en"&gt;
      In network security, a network that is isolated from, and 
      serves as a neutral zone between, a trusted network (for example, 
      a private intranet) and an untrusted network (for example, the
      Internet). One or more secure gateways usually control access 
      to the DMZ from the trusted or the untrusted network.
    &lt;/defn&gt;
    &lt;defn topic="security" language="it"&gt;
      [Pretend this is an Italian definition of DMZ.]
    &lt;/defn&gt;
    &lt;defn topic="security" language="es"&gt;
      [Pretend this is a Spanish definition of DMZ.]
    &lt;/defn&gt;
    &lt;defn topic="security" language="jp"&gt;
      [Pretend this is a Japanese definition of DMZ.]
    &lt;/defn&gt;
    &lt;defn topic="security" language="de"&gt;
      [Pretend this is a German definition of DMZ.]
    &lt;/defn&gt;
  &lt;/glentry&gt;

  &lt;glentry&gt;
    &lt;term id="servlet"&gt;servlet&lt;/term&gt;
    &lt;defn topic="Java" language="en"&gt;
      An application program, written in the Java programming language, 
      that is executed on a web server. A reference to a servlet 
      appears in the markup for a web page, in the same way that a 
      reference to a graphics file appears. The web server executes
      the servlet and sends the results of the execution (if there are
      any) to the web browser. Contrast with &lt;xref refid="applet" /&gt;.
    &lt;/defn&gt;
    &lt;defn topic="Java" language="es"&gt;
      [Pretend this is a Spanish definition of servlet.]
    &lt;/defn&gt;
    &lt;defn topic="Java" language="it"&gt;
      [Pretend this is an Italian definition of servlet.]
    &lt;/defn&gt;
<!--<?troff .Nd 10?>-->
    &lt;defn topic="Java" language="de"&gt;
      [Pretend this is a German definition of servlet.]
    &lt;/defn&gt;
    &lt;defn topic="Java" language="jp"&gt;
      [Pretend this is a Japanese definition of servlet.]
    &lt;/defn&gt;
  &lt;/glentry&gt;
&lt;/glossary&gt;</pre></span>
<p>̃hLg̏ɎgpX^CV[gɎ܂Bł́A2  <span class="LITERAL">&lt;xsl:key&gt;</span> vf` XML hLg 2 ̈قȂ@ŃCfbNXt܂B</p>
<span class="PROGRAMLISTING"><pre>
&lt;?xml version="1.0"?&gt;
&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
&lt;xsl:output method="html" indent="yes"/&gt;
&lt;xsl:strip-space elements="*"/&gt;

  &lt;xsl:key name="language-index" match="defn" use="@language"/&gt;
  &lt;xsl:key name="term-ids"       match="term" use="@id"/&gt;

  &lt;xsl:param name="targetLanguage"/&gt;

  &lt;xsl:template match="/"&gt;
    &lt;xsl:apply-templates select="glossary"/&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template match="glossary"&gt;
    &lt;html&gt;
      &lt;head&gt;
        &lt;title&gt;
          &lt;xsl:text&gt;Glossary Listing: &lt;/xsl:text&gt;
        &lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
        &lt;h1&gt;
          &lt;xsl:text&gt;Glossary Listing: &lt;/xsl:text&gt;
        &lt;/h1&gt;
        &lt;xsl:for-each select="key('language-index', $targetLanguage)"&gt;
          &lt;xsl:apply-templates select="ancestor::glentry"/&gt;
        &lt;/xsl:for-each&gt;
      &lt;/body&gt;
    &lt;/html&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template match="glentry"&gt;
    &lt;p&gt;
      &lt;b&gt;
        &lt;a&gt;
          &lt;xsl:attribute name="name"&gt;
            &lt;xsl:value-of select="term/@id" /&gt;
          &lt;/xsl:attribute&gt;
        &lt;/a&gt;
        &lt;xsl:value-of select="term"/&gt;
        &lt;xsl:text&gt;: &lt;/xsl:text&gt;
      &lt;/b&gt;
      &lt;xsl:apply-templates select="defn[@language=$targetLanguage]"/&gt;
    &lt;/p&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template match="defn"&gt;
    &lt;xsl:apply-templates 
     select="*|comment()|processing-instruction()|text()"/&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template match="xref"&gt;
    &lt;a&gt;
      &lt;xsl:attribute name="href"&gt;
        &lt;xsl:text&gt;#&lt;/xsl:text&gt;&lt;xsl:value-of select="@refid"/&gt;
      &lt;/xsl:attribute&gt;
      &lt;xsl:choose&gt;
        &lt;xsl:when test="key('term-ids', @refid)[1]/@xreftext"&gt;
          &lt;xsl:value-of select="key('term-ids', @refid)[1]/@xreftext"/&gt;
        &lt;/xsl:when&gt;
        &lt;xsl:otherwise&gt;
          &lt;xsl:value-of select="key('term-ids', @refid)[1]"/&gt;
        &lt;/xsl:otherwise&gt;
      &lt;/xsl:choose&gt;
    &lt;/a&gt;
  &lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;</pre></span>
<p><span class="LITERAL">targetLanguage</span>  <span class="LITERAL">en</span> w肵ėpWϊʂ͎̂ƂłB</p>
<span class="PROGRAMLISTING"><pre>
&lt;html&gt;
&lt;head&gt;
&lt;META http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
&lt;title&gt;Glossary Listing: &lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;Glossary Listing: &lt;/h1&gt;
&lt;p&gt;
&lt;b&gt;&lt;a name="applet"&gt;&lt;/a&gt;applet: &lt;/b&gt;
      An application program,
      written in the Java programming language, that can be 
      retrieved from a web server and executed by a web browser. 
      A reference to an applet appears in the markup for a web 
      page, in the same way that a reference to a graphics
      file appears; a browser retrieves an applet in the same 
      way that it retrieves a graphics file. 
      For security reasons, an applet's access rights are limited
      in two ways: the applet cannot access the filesystem of the 
      client upon which it is executing, and the applet's 
      communication across the network is limited to the server 
      from which it was downloaded. 
      Contrast with &lt;a href="#servlet"&gt;servlet&lt;/a&gt;.
    &lt;/p&gt;
&lt;p&gt;
&lt;b&gt;&lt;a name="DMZlong"&gt;&lt;/a&gt;demilitarized 
      zone (DMZ): &lt;/b&gt;
      In network security, a network that is isolated from, and 
      serves as a neutral zone between, a trusted network (for example, 
      a private intranet) and an untrusted network (for example, the
      Internet). One or more secure gateways usually control access 
      to the DMZ from the trusted or the untrusted network.
    &lt;/p&gt;
&lt;p&gt;
&lt;b&gt;&lt;a name="servlet"&gt;&lt;/a&gt;servlet: &lt;/b&gt;
      An application program, written in the Java programming language, 
      that is executed on a web server. A reference to a servlet 
      appears in the markup for a web page, in the same way that a 
      reference to a graphics file appears. The web server executes
      the servlet and sends the results of the execution (if there are
      any) to the web browser. Contrast with &lt;a href="#applet"&gt;applet&lt;/a&gt;.
    &lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></span>
<p><link linkend="xslt-appc-c5">} C-5</link> ɁÃhLguEUŕ\Oς܂B<span class="LITERAL">targetLanguage</span>  <span class="LITERAL">jp</span> w肵ʂ͎̂ƂłB</p><figure id="xslt-appc-c5" label="C-5">
<p class="TITLE">ꂽ HTML pW</p>
        <graphic depth="432" width="420" fileref="figs/xslt.ac05.gif"/>
      </figure>
<span class="PROGRAMLISTING"><pre>
&lt;html&gt;
&lt;head&gt;
&lt;META http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
&lt;title&gt;Glossary Listing: &lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;Glossary Listing: &lt;/h1&gt;
&lt;p&gt;
&lt;b&gt;&lt;a name="DMZlong"&gt;&lt;/a&gt;demilitarized 
      zone (DMZ): &lt;/b&gt;
      [Pretend this is a Japanese definition of DMZ.]
    &lt;/p&gt;
&lt;p&gt;
&lt;b&gt;&lt;a name="servlet"&gt;&lt;/a&gt;servlet: &lt;/b&gt;
      [Pretend this is a Japanese definition of servlet.]
    &lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
      &lt;/programlisting&gt;</pre></span>
<p>̃hLg̕\<link linkend="xslt-appc-c6">} C-6</link> Ɏ܂B<span class="LITERAL">targetLanguage</span> ύXƁAʂ܂قȂ邱Ƃ킩܂B</p>
<figure id="xslt-appc-c6" label="C-6">
<p class="TITLE">ꂽ HTML pW</p>
        <graphic depth="150" width="420" fileref="figs/xslt.ac06.gif"/>
      </figure>
</td>
</tr>
</table>
</div>
</body>
</html>
