1<?xml version="1.0"?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" 3 xmlns:cextend="http://xml.apache.org/xalan" 4 xmlns:test="http://www.cnn.com" 5 xmlns:default="http://www.hello.com" 6 exclude-result-prefixes="test default cextend"> 7 8 <!-- FileName: libraryNodeset01 --> 9 <!-- Document: http://www.w3.org/TR/xslt --> 10 <!-- DocVersion: 19991116 --> 11 <!-- Section: 14 Extensions --> 12 <!-- Purpose: Testing Lotus-specific extension "Nodeset". --> 13 14<xsl:strip-space elements="*"/> 15<xsl:output indent="yes"/> 16 17<xsl:template match="/"> 18 <out> 19 <xsl:variable name="rtf"> 20 <docelem xmlns="http://www.hello.com" xmlns:test="http://www.cnn.com"> 21 <elem1> 22 <elem1a>ELEMENT1A</elem1a> 23 <elem1b>,ELEMENT1B</elem1b> 24 </elem1> 25 <elem2> 26 <elem2a>ELEMENT2A</elem2a> 27 <elem2b/> 28 </elem2> 29 <elem3>1</elem3> 30 <elem3>2</elem3> 31 <test:elem3/> 32 <elem3>4</elem3> 33 <elem3>5</elem3> 34 <elem4>Yahoo</elem4> 35 </docelem> 36 <docelem> 37 <elem1> 38 <elem2> 39 <elem3 attr1="A" attr2="B" attr3="C">Whooa</elem3> 40 <elem3 attr1="Z" attr2="Y" attr3="X">Aoohw</elem3> 41 </elem2> 42 </elem1> 43 </docelem> 44 </xsl:variable> 45 46 <xsl:element name="Count"> 47 <xsl:value-of select="count(cextend:nodeset($rtf)/default:docelem/default:elem3)"/> 48 </xsl:element> 49 50 <xsl:element name="Sum"> 51 <xsl:value-of select="sum(cextend:nodeset($rtf)/default:docelem/default:elem3)"/> 52 </xsl:element> 53 54 <xsl:element name="Number"> 55 <xsl:value-of select="number(cextend:nodeset($rtf)/default:docelem/default:elem3[2])"/> 56 </xsl:element> 57 58 <xsl:element name="Name"> 59 <xsl:value-of select="name(cextend:nodeset($rtf)/*)"/> 60 </xsl:element> 61 62 <xsl:element name="Local-name"> 63 <xsl:value-of select="local-name(cextend:nodeset($rtf)/*)"/> 64 </xsl:element> 65 66 <xsl:element name="Namespace-URIs"> 67 <xsl:attribute name="uri1"> 68 <xsl:value-of select="namespace-uri(cextend:nodeset($rtf)/default:docelem)"/> 69 </xsl:attribute> 70 <xsl:attribute name="uri2"> 71 <xsl:value-of select="namespace-uri(cextend:nodeset($rtf)/default:docelem/default:elem1)"/> 72 </xsl:attribute> 73 <xsl:attribute name="uri3"> 74 <xsl:value-of select="namespace-uri(cextend:nodeset($rtf)/default:docelem/test:elem3)"/> 75 </xsl:attribute> 76 </xsl:element> 77 78 <xsl:element name="Value-DOCELEM-Elem1"> 79 <xsl:value-of select="cextend:nodeset($rtf)/default:docelem/default:elem1"/> 80 </xsl:element> 81 82 <xsl:element name="FE-DOCELEM-STAR"> 83 <xsl:for-each select="cextend:nodeset($rtf)/default:docelem/*"> 84 <xsl:value-of select="name(.)"/><xsl:text> </xsl:text> 85 </xsl:for-each> 86 </xsl:element> 87 88 <xsl:element name="FE-DOCELEM-ELEM2-STAR"> 89 <xsl:for-each select="cextend:nodeset($rtf)/default:docelem/default:elem2/*"> 90 <xsl:value-of select="name(.)"/><xsl:text> </xsl:text> 91 </xsl:for-each> 92 </xsl:element> 93 94 <xsl:element name="AT-DOCELEM-ELEM4"> 95 <xsl:apply-templates select="cextend:nodeset($rtf)/default:docelem/default:elem4"/> 96 </xsl:element> 97 98 <xsl:element name="Copy-of-ELEM1B"> 99 <xsl:copy-of select="cextend:nodeset($rtf)/default:docelem/default:elem1/default:elem1b"/> 100 </xsl:element> 101 102 </out> 103</xsl:template> 104 105<xsl:template match="default:elem4"> 106 <xsl:value-of select="."/> 107</xsl:template> 108 109 110 <!-- 111 * Licensed to the Apache Software Foundation (ASF) under one 112 * or more contributor license agreements. See the NOTICE file 113 * distributed with this work for additional information 114 * regarding copyright ownership. The ASF licenses this file 115 * to you under the Apache License, Version 2.0 (the "License"); 116 * you may not use this file except in compliance with the License. 117 * You may obtain a copy of the License at 118 * 119 * http://www.apache.org/licenses/LICENSE-2.0 120 * 121 * Unless required by applicable law or agreed to in writing, software 122 * distributed under the License is distributed on an "AS IS" BASIS, 123 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 124 * See the License for the specific language governing permissions and 125 * limitations under the License. 126 --> 127 128</xsl:stylesheet> 129