1<?xml version="1.0"?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 3 4 <!-- FileName: axes130 --> 5 <!-- Document: http://www.w3.org/TR/xpath --> 6 <!-- DocVersion: 19991116 --> 7 <!-- Section: 2.2 --> 8 <!-- Creator: David Marston --> 9 <!-- Purpose: Test for 'self::' axis on an attribute --> 10 11<xsl:output method="xml" encoding="UTF-8" indent="yes" /> 12 13<xsl:template match="/"> 14 <out> 15 <xsl:for-each select="//center"> 16 <xsl:apply-templates select="@*"/> 17 </xsl:for-each> 18 </out> 19</xsl:template> 20 21<xsl:template match="@*"> 22 <xsl:choose> 23 <xsl:when test="self::node()"> 24 <any-node>true</any-node> 25 </xsl:when> 26 <xsl:otherwise> 27 <any-node>false</any-node> 28 </xsl:otherwise> 29 </xsl:choose> 30 <xsl:choose> 31 <!-- FALSE: principal node type of self is element --> 32 <xsl:when test="self::*"> 33 <any-elem>true</any-elem> 34 </xsl:when> 35 <xsl:otherwise> 36 <any-elem>false</any-elem> 37 </xsl:otherwise> 38 </xsl:choose> 39 <xsl:choose> 40 <xsl:when test="self::text()"> 41 <any-text>true</any-text> 42 </xsl:when> 43 <xsl:otherwise> 44 <any-text>false</any-text> 45 </xsl:otherwise> 46 </xsl:choose> 47 <xsl:choose> 48 <!-- FALSE: principal node type of self is element --> 49 <xsl:when test="self::center-attr"> 50 <named>true</named> 51 </xsl:when> 52 <xsl:otherwise> 53 <named>false</named> 54 </xsl:otherwise> 55 </xsl:choose> 56</xsl:template> 57 58 59 <!-- 60 * Licensed to the Apache Software Foundation (ASF) under one 61 * or more contributor license agreements. See the NOTICE file 62 * distributed with this work for additional information 63 * regarding copyright ownership. The ASF licenses this file 64 * to you under the Apache License, Version 2.0 (the "License"); 65 * you may not use this file except in compliance with the License. 66 * You may obtain a copy of the License at 67 * 68 * http://www.apache.org/licenses/LICENSE-2.0 69 * 70 * Unless required by applicable law or agreed to in writing, software 71 * distributed under the License is distributed on an "AS IS" BASIS, 72 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 73 * See the License for the specific language governing permissions and 74 * limitations under the License. 75 --> 76 77</xsl:stylesheet> 78