xref: /aosp_15_r20/external/apache-xml/test/tests/conf/variable/variable23.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
1<?xml version="1.0"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
4  <!-- FileName: variable23 -->
5  <!-- Document: http://www.w3.org/TR/xslt -->
6  <!-- DocVersion: 19991116 -->
7  <!-- Section: 11.6 -->
8  <!-- Purpose: Test how big a string can be passed to a template. -->
9  <!-- Author: David Marston -->
10
11<!-- Set upper limit here -->
12<xsl:variable name="max" select="256" />
13
14<xsl:template match="/doc">
15  <out>
16    <xsl:call-template name="looper">
17      <xsl:with-param name="str" select="'....5....|'" />
18    </xsl:call-template>
19  </out>
20</xsl:template>
21
22<xsl:template name="looper">
23  <xsl:param name="str" select="0000000000" />
24  <!-- put out one iteration of the name and a trailing space -->
25  <xsl:value-of select="string-length($str)"/><xsl:text>: </xsl:text>
26  <xsl:value-of select="$str"/><xsl:text>
27</xsl:text>
28  <!-- here's the recursion -->
29  <xsl:if test="string-length($str) &lt; $max">
30    <xsl:call-template name="looper">
31      <xsl:with-param name="str">
32        <xsl:value-of select="concat($str,'....5....|')"/>
33      </xsl:with-param>
34    </xsl:call-template>
35  </xsl:if>
36</xsl:template>
37
38
39  <!--
40   * Licensed to the Apache Software Foundation (ASF) under one
41   * or more contributor license agreements. See the NOTICE file
42   * distributed with this work for additional information
43   * regarding copyright ownership. The ASF licenses this file
44   * to you under the Apache License, Version 2.0 (the  "License");
45   * you may not use this file except in compliance with the License.
46   * You may obtain a copy of the License at
47   *
48   *     http://www.apache.org/licenses/LICENSE-2.0
49   *
50   * Unless required by applicable law or agreed to in writing, software
51   * distributed under the License is distributed on an "AS IS" BASIS,
52   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
53   * See the License for the specific language governing permissions and
54   * limitations under the License.
55  -->
56
57</xsl:stylesheet>
58