1<xsl:stylesheet 2 3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 4 5 version="1.0"> 6 7 8 9 <!-- Test FileName: mk004.xsl --> 10 11 <!-- Source Attribution: 12 13 This test was written by Michael Kay and is taken from 14 15 'XSLT Programmer's Reference' published by Wrox Press Limited in 2000; 16 17 ISBN 1-861003-12-9; copyright Wrox Press Limited 2000; all rights reserved. 18 19 Now updated in the second edition (ISBN 1861005067), http://www.wrox.com. 20 21 No part of this book may be reproduced, stored in a retrieval system or 22 23 transmitted in any form or by any means - electronic, electrostatic, mechanical, 24 25 photocopying, recording or otherwise - without the prior written permission of 26 27 the publisher, except in the case of brief quotations embodied in critical articles or reviews. 28 29 --> 30 31 <!-- Example: Simple Recursive-Decent Processing (books.xml, booklist.xsl) --> 32 33 <!-- Chapter/Page: 2-70 --> 34 35 <!-- Purpose: Using templates for each kind of node --> 36 37 38 39 40 41<xsl:template match="books"> 42 43 <html><body> 44 45 <h1>A list of books</h1> 46 47 <table width="640"> 48 49 <xsl:apply-templates/> 50 51 </table> 52 53 </body></html> 54 55</xsl:template> 56 57 58 59<xsl:template match="book"> 60 61 <tr> 62 63 <td><xsl:number/></td> 64 65 <xsl:apply-templates/> 66 67 </tr> 68 69</xsl:template> 70 71 72 73<xsl:template match="author | title | price"> 74 75 <td><xsl:value-of select="."/></td> 76 77</xsl:template> 78 79 <!-- 80 * Licensed to the Apache Software Foundation (ASF) under one 81 * or more contributor license agreements. See the NOTICE file 82 * distributed with this work for additional information 83 * regarding copyright ownership. The ASF licenses this file 84 * to you under the Apache License, Version 2.0 (the "License"); 85 * you may not use this file except in compliance with the License. 86 * You may obtain a copy of the License at 87 * 88 * http://www.apache.org/licenses/LICENSE-2.0 89 * 90 * Unless required by applicable law or agreed to in writing, software 91 * distributed under the License is distributed on an "AS IS" BASIS, 92 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 93 * See the License for the specific language governing permissions and 94 * limitations under the License. 95 --> 96 97</xsl:stylesheet> 98