1<?xml version="1.0" encoding="utf-8"?> 2<xsl:stylesheet 3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 4 version="1.0"> 5<!-- Reproduce Bugzilla#4218, apply this to identity.xml or any file --> 6<!-- 7The following stylesheet puts out <out>abcabc</out>, which is absolutely 8incorrect. If you uncomment the commented value-of and variable, it results 9"Variable accessed before it is bound!" error message. The bug seems to be 10related to the inner call-template... it looks like something in the stack 11frame is not being restored??? 12--> 13<xsl:template match="/"> 14 <out> 15 <xsl:variable name="v1" select="'abc-should-appear-once'"/> 16 <xsl:variable name="v2" select="'def-should-appear-once'"/> 17 18 <!-- Comment this in, along with the value-of below, 19 to get error message: Variable accessed before it is bound! 20 See Bugzilla4218.xsl --> 21 <xsl:variable name="v3" select="'ghi-should-appear-once'"/> 22 23 <xsl:call-template name="test-template"> 24 <xsl:with-param name="p1"> 25 <xsl:call-template name="xyz-template"> 26 <xsl:with-param name="p1" select="$v1"/> 27 </xsl:call-template> 28 <xsl:value-of select="$v2"/> 29 <!-- Comment this in along with the v3 variable above to 30 get error message! See Bugzilla4218.xsl --> 31 <xsl:value-of select="$v3"/> 32 </xsl:with-param> 33 </xsl:call-template> 34 </out> 35 </xsl:template> 36 37 <xsl:template name="test-template"> 38 <xsl:param name="p1" select="'error'"/> 39 <test-template><xsl:value-of select="$p1"/></test-template> 40 </xsl:template> 41 42 <xsl:template name="xyz-template"> 43 <xsl:param name="p1" select="'error'"/> 44 <xyz-template><xsl:value-of select="$p1"/></xyz-template> 45 </xsl:template> 46 47 <!-- 48 * Licensed to the Apache Software Foundation (ASF) under one 49 * or more contributor license agreements. See the NOTICE file 50 * distributed with this work for additional information 51 * regarding copyright ownership. The ASF licenses this file 52 * to you under the Apache License, Version 2.0 (the "License"); 53 * you may not use this file except in compliance with the License. 54 * You may obtain a copy of the License at 55 * 56 * http://www.apache.org/licenses/LICENSE-2.0 57 * 58 * Unless required by applicable law or agreed to in writing, software 59 * distributed under the License is distributed on an "AS IS" BASIS, 60 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 61 * See the License for the specific language governing permissions and 62 * limitations under the License. 63 --> 64 65</xsl:stylesheet> 66