<html>
<head>
<title>current() ֐</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">current() ֐</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">
݂̃m[hB̃o[łm[hZbgԂ܂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>Ȃ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>݂̃m[hB̃o[łm[hZbgBقƂǂ̏ꍇÃ݂m[h̓ReLXgm[hƓłB 2  XSLT vf̈Ӗ͓łB</p>
<span class="PROGRAMLISTING"><pre>
&lt;xsl:value-of select="current()"/&gt;
&lt;xsl:value-of select="."/&gt;</pre></span>
<p>Aqꎮł́Ã݂m[hƃReLXgm[h͒ʏ͈قȂ܂B̗ł́A<span class="LITERAL">current()</span> ֐gp邩Ă܂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.4 ߁uMiscellaneous Additional Functionsv</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">
<!--<?troff .hw transform?>-->
<p><span class="LITERAL">current()</span> ֐Qƃe[uƋɎgp܂BϊhLĝ͎ƂłB</p>
<span class="PROGRAMLISTING"><pre>
&lt;?xml version="1.0"?&gt;
&lt;report&gt;
  &lt;title&gt;Miles Flown in 2001&lt;/title&gt;
  &lt;month sequence="01"&gt;
    &lt;miles-flown&gt;12379&lt;/miles-flown&gt;
    &lt;miles-earned&gt;35215&lt;/miles-earned&gt;
  &lt;/month&gt;
  &lt;month sequence="02"&gt;
    &lt;miles-flown&gt;32857&lt;/miles-flown&gt;
    &lt;miles-earned&gt;92731&lt;/miles-earned&gt;
  &lt;/month&gt;
  &lt;month sequence="03"&gt;
    &lt;miles-flown&gt;19920&lt;/miles-flown&gt;
    &lt;miles-earned&gt;76725&lt;/miles-earned&gt;
  &lt;/month&gt;
  &lt;month sequence="04"&gt;
    &lt;miles-flown&gt;18903&lt;/miles-flown&gt;
    &lt;miles-earned&gt;31781&lt;/miles-earned&gt;
  &lt;/month&gt;
&lt;/report&gt;</pre></span>
<p>X^CV[ĝ͎ƂłBϊ 2 s܂A1  <span class="LITERAL">current()</span> ֐gpA 1 ͂̊֐gpɍs܂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"
  xmlns:months="Lookup table for month names"&gt;

  &lt;months:name sequence="12"&gt;December&lt;/months:name&gt;
  &lt;months:name sequence="01"&gt;January&lt;/months:name&gt;
  &lt;months:name sequence="02"&gt;February&lt;/months:name&gt;
  &lt;months:name sequence="03"&gt;March&lt;/months:name&gt;
  &lt;months:name sequence="04"&gt;April&lt;/months:name&gt;
  &lt;months:name sequence="05"&gt;May&lt;/months:name&gt;
  &lt;months:name sequence="06"&gt;June&lt;/months:name&gt;
  &lt;months:name sequence="07"&gt;July&lt;/months:name&gt;
  &lt;months:name sequence="08"&gt;August&lt;/months:name&gt;
  &lt;months:name sequence="09"&gt;September&lt;/months:name&gt;
  &lt;months:name sequence="10"&gt;October&lt;/months:name&gt;
  &lt;months:name sequence="11"&gt;November&lt;/months:name&gt;

  &lt;xsl:output method="text"/&gt;

<!--<?troff .Nd 10?>-->
  &lt;xsl:variable name="newline"&gt;
&lt;xsl:text&gt;
&lt;/xsl:text&gt;
  &lt;/xsl:variable&gt;

  &lt;xsl:template match="/"&gt;
    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:text&gt;A test of the current() function:&lt;/xsl:text&gt;

    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:for-each select="/report/month"&gt;
      &lt;xsl:text&gt;   &lt;/xsl:text&gt;
      &lt;xsl:value-of 
        select="document('')/*/months:name[@sequence=current()/@sequence]"/&gt;
      &lt;xsl:text&gt; - &lt;/xsl:text&gt;
      &lt;xsl:value-of select="format-number(miles-flown, '##,###')"/&gt;
      &lt;xsl:text&gt; miles flown, &lt;/xsl:text&gt;
      &lt;xsl:value-of select="format-number(miles-earned, '##,###')"/&gt;
      &lt;xsl:text&gt; miles earned.&lt;/xsl:text&gt;
      &lt;xsl:value-of select="$newline"/&gt;
      &lt;xsl:text&gt;      (Averaged &lt;/xsl:text&gt;
      &lt;xsl:value-of 
        select="format-number(miles-earned div miles-flown, '##.#')"/&gt;
      &lt;xsl:text&gt; miles earned for each mile flown.)&lt;/xsl:text&gt;
      &lt;xsl:value-of select="$newline"/&gt;
      &lt;xsl:value-of select="$newline"/&gt;
    &lt;/xsl:for-each&gt;
    &lt;xsl:value-of select="$newline"/&gt;

    &lt;xsl:text&gt;Let's try it again, without using current() this time:&lt;/xsl:text&gt;
    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:value-of select="$newline"/&gt;

    &lt;xsl:for-each select="/report/month"&gt;
      &lt;xsl:text&gt;   &lt;/xsl:text&gt;
      &lt;xsl:value-of 
        select="document('')/*/months:name[@sequence=./@sequence]"/&gt;
      &lt;xsl:text&gt; - &lt;/xsl:text&gt;
      &lt;xsl:value-of select="format-number(miles-flown, '##,###')"/&gt;
      &lt;xsl:text&gt; miles flown, &lt;/xsl:text&gt;
      &lt;xsl:value-of select="format-number(miles-earned, '##,###')"/&gt;
      &lt;xsl:text&gt; miles earned.&lt;/xsl:text&gt;
      &lt;xsl:value-of select="$newline"/&gt;
      &lt;xsl:text&gt;      (Averaged &lt;/xsl:text&gt;
      &lt;xsl:value-of 
        select="format-number(miles-earned div miles-flown, '##.#')"/&gt;
      &lt;xsl:text&gt; miles earned for each mile flown.)&lt;/xsl:text&gt;
<!--<?troff .Nd 10?>-->
      &lt;xsl:value-of select="$newline"/&gt;
      &lt;xsl:value-of select="$newline"/&gt;
    &lt;/xsl:for-each&gt;
  &lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;</pre></span>
<p>ʂ͎̂ƂłB</p>
<span class="PROGRAMLISTING"><pre>

A test of the current() function:

   January - 12,379 miles flown, 35,215 miles earned.
      (Averaged 2.8 miles earned for each mile flown.)

   February - 32,857 miles flown, 92,731 miles earned.
      (Averaged 2.8 miles earned for each mile flown.)

   March - 19,920 miles flown, 76,725 miles earned.
      (Averaged 3.9 miles earned for each mile flown.)

   April - 18,903 miles flown, 31,781 miles earned.
      (Averaged 1.7 miles earned for each mile flown.)


Let's try it again, without using current() this time:

   December - 12,379 miles flown, 35,215 miles earned.
      (Averaged 2.8 miles earned for each mile flown.)

   December - 32,857 miles flown, 92,731 miles earned.
      (Averaged 2.8 miles earned for each mile flown.)

   December - 19,920 miles flown, 76,725 miles earned.
      (Averaged 3.9 miles earned for each mile flown.)

   December - 18,903 miles flown, 31,781 miles earned.
      (Averaged 1.7 miles earned for each mile flown.)
</pre></span>
<p>2 ڂł́Ae <span class="LITERAL">&lt;month&gt;</span> vf <span class="LITERAL">December</span> Ɉv܂B̈Ⴂ́Ahbg\ (<span class="LITERAL">.</span>)  XPath ł̎_݂̌̃m[h\̂ɑ΂A<span class="LITERAL">current()</span> ֐́AXSLT vZbT XPath ̕]JnǑ݂̃m[h\Ƃɂ܂B </p>
<p>܂AXSLT vZbT́Aŏ <span class="LITERAL">&lt;months:name&gt;</span> vfJnA<span class="LITERAL">sequence</span> A̕ʂ <span class="LITERAL">sequence</span> Ɉvvf݂̌܂B<span class="LITERAL">./@sequence</span>  <span class="LITERAL">sequence</span> w肷ƁAł̎_ɂ錻݂̃m[h <span class="LITERAL">sequence</span> ܂B͍ŏ <span class="LITERAL">&lt;months:name&gt;</span> vfłBɍŏ <span class="LITERAL">&lt;months:name&gt;</span> vf̒lԂ܂BA<span class="LITERAL">current()</span> ֐gpƁA̎̕]Jn_̃m[hԂA<span class="LITERAL">current()</span> ͖ړI̓삪܂B </p>
</td>
</tr>
</table>
</div>
</body>
</html>
