1<?xml version="1.0" encoding="UTF-8"?> 2<xsl:stylesheet version="1.0" 3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > 4 5 <!-- FileName: copy27 --> 6 <!-- Document: http://www.w3.org/TR/xslt --> 7 <!-- DocVersion: 19991116 --> 8 <!-- Section: 11.3 --> 9 <!-- Creator: Oliver Becker --> 10 <!-- Purpose: Demonstrate copying a named template from the stylesheet 11 into the result. From a thread on XSL-list 7/30/2001. --> 12 13<xsl:template name="qq"> 14 <node attr="8"/> 15</xsl:template> 16 17<xsl:template match="/"> 18 <results> 19 <usual-result> 20 <xsl:call-template name="qq"/> 21 </usual-result> 22 <xsl:text> </xsl:text> 23 <exotic-result> 24 <xsl:copy-of select="document('')/*/xsl:template[@name='qq']/node()" /> 25 </exotic-result> 26 </results> 27</xsl:template> 28 29 30 <!-- 31 * Licensed to the Apache Software Foundation (ASF) under one 32 * or more contributor license agreements. See the NOTICE file 33 * distributed with this work for additional information 34 * regarding copyright ownership. The ASF licenses this file 35 * to you under the Apache License, Version 2.0 (the "License"); 36 * you may not use this file except in compliance with the License. 37 * You may obtain a copy of the License at 38 * 39 * http://www.apache.org/licenses/LICENSE-2.0 40 * 41 * Unless required by applicable law or agreed to in writing, software 42 * distributed under the License is distributed on an "AS IS" BASIS, 43 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 44 * See the License for the specific language governing permissions and 45 * limitations under the License. 46 --> 47 48</xsl:stylesheet> 49