XPathのposition()関数の使い方の例

次のいずれの書き方でもいい。下の書き方は省略構文。
child::会員[position()=3]
会員[position()=3]

【sample038.xml】
<?xml version="1.0" encoding="Shift_JIS" ?>
<?xml-stylesheet href="sample038.xsl" type="text/xsl" ?>
<リスト>
<会員>山田太郎</会員>
<会員>鈴木敬一</会員>
<会員>田中花子</会員>
<会員>井上恵子</会員>
<会員>菊池弘幸</会員>
</リスト>


【sample038.xsl】
<?xml version="1.0" encoding="Shift_JIS" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="Shift_JIS" />
<xsl:template match="リスト">
<html>
<head><title></title></head>
<body>
<p><xsl:value-of select="child::会員[position()=3]" /></p>
<p><xsl:value-of select="会員[position()=3]" /></p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


【結果】