<html>
<head>
<title>&lt;xsl:variable&gt;</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">&lt;xsl:variable&gt;</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">
ϐ`܂B<span class="LITERAL">&lt;xsl:variable&gt;</span> gbvxvfƂĎw肷ƁAX^CV[gŜANZXłO[oϐɂȂ܂B̂悤Ɏw肵Ȃꍇ́A[JϐƂȂ <span class="LITERAL">&lt;xsl:variable&gt;</span> ܂ޗvfł̂ݗLɂȂ܂Bϐ̒l`ɂ́A<span class="LITERAL">select</span> Ŏw肷邩A܂ <span class="LITERAL">&lt;xsl:variable&gt;</span> vf XSLT ev[g` 2 ̕@܂Bǂ̕@gpȂꍇ́Aϐ̒l̕ɂȂ܂B</td></tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">JeS</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>gbvxvf܂͖߂̂ꂩB</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">K{̑</td>
</tr>
<tr>
<td colspan="2" class="description">
<dl>
<dt>
name
</dt>
<dd>
̕ϐ̖Ow肷鑮B
<P></p>
</dl>
</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">
<dl>
<dt>
select
</dt>
<dd>
̕ϐ̒l` XPath B
<P></p>
</dl>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Rec</td>
</tr>
<tr>
<td colspan="2" class="description">
<p><span class="LITERAL">&lt;xsl:variable&gt;</span> vfɂ͉w肵ȂA܂ XSLT ev[g܂߂邱Ƃł܂BXSLT ev[g܂߂ꍇA<span class="LITERAL">select</span>  (ꍇ) ͖܂B</p>
</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">w</td>
</tr>
<tr>
<td colspan="2" class="description">
<p>
gbvxvfƂ <span class="LITERAL">&lt;xsl:stylesheet&gt;</span>A܂̓ev[gB</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 11 ߁uϐƃp[^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>̕ϐ`X^CV[gȉɎ܂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="text"/&gt;

  &lt;xsl:variable name="newline"&gt;
&lt;xsl:text&gt;
&lt;/xsl:text&gt;
  &lt;/xsl:variable&gt;

  &lt;xsl:variable name="favoriteNumber" select="23"/&gt;
  &lt;xsl:variable name="favoriteColor" select="'blue'"/&gt;
  &lt;xsl:variable name="complicatedVariable"&gt;
    &lt;xsl:choose&gt;
      &lt;xsl:when test="count(//listitem) &gt; 10"&gt;
        &lt;xsl:text&gt;really long list&lt;/xsl:text&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:when test="count(//listitem) &gt; 5"&gt;
        &lt;xsl:text&gt;moderately long list&lt;/xsl:text&gt;
      &lt;/xsl:when&gt;
      &lt;xsl:otherwise&gt;
        &lt;xsl:text&gt;fairly short list&lt;/xsl:text&gt;
      &lt;/xsl:otherwise&gt;
    &lt;/xsl:choose&gt;
  &lt;/xsl:variable&gt;

  &lt;xsl:template match="/"&gt;
    &lt;xsl:text&gt;Hello!  Your favorite number is &lt;/xsl:text&gt;
    &lt;xsl:value-of select="$favoriteNumber"/&gt;
    &lt;xsl:text&gt;.&lt;/xsl:text&gt;
    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:text&gt;Your favorite color is &lt;/xsl:text&gt;
    &lt;xsl:value-of select="$favoriteColor"/&gt;
    &lt;xsl:text&gt;.&lt;/xsl:text&gt;
    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:text&gt;Here is a &lt;/xsl:text&gt;
    &lt;xsl:value-of select="$complicatedVariable"/&gt;
    &lt;xsl:text&gt;:&lt;/xsl:text&gt;
    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:variable name="listitems" select="list/listitem"/&gt;
    &lt;xsl:call-template name="processListitems"&gt;
      &lt;xsl:with-param name="items" select="$listitems"/&gt;
    &lt;/xsl:call-template&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template name="processListitems"&gt;
    &lt;xsl:param name="items"/&gt;
    &lt;xsl:variable name="favoriteColor"&gt;
      &lt;xsl:text&gt;chartreuse&lt;/xsl:text&gt;
    &lt;/xsl:variable&gt;
    
    &lt;xsl:text&gt;    (Your favorite color is now &lt;/xsl:text&gt;
    &lt;xsl:value-of select="$favoriteColor"/&gt;
    &lt;xsl:text&gt;.)&lt;/xsl:text&gt;
    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:for-each select="$items"&gt;
      &lt;xsl:value-of select="position()"/&gt;
      &lt;xsl:text&gt;.  &lt;/xsl:text&gt;
      &lt;xsl:value-of select="."/&gt;
      &lt;xsl:value-of select="$newline"/&gt;
    &lt;/xsl:for-each&gt;
  &lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;</pre></span>
<p>̃X^CV[ggpĎ̃hLgϊ܂B</p>
<span class="PROGRAMLISTING"><pre>
&lt;?xml version="1.0"?&gt;
&lt;list xml:lang="en"&gt;
  &lt;title&gt;Albums I've bought recently:&lt;/title&gt;
  &lt;listitem&gt;The Sacred Art of Dub&lt;/listitem&gt;
  &lt;listitem&gt;Only the Poor Man Feel It&lt;/listitem&gt;
  &lt;listitem&gt;Excitable Boy&lt;/listitem&gt;
  &lt;listitem xml:lang="sw"&gt;Aki Special&lt;/listitem&gt;
  &lt;listitem xml:lang="en-gb"&gt;Combat Rock&lt;/listitem&gt;
  &lt;listitem xml:lang="zu"&gt;Talking Timbuktu&lt;/listitem&gt;
  &lt;listitem xml:lang="jz"&gt;The Birth of the Cool&lt;/listitem&gt;
&lt;/list&gt;</pre></span>
<!--<?troff .Nd 10?>-->
<p>ϊ̌ʂ͎̂ƂłB</p>
<span class="PROGRAMLISTING"><pre>
Hello!  Your favorite number is 23.
Your favorite color is blue.

Here is a moderately long list:
    (Your favorite color is now chartreuse.)
1.  The Sacred Art of Dub
2.  Only the Poor Man Feel It
3.  Excitable Boy
4.  Aki Special
5.  Combat Rock
6.  Talking Timbuktu
7.  The Birth of the Cool</pre></span>
<p>̃X^CV[gɂ͒ӂKv_܂B܂Aŏ 2 ̕ϐ (<span class="LITERAL">favoriteNumber</span>  <span class="LITERAL">favoriteColor</span>) ̒l`ƂɁA "blue" pň͂ł܂A<span class="LITERAL">23</span> pň͂ł܂B<span class="LITERAL">blue</span> pň͂܂ȂƁAXSLT vZbT݂͌̃ReLXĝׂĂ <span class="LITERAL">&lt;blue&gt;</span> vfӖƔf܂BXML vf͐Ŏn߂邱ƂłȂ߁A<span class="LITERAL">23</span> pň͂ޕKv͂܂BéAvfłȂꍇłĂɈpň͂ނƂ߂܂B΁Â悤Ȏdg݂oĂKv܂B </p>
<p>܂A<span class="LITERAL">favoriteColor</span> ƂO̕ϐ 2 ܂B1 ́Ae <span class="LITERAL">&lt;xsl:stylesheet&gt;</span> vfł邽߃O[oϐłB 1 ́A<span class="LITERAL">&lt;xsl:template&gt;</span> Œ`Ă邽߃[JϐłB<span class="LITERAL">match="/"</span> ev[g <span class="LITERAL">favoriteColor</span> ɃANZXꍇ̒lƁA<span class="LITERAL">name="processListitems"</span> ev[ĝ̕ϐɃANZXꍇ̒l͈قȂ܂Bx 2 ̕ϐɓOw肷ƃG[܂BxœO <span class="LITERAL">&lt;xsl:variable&gt;</span>  <span class="LITERAL">&lt;xsl:param&gt;</span> `ꍇɂG[܂B </p>
<p><span class="LITERAL">&lt;xsl:choose&gt;</span> vfgp <span class="LITERAL">&lt;xsl:variable&gt;</span> 邱Ƃ͈ʓIȕ@łB̕@́Aȉ̃vV[WvO~O̍\ƓłB</p>
<span class="PROGRAMLISTING"><pre>
String complicatedVariable;
if (count(listitems) &gt; 10)
  complicatedVariable = "really long list";
else if (count(listitems)) &gt; 5)
  complicatedVariable = "moderately long list";
else
  complicatedVariable = "fairly short list";</pre></span>
<p>ŌɁAϐ̎ނɂ̓m[hZbg܂ XPath  XSLT ܂B<span class="LITERAL">processListitems</span> ev[gĂяoꍇAnꂽp[^̓hLĝׂĂ <span class="LITERAL">&lt;listitem&gt;</span> vf̃m[hZbg܂ޕϐłB<span class="LITERAL">processListitems</span> ev[gł́Aϐ (̏ꍇAɂ̓p[^)  <span class="LITERAL">&lt;xsl:for-each&gt;</span> vfŎgpł܂B </p>
</td>
</tr>
</table>
</div>
</body>
</html>
