1<?xml version="1.0"?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 3 4 <!-- FileName: modes15 --> 5 <!-- Document: http://www.w3.org/TR/xslt --> 6 <!-- DocVersion: 19991116 --> 7 <!-- Section: 5.7 Modes --> 8 <!-- Purpose: Re-use nodes in different modes; templates have step-paths --> 9 <!-- Creator: Mingfei Peng ([email protected]), altered by David Marston --> 10 <!-- Within a given mode, there are situations when more than one template 11 will match. Normal conflict-resolution rules should apply. --> 12 13<xsl:template match="/"> 14 <out> 15 <xsl:apply-templates select="sss/sss" mode="c"/> 16 <xsl:apply-templates select="sss/sss" mode="d"/> 17 <xsl:apply-templates select="sss//i" mode="c"/> 18 <xsl:apply-templates select="sss//i" mode="d"/> 19 <xsl:apply-templates select="/sss/sss/i" mode="c"/> 20 <xsl:apply-templates select="/sss/sss/i" mode="d"/> 21 </out> 22</xsl:template> 23 24<xsl:template match="sss//*" mode="d"> 25 !Any descendant of any sss! 26</xsl:template> 27 28<xsl:template match="/sss//*" mode="d"> 29 +Any descendant of root sss+ 30</xsl:template> 31 32<xsl:template match="sss/*" mode="c"> 33 -Any child of any sss- 34</xsl:template> 35 36<xsl:template match="/sss/*" mode="c"> 37 -Any child of root sss- 38</xsl:template> 39 40 41 <!-- 42 * Licensed to the Apache Software Foundation (ASF) under one 43 * or more contributor license agreements. See the NOTICE file 44 * distributed with this work for additional information 45 * regarding copyright ownership. The ASF licenses this file 46 * to you under the Apache License, Version 2.0 (the "License"); 47 * you may not use this file except in compliance with the License. 48 * You may obtain a copy of the License at 49 * 50 * http://www.apache.org/licenses/LICENSE-2.0 51 * 52 * Unless required by applicable law or agreed to in writing, software 53 * distributed under the License is distributed on an "AS IS" BASIS, 54 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 55 * See the License for the specific language governing permissions and 56 * limitations under the License. 57 --> 58 59</xsl:stylesheet> 60