1<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 2 3 <!-- FileName: match32 --> 4 <!-- Document: http://www.w3.org/TR/xslt --> 5 <!-- DocVersion: 19991116 --> 6 <!-- Section: 5.2 --> 7 <!-- Purpose: Use multiple levels of child axis in match patterns. Spell out 'child::' sometimes. --> 8 <!-- Creator: Henry Zongaro --> 9 10<xsl:output method="xml" encoding="UTF-8" indent="no"/> 11 12 <xsl:template match="/"> 13 <out> 14 <xsl:apply-templates/><!-- rely on some built-ins --> 15 </out> 16 </xsl:template> 17 18 <xsl:template match="doc/l1/v2"> 19 <xsl:text> 20</xsl:text> 21 <match> 22 <xsl:text>Rule doc/l1/v2; value of matched node: </xsl:text> 23 <xsl:value-of select='.'/> 24 </match> 25 </xsl:template> 26 27 <xsl:template match="doc/l1//v3"> 28 <xsl:text> 29</xsl:text> 30 <match> 31 <xsl:text>Rule doc/l1//v3; value of matched node: </xsl:text> 32 <xsl:value-of select='.'/> 33 </match> 34 </xsl:template> 35 36 <xsl:template match="doc//l2/w3"> 37 <xsl:text> 38</xsl:text> 39 <match> 40 <xsl:text>Rule doc//l2/w3; value of matched node: </xsl:text> 41 <xsl:value-of select='.'/> 42 </match> 43 </xsl:template> 44 45 <xsl:template match="doc//l2//v4"> 46 <xsl:text> 47</xsl:text> 48 <match> 49 <xsl:text>Rule doc//l2//v4; value of matched node: </xsl:text> 50 <xsl:value-of select='.'/> 51 </match> 52 </xsl:template> 53 54 <xsl:template match="doc/child::l1/child::x2"> 55 <xsl:text> 56</xsl:text> 57 <match> 58 <xsl:text>Rule doc/child::l1/child::x2; value of matched node: </xsl:text> 59 <xsl:value-of select='.'/> 60 </match> 61 </xsl:template> 62 63 <xsl:template match="doc/child::l1//child::x3"> 64 <xsl:text> 65</xsl:text> 66 <match> 67 <xsl:text>Rule doc/child::l1//child::x3; value of matched node: </xsl:text> 68 <xsl:value-of select='.'/> 69 </match> 70 </xsl:template> 71 72 <xsl:template match="doc//child::l2/child::y3"> 73 <xsl:text> 74</xsl:text> 75 <match> 76 <xsl:text>Rule doc//child::l2/child::y3; value of matched node: </xsl:text> 77 <xsl:value-of select='.'/> 78 </match> 79 </xsl:template> 80 81 <xsl:template match="doc//child::l2//child::x4"> 82 <xsl:text> 83</xsl:text> 84 <match> 85 <xsl:text>Rule doc//child::l2//child::x4; value of matched node: </xsl:text> 86 <xsl:value-of select='.'/> 87 </match> 88 </xsl:template> 89 90 <xsl:template match='text()'/><!-- squelch direct replay of text --> 91 92 93 <!-- 94 * Licensed to the Apache Software Foundation (ASF) under one 95 * or more contributor license agreements. See the NOTICE file 96 * distributed with this work for additional information 97 * regarding copyright ownership. The ASF licenses this file 98 * to you under the Apache License, Version 2.0 (the "License"); 99 * you may not use this file except in compliance with the License. 100 * You may obtain a copy of the License at 101 * 102 * http://www.apache.org/licenses/LICENSE-2.0 103 * 104 * Unless required by applicable law or agreed to in writing, software 105 * distributed under the License is distributed on an "AS IS" BASIS, 106 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 107 * See the License for the specific language governing permissions and 108 * limitations under the License. 109 --> 110 111</xsl:stylesheet> 112