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 <!-- Comment this in, along with the value-of below, 19*1212f9a0SAndroid Build Coastguard Worker to get error message: Variable accessed before it is bound! 20*1212f9a0SAndroid Build Coastguard Worker See Bugzilla4218.xsl --> 21*1212f9a0SAndroid Build Coastguard Worker <xsl:variable name="v3" select="'ghi-should-appear-once'"/> 22*1212f9a0SAndroid Build Coastguard Worker 23*1212f9a0SAndroid Build Coastguard Worker <xsl:call-template name="test-template"> 24*1212f9a0SAndroid Build Coastguard Worker <xsl:with-param name="p1"> 25*1212f9a0SAndroid Build Coastguard Worker <xsl:call-template name="xyz-template"> 26*1212f9a0SAndroid Build Coastguard Worker <xsl:with-param name="p1" select="$v1"/> 27*1212f9a0SAndroid Build Coastguard Worker </xsl:call-template> 28*1212f9a0SAndroid Build Coastguard Worker <xsl:value-of select="$v2"/> 29*1212f9a0SAndroid Build Coastguard Worker <!-- Comment this in along with the v3 variable above to 30*1212f9a0SAndroid Build Coastguard Worker get error message! See Bugzilla4218.xsl --> 31*1212f9a0SAndroid Build Coastguard Worker <xsl:value-of select="$v3"/> 32*1212f9a0SAndroid Build Coastguard Worker </xsl:with-param> 33*1212f9a0SAndroid Build Coastguard Worker </xsl:call-template> 34*1212f9a0SAndroid Build Coastguard Worker </out> 35*1212f9a0SAndroid Build Coastguard Worker </xsl:template> 36*1212f9a0SAndroid Build Coastguard Worker 37*1212f9a0SAndroid Build Coastguard Worker <xsl:template name="test-template"> 38*1212f9a0SAndroid Build Coastguard Worker <xsl:param name="p1" select="'error'"/> 39*1212f9a0SAndroid Build Coastguard Worker <test-template><xsl:value-of select="$p1"/></test-template> 40*1212f9a0SAndroid Build Coastguard Worker </xsl:template> 41*1212f9a0SAndroid Build Coastguard Worker 42*1212f9a0SAndroid Build Coastguard Worker <xsl:template name="xyz-template"> 43*1212f9a0SAndroid Build Coastguard Worker <xsl:param name="p1" select="'error'"/> 44*1212f9a0SAndroid Build Coastguard Worker <xyz-template><xsl:value-of select="$p1"/></xyz-template> 45*1212f9a0SAndroid Build Coastguard Worker </xsl:template> 46*1212f9a0SAndroid Build Coastguard Worker 47*1212f9a0SAndroid Build Coastguard Worker <!-- 48*1212f9a0SAndroid Build Coastguard Worker * Licensed to the Apache Software Foundation (ASF) under one 49*1212f9a0SAndroid Build Coastguard Worker * or more contributor license agreements. See the NOTICE file 50*1212f9a0SAndroid Build Coastguard Worker * distributed with this work for additional information 51*1212f9a0SAndroid Build Coastguard Worker * regarding copyright ownership. The ASF licenses this file 52*1212f9a0SAndroid Build Coastguard Worker * to you under the Apache License, Version 2.0 (the "License"); 53*1212f9a0SAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 54*1212f9a0SAndroid Build Coastguard Worker * You may obtain a copy of the License at 55*1212f9a0SAndroid Build Coastguard Worker * 56*1212f9a0SAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 57*1212f9a0SAndroid Build Coastguard Worker * 58*1212f9a0SAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 59*1212f9a0SAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 60*1212f9a0SAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 61*1212f9a0SAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 62*1212f9a0SAndroid Build Coastguard Worker * limitations under the License. 63*1212f9a0SAndroid Build Coastguard Worker --> 64*1212f9a0SAndroid Build Coastguard Worker 65*1212f9a0SAndroid Build Coastguard Worker</xsl:stylesheet> 66