1<?xml version="1.0" ?> 2<xsl:stylesheet 3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 4 version="1.0"> 5 6 <!-- Test FileName: mk030.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: opera.xml, opera.xsl --> 18 <!-- Chapter/Page: 4-312 --> 19 <!-- Purpose: Using a variable for context sensitive variables --> 20 21<xsl:output method="html" indent="yes" /> 22<xsl:template match="/"> 23<html> 24 <body> 25 <center> 26 <h1>Programme</h1> 27 <xsl:for-each select="/programme/composer"> 28 <h2><xsl:value-of select="concat(fullname, ' (', born, '-', died, ')')"/></h2> 29 <xsl:variable name="c" select="."/> 30 <xsl:for-each select="/programme/opera[composer=$c/@name]"> 31 <p><xsl:value-of select="title"/></p> 32 </xsl:for-each> 33 </xsl:for-each> 34 </center> 35 </body> 36</html> 37</xsl:template> 38 39 <!-- 40 * Licensed to the Apache Software Foundation (ASF) under one 41 * or more contributor license agreements. See the NOTICE file 42 * distributed with this work for additional information 43 * regarding copyright ownership. The ASF licenses this file 44 * to you under the Apache License, Version 2.0 (the "License"); 45 * you may not use this file except in compliance with the License. 46 * You may obtain a copy of the License at 47 * 48 * http://www.apache.org/licenses/LICENSE-2.0 49 * 50 * Unless required by applicable law or agreed to in writing, software 51 * distributed under the License is distributed on an "AS IS" BASIS, 52 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 53 * See the License for the specific language governing permissions and 54 * limitations under the License. 55 --> 56 57</xsl:stylesheet> 58