dmarston 00/12/15 13:35:00
Added: test/tests/conf/variable variable46.xsl impmid.xsl
var11imp.xsl var27side.xsl var28final.xsl
var28mid.xsl var29side.xsl var30mid.xsl
variable01.xml variable01.xsl variable02.xml
variable02.xsl variable03.xml variable03.xsl
variable04.xml variable04.xsl variable05.xml
variable05.xsl variable06.xml variable06.xsl
variable07.xml variable07.xsl variable08.xml
variable08.xsl variable09.xml variable09.xsl
variable10.xml variable10.xsl variable11.xml
variable11.xsl variable12.xml variable12.xsl
variable13.xml variable13.xsl variable14.xml
variable14.xsl variable15.xml variable15.xsl
variable16.xml variable16.xsl variable17.xml
variable17.xsl variable18.xml variable18.xsl
variable19.xml variable19.xsl variable20.xml
variable20.xsl variable21.xml variable21.xsl
variable22.xml variable22.xsl variable23.xml
variable23.xsl variable24.xml variable24.xsl
variable25.xml variable25.xsl variable26.xml
variable26.xsl variable27.xml variable27.xsl
variable28.xml variable28.xsl variable29.xml
variable29.xsl variable30.xml variable30.xsl
variable31.xml variable31.xsl variable32.xml
variable32.xsl variable33.xml variable33.xsl
variable34.xml variable34.xsl variable35.xml
variable35.xsl variable36.xml variable36.xsl
variable37.xml variable37.xsl variable38.xml
variable38.xsl variable39.xml variable39.xsl
variable40.xml variable40.xsl variable41.xml
variable41.xsl variable42.xml variable42.xsl
variable43.xml variable43.xsl variable44.xml
variable44.xsl variable45.xml variable45.xsl
variable46.xml impfinal.xsl
Log:
Copy of tests in Lotus/IBM repository
Revision Changes Path
1.1 xml-xalan/test/tests/conf/variable/variable46.xsl
Index: variable46.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable46 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 Values of Variables and Parameters -->
<!-- Purpose: Test proper construction of an RTF containing multiple top
level nodes. -->
<!-- Creator: Felix Garcia Romero ([EMAIL PROTECTED]) -->
<xsl:variable name="foo">
<b>First element</b>
Second element
<FORM METHOD="post">
<input type="length" size="30" />
</FORM>
</xsl:variable>
<xsl:template match="/">
<out><xsl:copy-of select="$foo"/></out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/impmid.xsl
Index: impmid.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: impmid -->
<!-- Purpose: to be imported by variable22, 27, etc. -->
<xsl:import href="impfinal.xsl"/>
<xsl:param name="test" select="'test value set in impmid'"/>
<xsl:template match="a">
<xsl:text>
In middle: </xsl:text><xsl:value-of select="$test"/>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/var11imp.xsl
Index: var11imp.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: var11imp -->
<!-- Purpose: to be imported by variable11 -->
<xsl:param name="test" select="'subsheet, should be overridden by main
sheet'"/>
<xsl:template match="/">
<out>
<xsl:value-of select="$test"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/var27side.xsl
Index: var27side.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: var27side -->
<!-- Purpose: to be imported by variable27 -->
<xsl:param name="test" select="'test value set in var27side'"/>
<xsl:template match="b">
<xsl:text>
On the side: </xsl:text><xsl:value-of select="$test"/>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/var28final.xsl
Index: var28final.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: var28final -->
<!-- Purpose: to be imported by var28mid -->
<xsl:param name="test" select="'test value set in final'"/>
<xsl:template match="b">
<xsl:text>
In final: </xsl:text><xsl:value-of select="$test"/>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/var28mid.xsl
Index: var28mid.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: var28mid -->
<!-- Purpose: to be imported by variable28 -->
<xsl:import href="var28final.xsl"/>
<xsl:param name="test" select="'test value set in mid'"/>
<xsl:template match="/">
<out><xsl:text>
In middle: </xsl:text><xsl:value-of select="$test"/>
<xsl:apply-templates/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/var29side.xsl
Index: var29side.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: var29side -->
<!-- Purpose: to be imported by variable29 -->
<xsl:param name="test" select="'set in var29side, should have highest
precedence'"/>
<xsl:template match="a">
<xsl:text>
On the side: </xsl:text><xsl:value-of select="$test"/>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="c">
<xsl:text>
Side again: </xsl:text><xsl:value-of select="$test"/>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/var30mid.xsl
Index: var30mid.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: var30mid -->
<!-- Purpose: to be imported by variable30 -->
<xsl:import href="impfinal.xsl"/>
<xsl:param name="test" select="'value set in var30mid, should have highest
precedence'"/>
<xsl:template match="b">
<xsl:text>
In middle: </xsl:text><xsl:value-of select="$test"/>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable01.xml
Index: variable01.xml
===================================================================
<?xml version="1.0"?>
<!-- Test #1 for xsl:variable -->
<doc>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable01.xsl
Index: variable01.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable01 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 Values of Variables and Parameters -->
<!-- Purpose: Set top-level xsl:variable to a string -->
<!-- Author: Paul Dick -->
<xsl:variable name="ExpressionTest" select="'ABC'"/>
<xsl:template match="doc">
<out>
<xsl:value-of select="$ExpressionTest"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable02.xml
Index: variable02.xml
===================================================================
<?xml version="1.0"?>
<!-- Test #2 for xsl:variable -->
<doc>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable02.xsl
Index: variable02.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable02 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 Values of Variables and Parameters -->
<!-- Purpose: Test top-level xsl:variable set to be an RTF -->
<!-- Author: Paul Dick -->
<xsl:variable name="ResultTreeFragTest">
<B>ABC</B>
</xsl:variable>
<xsl:template match="doc">
<out>
<xsl:value-of select="$ResultTreeFragTest"/><xsl:text>,</xsl:text>
<xsl:copy-of select="$ResultTreeFragTest"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable03.xml
Index: variable03.xml
===================================================================
<?xml version="1.0"?>
<doc>
<a>test</a>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable03.xsl
Index: variable03.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable03 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 Values of Variables and Parameters -->
<!-- Purpose: Test xsl:variable inside a template set to be an RTF -->
<!-- Author: Paul Dick -->
<xsl:template match="doc">
<out>
<xsl:variable name="ResultTreeFragTest">
<B><xsl:value-of select="a"/></B>
</xsl:variable>
<xsl:value-of select="$ResultTreeFragTest"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable04.xml
Index: variable04.xml
===================================================================
<?xml version="1.0"?>
<doc>
<a>test</a>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable04.xsl
Index: variable04.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable04 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 Values of Variables and Parameters -->
<!-- Purpose: Test for passing variable into other template via with-param.
-->
<!-- Author: Paul Dick -->
<xsl:template match="doc">
<out>
<xsl:variable name="ResultTreeFragTest">
<B><xsl:value-of select="a"/></B>
</xsl:variable>
<xsl:apply-templates select="a">
<xsl:with-param name="pvar1" select="$ResultTreeFragTest"/>
</xsl:apply-templates>
</out>
</xsl:template>
<xsl:template match="a">
<xsl:param name="pvar1">Default text in pvar1</xsl:param>
<xsl:param name="pvar2">Default text in pvar2</xsl:param>
<xsl:value-of select="$pvar1"/>, <xsl:value-of select="$pvar2"/>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable05.xml
Index: variable05.xml
===================================================================
<?xml version="1.0"?>
<doc>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable05.xsl
Index: variable05.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable05 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 Values of Variables and Parameters -->
<!-- Purpose: Verify top-level xsl:variable, HTML text RTF -->
<!-- Author: Paul Dick -->
<xsl:variable name="variable"><B>value</B></xsl:variable>
<xsl:template match="/">
<out>
<xsl:value-of select="$variable"/><xsl:text>,</xsl:text>
<xsl:copy-of select="$variable"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable06.xml
Index: variable06.xml
===================================================================
<?xml version="1.0"?>
<doc>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable06.xsl
Index: variable06.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable06 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 Values of Variables and Parameters -->
<!-- Purpose: Set variable by name but no value, should get null string -->
<!-- Author: Paul Dick -->
<!-- Note: "If the variable-binding element has empty content and
does not have a select attribute, then the value of the
variable is an empty string." -->
<xsl:template match="doc">
<xsl:variable name="x"/>
<out>
<xsl:value-of select="$x=''"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable07.xml
Index: variable07.xml
===================================================================
<?xml version="1.0"?>
<doc>
<item>1</item>
<item>2</item>
<item>3</item>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable07.xsl
Index: variable07.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable07 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 Values of Variables and Parameters -->
<!-- Purpose: Test for handling of RTF used as positional index by setting
variable as the content of the xsl:variable element. Reference as
[$n].
This is the case that will NOT obtain what a naive person expects. -->
<!-- Author: Paul Dick -->
<!-- Note: When a variable is used to select nodes by position,
be careful not to do:
<xsl:variable name="n">2</xsl:variable>
...
<xsl:value-of select="item[$n]"/>
This will output the value of the first item element, because
the variable n will be bound to a result tree fragment,
not a number. Instead, do either
<xsl:variable name="n" select="2"/>
...
<xsl:value-of select="item[$n]"/>
or
<xsl:variable name="n">2</xsl:variable>
...
<xsl:value-of select="item[position()=$n]"/> -->
<xsl:template match="doc">
<xsl:variable name="n">2</xsl:variable>
<out>
<xsl:value-of select="item[$n]"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable08.xml
Index: variable08.xml
===================================================================
<?xml version="1.0"?>
<doc>
<item>1</item>
<item>2</item>
<item>3</item>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable08.xsl
Index: variable08.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable08 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 Values of Variables and Parameters -->
<!-- Purpose: Test for handling of RTF used as positional index by setting
variable as the content of the xsl:variable element. Reference as
[position()=$n]
This is the case that will NOT obtain what the naive person expects.
-->
<!-- Author: Paul Dick -->
<!-- Note: When a variable is used to select nodes by position,
be careful not to do:
<xsl:variable name="n">2</xsl:variable>
...
<xsl:value-of select="item[$n]"/>
This will output the value of the first item element,
because the variable n will be bound to a result tree fragment,
not a number. Instead, do either
<xsl:variable name="n" select="2"/>
...
<xsl:value-of select="item[$n]"/>
or
<xsl:variable name="n">2</xsl:variable>
...
<xsl:value-of select="item[position()=$n]"/> -->
<xsl:template match="doc">
<xsl:variable name="n">2</xsl:variable>
<out>
<xsl:value-of select="item[position()=$n]"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable09.xml
Index: variable09.xml
===================================================================
<?xml version="1.0"?>
<doc>
<item>1</item>
<item>2</item>
<item>3</item>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable09.xsl
Index: variable09.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable09 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 Values of Variables and Parameters -->
<!-- Purpose: Test for handling of number used as positional index by
setting
variable using select attribute. Reference as [$n] -->
<!-- Author: Paul Dick -->
<!-- Note: When a variable is used to select nodes by position,
be careful not to do:
<xsl:variable name="n">2</xsl:variable>
...
<xsl:value-of select="item[$n]"/>
This will output the value of the first item element,
because the variable n will be bound to a result tree fragment,
not a number. Instead, do either
<xsl:variable name="n" select="2"/>
...
<xsl:value-of select="item[$n]"/>
or
<xsl:variable name="n">2</xsl:variable>
...
<xsl:value-of select="item[position()=$n]"/> -->
<xsl:template match="doc">
<xsl:variable name="n" select="2"/>
<out>
<xsl:value-of select="item[$n]"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable10.xml
Index: variable10.xml
===================================================================
<?xml version="1.0"?>
<doc>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable10.xsl
Index: variable10.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable10 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.3 Using Variables and Parameters with xsl:copy-of -->
<!-- Purpose: Test for using xsl:copy-of with empty (null string) variable.
-->
<!-- Author: Paul Dick -->
<xsl:template match="doc">
<xsl:variable name="x"/>
<out>
<xsl:copy-of select="$x"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable11.xml
Index: variable11.xml
===================================================================
<?xml version="1.0"?>
<doc>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable11.xsl
Index: variable11.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable11 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.4 Top-level Variables and Parameters -->
<!-- Purpose: Import precedence applies to top-level params
(even when template referencing it is in the imported file) -->
<!-- Author: Ed Blachman -->
<xsl:import href="var11imp.xsl"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="test" select="'main stylesheet, should have highest
precedence'"/>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable12.xml
Index: variable12.xml
===================================================================
<?xml version="1.0"?>
<doc>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable12.xsl
Index: variable12.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable12 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 Values of Variables and Parameters -->
<!-- Purpose: Set top-level xsl:param to a string -->
<!-- Author: David Marston -->
<xsl:param name="ExpressionTest" select="'ABC'"/>
<xsl:template match="doc">
<out>
<xsl:value-of select="$ExpressionTest"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable13.xml
Index: variable13.xml
===================================================================
<?xml version="1.0"?>
<doc>
<item>Y</item>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable13.xsl
Index: variable13.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable13 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 Values of Variables and Parameters -->
<!-- Purpose: Test for setting a param using a choose -->
<!-- Author: David Marston -->
<xsl:param name="chooseTest" select="'ABC'"/>
<xsl:template match="doc">
<out>
<xsl:value-of select="$chooseTest"/><xsl:text>_</xsl:text>
<xsl:param name="chooseTest">
<xsl:choose>
<xsl:when test="item='X'">24</xsl:when>
<xsl:when test="item='Y'">25</xsl:when>
<xsl:when test="item='Z'">26</xsl:when>
<xsl:otherwise>32</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:value-of select="$chooseTest"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable14.xml
Index: variable14.xml
===================================================================
<?xml version="1.0"?>
<doc>
<Test>Hello</Test>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable14.xsl
Index: variable14.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable14 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.6 Passing Parameters to Templates. -->
<!-- Purpose: Verify that a variable defined within a xsl:with-param content
is scoped correctly. Idea sent in on xalan-dev list. We should
recognize 'test' within the with-param statement.
The named template 'foo' really plays no part here. -->
<!-- Author: Paul Dick, based on posting to xalan-dev list -->
<xsl:template match="doc">
<xsl:call-template name="foo">
<xsl:with-param name="bar">
<xsl:variable name="test">Test</xsl:variable>
<xsl:value-of select="$test"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="foo">
<xsl:param name="bar"/>
<foo>
<xsl:copy-of select="$bar"/>
</foo>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable15.xml
Index: variable15.xml
===================================================================
<?xml version="1.0"?>
<docs>
<doc/>
<a>X</a>
<a>Y</a>
<a>Z</a>
</docs>
1.1 xml-xalan/test/tests/conf/variable/variable15.xsl
Index: variable15.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable15 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 -->
<!-- Purpose: Test for-each inside xsl:variable -->
<!-- Author: David Marston -->
<xsl:template match="docs">
<out>
<xsl:variable name="all">
<xsl:for-each select="a">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:variable>
<xsl:text>$all contains </xsl:text>
<xsl:value-of select="$all"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable16.xml
Index: variable16.xml
===================================================================
<?xml version="1.0"?>
<docs>
<doc/>
<a>X</a>
<a>Y</a>
<a>Z</a>
</docs>
1.1 xml-xalan/test/tests/conf/variable/variable16.xsl
Index: variable16.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable16 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 -->
<!-- Purpose: Test for-each inside xsl:param -->
<!-- Author: David Marston -->
<xsl:param name="all">
<xsl:for-each select="/docs/a">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:param>
<xsl:template match="docs">
<out>
<xsl:text>$all contains </xsl:text>
<xsl:value-of select="$all"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable17.xml
Index: variable17.xml
===================================================================
<?xml version="1.0"?>
<docs>
<doc>blah</doc>
<a>X</a>
</docs>
1.1 xml-xalan/test/tests/conf/variable/variable17.xsl
Index: variable17.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable17 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.4 -->
<!-- Purpose: Show that there is always a current node -->
<!-- Author: David Marston -->
<xsl:param name="children" select="count(*)"/>
<xsl:template match="docs">
<out>
<xsl:text>$children contains </xsl:text>
<xsl:value-of select="$children"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable18.xml
Index: variable18.xml
===================================================================
<?xml version="1.0"?>
<doc>
<defaultVal>Just checking</defaultVal>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable18.xsl
Index: variable18.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable18 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.6 Passing Parameters to Templates. -->
<!-- Purpose: Test param being set to default in a named template. -->
<!-- Author: David Marston -->
<xsl:template match="/">
<out>
<xsl:call-template name="myTmpl">
<!-- If we had a with-param here, we could change the value of "bar".
-->
</xsl:call-template>
</out>
</xsl:template>
<xsl:template name="myTmpl">
<xsl:param name="bar">defaultVal</xsl:param>
<foo>
<xsl:value-of select="$bar"/>
</foo>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable19.xml
Index: variable19.xml
===================================================================
<?xml version="1.0"?>
<doc>
<a pos="first">
<b/>
</a>
<a pos="second">
<b/>
</a>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable19.xsl
Index: variable19.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable19 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11 -->
<!-- Purpose: Verify that a variable in an inner template can take on a new
value -->
<!-- Author: David Marston -->
<!-- "Only the innermost binding of a variable is visible." -->
<xsl:template match="/">
<out>
<xsl:variable name="var" select="'level0'"/>
<xsl:text>begin root template, $var=</xsl:text><xsl:value-of
select="$var"/><xsl:text>
</xsl:text>
<xsl:apply-templates/>
<xsl:text>end root template, $var=</xsl:text><xsl:value-of
select="$var"/><xsl:text>
</xsl:text>
</out>
</xsl:template>
<xsl:template match="doc">
<xsl:variable name="var" select="'level1'"/>
<xsl:text>begin doc template, $var=</xsl:text><xsl:value-of
select="$var"/><xsl:text>
</xsl:text>
<xsl:apply-templates/>
<xsl:text>end doc template, $var=</xsl:text><xsl:value-of
select="$var"/><xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="a">
<xsl:variable name="var" select="@pos"/>
<xsl:text>begin a template, $var=</xsl:text><xsl:value-of
select="$var"/><xsl:text>
</xsl:text>
<xsl:apply-templates/>
<xsl:text>end a template, $var=</xsl:text><xsl:value-of
select="$var"/><xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="b">
<xsl:variable name="var" select="'level3'"/>
<xsl:text>in b template, $var=</xsl:text><xsl:value-of
select="$var"/><xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="text()"/><!-- suppress empty lines -->
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable20.xml
Index: variable20.xml
===================================================================
<?xml version="1.0"?>
<doc>
<a pos="first">
<b/>
</a>
<a pos="second">
<b/>
</a>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable20.xsl
Index: variable20.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable20 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11 -->
<!-- Purpose: Verify that a variable in a for-each can take on a new value
-->
<!-- It's unclear whether the spec allows this. XT does; Saxon doesn't. -->
<!-- Author: David Marston -->
<xsl:template match="/">
<out>
<xsl:apply-templates/>
</out>
</xsl:template>
<xsl:template match="doc">
<xsl:variable name="var" select="'level1'"/>
<xsl:text>begin doc template, $var=</xsl:text><xsl:value-of
select="$var"/><xsl:text>
</xsl:text>
<xsl:for-each select="a">
<xsl:variable name="var" select="@pos"/>
<xsl:text>inside for-each, $var=</xsl:text><xsl:value-of
select="$var"/><xsl:text>
</xsl:text>
</xsl:for-each>
<xsl:text>end doc template, $var=</xsl:text><xsl:value-of
select="$var"/><xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="text()"/><!-- suppress empty lines -->
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable21.xml
Index: variable21.xml
===================================================================
<?xml version="1.0"?>
<doc>
<item>a</item>
<item>e</item>
<item>e</item>
<item>i</item>
<item>i</item>
<item>l</item>
<item>r</item>
<item>s</item>
<item>z</item>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable21.xsl
Index: variable21.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable21 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 Values of Variables and Parameters -->
<!-- Purpose: Test setting several parameters locally -->
<!-- Author: David Marston -->
<xsl:template match="doc">
<xsl:param name="n1" select="1"/>
<xsl:param name="n2" select="2"/>
<xsl:param name="n3" select="3"/>
<xsl:param name="n4" select="4"/>
<xsl:param name="n5" select="5"/>
<xsl:param name="n6" select="6"/>
<xsl:param name="n7" select="7"/>
<xsl:param name="n8" select="8"/>
<xsl:param name="n9" select="9"/>
<out>
<xsl:value-of select="item[$n8]"/>
<xsl:value-of select="item[$n3]"/>
<xsl:value-of select="item[$n7]"/>
<xsl:value-of select="item[$n4]"/>
<xsl:value-of select="item[$n1]"/>
<xsl:value-of select="item[$n6]"/>
<xsl:value-of select="item[$n5]"/>
<xsl:value-of select="item[$n9]"/>
<xsl:value-of select="item[$n2]"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable22.xml
Index: variable22.xml
===================================================================
<?xml version="1.0"?>
<doc>
<a>
<b>
<c/>
</b>
</a>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable22.xsl
Index: variable22.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable22 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.4 Top-level Variables and Parameters -->
<!-- Purpose: Import precedence applies to top-level params
(testing references from various import levels) -->
<!-- Author: David Marston -->
<xsl:import href="impmid.xsl"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="test" select="'main stylesheet, should have highest
precedence'"/>
<xsl:template match="b">
<xsl:text>
In main: </xsl:text><xsl:value-of select="$test"/>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable23.xml
Index: variable23.xml
===================================================================
<?xml version="1.0"?>
<doc>a</doc>
1.1 xml-xalan/test/tests/conf/variable/variable23.xsl
Index: variable23.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable23 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.6 -->
<!-- Purpose: Test how big a string can be passed to a template. -->
<!-- Author: David Marston -->
<!-- Set upper limit here -->
<xsl:variable name="max" select="256" />
<xsl:template match="/doc">
<out>
<xsl:call-template name="looper">
<xsl:with-param name="str" select="'....5....|'" />
</xsl:call-template>
</out>
</xsl:template>
<xsl:template name="looper">
<xsl:param name="str" select="0000000000" />
<!-- put out one iteration of the name and a trailing space -->
<xsl:value-of select="string-length($str)"/><xsl:text>: </xsl:text>
<xsl:value-of select="$str"/><xsl:text>
</xsl:text>
<!-- here's the recursion -->
<xsl:if test="string-length($str) < $max">
<xsl:call-template name="looper">
<xsl:with-param name="str">
<xsl:value-of select="concat($str,'....5....|')"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable24.xml
Index: variable24.xml
===================================================================
<?xml version="1.0"?>
<doc>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable24.xsl
Index: variable24.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml"/>
<!-- FileName: variable24 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 Values of Variables and Parameters -->
<!-- Purpose: Test the ability of variable to hold the result of document()
-->
<!-- Author: Paul Dick -->
<xsl:template match="doc">
<out>
<xsl:variable name="document-nodelist"
select="document('variable20.xml')"/>
<xsl:copy-of select="$document-nodelist"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable25.xml
Index: variable25.xml
===================================================================
<?xml version="1.0"?>
<doc>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable25.xsl
Index: variable25.xsl
===================================================================
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:txt="http://www.host.com/txt"
exclude-result-prefixes="txt">
<!-- FileName: variable25 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11 Variables and Parameters -->
<!-- Purpose: Variable name is a QName. -->
<!-- Author: Tommy Burglund -->
<xsl:variable name="txt:me" select="'Tommy'"/>
<xsl:template match="/">
<out>
<xsl:value-of select="$txt:me"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable26.xml
Index: variable26.xml
===================================================================
<?xml version="1.0"?>
<dummy/>
1.1 xml-xalan/test/tests/conf/variable/variable26.xsl
Index: variable26.xsl
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable26 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.6 Passing Parameters to Templates -->
<!-- Purpose: It is not an error to pass a parameter to a template that does
not have an element for it, the parameter is simpily ignored. -->
<!-- Author: Ed Blachman -->
<xsl:output method="xml"/>
<xsl:param name="test" select="'global'"/>
<xsl:template match="/">
<out>
<xsl:call-template name="temtest">
<xsl:with-param name="test" select="'local'"/>
</xsl:call-template>
</out>
</xsl:template>
<xsl:template name="temtest">
<xsl:choose>
<xsl:when test="$test = 'global'">It is global!</xsl:when>
<xsl:otherwise>Not global!!!</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable27.xml
Index: variable27.xml
===================================================================
<?xml version="1.0"?>
<doc>
<a>
<b>
<c/>
</b>
</a>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable27.xsl
Index: variable27.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable27 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.4 Top-level Variables and Parameters -->
<!-- Purpose: Import precedence applies to top-level params
(testing references from various import levels) -->
<!-- Author: David Marston -->
<xsl:import href="impmid.xsl"/>
<xsl:import href="var27side.xsl"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="test" select="'main stylesheet, should have highest
precedence'"/>
<xsl:template match="c">
<xsl:text>
In main: </xsl:text><xsl:value-of select="$test"/>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable28.xml
Index: variable28.xml
===================================================================
<?xml version="1.0"?>
<doc>
<a>
<b>
<c/>
</b>
</a>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable28.xsl
Index: variable28.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable28 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.4 Top-level Variables and Parameters -->
<!-- Purpose: Import precedence applies to top-level params
(first template from middle, then up/down/up) -->
<!-- Author: David Marston -->
<xsl:import href="var28mid.xsl"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="test" select="'main stylesheet, should have highest
precedence'"/>
<xsl:template match="a">
<xsl:text>
In main: </xsl:text><xsl:value-of select="$test"/>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="c">
<xsl:text>
In main again: </xsl:text><xsl:value-of select="$test"/>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable29.xml
Index: variable29.xml
===================================================================
<?xml version="1.0"?>
<doc>
<a>
<b>
<c/>
</b>
</a>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable29.xsl
Index: variable29.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable29 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.4 Top-level Variables and Parameters -->
<!-- Purpose: Import precedence applies to top-level params
(order of imports in this sheet matters) -->
<!-- Author: David Marston -->
<xsl:import href="impfinal.xsl"/>
<xsl:import href="var29side.xsl"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="b">
<xsl:text>
In main: </xsl:text><xsl:value-of select="$test"/>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable30.xml
Index: variable30.xml
===================================================================
<?xml version="1.0"?>
<doc>
<a>
<b>
<c/>
</b>
</a>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable30.xsl
Index: variable30.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable30 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.4 Top-level Variables and Parameters -->
<!-- Purpose: Import precedence applies to top-level params
(start at bottom; all use variable set in middle) -->
<!-- Author: David Marston -->
<xsl:import href="var30mid.xsl"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="a">
<xsl:text>
In main: </xsl:text><xsl:value-of select="$test"/>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="c">
<xsl:text>
In main again: </xsl:text><xsl:value-of select="$test"/>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable31.xml
Index: variable31.xml
===================================================================
<?xml version="1.0"?>
<doc/>
1.1 xml-xalan/test/tests/conf/variable/variable31.xsl
Index: variable31.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable31 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.4 Top-level Variables and Parameters -->
<!-- Purpose: Test passing value from top-level param to top-level variable
via value-of. -->
<!-- Author: Benoit Cerrina, adapted by David Marston -->
<xsl:param name="toto" select="'titi'"/>
<xsl:variable name="tata">
<xsl:call-template name="set-tata"/>
</xsl:variable>
<xsl:template match="/">
<out>
<xsl:value-of select="$tata"/>
</out>
</xsl:template>
<xsl:template name="set-tata">
<xsl:value-of select="$toto"/>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable32.xml
Index: variable32.xml
===================================================================
<?xml version="1.0"?>
<doc/>
1.1 xml-xalan/test/tests/conf/variable/variable32.xsl
Index: variable32.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable32 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.4 Top-level Variables and Parameters -->
<!-- Purpose: Test passing value from top-level param to top-level variable
via value-of. -->
<!-- Author: David Marston -->
<xsl:param name="toto" select="'titi'"/>
<xsl:variable name="tata" select="$toto"/>
<xsl:template match="/">
<out>
<xsl:value-of select="$tata"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable33.xml
Index: variable33.xml
===================================================================
<?xml version="1.0"?>
<doc/>
1.1 xml-xalan/test/tests/conf/variable/variable33.xsl
Index: variable33.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable33 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.4 Top-level Variables and Parameters -->
<!-- Purpose: Set top-level variable with a forward reference to see what
happens. -->
<!-- Author: David Marston -->
<xsl:variable name="tata" select="$toto"/>
<xsl:param name="toto" select="'titi'"/>
<xsl:template match="/">
<out>
<xsl:value-of select="$tata"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable34.xml
Index: variable34.xml
===================================================================
<?xml version="1.0"?>
<doc>
<mid>
<inner>GotIt</inner>
</mid>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable34.xsl
Index: variable34.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable34 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.4 Top-level Variables and Parameters -->
<!-- Purpose: Set cascaded top-level variables in arbitrary order. -->
<!-- Author: David Marston -->
<xsl:variable name="b" select="$a"/>
<xsl:variable name="e" select="$d"/>
<xsl:variable name="a" select="/doc/mid/inner"/>
<xsl:variable name="d" select="$c"/>
<xsl:variable name="c" select="$b"/>
<xsl:template match="/">
<out>
<xsl:text>
a= </xsl:text><xsl:value-of select="$a"/>
<xsl:text>
b= </xsl:text><xsl:value-of select="$b"/>
<xsl:text>
c= </xsl:text><xsl:value-of select="$c"/>
<xsl:text>
d= </xsl:text><xsl:value-of select="$d"/>
<xsl:text>
e= </xsl:text><xsl:value-of select="$e"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable35.xml
Index: variable35.xml
===================================================================
<?xml version="1.0"?>
<doc/>
1.1 xml-xalan/test/tests/conf/variable/variable35.xsl
Index: variable35.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable35 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.4 Top-level Variables and Parameters -->
<!-- Purpose: Try to catch lazy-evaluation scheme picking up local instead
of global. -->
<!-- Author: David Marston -->
<xsl:variable name="tata" select="$toto"/>
<xsl:param name="toto" select="'titi'"/>
<xsl:template match="/">
<xsl:param name="toto" select="'templ'"/>
<out>
<xsl:value-of select="$toto"/><xsl:text>, </xsl:text>
<xsl:value-of select="$tata"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable36.xml
Index: variable36.xml
===================================================================
<?xml version="1.0"?>
<doc>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable36.xsl
Index: variable36.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable36 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 Values of Variables and Parameters -->
<!-- Purpose: Set variable to null string explicitly and implicitly,
compare. -->
<!-- Author: David Marston -->
<xsl:variable name="empty" />
<xsl:template match="doc">
<xsl:param name="x" select="substring-before('a','z')" />
<out>
<xsl:value-of select="$x=$empty"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable37.xml
Index: variable37.xml
===================================================================
<?xml version="1.0"?>
<doc>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable37.xsl
Index: variable37.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable37 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 Values of Variables and Parameters -->
<!-- Purpose: Set a variable to a boolean, and show it being used in xsl:if
-->
<!-- Author: David Marston -->
<xsl:template match="doc">
<xsl:variable name="partest" select="contains('foo','o')"/>
<out>
<xsl:if test="$partest">
<xsl:text>Success</xsl:text>
</xsl:if>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable38.xml
Index: variable38.xml
===================================================================
<?xml version="1.0"?>
<doc>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable38.xsl
Index: variable38.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable38 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.3 Using Variables and Parameters with xsl:copy-of -->
<!-- Purpose: Test for using xsl:copy-of with variable set to a number. -->
<!-- This should have the same result as xsl:value-of, stringified number.
-->
<!-- Author: David Marston -->
<xsl:template match="doc">
<xsl:variable name="x" select="10+7"/><!-- Use of + causes it to be numeric
-->
<out>
<xsl:copy-of select="$x"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable39.xml
Index: variable39.xml
===================================================================
<?xml version="1.0"?>
<doc>content</doc>
1.1 xml-xalan/test/tests/conf/variable/variable39.xsl
Index: variable39.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable39 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.3 Using Variables and Parameters with xsl:copy-of -->
<!-- Purpose: Build an RTF from instructions, then use xsl:copy-of. -->
<!-- Author: David Marston -->
<xsl:template match="doc">
<xsl:variable name="tree">
<xsl:element name="main">
<xsl:element name="first">
<xsl:attribute name="type">text</xsl:attribute>
<xsl:text>junk</xsl:text>
</xsl:element>
<xsl:element name="second">
<xsl:attribute name="type">fetched</xsl:attribute>
<xsl:value-of select="." />
</xsl:element>
<xsl:element name="third">
<xsl:attribute name="type">comment</xsl:attribute>
<xsl:comment>remarks</xsl:comment>
</xsl:element>
</xsl:element>
</xsl:variable>
<out>
<xsl:copy-of select="$tree"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable40.xml
Index: variable40.xml
===================================================================
<?xml version="1.0"?>
<doc>
<a><b>begin</b><c>junk</c></a>
<b>+more+</b>
<d>wrong<b>end</b>bad</d>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable40.xsl
Index: variable40.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable40 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 Values of Variables and Parameters -->
<!-- Purpose: Test top-level xsl:variable set using apply-templates -->
<!-- Author: David Marston -->
<xsl:variable name="TreeFrag">
<xsl:apply-templates select="//b" />
</xsl:variable>
<xsl:template match="doc">
<out>
<xsl:value-of select="$TreeFrag"/><xsl:text>,</xsl:text>
<xsl:apply-templates/>
</out>
</xsl:template>
<xsl:template match="a|d">
<xsl:value-of select="name(.)"/><xsl:text>,</xsl:text>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="b">
<xsl:apply-templates/><!-- expect only text, not child elements -->
</xsl:template>
<xsl:template match="c">
<xsl:text>-</xsl:text><xsl:value-of select="."/><xsl:text>;</xsl:text>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable41.xml
Index: variable41.xml
===================================================================
<?xml version="1.0"?>
<!-- the comment -->
<doc>blah</doc>
1.1 xml-xalan/test/tests/conf/variable/variable41.xsl
Index: variable41.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable41 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.4 -->
<!-- Purpose: Because root node is current when top-level param is set, can
get top-level comment. -->
<!-- Author: David Marston -->
<xsl:param name="z" select="comment()"/>
<xsl:template match="doc">
<out>
<xsl:text>$z contains</xsl:text>
<xsl:value-of select="$z"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable42.xml
Index: variable42.xml
===================================================================
<?xml version="1.0"?>
<doc status="original">
<t0>inner</t0>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable42.xsl
Index: variable42.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable42 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.4 -->
<!-- Purpose: Use copy to set a variable to an RTF.
REMINDER: we won't get the whole sub-tree, just the 'doc' element
node. -->
<!-- Author: David Marston -->
<xsl:template match="doc">
<xsl:variable name="z">
<xsl:copy>
<xsl:attribute name="status">replacement</xsl:attribute>
</xsl:copy>
</xsl:variable>
<out>
<xsl:text>$z contains </xsl:text>
<xsl:copy-of select="$z"/>
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable43.xml
Index: variable43.xml
===================================================================
<?xml version="1.0"?>
<doc>
<width>9</width>
<depth>22</depth>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable43.xsl
Index: variable43.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable43 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.2 -->
<!-- AdditionalSpec: 7.5 -->
<!-- Purpose: Test xsl:variable inside xsl:copy -->
<!-- Author: David Marston -->
<xsl:template match="/">
<out>
<xsl:apply-templates/>
</out>
</xsl:template>
<xsl:template match="doc">
<xsl:copy>
<xsl:variable name="size" select="width * depth"/>
<xsl:element name="item">
<xsl:value-of select="$size"/>
</xsl:element>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable44.xml
Index: variable44.xml
===================================================================
<?xml version="1.0"?>
<doc>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable44.xsl
Index: variable44.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: variable44 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.5 -->
<!-- Purpose: Set a variable inside a template based on variable defined
earlier in that template. -->
<!-- Author: David Marston -->
<xsl:template match="doc">
<out>
<xsl:variable name="a" select="'first'" /><!-- Two sets of quotes make it
a string -->
<xsl:variable name="b" select="$a" />
<xsl:value-of select="$b" />
</out>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable45.xml
Index: variable45.xml
===================================================================
<?xml version="1.0"?>
<doc>
</doc>
1.1 xml-xalan/test/tests/conf/variable/variable45.xsl
Index: variable45.xsl
===================================================================
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:zoo="http://www.host.com/zoo"
exclude-result-prefixes="zoo">
<!-- FileName: variable45 -->
<!-- Document: http://www.w3.org/TR/xslt -->
<!-- DocVersion: 19991116 -->
<!-- Section: 11.6 -->
<!-- Purpose: Use param whose name is a QName in with-param passing. -->
<!-- Author: David Marston -->
<xsl:template match="/">
<out>
<xsl:call-template name="a">
<xsl:with-param name="zoo:bear" select="'200'"/>
</xsl:call-template>
</out>
</xsl:template>
<xsl:template name="a">
<xsl:param name="zoo:bear">Default mammal</xsl:param>
<xsl:param name="zoo:snake">Default reptile</xsl:param>
<xsl:value-of select="$zoo:bear"/>, <xsl:value-of select="$zoo:snake"/>
</xsl:template>
</xsl:stylesheet>
1.1 xml-xalan/test/tests/conf/variable/variable46.xml
Index: variable46.xml
===================================================================
<?xml version="1.0"?>
<root/>
1.1 xml-xalan/test/tests/conf/variable/impfinal.xsl
Index: impfinal.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- FileName: impfinal -->
<!-- Purpose: to be imported by impmid and others -->
<xsl:param name="test" select="'test value set in impfinal'"/>
<xsl:template match="/">
<out><xsl:text>
In final: </xsl:text><xsl:value-of select="$test"/>
<xsl:apply-templates/>
</out>
</xsl:template>
</xsl:stylesheet>