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