summaryrefslogtreecommitdiffstats
path: root/libxslt/tests/extensions
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2016-10-19 18:25:21 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2016-10-19 18:25:21 (GMT)
commitd72feaf69933b069cff3c0cb20a5f5f03ecba77b (patch)
treebf51d2814f4be65c850dba86dc2a5db0ad38bedf /libxslt/tests/extensions
parent34be72f9ed749a5c013d3f7f47d810e8caf652cb (diff)
parent49e8fbec2420ef55b3246aabd89328b13530810c (diff)
downloadblt-d72feaf69933b069cff3c0cb20a5f5f03ecba77b.zip
blt-d72feaf69933b069cff3c0cb20a5f5f03ecba77b.tar.gz
blt-d72feaf69933b069cff3c0cb20a5f5f03ecba77b.tar.bz2
Merge commit '49e8fbec2420ef55b3246aabd89328b13530810c' as 'libxslt'
Diffstat (limited to 'libxslt/tests/extensions')
-rw-r--r--libxslt/tests/extensions/Makefile.am51
-rw-r--r--libxslt/tests/extensions/evaluate.out2
-rw-r--r--libxslt/tests/extensions/evaluate.xml11
-rw-r--r--libxslt/tests/extensions/evaluate.xsl26
-rw-r--r--libxslt/tests/extensions/list.out40
-rw-r--r--libxslt/tests/extensions/list.xml1
-rw-r--r--libxslt/tests/extensions/list.xsl88
-rw-r--r--libxslt/tests/extensions/module.out3
-rw-r--r--libxslt/tests/extensions/module.xml1
-rw-r--r--libxslt/tests/extensions/module.xsl12
10 files changed, 235 insertions, 0 deletions
diff --git a/libxslt/tests/extensions/Makefile.am b/libxslt/tests/extensions/Makefile.am
new file mode 100644
index 0000000..06ac236
--- /dev/null
+++ b/libxslt/tests/extensions/Makefile.am
@@ -0,0 +1,51 @@
+## Process this file with automake to produce Makefile.in
+
+$(top_builddir)/xsltproc/xsltproc:
+ @(cd ../../xsltproc ; $(MAKE) xsltproc)
+
+EXTRA_DIST = \
+ evaluate.xml evaluate.xsl evaluate.out \
+ module.xml module.xsl module.out \
+ list.xml list.xsl list.out
+
+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 extensions tests'
+ @(echo > .memdump)
+ -@(for i in $(srcdir)/*.xml ; do \
+ if [ -d $$i ] ; then continue ; fi ; \
+ doc=`basename $$i .xml` ; \
+ j=$(srcdir)/$$doc*.xsl ; \
+ if [ ! -f $$j ] ; then continue ; fi ; \
+ if [ -d $$j ] ; then continue ; fi ; \
+ name=`basename $$j .xsl`; \
+ out=$(srcdir)/"$$name".out; \
+ err=$(srcdir)/"$$name".err; \
+ log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc $$j $$i \
+ > result.$$name 2>err.$$name; \
+ if [ ! -f $$out ] ; then \
+ cp result.$$name $$out ; \
+ if [ -s err.$$name ] ; then \
+ cp err.$$name $$err ; \
+ fi ; \
+ else \
+ diff $$out result.$$name; \
+ if [ -s $$err ] ; then \
+ diff $$err err.$$name; \
+ else \
+ diff /dev/null err.$$name; \
+ fi ; \
+ fi ; \
+ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true`;\
+ if [ -n "$$log" ] ; then \
+ echo $$name result ; \
+ echo "$$log" ; \
+ fi ; \
+ rm -f result.$$name err.$$name; \
+ done)
+
diff --git a/libxslt/tests/extensions/evaluate.out b/libxslt/tests/extensions/evaluate.out
new file mode 100644
index 0000000..b4e4c7c
--- /dev/null
+++ b/libxslt/tests/extensions/evaluate.out
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+one4onetwofour-onefour-two
diff --git a/libxslt/tests/extensions/evaluate.xml b/libxslt/tests/extensions/evaluate.xml
new file mode 100644
index 0000000..bddd528
--- /dev/null
+++ b/libxslt/tests/extensions/evaluate.xml
@@ -0,0 +1,11 @@
+<doc>
+ <one>one</one>
+ <two>two</two>
+ <three>/doc/one</three>
+ <four>
+ <doc>
+ <one>four-one</one>
+ <two>four-two</two>
+ </doc>
+ </four>
+</doc> \ No newline at end of file
diff --git a/libxslt/tests/extensions/evaluate.xsl b/libxslt/tests/extensions/evaluate.xsl
new file mode 100644
index 0000000..c44bfc8
--- /dev/null
+++ b/libxslt/tests/extensions/evaluate.xsl
@@ -0,0 +1,26 @@
+<?xml version='1.0'?>
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:saxon="http://icl.com/saxon"
+ version='1.0'>
+
+<xsl:variable name="expression" select="saxon:expression('doc/two')"/>
+
+ <xsl:template match="/">
+ <xsl:variable name="string">doc/one</xsl:variable>
+ <xsl:value-of select="saxon:evaluate($string)"/>
+ <xsl:value-of select="count(saxon:evaluate('/doc/one')/../*)"/>
+ <xsl:value-of select="saxon:evaluate(/doc/three)"/>
+ <xsl:value-of select="saxon:eval($expression)"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="four">
+ <xsl:variable name="string">doc/one</xsl:variable>
+ <xsl:value-of select="saxon:evaluate($string)"/>
+ <xsl:value-of select="saxon:eval($expression)"/>
+ </xsl:template>
+
+ <xsl:template match="text()"/>
+
+</xsl:stylesheet>
diff --git a/libxslt/tests/extensions/list.out b/libxslt/tests/extensions/list.out
new file mode 100644
index 0000000..e2d9ce1
--- /dev/null
+++ b/libxslt/tests/extensions/list.out
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+ === 24 Standard elements:
+xsl:apply-templates available
+xsl:apply-imports available
+xsl:call-template available
+xsl:element available
+xsl:attribute available
+xsl:text available
+xsl:processing-instruction available
+xsl:comment available
+xsl:copy available
+xsl:value-of available
+xsl:number available
+xsl:for-each available
+xsl:if available
+xsl:choose available
+xsl:sort available
+xsl:copy-of available
+xsl:message available
+xsl:variable available
+xsl:param available
+xsl:with-param available
+xsl:decimal-format available
+xsl:when available
+xsl:otherwise available
+xsl:fallback available
+ === 5 Extension elements:
+xsl:element available
+saxon:output available
+xalanredirect:write available
+xt:document available
+libxslt:debug available
+ === 6 Extension functions:
+libxslt:node-set() available
+saxon:node-set() available
+xt:node-set() available
+saxon:evaluate() available
+saxon:expression() available
+saxon:eval() available
+
diff --git a/libxslt/tests/extensions/list.xml b/libxslt/tests/extensions/list.xml
new file mode 100644
index 0000000..ff29a91
--- /dev/null
+++ b/libxslt/tests/extensions/list.xml
@@ -0,0 +1 @@
+<doc/> \ No newline at end of file
diff --git a/libxslt/tests/extensions/list.xsl b/libxslt/tests/extensions/list.xsl
new file mode 100644
index 0000000..0523342
--- /dev/null
+++ b/libxslt/tests/extensions/list.xsl
@@ -0,0 +1,88 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:saxon="http://icl.com/saxon"
+ xmlns:xalanredirect="org.apache.xalan.xslt.extensions.Redirect"
+ xmlns:xt="http://www.jclark.com/xt"
+ xmlns:libxslt="http://xmlsoft.org/XSLT/namespace"
+ version='1.0'>
+
+<xsl:template match="/">
+<xsl:text> === 24 Standard elements:
+</xsl:text>
+<xsl:if test="element-available('xsl:apply-templates')">xsl:apply-templates available
+</xsl:if>
+<xsl:if test="element-available('xsl:apply-imports')">xsl:apply-imports available
+</xsl:if>
+<xsl:if test="element-available('xsl:call-template')">xsl:call-template available
+</xsl:if>
+<xsl:if test="element-available('xsl:element')">xsl:element available
+</xsl:if>
+<xsl:if test="element-available('xsl:attribute')">xsl:attribute available
+</xsl:if>
+<xsl:if test="element-available('xsl:text')">xsl:text available
+</xsl:if>
+<xsl:if test="element-available('xsl:processing-instruction')">xsl:processing-instruction available
+</xsl:if>
+<xsl:if test="element-available('xsl:comment')">xsl:comment available
+</xsl:if>
+<xsl:if test="element-available('xsl:copy')">xsl:copy available
+</xsl:if>
+<xsl:if test="element-available('xsl:value-of')">xsl:value-of available
+</xsl:if>
+<xsl:if test="element-available('xsl:number')">xsl:number available
+</xsl:if>
+<xsl:if test="element-available('xsl:for-each')">xsl:for-each available
+</xsl:if>
+<xsl:if test="element-available('xsl:if')">xsl:if available
+</xsl:if>
+<xsl:if test="element-available('xsl:choose')">xsl:choose available
+</xsl:if>
+<xsl:if test="element-available('xsl:sort')">xsl:sort available
+</xsl:if>
+<xsl:if test="element-available('xsl:copy-of')">xsl:copy-of available
+</xsl:if>
+<xsl:if test="element-available('xsl:message')">xsl:message available
+</xsl:if>
+<xsl:if test="element-available('xsl:variable')">xsl:variable available
+</xsl:if>
+<xsl:if test="element-available('xsl:param')">xsl:param available
+</xsl:if>
+<xsl:if test="element-available('xsl:with-param')">xsl:with-param available
+</xsl:if>
+<xsl:if test="element-available('xsl:decimal-format')">xsl:decimal-format available
+</xsl:if>
+<xsl:if test="element-available('xsl:when')">xsl:when available
+</xsl:if>
+<xsl:if test="element-available('xsl:otherwise')">xsl:otherwise available
+</xsl:if>
+<xsl:if test="element-available('xsl:fallback')">xsl:fallback available
+</xsl:if>
+<xsl:text> === 5 Extension elements:
+</xsl:text>
+<xsl:if test="element-available('xsl:element')">xsl:element available
+</xsl:if>
+<xsl:if test="element-available('saxon:output')">saxon:output available
+</xsl:if>
+<xsl:if test="element-available('xalanredirect:write')">xalanredirect:write available
+</xsl:if>
+<xsl:if test="element-available('xt:document')">xt:document available
+</xsl:if>
+<xsl:if test="element-available('libxslt:debug')">libxslt:debug available
+</xsl:if>
+<xsl:text> === 6 Extension functions:
+</xsl:text>
+<xsl:if test="function-available('libxslt:node-set')">libxslt:node-set() available
+</xsl:if>
+<xsl:if test="function-available('saxon:node-set')">saxon:node-set() available
+</xsl:if>
+<xsl:if test="function-available('xt:node-set')">xt:node-set() available
+</xsl:if>
+<xsl:if test="function-available('saxon:evaluate')">saxon:evaluate() available
+</xsl:if>
+<xsl:if test="function-available('saxon:expression')">saxon:expression() available
+</xsl:if>
+<xsl:if test="function-available('saxon:eval')">saxon:eval() available
+</xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/libxslt/tests/extensions/module.out b/libxslt/tests/extensions/module.out
new file mode 100644
index 0000000..fa2cdd7
--- /dev/null
+++ b/libxslt/tests/extensions/module.out
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<!--libxslt:test element test worked-->
+SUCCESS
diff --git a/libxslt/tests/extensions/module.xml b/libxslt/tests/extensions/module.xml
new file mode 100644
index 0000000..69d62f2
--- /dev/null
+++ b/libxslt/tests/extensions/module.xml
@@ -0,0 +1 @@
+<doc/>
diff --git a/libxslt/tests/extensions/module.xsl b/libxslt/tests/extensions/module.xsl
new file mode 100644
index 0000000..4ada278
--- /dev/null
+++ b/libxslt/tests/extensions/module.xsl
@@ -0,0 +1,12 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:libxslt="http://xmlsoft.org/XSLT/"
+ xmlns:test="http://xmlsoft.org/XSLT/"
+ extension-element-prefixes="libxslt test"
+ version='1.0'>
+<!-- the prefix is registered twice to check single initialization -->
+<xsl:template match="/">
+<libxslt:test/>
+<xsl:value-of select="libxslt:test('SUCCESS')"/>
+</xsl:template>
+</xsl:stylesheet>