<html>
<head>
<title>&lt;xsl:sort&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:sort&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">
݂̃ReLXg̕בւL[`܂B̗vf́A<span class="LITERAL">&lt;xsl:apply-templates&gt;</span> vf܂ <span class="LITERAL">&lt;xsl:for-each&gt;</span> vf̎qƂĎgp܂B̗vfł́Aŏ <span class="LITERAL">&lt;xsl:sort&gt;</span> ɂ 1 בւL[`A2 ڂ <span class="LITERAL">&lt;xsl:sort&gt;</span> ɂ 2 בւ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>Tu (<span class="LITERAL">&lt;xsl:sort&gt;</span> ́A<span class="LITERAL">&lt;xsl:apply-templates&gt;</span> vf܂ <span class="LITERAL">&lt;xsl:for-each&gt;</span> vf̎qƂĎw肷Kv܂)</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">
<p>Ȃ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">
<dl>
<dt>
select
</dt>
<dd>
בւm[h` XPath B
<P></p>
<dt>
lang
</dt>
<dd>
בւɎgp錾`镶BR[h RFC1766 Œ`Ă܂ 
<systemitem role="url">
(http://www.ietf.org/rfc/rfc1766.txt Q)B
</systemitem>
<P></p>
<dt>
data-type
</dt>
<dd>
בւ鍀ڂ̎ނ`鑮Bgp\ȒĺA<span class="LITERAL"> number </span>  <span class="LITERAL"> text </span> łBݒl <span class="LITERAL"> text </span> łBXSLT vZbTɂ́A̒lT|[gIvV܂Bl <span class="LITERAL"> 32 10 120 </span>  <span class="LITERAL"> data-type= " text " </span> ŕבւƁA<span class="LITERAL"> 10 120 32 </span> ԂA<span class="LITERAL"> data-type= " number " </span> ̏ꍇ <span class="LITERAL"> 10 32 120 </span> Ԃ܂B
<P></p>
<dt>
order
</dt>
<dd>
בւ̏`鑮Bgp\ȒĺA<span class="LITERAL"> ascending </span>  <span class="LITERAL"> descending </span> łB
<P></p>
<dt>
case-order
</dt>
<dd>
啶Əבւ鏇`鑮Bgp\ȒĺA<span class="LITERAL"> upper-first </span>  <span class="LITERAL"> lower-first </span> ł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>Ȃ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>
<span class="LITERAL">&lt;xsl:apply-templates&gt;</span>  <span class="LITERAL">&lt;xsl:for-each&gt;</span>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 10 ߁uבւ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">&lt;xsl:sort&gt;</span> ̃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:template match="/"&gt;
    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:call-template name="ascending-alpha-sort"&gt;
      &lt;xsl:with-param name="items" select="/sample/textlist/listitem"/&gt;
    &lt;/xsl:call-template&gt;
    &lt;xsl:call-template name="ascending-alpha-sort"&gt;
      &lt;xsl:with-param name="items" select="/sample/numericlist/listitem"/&gt;
    &lt;/xsl:call-template&gt;
    &lt;xsl:call-template name="ascending-numeric-sort"&gt;
      &lt;xsl:with-param name="items" select="/sample/numericlist/listitem"/&gt;
    &lt;/xsl:call-template&gt;
    &lt;xsl:call-template name="descending-alpha-sort"&gt;
      &lt;xsl:with-param name="items" select="/sample/textlist/listitem"/&gt;
    &lt;/xsl:call-template&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template name="ascending-alpha-sort"&gt;
    &lt;xsl:param name="items"/&gt;
    &lt;xsl:text&gt;Ascending text sort:&lt;/xsl:text&gt;
    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:for-each select="$items"&gt;
      &lt;xsl:sort select="."/&gt;
      &lt;xsl:value-of select="."/&gt;
      &lt;xsl:value-of select="$newline"/&gt;
    &lt;/xsl:for-each&gt;
    &lt;xsl:value-of select="$newline"/&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template name="descending-alpha-sort"&gt;
    &lt;xsl:param name="items"/&gt;
    &lt;xsl:text&gt;Descending text sort:&lt;/xsl:text&gt;
    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:for-each select="$items"&gt;
      &lt;xsl:sort select="." order="descending"/&gt;
      &lt;xsl:value-of select="."/&gt;
      &lt;xsl:value-of select="$newline"/&gt;
    &lt;/xsl:for-each&gt;
    &lt;xsl:value-of select="$newline"/&gt;
  &lt;/xsl:template&gt;

  &lt;xsl:template name="ascending-numeric-sort"&gt;
    &lt;xsl:param name="items"/&gt;
    &lt;xsl:text&gt;Ascending numeric sort:&lt;/xsl:text&gt;
    &lt;xsl:value-of select="$newline"/&gt;
    &lt;xsl:for-each select="$items"&gt;
      &lt;xsl:sort select="." data-type="number"/&gt;
      &lt;xsl:value-of select="."/&gt;
      &lt;xsl:value-of select="$newline"/&gt;
    &lt;/xsl:for-each&gt;
    &lt;xsl:value-of select="$newline"/&gt;
  &lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;</pre></span>
<p>̃X^CV[gł́AOw肳ꂽ 3 ̃ev[g`܂Beev[ǵAقȂ鏇܂͈قȂ <span class="LITERAL">data-type</span>  <span class="LITERAL">&lt;listitem&gt;</span> בւ܂B̃X^CV[g̃hLgɑ΂Ďgp܂B</p>
<span class="PROGRAMLISTING"><pre>
&lt;?xml version="1.0"?&gt;
&lt;sample&gt;
  &lt;numericlist&gt;
    &lt;listitem&gt;1&lt;/listitem&gt;
    &lt;listitem&gt;3&lt;/listitem&gt;
    &lt;listitem&gt;23&lt;/listitem&gt;
    &lt;listitem&gt;120&lt;/listitem&gt;
    &lt;listitem&gt;2&lt;/listitem&gt;
  &lt;/numericlist&gt;
  &lt;textlist&gt;
    &lt;listitem&gt;3&lt;/listitem&gt;
    &lt;listitem&gt;apple&lt;/listitem&gt;
    &lt;listitem&gt;orange&lt;/listitem&gt;
    &lt;listitem&gt;dragonfruit&lt;/listitem&gt;
    &lt;listitem&gt;carambola&lt;/listitem&gt;
  &lt;/textlist&gt;
&lt;/sample&gt;</pre></span>
<!--<?troff .Nd 10?>-->
<p>ʂ͎̂ƂłB</p>
<span class="PROGRAMLISTING"><pre>

Ascending text sort:
3
apple
carambola
dragonfruit
orange

Ascending text sort:
1
120
2
23
3

Ascending numeric sort:
1
2
3
23
120

Descending text sort:
orange
dragonfruit
carambola
apple
3</pre></span>
<p><span class="LITERAL">data-type="numeric"</span> ɂAf[^ԍɕבւ܂B </p>
</td>
</tr>
</table>
</div>
</body>
</html>
