1<?xml version="1.0"?> 2<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 3 4 <!-- FileName: position92 --> 5 <!-- Document: http://www.w3.org/TR/xpath --> 6 <!-- DocVersion: 19991116 --> 7 <!-- Section: 3.3 --> 8 <!-- Creator: John Howard --> 9 <!-- Purpose: Test retrieving correct values from node-set variables by positional predicate. --> 10 11 <xsl:output method="xml"/> 12 13 <xsl:template match="/"> 14 <xsl:variable name="x1"> 15 <xsl:variable name="node" select="/foo/*/test/text()"/> 16 <xsl:value-of select="$node[1]"/> 17 </xsl:variable> 18 <xsl:variable name="x6"> 19 <xsl:variable name="node" select="/foo/*/test/text()"/> 20 <xsl:for-each select="$node[6]"> 21 <xsl:value-of select="."/> 22 </xsl:for-each> 23 </xsl:variable> 24 <xsl:variable name="xL"> 25 <xsl:variable name="node" select="/foo/*/test/text()"/> 26 <xsl:for-each select="$node[last()]"> 27 <xsl:value-of select="."/> 28 </xsl:for-each> 29 </xsl:variable> 30 <out> 31 <x1><xsl:value-of select="$x1"/></x1><xsl:text> </xsl:text> 32 <x6><xsl:value-of select="$x6"/></x6><xsl:text> </xsl:text> 33 <xL><xsl:value-of select="$xL"/></xL> 34 </out> 35 </xsl:template> 36 37 38 <!-- 39 * Licensed to the Apache Software Foundation (ASF) under one 40 * or more contributor license agreements. See the NOTICE file 41 * distributed with this work for additional information 42 * regarding copyright ownership. The ASF licenses this file 43 * to you under the Apache License, Version 2.0 (the "License"); 44 * you may not use this file except in compliance with the License. 45 * You may obtain a copy of the License at 46 * 47 * http://www.apache.org/licenses/LICENSE-2.0 48 * 49 * Unless required by applicable law or agreed to in writing, software 50 * distributed under the License is distributed on an "AS IS" BASIS, 51 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 52 * See the License for the specific language governing permissions and 53 * limitations under the License. 54 --> 55 56</xsl:stylesheet> 57