summaryrefslogtreecommitdiffstats
path: root/libxslt/tests/exslt/functions
diff options
context:
space:
mode:
Diffstat (limited to 'libxslt/tests/exslt/functions')
-rw-r--r--libxslt/tests/exslt/functions/Makefile.am55
-rw-r--r--libxslt/tests/exslt/functions/function.1.out2
-rw-r--r--libxslt/tests/exslt/functions/function.1.xml26
-rw-r--r--libxslt/tests/exslt/functions/function.1.xsl19
-rw-r--r--libxslt/tests/exslt/functions/function.10.out2
-rw-r--r--libxslt/tests/exslt/functions/function.10.xml5
-rw-r--r--libxslt/tests/exslt/functions/function.10.xsl25
-rw-r--r--libxslt/tests/exslt/functions/function.2.out4
-rw-r--r--libxslt/tests/exslt/functions/function.2.xml26
-rw-r--r--libxslt/tests/exslt/functions/function.2.xsl22
-rw-r--r--libxslt/tests/exslt/functions/function.3.out25
-rw-r--r--libxslt/tests/exslt/functions/function.3.xml26
-rw-r--r--libxslt/tests/exslt/functions/function.3.xsl23
-rw-r--r--libxslt/tests/exslt/functions/function.4.out2
-rw-r--r--libxslt/tests/exslt/functions/function.4.xml26
-rw-r--r--libxslt/tests/exslt/functions/function.4.xsl21
-rw-r--r--libxslt/tests/exslt/functions/function.5.out2
-rw-r--r--libxslt/tests/exslt/functions/function.5.xml26
-rw-r--r--libxslt/tests/exslt/functions/function.5.xsl24
-rw-r--r--libxslt/tests/exslt/functions/function.6.out8
-rw-r--r--libxslt/tests/exslt/functions/function.6.xml26
-rw-r--r--libxslt/tests/exslt/functions/function.6.xsl32
-rw-r--r--libxslt/tests/exslt/functions/function.7.out2
-rw-r--r--libxslt/tests/exslt/functions/function.7.xml26
-rw-r--r--libxslt/tests/exslt/functions/function.7.xsl13
-rw-r--r--libxslt/tests/exslt/functions/function.8.out2
-rw-r--r--libxslt/tests/exslt/functions/function.8.xml22
-rw-r--r--libxslt/tests/exslt/functions/function.8.xsl64
-rw-r--r--libxslt/tests/exslt/functions/function.9.out6
-rw-r--r--libxslt/tests/exslt/functions/function.9.xml9
-rw-r--r--libxslt/tests/exslt/functions/function.9.xsl24
31 files changed, 595 insertions, 0 deletions
diff --git a/libxslt/tests/exslt/functions/Makefile.am b/libxslt/tests/exslt/functions/Makefile.am
new file mode 100644
index 0000000..303043a
--- /dev/null
+++ b/libxslt/tests/exslt/functions/Makefile.am
@@ -0,0 +1,55 @@
+## Process this file with automake to produce Makefile.in
+
+$(top_builddir)/xsltproc/xsltproc:
+ @(cd ../../../xsltproc ; $(MAKE) xsltproc)
+
+EXTRA_DIST = \
+ function.1.out function.1.xml function.1.xsl \
+ function.2.out function.2.xml function.2.xsl \
+ function.3.out function.3.xml function.3.xsl \
+ function.4.out function.4.xml function.4.xsl \
+ function.5.out function.5.xml function.5.xsl \
+ function.6.out function.6.xml function.6.xsl \
+ function.7.out function.7.xml function.7.xsl \
+ function.8.out function.8.xml function.8.xsl \
+ function.9.out function.9.xml function.9.xsl \
+ function.10.out function.10.xml function.10.xsl
+
+CLEANFILES = .memdump
+
+valgrind:
+ @echo '## Running the regression tests under Valgrind'
+ $(MAKE) CHECKER='libtool --mode=execute valgrind -q --leak-check=full' tests
+
+test tests: $(top_builddir)/xsltproc/xsltproc
+ @echo '## Running exslt function tests'
+ @(echo > .memdump)
+ @(for i in $(srcdir)/*.xsl ; do \
+ name=`basename $$i .xsl` ; \
+ if [ ! -f $(srcdir)/$$name.xml ] ; then continue ; fi ; \
+ log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+ $(srcdir)/$$name.xsl $(srcdir)/$$name.xml > $$name.res 2>$$name.bad;\
+ if [ ! -f $(srcdir)/$$name.out ] ; then \
+ cp $$name.res $(srcdir)/$$name.out ; \
+ if [ -s $$name.bad ] ; then \
+ mv $$name.bad $(srcdir)/$$name.err ; \
+ fi ; \
+ else \
+ if [ ! -s $$name.res ] ; then \
+ echo "Fatal error, no $$name.res\n" ; \
+ else \
+ diff $(srcdir)/$$name.out $$name.res ; \
+ if [ -s $(srcdir)/$$name.err ] ; then \
+ diff $(srcdir)/$$name.err $$name.bad; \
+ else \
+ diff /dev/null $$name.bad; \
+ fi ; \
+ fi ; \
+ fi; \
+ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true`;\
+ if [ -n "$$log" ] ; then \
+ echo $$name result ; \
+ echo "$$log" ; \
+ fi ; \
+ rm -f $$name.res $$name.bad ; \
+ done)
diff --git a/libxslt/tests/exslt/functions/function.1.out b/libxslt/tests/exslt/functions/function.1.out
new file mode 100644
index 0000000..b55429f
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.1.out
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<out xmlns:my="my://own.uri">17</out>
diff --git a/libxslt/tests/exslt/functions/function.1.xml b/libxslt/tests/exslt/functions/function.1.xml
new file mode 100644
index 0000000..bd4128d
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.1.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+
+<doc>
+ <section index="section1" index2="atr2val">
+ <section index="subSection1.1">
+ <p>Hello</p>
+ <p>Hello again.</p>
+ </section>
+ </section>
+ <section index="section2">
+ <p>Hello2</p>
+ <section index="subSection2.1">
+ <p>Hello</p>
+ <p>Hello again.</p>
+ </section>
+ <section index="subSection2.2">
+ <p>Hello</p>
+ <p>Hello again.</p>
+ </section>
+ <p>Hello2 again.</p>
+ <section index="subSection2.3">
+ <p>Hello</p>
+ <p>Hello again.</p>
+ </section>
+ </section>
+</doc>
diff --git a/libxslt/tests/exslt/functions/function.1.xsl b/libxslt/tests/exslt/functions/function.1.xsl
new file mode 100644
index 0000000..befd818
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.1.xsl
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+ xmlns:func = "http://exslt.org/functions" extension-element-prefixes="func"
+ xmlns:my="my://own.uri">
+
+<func:function name="my:count-elements">
+<xsl:for-each select="(//*)[1]">
+ <func:result select="count(//*)"/>
+ </xsl:for-each>
+</func:function>
+
+ <xsl:template match="/">
+ <out>
+ <xsl:value-of select="my:count-elements()"/>
+ </out>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/libxslt/tests/exslt/functions/function.10.out b/libxslt/tests/exslt/functions/function.10.out
new file mode 100644
index 0000000..9eb1fda
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.10.out
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+15
diff --git a/libxslt/tests/exslt/functions/function.10.xml b/libxslt/tests/exslt/functions/function.10.xml
new file mode 100644
index 0000000..e586af3
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.10.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<root>
+ <a>5</a>
+ <b>1</b>
+</root>
diff --git a/libxslt/tests/exslt/functions/function.10.xsl b/libxslt/tests/exslt/functions/function.10.xsl
new file mode 100644
index 0000000..89e5952
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.10.xsl
@@ -0,0 +1,25 @@
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:func="http://exslt.org/functions"
+ xmlns:mg="mg"
+ extension-element-prefixes="func">
+
+ <xsl:template match="root">
+ <xsl:value-of select="mg:recurse(a, b)"/>
+ </xsl:template>
+
+ <func:function name="mg:recurse">
+ <xsl:param name="a"/>
+ <xsl:param name="b"/>
+ <xsl:choose>
+ <xsl:when test="$a > 0">
+ <func:result select="$a+mg:recurse($a - $b, $b)"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <func:result select="0"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </func:function>
+</xsl:stylesheet>
+
+
diff --git a/libxslt/tests/exslt/functions/function.2.out b/libxslt/tests/exslt/functions/function.2.out
new file mode 100644
index 0000000..07a1b71
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.2.out
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<out><el>17</el>;
+ <at>7</at>;
+ 24</out>
diff --git a/libxslt/tests/exslt/functions/function.2.xml b/libxslt/tests/exslt/functions/function.2.xml
new file mode 100644
index 0000000..bd4128d
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.2.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+
+<doc>
+ <section index="section1" index2="atr2val">
+ <section index="subSection1.1">
+ <p>Hello</p>
+ <p>Hello again.</p>
+ </section>
+ </section>
+ <section index="section2">
+ <p>Hello2</p>
+ <section index="subSection2.1">
+ <p>Hello</p>
+ <p>Hello again.</p>
+ </section>
+ <section index="subSection2.2">
+ <p>Hello</p>
+ <p>Hello again.</p>
+ </section>
+ <p>Hello2 again.</p>
+ <section index="subSection2.3">
+ <p>Hello</p>
+ <p>Hello again.</p>
+ </section>
+ </section>
+</doc>
diff --git a/libxslt/tests/exslt/functions/function.2.xsl b/libxslt/tests/exslt/functions/function.2.xsl
new file mode 100644
index 0000000..a316817
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.2.xsl
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+xmlns:func = "http://exslt.org/functions" extension-element-prefixes="func">
+
+<!-- Test an EXSLT function with local variables -->
+
+<func:function name="func:count-elements-and-attributes">
+ <xsl:variable name="elements" select="//*"/>
+ <xsl:variable name="attributes" select="//@*"/>
+ <func:result select="count($elements | $attributes)"/>
+</func:function>
+
+ <xsl:template match="/">
+ <out>
+ <el><xsl:value-of select="count(//*)"/></el>;
+ <at><xsl:value-of select="count(//@*)"/></at>;
+ <xsl:value-of select="func:count-elements-and-attributes()"/>
+ </out>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/libxslt/tests/exslt/functions/function.3.out b/libxslt/tests/exslt/functions/function.3.out
new file mode 100644
index 0000000..25724b1
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.3.out
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<doc>
+ <section>
+ <section>
+ <p>Hel</p>
+ <p>Its</p>
+ </section>
+ </section>
+ <section>
+ <p>Jam</p>
+ <section>
+ <p>Mar</p>
+ <p>And</p>
+ </section>
+ <section>
+ <p>Wit</p>
+ <p>On </p>
+ </section>
+ <p>Del</p>
+ <section>
+ <p>Ful</p>
+ <p>You</p>
+ </section>
+ </section>
+</doc>
diff --git a/libxslt/tests/exslt/functions/function.3.xml b/libxslt/tests/exslt/functions/function.3.xml
new file mode 100644
index 0000000..69658c0
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.3.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+
+<doc>
+ <section index="section1" index2="atr2val">
+ <section index="subSection1.1">
+ <p>Hello</p>
+ <p>Its me again.</p>
+ </section>
+ </section>
+ <section index="section2">
+ <p>Jam</p>
+ <section index="subSection2.1">
+ <p>Marmalade</p>
+ <p>And Honey</p>
+ </section>
+ <section index="subSection2.2">
+ <p>With peanut butter</p>
+ <p>On toast</p>
+ </section>
+ <p>Delicious!</p>
+ <section index="subSection2.3">
+ <p>Full up now?</p>
+ <p>You bet.</p>
+ </section>
+ </section>
+</doc>
diff --git a/libxslt/tests/exslt/functions/function.3.xsl b/libxslt/tests/exslt/functions/function.3.xsl
new file mode 100644
index 0000000..fe1dc07
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.3.xsl
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+xmlns:func = "http://exslt.org/functions" extension-element-prefixes="func">
+
+<!-- Test an EXSLT function with arguments -->
+
+<func:function name="func:initial">
+ <xsl:param name="size"/>
+ <func:result select="substring(.,1,$size)"/>
+</func:function>
+
+ <xsl:template match="text()">
+ <xsl:value-of select="func:initial(3)"/>
+ </xsl:template>
+
+ <xsl:template match="*">
+ <xsl:copy>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/libxslt/tests/exslt/functions/function.4.out b/libxslt/tests/exslt/functions/function.4.out
new file mode 100644
index 0000000..b8458bb
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.4.out
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<out>120</out>
diff --git a/libxslt/tests/exslt/functions/function.4.xml b/libxslt/tests/exslt/functions/function.4.xml
new file mode 100644
index 0000000..69658c0
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.4.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+
+<doc>
+ <section index="section1" index2="atr2val">
+ <section index="subSection1.1">
+ <p>Hello</p>
+ <p>Its me again.</p>
+ </section>
+ </section>
+ <section index="section2">
+ <p>Jam</p>
+ <section index="subSection2.1">
+ <p>Marmalade</p>
+ <p>And Honey</p>
+ </section>
+ <section index="subSection2.2">
+ <p>With peanut butter</p>
+ <p>On toast</p>
+ </section>
+ <p>Delicious!</p>
+ <section index="subSection2.3">
+ <p>Full up now?</p>
+ <p>You bet.</p>
+ </section>
+ </section>
+</doc>
diff --git a/libxslt/tests/exslt/functions/function.4.xsl b/libxslt/tests/exslt/functions/function.4.xsl
new file mode 100644
index 0000000..59a084f
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.4.xsl
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+xmlns:func = "http://exslt.org/functions" extension-element-prefixes="func">
+
+<!-- Test a recursive EXSLT function -->
+
+<func:function name="func:factorial">
+ <xsl:param name="n"/>
+ <xsl:choose>
+ <xsl:when test="$n=1"><func:result select="1"/></xsl:when>
+ <xsl:otherwise><func:result select="$n * func:factorial($n - 1)"/></xsl:otherwise>
+ </xsl:choose>
+</func:function>
+
+ <xsl:template match="/">
+ <out><xsl:value-of select="func:factorial(5)"/></out>
+ </xsl:template>
+
+
+</xsl:stylesheet>
diff --git a/libxslt/tests/exslt/functions/function.5.out b/libxslt/tests/exslt/functions/function.5.out
new file mode 100644
index 0000000..c365eb2
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.5.out
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<out>15</out>
diff --git a/libxslt/tests/exslt/functions/function.5.xml b/libxslt/tests/exslt/functions/function.5.xml
new file mode 100644
index 0000000..69658c0
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.5.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+
+<doc>
+ <section index="section1" index2="atr2val">
+ <section index="subSection1.1">
+ <p>Hello</p>
+ <p>Its me again.</p>
+ </section>
+ </section>
+ <section index="section2">
+ <p>Jam</p>
+ <section index="subSection2.1">
+ <p>Marmalade</p>
+ <p>And Honey</p>
+ </section>
+ <section index="subSection2.2">
+ <p>With peanut butter</p>
+ <p>On toast</p>
+ </section>
+ <p>Delicious!</p>
+ <section index="subSection2.3">
+ <p>Full up now?</p>
+ <p>You bet.</p>
+ </section>
+ </section>
+</doc>
diff --git a/libxslt/tests/exslt/functions/function.5.xsl b/libxslt/tests/exslt/functions/function.5.xsl
new file mode 100644
index 0000000..1b57307
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.5.xsl
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+xmlns:func = "http://exslt.org/functions" extension-element-prefixes="func">
+
+<!-- Test an EXSLT function call with defaulted arguments -->
+
+<func:function name="func:total">
+ <xsl:param name="n1" select="0"/>
+ <xsl:param name="n2" select="0"/>
+ <xsl:param name="n3" select="0"/>
+ <xsl:param name="n4" select="0"/>
+ <xsl:param name="n5" select="0"/>
+ <xsl:param name="n6" select="0"/>
+ <xsl:param name="n7" select="0"/>
+ <func:result select="$n1+$n2+$n3+$n4+$n5+$n6+$n7"/>
+</func:function>
+
+ <xsl:template match="/">
+ <out><xsl:value-of select="func:total(1,2,3,4,5)"/></out>
+ </xsl:template>
+
+
+</xsl:stylesheet>
diff --git a/libxslt/tests/exslt/functions/function.6.out b/libxslt/tests/exslt/functions/function.6.out
new file mode 100644
index 0000000..b62aa20
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.6.out
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<out>;
+ <true>true</true>;
+ <false>false</false>;
+ <true>true</true>;
+ <false>false</false>;
+ <false>false</false>;
+ </out>
diff --git a/libxslt/tests/exslt/functions/function.6.xml b/libxslt/tests/exslt/functions/function.6.xml
new file mode 100644
index 0000000..69658c0
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.6.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+
+<doc>
+ <section index="section1" index2="atr2val">
+ <section index="subSection1.1">
+ <p>Hello</p>
+ <p>Its me again.</p>
+ </section>
+ </section>
+ <section index="section2">
+ <p>Jam</p>
+ <section index="subSection2.1">
+ <p>Marmalade</p>
+ <p>And Honey</p>
+ </section>
+ <section index="subSection2.2">
+ <p>With peanut butter</p>
+ <p>On toast</p>
+ </section>
+ <p>Delicious!</p>
+ <section index="subSection2.3">
+ <p>Full up now?</p>
+ <p>You bet.</p>
+ </section>
+ </section>
+</doc>
diff --git a/libxslt/tests/exslt/functions/function.6.xsl b/libxslt/tests/exslt/functions/function.6.xsl
new file mode 100644
index 0000000..75dde27
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.6.xsl
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+xmlns:func = "http://exslt.org/functions" extension-element-prefixes="func"
+xmlns:f = "f.uri" exclude-result-prefixes="f">
+
+<!-- Test the effect of function-available() and element-available() -->
+
+<func:function name="f:total">
+ <xsl:param name="n1" select="0"/>
+ <xsl:param name="n2" select="0"/>
+ <xsl:param name="n3" select="0"/>
+ <xsl:param name="n4" select="0"/>
+ <xsl:param name="n5" select="0"/>
+ <xsl:param name="n6" select="0"/>
+ <xsl:param name="n7" select="0"/>
+ <func:result select="$n1+$n2+$n3+$n4+$n5+$n6+$n7"/>
+</func:function>
+
+ <xsl:template match="/">
+ <out>;
+ <true><xsl:value-of select="function-available('f:total')"/></true>;
+ <false><xsl:value-of select="function-available('f:jabberwocky')"/></false>;
+ <true><xsl:value-of select="element-available('func:result')"/></true>;
+ <false><xsl:value-of select="element-available('func:function')"/></false>;
+ <!-- note, this should return false because func:function is not an INSTRUCTION -->
+ <false><xsl:value-of select="element-available('func:jeni-tennison')"/></false>;
+ </out>
+ </xsl:template>
+
+
+</xsl:stylesheet>
diff --git a/libxslt/tests/exslt/functions/function.7.out b/libxslt/tests/exslt/functions/function.7.out
new file mode 100644
index 0000000..b55429f
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.7.out
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<out xmlns:my="my://own.uri">17</out>
diff --git a/libxslt/tests/exslt/functions/function.7.xml b/libxslt/tests/exslt/functions/function.7.xml
new file mode 100644
index 0000000..bd4128d
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.7.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+
+<doc>
+ <section index="section1" index2="atr2val">
+ <section index="subSection1.1">
+ <p>Hello</p>
+ <p>Hello again.</p>
+ </section>
+ </section>
+ <section index="section2">
+ <p>Hello2</p>
+ <section index="subSection2.1">
+ <p>Hello</p>
+ <p>Hello again.</p>
+ </section>
+ <section index="subSection2.2">
+ <p>Hello</p>
+ <p>Hello again.</p>
+ </section>
+ <p>Hello2 again.</p>
+ <section index="subSection2.3">
+ <p>Hello</p>
+ <p>Hello again.</p>
+ </section>
+ </section>
+</doc>
diff --git a/libxslt/tests/exslt/functions/function.7.xsl b/libxslt/tests/exslt/functions/function.7.xsl
new file mode 100644
index 0000000..fa057e9
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.7.xsl
@@ -0,0 +1,13 @@
+<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+version="1.0" xmlns:my="my://own.uri">
+<xsl:import href="function.1.xsl"/>
+
+<xsl:template match="/">
+ <out>
+ <xsl:value-of select="my:count-elements()"/>
+ </out>
+</xsl:template>
+
+</xsl:stylesheet>
+
+
diff --git a/libxslt/tests/exslt/functions/function.8.out b/libxslt/tests/exslt/functions/function.8.out
new file mode 100644
index 0000000..745ace7
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.8.out
@@ -0,0 +1,2 @@
+typedef struct Pcmdb_TestHeadDatabase Pcmdb_TestHeadDatabase;
+
diff --git a/libxslt/tests/exslt/functions/function.8.xml b/libxslt/tests/exslt/functions/function.8.xml
new file mode 100644
index 0000000..8eee16d
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.8.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!--
+<!DOCTYPE adt SYSTEM "adt.dtd">
+-->
+
+<adt>
+
+ <prosa-name>Test Head Database</prosa-name>
+ <prefix>pcmdb</prefix>
+
+ <author>Max Mueller</author>
+ <date>August 16, 2002</date>
+
+ <brief>This adt holds relevant information regarding the test head
+ of the tester.</brief>
+ <detailed>
+ There is only one instance of the adt in the system, and you can
+ query the adt regarding parameters of the current installed test
+ head.
+ </detailed>
+
+</adt>
diff --git a/libxslt/tests/exslt/functions/function.8.xsl b/libxslt/tests/exslt/functions/function.8.xsl
new file mode 100644
index 0000000..5d46af1
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.8.xsl
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:func="http://exslt.org/functions"
+ extension-element-prefixes="func"
+>
+<xsl:output method="text" encoding="ISO-8859-1" omit-xml-declaration="yes" />
+
+<xsl:variable name="prefix" select="/adt/prefix" />
+<xsl:variable name="prosaName" select="/adt/prosa-name" />
+
+<xsl:variable name="suffix" select="'.h'" />
+
+<!-- makes all letters upper case -->
+<func:function name="func:upper">
+ <xsl:param name="in" />
+ <func:result select="translate($in,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
+</func:function>
+
+<!-- makes all letters lower case -->
+<func:function name="func:lower">
+ <xsl:param name="in" />
+ <func:result select="translate($in,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')" />
+</func:function>
+
+<!-- makes first letter (of every word) upper case -->
+<!-- converts first x to X and every _x to _X -->
+<!-- and every ' x' to 'X' (note the space) -->
+<func:function name="func:firstUpper">
+ <xsl:param name="in" />
+ <xsl:variable name="tmp" select="$in"/>
+ <xsl:choose>
+ <!-- Call first upper for each word -->
+ <xsl:when test="contains(substring($tmp,2),' ')">
+ <func:result select="concat(
+ func:firstUpper(substring-before($tmp,' ')),
+ func:firstUpper(substring-after(substring($tmp,2),' ')))" />
+ </xsl:when>
+ <!-- read over '_' -->
+ <xsl:when test="contains(substring($tmp,1,1),'_')">
+ <func:result select="concat('_',
+ func:firstUpper(substring($tmp,2)))" />
+ </xsl:when>
+ <!-- Make first character upper case and continue -->
+ <xsl:otherwise>
+ <func:result select="concat(func:upper(substring($tmp,1,1)),
+ substring($tmp,2))" />
+ </xsl:otherwise>
+ </xsl:choose>
+</func:function>
+
+<xsl:template match="adt">
+
+ <xsl:variable name="prosaNameLower" select="func:lower($prosaName)" />
+
+ <xsl:value-of select="concat( 'typedef struct ',
+ func:firstUpper($prefix), '_', func:firstUpper($prosaNameLower), ' ',
+ func:firstUpper($prefix), '_', func:firstUpper($prosaNameLower),
+ '; &#10;&#10;' )" />
+
+</xsl:template>
+
+<!-- finished -->
+</xsl:stylesheet>
diff --git a/libxslt/tests/exslt/functions/function.9.out b/libxslt/tests/exslt/functions/function.9.out
new file mode 100644
index 0000000..1224d96
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.9.out
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+
+
+ a
+
+
diff --git a/libxslt/tests/exslt/functions/function.9.xml b/libxslt/tests/exslt/functions/function.9.xml
new file mode 100644
index 0000000..6a3c717
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.9.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root>
+ <table>
+ <tr>
+ <td align="center">a</td>
+ </tr>
+ </table>
+</root>
+
diff --git a/libxslt/tests/exslt/functions/function.9.xsl b/libxslt/tests/exslt/functions/function.9.xsl
new file mode 100644
index 0000000..f609280
--- /dev/null
+++ b/libxslt/tests/exslt/functions/function.9.xsl
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:exsl="http://exslt.org/common"
+ xmlns:func="http://exslt.org/functions"
+ xmlns:math="http://exslt.org/math"
+ xmlns:mg="mg"
+ extension-element-prefixes="exsl func">
+
+ <xsl:template match="table">
+ <xsl:variable name="cols" select="mg:function(., .)"/>
+ <xsl:value-of select="$cols"/>
+ </xsl:template>
+
+ <func:function name="mg:function">
+ <xsl:param name="table"/>
+ <xsl:param name="t2" select="$table/tr[1]"/>
+ <xsl:param name="tr" select="$table/tr[1]"/>
+ <xsl:param name="trd" select="$tr/td[1]"/>
+ <func:result select="$tr"/>
+ </func:function>
+</xsl:stylesheet>
+
+