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