1<xsl:transform 2 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 3 version="1.0" 4 xmlns:book="books.uri" 5 exclude-result-prefixes="book" 6> 7 8 <!-- Test FileName: mk038.xsl --> 9 <!-- Source Attribution: 10 This test was written by Michael Kay and is taken from 11 'XSLT Programmer's Reference' published by Wrox Press Limited in 2000; 12 ISBN 1-861003-12-9; copyright Wrox Press Limited 2000; all rights reserved. 13 Now updated in the second edition (ISBN 1861005067), http://www.wrox.com. 14 No part of this book may be reproduced, stored in a retrieval system or 15 transmitted in any form or by any means - electronic, electrostatic, mechanical, 16 photocopying, recording or otherwise - without the prior written permission of 17 the publisher, except in the case of brief quotations embodied in critical articles or reviews. 18 --> 19 <!-- Example: booklist.xml, list-categories.xsl --> 20 <!-- Chapter/Page: 7-449 --> 21 <!-- Purpose: A lookup table in the stylesheet --> 22 23<xsl:template match="/"> 24 <html><body> 25 <xsl:for-each select="//book"> 26 <h1><xsl:value-of select="title"/></h1> 27 <p>Category: <xsl:value-of 28 select="document('')/*/book:category[@code=current()/@category]/@desc"/> 29 </p> 30 </xsl:for-each> 31 </body></html> 32</xsl:template> 33 34<book:category code="S" desc="Science"/> 35<book:category code="CS" desc="Computing"/> 36<book:category code="FC" desc="Children's Fiction"/> 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:transform> 57