1<xsl:stylesheet 2 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 3 version="1.0" 4> 5 6 <!-- Test FileName: mk017.xsl --> 7 <!-- Source Attribution: 8 This test was written by Michael Kay and is taken from 9 'XSLT Programmer's Reference' published by Wrox Press Limited in 2000; 10 ISBN 1-861003-12-9; copyright Wrox Press Limited 2000; all rights reserved. 11 Now updated in the second edition (ISBN 1861005067), http://www.wrox.com. 12 No part of this book may be reproduced, stored in a retrieval system or 13 transmitted in any form or by any means - electronic, electrostatic, mechanical, 14 photocopying, recording or otherwise - without the prior written permission of 15 the publisher, except in the case of brief quotations embodied in critical articles or reviews. 16 --> 17 <!-- Example: for-each/poem.xml, for-each/nesting.xsl --> 18 <!-- Chapter/Page: 4-203 --> 19 <!-- Purpose: Showing the ancestors of a node --> 20 21<xsl:template match="*"> 22 <xsl:comment> 23 <xsl:value-of select="name()"/> 24 <xsl:for-each select="ancestor::*"> 25 <xsl:sort select="position()" order="descending"/> 26 <xsl:text> within </xsl:text> 27 <xsl:value-of select="name()"/> 28 </xsl:for-each> 29 </xsl:comment> 30 <xsl:apply-templates/> 31</xsl:template> 32 33 34 <!-- 35 * Licensed to the Apache Software Foundation (ASF) under one 36 * or more contributor license agreements. See the NOTICE file 37 * distributed with this work for additional information 38 * regarding copyright ownership. The ASF licenses this file 39 * to you under the Apache License, Version 2.0 (the "License"); 40 * you may not use this file except in compliance with the License. 41 * You may obtain a copy of the License at 42 * 43 * http://www.apache.org/licenses/LICENSE-2.0 44 * 45 * Unless required by applicable law or agreed to in writing, software 46 * distributed under the License is distributed on an "AS IS" BASIS, 47 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 48 * See the License for the specific language governing permissions and 49 * limitations under the License. 50 --> 51 52</xsl:stylesheet> 53