Skip to content
Snippets Groups Projects
Commit f84cb05c2100 authored by Daniel Veillard's avatar Daniel Veillard
Browse files

Added more test stuff and tested xsl:choose:

- FEATURES: updated choose/when/otherwise added
- libxslt/transform.c: plugged choose in
- configure.in tests/Makefile.am tests/REC/Makefile.am
  tests/docs/Makefile.am tests/docs/items.xml tests/general/Makefile.am
  tests/general/itemschoose.*: started adding a more generic
  infrastructure for testing.
Daniel
parent 438b4613dae3
No related branches found
No related tags found
No related merge requests found
Thu Feb 1 14:54:39 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* FEATURES: updated choose/when/otherwise added
* libxslt/transform.c: plugged choose in
* configure.in tests/Makefile.am tests/REC/Makefile.am
tests/docs/Makefile.am tests/docs/items.xml tests/general/Makefile.am
tests/general/itemschoose.*: started adding a more generic
infrastructure for testing.
Thu Feb 1 05:36:28 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr> Thu Feb 1 05:36:28 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* tests/REC/test-11*: added more tests * tests/REC/test-11*: added more tests
......
...@@ -133,5 +133,5 @@ ...@@ -133,5 +133,5 @@
YES xsl:if YES xsl:if
YES test = boolean-expression YES test = boolean-expression
NO xsl:choose YES xsl:choose
...@@ -137,4 +137,4 @@ ...@@ -137,4 +137,4 @@
NO xsl:when YES xsl:when
NO test = boolean-expression YES test = boolean-expression
...@@ -140,5 +140,5 @@ ...@@ -140,5 +140,5 @@
NO xsl:otherwise YES xsl:otherwise
YES xsl:sort YES xsl:sort
YES select = string-expression YES select = string-expression
......
...@@ -144,6 +144,7 @@ ...@@ -144,6 +144,7 @@
libxslt/Makefile libxslt/Makefile
libxslt/xsltconfig.h libxslt/xsltconfig.h
tests/Makefile tests/Makefile
tests/docs/Makefile
tests/REC1/Makefile tests/REC1/Makefile
tests/REC2/Makefile tests/REC2/Makefile
tests/REC/Makefile tests/REC/Makefile
...@@ -147,6 +148,7 @@ ...@@ -147,6 +148,7 @@
tests/REC1/Makefile tests/REC1/Makefile
tests/REC2/Makefile tests/REC2/Makefile
tests/REC/Makefile tests/REC/Makefile
tests/general/Makefile
tests/numbers/Makefile tests/numbers/Makefile
doc/Makefile doc/Makefile
xslt-config xslt-config
......
...@@ -224,6 +224,7 @@ ...@@ -224,6 +224,7 @@
void xsltForEach(xsltTransformContextPtr ctxt, xmlNodePtr node, void xsltForEach(xsltTransformContextPtr ctxt, xmlNodePtr node,
xmlNodePtr inst); xmlNodePtr inst);
void xsltIf(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst); void xsltIf(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst);
void xsltChoose(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst);
/** /**
* xsltSort: * xsltSort:
...@@ -1184,6 +1185,10 @@ ...@@ -1184,6 +1185,10 @@
ctxt->insert = insert; ctxt->insert = insert;
xsltIf(ctxt, node, cur); xsltIf(ctxt, node, cur);
ctxt->insert = oldInsert; ctxt->insert = oldInsert;
} else if (IS_XSLT_NAME(cur, "choose")) {
ctxt->insert = insert;
xsltChoose(ctxt, node, cur);
ctxt->insert = oldInsert;
} else if (IS_XSLT_NAME(cur, "for-each")) { } else if (IS_XSLT_NAME(cur, "for-each")) {
ctxt->insert = insert; ctxt->insert = insert;
xsltForEach(ctxt, node, cur); xsltForEach(ctxt, node, cur);
......
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
SUBDIRS=REC1 REC2 REC numbers SUBDIRS=docs REC1 REC2 REC general numbers
test tests: all test tests: all
...@@ -3,7 +3,35 @@ ...@@ -3,7 +3,35 @@
$(top_builddir)/libxslt/xsltproc: $(top_builddir)/libxslt/xsltproc:
@(cd ../../libxslt ; make xsltproc) @(cd ../../libxslt ; make xsltproc)
EXTRA_DIST = doc.xsl doc.xml result.xml EXTRA_DIST = \
test-10-1.out test-10-1.xml test-10-1.xsl \
test-11.2-1.out test-11.2-1.xml test-11.2-1.xsl \
test-11.2-2.out test-11.2-2.xml test-11.2-2.xsl \
test-11.2-3.out test-11.2-3.xml test-11.2-3.xsl \
test-11.2-4.out test-11.2-4.xml test-11.2-4.xsl \
test-11.2-5.out test-11.2-5.xml test-11.2-5.xsl \
test-11.2-6.out test-11.2-6.xml test-11.2-6.xsl \
test-5.3.out test-5.3.xml test-5.3.xsl \
test-5.4-1.out test-5.4-1.xml test-5.4-1.xsl \
test-5.4-2.out test-5.4-2.xml test-5.4-2.xsl \
test-5.4-3.out test-5.4-3.xml test-5.4-3.xsl \
test-5.4-4.out test-5.4-4.xml test-5.4-4.xsl \
test-5.4-5.out test-5.4-5.xml test-5.4-5.xsl \
test-5.8.out test-5.8.xml test-5.8.xsl \
test-6.out test-6.xml test-6.xsl \
test-7.1.1.out test-7.1.1.xml test-7.1.1.xsl \
test-7.1.3.out test-7.1.3.xml test-7.1.3.xsl \
test-7.1.4.out test-7.1.4.xml test-7.1.4.xsl \
test-7.3.out test-7.3.xml test-7.3.xsl \
test-7.4.out test-7.4.xml test-7.4.xsl \
test-7.5-1.out test-7.5-1.xml test-7.5-1.xsl \
test-7.6.1-1.out test-7.6.1-1.xml test-7.6.1-1.xsl \
test-7.6.1-2.out test-7.6.1-2.xml test-7.6.1-2.xsl \
test-7.6.1-3.out test-7.6.1-3.xml test-7.6.1-3.xsl \
test-7.6.2-1.out test-7.6.2-1.xml test-7.6.2-1.xsl \
test-8-1.out test-8-1.xml test-8-1.xsl \
test-9.1-1.out test-9.1-1.xml test-9.1-1.xsl \
test-9.1-2.out test-9.1-2.xml test-9.1-2.xsl
all: test all: test
......
## Process this file with automake to produce Makefile.in
#
# Contains only test documents
#
EXTRA_DIST = \
items.xml
<doc>
<orderedlist>
<listitem>listitem1</listitem>
<listitem>listitem2</listitem>
<listitem>listitem3</listitem>
<listitem>listitem4</listitem>
<listitem>listitem5</listitem>
<listitem>listitem6</listitem>
<listitem>
<orderedlist>
<listitem>
<orderedlist>
<listitem>
</listitem>
<listitem>listitem7.1.2</listitem>
<listitem>listitem7.1.3</listitem>
<listitem>listitem7.1.4</listitem>
<listitem>listitem7.1.5</listitem>
<listitem>listitem7.1.6</listitem>
<listitem>
</listitem>
</orderedlist>
</listitem>
<listitem>listitem7.2</listitem>
<listitem>listitem7.3</listitem>
<listitem>listitem7.4</listitem>
<listitem>listitem7.5</listitem>
<listitem>listitem7.6</listitem>
<listitem>
</listitem>
</orderedlist>
</listitem>
</orderedlist>
</doc>
## Process this file with automake to produce Makefile.in
$(top_builddir)/libxslt/xsltproc:
@(cd ../../libxslt ; make xsltproc)
EXTRA_DIST = \
itemschoose.out itemschoose.xsl
all: test
test tests: $(top_builddir)/libxslt/xsltproc
@(rm -f .memdump ; touch .memdump)
@(for i in $(srcdir)/../docs/*.xml ; do \
if [ -d $$i ] ; then continue ; fi ; \
doc=`basename $$i .xml` ; \
for j in $(srcdir)/$$doc*.xsl ; do \
if [ ! -f $$j ] ; then continue ; fi ; \
if [ -d $$j ] ; then continue ; fi ; \
name=`basename $$j .xsl`; \
out=$(srcdir)/"$$name".out; \
echo Running $$j on $$i ; \
$(top_builddir)/libxslt/xsltproc $$j $$i > result.$$name;\
if [ ! -f $$out ] ; then cp result.$$name $$out ; \
else diff $$out result.$$name ; fi ; \
grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\
rm -f result.$$name ; \
done ; done)
<?xml version="1.0"?>
<doc>
<fo:list-item xmlns:fo="http://www.w3.org/1999/XSL/Format" indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem1</fo:list-item-body></fo:list-item>
<fo:list-item xmlns:fo="http://www.w3.org/1999/XSL/Format" indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem2</fo:list-item-body></fo:list-item>
<fo:list-item xmlns:fo="http://www.w3.org/1999/XSL/Format" indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem3</fo:list-item-body></fo:list-item>
<fo:list-item xmlns:fo="http://www.w3.org/1999/XSL/Format" indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem4</fo:list-item-body></fo:list-item>
<fo:list-item xmlns:fo="http://www.w3.org/1999/XSL/Format" indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem5</fo:list-item-body></fo:list-item>
<fo:list-item xmlns:fo="http://www.w3.org/1999/XSL/Format" indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>listitem6</fo:list-item-body></fo:list-item>
<fo:list-item xmlns:fo="http://www.w3.org/1999/XSL/Format" indent-start="2pi"><fo:list-item-label><number format="i"/>. </fo:list-item-label><fo:list-item-body>
<fo:list-item indent-start="2pi"><fo:list-item-label><number format="a"/>. </fo:list-item-label><fo:list-item-body>
<fo:list-item indent-start="2pi"><fo:list-item-label><number format="1"/>. </fo:list-item-label><fo:list-item-body>
</fo:list-item-body></fo:list-item>
<fo:list-item indent-start="2pi"><fo:list-item-label><number format="1"/>. </fo:list-item-label><fo:list-item-body>listitem7.1.2</fo:list-item-body></fo:list-item>
<fo:list-item indent-start="2pi"><fo:list-item-label><number format="1"/>. </fo:list-item-label><fo:list-item-body>listitem7.1.3</fo:list-item-body></fo:list-item>
<fo:list-item indent-start="2pi"><fo:list-item-label><number format="1"/>. </fo:list-item-label><fo:list-item-body>listitem7.1.4</fo:list-item-body></fo:list-item>
<fo:list-item indent-start="2pi"><fo:list-item-label><number format="1"/>. </fo:list-item-label><fo:list-item-body>listitem7.1.5</fo:list-item-body></fo:list-item>
<fo:list-item indent-start="2pi"><fo:list-item-label><number format="1"/>. </fo:list-item-label><fo:list-item-body>listitem7.1.6</fo:list-item-body></fo:list-item>
<fo:list-item indent-start="2pi"><fo:list-item-label><number format="1"/>. </fo:list-item-label><fo:list-item-body>
</fo:list-item-body></fo:list-item>
</fo:list-item-body></fo:list-item>
<fo:list-item indent-start="2pi"><fo:list-item-label><number format="a"/>. </fo:list-item-label><fo:list-item-body>listitem7.2</fo:list-item-body></fo:list-item>
<fo:list-item indent-start="2pi"><fo:list-item-label><number format="a"/>. </fo:list-item-label><fo:list-item-body>listitem7.3</fo:list-item-body></fo:list-item>
<fo:list-item indent-start="2pi"><fo:list-item-label><number format="a"/>. </fo:list-item-label><fo:list-item-body>listitem7.4</fo:list-item-body></fo:list-item>
<fo:list-item indent-start="2pi"><fo:list-item-label><number format="a"/>. </fo:list-item-label><fo:list-item-body>listitem7.5</fo:list-item-body></fo:list-item>
<fo:list-item indent-start="2pi"><fo:list-item-label><number format="a"/>. </fo:list-item-label><fo:list-item-body>listitem7.6</fo:list-item-body></fo:list-item>
<fo:list-item indent-start="2pi"><fo:list-item-label><number format="a"/>. </fo:list-item-label><fo:list-item-body>
</fo:list-item-body></fo:list-item>
</fo:list-item-body></fo:list-item>
</doc>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:strip-space elements="itemlist"/>
<xsl:template match="doc">
<doc>
<xsl:apply-templates/>
</doc>
</xsl:template>
<xsl:template match="orderedlist/listitem">
<fo:list-item indent-start='2pi'>
<fo:list-item-label>
<xsl:variable name="level"
select="count(ancestor::orderedlist) mod 3"/>
<xsl:choose>
<xsl:when test='$level=1'>
<number format="i"/>
</xsl:when>
<xsl:when test='$level=2'>
<number format="a"/>
</xsl:when>
<xsl:otherwise>
<number format="1"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>. </xsl:text>
</fo:list-item-label>
<fo:list-item-body>
<xsl:apply-templates/>
</fo:list-item-body>
</fo:list-item>
</xsl:template>
</xsl:stylesheet>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment