1<?xml version="1.0"?> 2<?xml-stylesheet type="text/xsl" href="#style1"?> 3<!DOCTYPE doc [ 4<!ELEMENT doc (#PCDATA | head | body)*> 5 6<!ELEMENT head (#PCDATA | xsl:stylesheet)*> 7<!ELEMENT body (#PCDATA|para)*> 8 9<!ELEMENT xsl:stylesheet (#PCDATA | xsl:key | xsl:template)*> 10<!ATTLIST xsl:stylesheet 11 id ID #REQUIRED 12 xmlns:xsl CDATA #FIXED "http://www.w3.org/1999/XSL/Transform" 13 version NMTOKEN #REQUIRED> 14 15<!ELEMENT xsl:key EMPTY> 16<!ATTLIST xsl:key 17 name NMTOKENS #REQUIRED 18 match CDATA #REQUIRED 19 use CDATA #REQUIRED> 20 21<!ELEMENT xsl:template (#PCDATA | out)*> 22<!ATTLIST xsl:template match CDATA #IMPLIED> 23 24<!ELEMENT out (#PCDATA | xsl:value-of | xsl:text)*> 25 26<!ELEMENT xsl:value-of EMPTY> 27<!ATTLIST xsl:value-of select CDATA #REQUIRED> 28 29<!ELEMENT xsl:text (#PCDATA)> 30 31<!ELEMENT para (#PCDATA)*> 32<!ATTLIST para id ID #REQUIRED> 33]> 34 35<doc> 36 <head> 37 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" 38 id="style1"> 39 40 <!-- FileName: embed01 --> 41 <!-- Document: http://www.w3.org/TR/xslt --> 42 <!-- DocVersion: 19991116 --> 43 <!-- Section: 2.7 Embedding Stylesheets. --> 44 <!-- Purpose: General test of embedded stylesheet using fragment identifier --> 45 46 <xsl:key name="test" match="para" use="@id"/> 47 48 <xsl:template match="/"> 49 <out> 50 <xsl:value-of select="doc/body/para"/> 51 <xsl:value-of select="key('test','foey')"/><xsl:text> </xsl:text> 52 </out> 53 </xsl:template> 54 55 <!-- 56 * Licensed to the Apache Software Foundation (ASF) under one 57 * or more contributor license agreements. See the NOTICE file 58 * distributed with this work for additional information 59 * regarding copyright ownership. The ASF licenses this file 60 * to you under the Apache License, Version 2.0 (the "License"); 61 * you may not use this file except in compliance with the License. 62 * You may obtain a copy of the License at 63 * 64 * http://www.apache.org/licenses/LICENSE-2.0 65 * 66 * Unless required by applicable law or agreed to in writing, software 67 * distributed under the License is distributed on an "AS IS" BASIS, 68 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 69 * See the License for the specific language governing permissions and 70 * limitations under the License. 71 --> 72 73 </xsl:stylesheet> 74 </head> 75 76 <body> 77 <para id="foo"> 78Hello 79 </para> 80 <para id="foey"> 81Goodbye 82 </para> 83 </body> 84</doc> 85