1<?xml version="1.0"?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" 3 xmlns:ex="http://xml.apache.org/xalan" 4 extension-element-prefixes="ex"> 5 6 <!-- FileName: libraryNodeset07 --> 7 <!-- Document: http://www.w3.org/TR/xslt --> 8 <!-- DocVersion: 19991116 --> 9 <!-- Section: 11.4 --> 10 <!-- Creator: Joe Kesselman --> 11 <!-- Purpose: Try paths from nodeset of global RTF; ensure we get the right one. --> 12 <!-- Theoretically, we should repeat the whole Axes suite for variables. --> 13 14<xsl:output method="xml" indent="no" encoding="UTF-8"/> 15 16<xsl:variable name="top1"> 17<t1-far-north> 18 <t1-north> 19 <t1-near-north> 20 <t1-far-west/> 21 <t1-west/> 22 <t1-near-west/> 23 <center center-attr-1="c1" xmlns:n="http://example.com">Wrong variable, can you dig it? 24 <t1-near-south> 25 <t1-south> 26 <t1-far-south/> 27 </t1-south> 28 </t1-near-south> 29 </center> 30 <t1-near-east/> 31 <t1-east/> 32 <t1-far-east/> 33 </t1-near-north> 34 </t1-north> 35</t1-far-north> 36</xsl:variable> 37 38<xsl:variable name="top2"> 39<t2-far-north> 40 <t2-north> 41 <t2-near-north> 42 <t2-far-west/> 43 <t2-west/> 44 <t2-near-west/> 45 <center center-attr-1="c2" xmlns:n="http://example.com">Dig we must! 46 <t2-near-south> 47 <t2-south> 48 <t2-far-south/> 49 </t2-south> 50 </t2-near-south> 51 </center> 52 <t2-near-east/> 53 <t2-east/> 54 <t2-far-east/> 55 </t2-near-north> 56 </t2-north> 57</t2-far-north> 58</xsl:variable> 59 60<xsl:template match="/"> 61 <out> 62 <!-- First, force evaluation of each variable --> 63 <junk> 64 <xsl:text>$top1 summary: </xsl:text> 65 <xsl:value-of select="$top1"/> 66 <xsl:text> 67</xsl:text> 68 <xsl:text>$top2 summary: </xsl:text> 69 <xsl:value-of select="$top2"/> 70 </junk> 71 72 <!-- Now, traverse some axes --> 73 <xsl:apply-templates select="ex:nodeset($top2)//t2-north"/> 74 </out> 75</xsl:template> 76 77<xsl:template match="t2-north"> 78 <!-- DS means the location path is optimizable as a single descendant iterator. --> 79DS 1. AC: <xsl:value-of select="name(/descendant-or-self::t2-north)"/> 80DS 2. AD: <xsl:value-of select="name(/descendant::t2-near-north)"/> 81DS 3. BC: <xsl:value-of select="name(self::node()/descendant-or-self::t2-north)"/> 82DS 4. BD: <xsl:value-of select="name(self::node()/descendant::t2-near-north)"/> 83NDS 5. CC: <xsl:value-of select="name(descendant-or-self::t2-north/descendant-or-self::t2-north)"/> 84NDS 6. CD: <xsl:value-of select="name(descendant-or-self::t2-north/descendant::t2-near-north)"/> 85NDS 7. CE: <xsl:value-of select="name(descendant-or-self::t2-north/child::t2-near-north)"/> 86NDS 8. DC: <xsl:value-of select="name(descendant::t2-near-north/descendant-or-self::t2-near-north)"/> 87NDS 9. DD: <xsl:value-of select="name(descendant::t2-near-north/descendant::t2-far-west)"/> 88 89NDS 10. ACC: <xsl:value-of select="name(/descendant-or-self::t2-north/descendant-or-self::t2-north)"/> 90NDS 11. ACE: <xsl:value-of select="name(/descendant-or-self::t2-north/child::t2-near-north)"/> 91NDS 12. ADC: <xsl:value-of select="name(/descendant::t2-near-north/descendant-or-self::t2-near-north)"/> 92NDS 13. BCC: <xsl:value-of select="name(self::node()/descendant-or-self::t2-north/descendant-or-self::t2-north)"/> 93NDS 14. BCE: <xsl:value-of select="name(self::node()/descendant-or-self::t2-north/child::t2-near-north)"/> 94NDS 15. BDC: <xsl:value-of select="name(self::node()/descendant::t2-near-north/descendant-or-self::t2-far-west)"/> 95NDS 16. BDE: <xsl:value-of select="name(self::node()/descendant::t2-near-north/child::t2-far-west)"/> 96NDS 17. CCC: <xsl:value-of select="name(descendant-or-self::t2-north/descendant-or-self::t2-north/descendant-or-self::t2-north)"/> 97NDS 18. CCE: <xsl:value-of select="name(descendant-or-self::t2-north/descendant-or-self::t2-north/child::t2-near-north)"/> 98NDS 19. CDC: <xsl:value-of select="name(descendant-or-self::t2-north/descendant::t2-near-north/descendant-or-self::t2-near-north)"/> 99NDS 20. CDE: <xsl:value-of select="name(descendant-or-self::t2-north/descendant::t2-near-north/child::t2-far-west)"/> 100NDS 21. CEC: <xsl:value-of select="name(descendant-or-self::t2-north/child::t2-near-north/descendant-or-self::t2-near-north)"/> 101NDS 22. CEE: <xsl:value-of select="name(descendant-or-self::t2-north/child::t2-near-north/child::t2-far-west)"/> 102NDS 23. DCC: <xsl:value-of select="name(descendant::t2-near-north/descendant-or-self::t2-near-north/descendant-or-self::t2-near-north)"/> 103NDS 24. DCE: <xsl:value-of select="name(descendant::t2-near-north/descendant-or-self::t2-near-north/child::t2-far-west)"/> 104NDS 25. DDC: <xsl:value-of select="name(descendant::t2-near-north/descendant::t2-far-west/descendant-or-self::t2-far-west)"/> 105 106DS 26. CC: <xsl:value-of select="name(descendant-or-self::node()/descendant-or-self::t2-north)"/> 107DS 27. CD: <xsl:value-of select="name(descendant-or-self::node()/descendant::t2-near-north)"/> 108DS 28. CE: <xsl:value-of select="name(descendant-or-self::node()/child::t2-near-north)"/> 109DS 29. DC: <xsl:value-of select="name(descendant::node()/descendant-or-self::t2-near-north)"/> 110DS 30. DD: <xsl:value-of select="name(descendant::node()/descendant::t2-far-west)"/> 111 112DS 31. ACC: <xsl:value-of select="name(/descendant-or-self::node()/descendant-or-self::t2-north)"/> 113DS 32. ACE: <xsl:value-of select="name(/descendant-or-self::node()/child::t2-near-north)"/> 114DS 33. ADC: <xsl:value-of select="name(/descendant::node()/descendant-or-self::t2-near-north)"/> 115DS 34. BCC: <xsl:value-of select="name(self::node()/descendant-or-self::node()/descendant-or-self::t2-north)"/> 116DS 35. BCE: <xsl:value-of select="name(self::node()/descendant-or-self::node()/child::t2-near-north)"/> 117DS 36. BDC: <xsl:value-of select="name(self::node()/descendant::node()/descendant-or-self::t2-far-west)"/> 118DS 37. BDE: <xsl:value-of select="name(self::node()/descendant::node()/child::t2-far-west)"/> 119DS 38. CCC: <xsl:value-of select="name(descendant-or-self::node()/descendant-or-self::node()/descendant-or-self::t2-north)"/> 120DS 39. CCE: <xsl:value-of select="name(descendant-or-self::node()/descendant-or-self::node()/child::t2-near-north)"/> 121DS 40. CDC: <xsl:value-of select="name(descendant-or-self::node()/descendant::node()/descendant-or-self::t2-near-north)"/> 122DS 41. CDE: <xsl:value-of select="name(descendant-or-self::node()/descendant::node()/child::t2-far-west)"/> 123DS 42. CEC: <xsl:value-of select="name(descendant-or-self::node()/child::node()/descendant-or-self::t2-near-north)"/> 124DS 43. CEE: <xsl:value-of select="name(descendant-or-self::node()/child::node()/child::t2-far-west)"/> 125DS 44. DCC: <xsl:value-of select="name(descendant::node()/descendant-or-self::node()/descendant-or-self::t2-near-north)"/> 126DS 45. DCE: <xsl:value-of select="name(descendant::node()/descendant-or-self::node()/child::t2-far-west)"/> 127DS 46. DDC: <xsl:value-of select="name(descendant::node()/descendant::node()/descendant-or-self::t2-far-west)"/> 128</xsl:template> 129 130 131 <!-- 132 * Licensed to the Apache Software Foundation (ASF) under one 133 * or more contributor license agreements. See the NOTICE file 134 * distributed with this work for additional information 135 * regarding copyright ownership. The ASF licenses this file 136 * to you under the Apache License, Version 2.0 (the "License"); 137 * you may not use this file except in compliance with the License. 138 * You may obtain a copy of the License at 139 * 140 * http://www.apache.org/licenses/LICENSE-2.0 141 * 142 * Unless required by applicable law or agreed to in writing, software 143 * distributed under the License is distributed on an "AS IS" BASIS, 144 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 145 * See the License for the specific language governing permissions and 146 * limitations under the License. 147 --> 148 149</xsl:stylesheet> 150