1<xsl:stylesheet 2 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 3 version="1.0" 4> 5 6 <!-- Test FileName: mk013.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: poem.xml, number-lines.xsl --> 18 <!-- Chapter/Page: 4-165 --> 19 <!-- Purpose: Using an attribute set for numbering --> 20 21<xsl:strip-space elements="*"/> 22<xsl:output method="xml" indent="yes"/> 23 24<xsl:template match="*"> 25 <xsl:copy> 26 <xsl:apply-templates/> 27 </xsl:copy> 28</xsl:template> 29 30<xsl:template match="line"> 31 <xsl:copy use-attribute-sets="sequence"> 32 <xsl:apply-templates/> 33 </xsl:copy> 34</xsl:template> 35 36<xsl:attribute-set name="sequence"> 37 <xsl:attribute name="number"><xsl:value-of select="position()"/></xsl:attribute> 38 <xsl:attribute name="of"><xsl:value-of select="last()"/></xsl:attribute> 39</xsl:attribute-set> 40 41 42 <!-- 43 * Licensed to the Apache Software Foundation (ASF) under one 44 * or more contributor license agreements. See the NOTICE file 45 * distributed with this work for additional information 46 * regarding copyright ownership. The ASF licenses this file 47 * to you under the Apache License, Version 2.0 (the "License"); 48 * you may not use this file except in compliance with the License. 49 * You may obtain a copy of the License at 50 * 51 * http://www.apache.org/licenses/LICENSE-2.0 52 * 53 * Unless required by applicable law or agreed to in writing, software 54 * distributed under the License is distributed on an "AS IS" BASIS, 55 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 56 * See the License for the specific language governing permissions and 57 * limitations under the License. 58 --> 59 60</xsl:stylesheet> 61