From 49e8fbec2420ef55b3246aabd89328b13530810c Mon Sep 17 00:00:00 2001 From: William Joye Date: Wed, 19 Oct 2016 14:25:21 -0400 Subject: Squashed 'libxslt/' content from commit 6abe4b3 git-subtree-dir: libxslt git-subtree-split: 6abe4b35a2ded60fcadfec79ebe984f1289fbd0d --- .gitignore | 152 + AUTHORS | 63 + ChangeLog | 7683 ++++++ Copyright | 53 + FEATURES | 244 + HACKING | 22 + INSTALL | 49 + MAINTAINERS | 9 + Makefile.am | 77 + NEWS | 1072 + NOTES | 253 + README | 24 + README.cvs-commits | 5 + TODO | 124 + autogen.sh | 83 + config.h.in | 225 + configure.in | 732 + doc/API.html | 27 + doc/APIchunk0.html | 251 + doc/APIchunk1.html | 276 + doc/APIchunk10.html | 468 + doc/APIchunk11.html | 262 + doc/APIchunk12.html | 337 + doc/APIchunk13.html | 47 + doc/APIchunk2.html | 359 + doc/APIchunk3.html | 387 + doc/APIchunk4.html | 342 + doc/APIchunk5.html | 250 + doc/APIchunk6.html | 254 + doc/APIchunk7.html | 255 + doc/APIchunk8.html | 262 + doc/APIchunk9.html | 275 + doc/APIconstructors.html | 89 + doc/APIfiles.html | 581 + doc/APIfunctions.html | 511 + doc/APIsymbols.html | 581 + doc/ChangeLog.xsl | 113 + doc/EXSLT/APIchunk0.html | 132 + doc/EXSLT/APIconstructors.html | 10 + doc/EXSLT/APIfiles.html | 42 + doc/EXSLT/APIfunctions.html | 18 + doc/EXSLT/APIsymbols.html | 42 + doc/EXSLT/bugs.html | 62 + doc/EXSLT/docs.html | 18 + doc/EXSLT/downloads.html | 29 + doc/EXSLT/exslt.html | 214 + doc/EXSLT/help.html | 24 + doc/EXSLT/html/book1.html | 10 + doc/EXSLT/html/home.png | Bin 0 -> 654 bytes doc/EXSLT/html/index.html | 10 + doc/EXSLT/html/left.png | Bin 0 -> 459 bytes doc/EXSLT/html/libexslt-exslt.html | 62 + doc/EXSLT/html/libexslt-exsltexports.html | 16 + doc/EXSLT/html/libexslt-lib.html | 10 + doc/EXSLT/html/right.png | Bin 0 -> 472 bytes doc/EXSLT/html/up.png | Bin 0 -> 406 bytes doc/EXSLT/index.html | 16 + doc/EXSLT/intro.html | 22 + doc/EXSLT/libexslt-api.xml | 148 + doc/EXSLT/libexslt-refs.xml | 360 + doc/FAQ.html | 44 + doc/Libxslt-Logo-180x168.gif | Bin 0 -> 8193 bytes doc/Libxslt-Logo-90x34.gif | Bin 0 -> 3035 bytes doc/Makefile.am | 328 + doc/api.xsl | 201 + doc/apibuild.py | 1914 ++ doc/bugs.html | 96 + doc/checkapisym.xsl | 48 + doc/contexts.fig | 175 + doc/contexts.gif | Bin 0 -> 10326 bytes doc/contribs.html | 42 + doc/docbook.html | 65 + doc/docs.html | 20 + doc/downloads.html | 31 + doc/duck.png | Bin 0 -> 10795 bytes doc/epatents.png | Bin 0 -> 1901 bytes doc/extensions.html | 287 + doc/gnome2.png | Bin 0 -> 3802 bytes doc/help.html | 26 + doc/html/book1.html | 10 + doc/html/home.png | Bin 0 -> 654 bytes doc/html/index.html | 10 + doc/html/left.png | Bin 0 -> 459 bytes doc/html/libxslt-attributes.html | 23 + doc/html/libxslt-documents.html | 47 + doc/html/libxslt-extensions.html | 152 + doc/html/libxslt-extra.html | 28 + doc/html/libxslt-functions.html | 42 + doc/html/libxslt-imports.html | 31 + doc/html/libxslt-keys.html | 27 + doc/html/libxslt-lib.html | 10 + doc/html/libxslt-namespaces.html | 33 + doc/html/libxslt-numbersInternals.html | 39 + doc/html/libxslt-pattern.html | 43 + doc/html/libxslt-preproc.html | 20 + doc/html/libxslt-security.html | 63 + doc/html/libxslt-templates.html | 44 + doc/html/libxslt-transform.html | 113 + doc/html/libxslt-variables.html | 54 + doc/html/libxslt-xslt.html | 22 + doc/html/libxslt-xsltInternals.html | 754 + doc/html/libxslt-xsltexports.html | 16 + doc/html/libxslt-xsltlocale.html | 29 + doc/html/libxslt-xsltutils.html | 182 + doc/html/right.png | Bin 0 -> 472 bytes doc/html/up.png | Bin 0 -> 406 bytes doc/images/callouts/1.png | Bin 0 -> 329 bytes doc/images/callouts/10.png | Bin 0 -> 361 bytes doc/images/callouts/2.png | Bin 0 -> 353 bytes doc/images/callouts/3.png | Bin 0 -> 350 bytes doc/images/callouts/4.png | Bin 0 -> 345 bytes doc/images/callouts/5.png | Bin 0 -> 348 bytes doc/images/callouts/6.png | Bin 0 -> 355 bytes doc/images/callouts/7.png | Bin 0 -> 344 bytes doc/images/callouts/8.png | Bin 0 -> 357 bytes doc/images/callouts/9.png | Bin 0 -> 357 bytes doc/index.html | 26 + doc/index.py | 1248 + doc/internals.html | 312 + doc/intro.html | 24 + doc/libxslt-api.xml | 3201 +++ doc/libxslt-decl.txt | 1449 ++ doc/libxslt-refs.xml | 8634 +++++++ doc/libxslt.xml | 92 + doc/libxslt.xsa | 37 + doc/newapi.xsl | 700 + doc/news.html | 923 + doc/news.xsl | 44 + doc/node.fig | 91 + doc/node.gif | Bin 0 -> 4928 bytes doc/object.fig | 90 + doc/object.gif | Bin 0 -> 4575 bytes doc/processing.fig | 137 + doc/processing.gif | Bin 0 -> 9209 bytes doc/python.html | 173 + doc/redhat.gif | Bin 0 -> 697 bytes doc/search.php | 346 + doc/search.php.inc | 333 + doc/search.templ | 11 + doc/search.xml | 48 + doc/site.xsl | 464 + doc/smallfootonly.gif | Bin 0 -> 2772 bytes doc/stylesheet.fig | 104 + doc/stylesheet.gif | Bin 0 -> 7050 bytes doc/symbols.xml | 317 + doc/syms.xsl | 99 + doc/templates.fig | 138 + doc/templates.gif | Bin 0 -> 8995 bytes doc/tutorial/libxslt_tutorial.c | 84 + doc/tutorial/libxslttutorial.html | 425 + doc/tutorial/libxslttutorial.xml | 288 + doc/tutorial2/libxslt_pipes.c | 127 + doc/tutorial2/libxslt_pipes.html | 612 + doc/tutorial2/libxslt_pipes.xml | 661 + doc/w3c.png | Bin 0 -> 2028 bytes doc/xsa.xsl | 54 + doc/xslt.html | 2771 ++ doc/xsltproc.1 | 361 + doc/xsltproc.html | 101 + doc/xsltproc.xml | 573 + doc/xsltproc2.html | 35 + examples/xsltICUSort.c | 304 + libexslt.pc.in | 12 + libexslt/Makefile.am | 35 + libexslt/common.c | 137 + libexslt/crypto.c | 806 + libexslt/date.c | 3911 +++ libexslt/dynamic.c | 304 + libexslt/exslt.c | 40 + libexslt/exslt.h | 102 + libexslt/exsltconfig.h.in | 73 + libexslt/exsltexports.h | 140 + libexslt/functions.c | 795 + libexslt/libexslt.3 | 270 + libexslt/libexslt.h | 29 + libexslt/math.c | 1202 + libexslt/saxon.c | 313 + libexslt/sets.c | 334 + libexslt/strings.c | 847 + libxslt.doap | 19 + libxslt.m4 | 191 + libxslt.pc.in | 12 + libxslt.spec.in | 133 + libxslt/Makefile.am | 79 + libxslt/attributes.c | 1162 + libxslt/attributes.h | 38 + libxslt/attrvt.c | 387 + libxslt/documents.c | 434 + libxslt/documents.h | 93 + libxslt/extensions.c | 2365 ++ libxslt/extensions.h | 262 + libxslt/extra.c | 332 + libxslt/extra.h | 80 + libxslt/functions.c | 988 + libxslt/functions.h | 78 + libxslt/imports.c | 414 + libxslt/imports.h | 75 + libxslt/keys.c | 935 + libxslt/keys.h | 53 + libxslt/libxslt.3 | 31 + libxslt/libxslt.h | 36 + libxslt/libxslt.syms | 490 + libxslt/namespaces.c | 853 + libxslt/namespaces.h | 68 + libxslt/numbers.c | 1369 + libxslt/numbersInternals.h | 73 + libxslt/pattern.c | 2593 ++ libxslt/pattern.h | 81 + libxslt/preproc.c | 2379 ++ libxslt/preproc.h | 43 + libxslt/security.c | 480 + libxslt/security.h | 104 + libxslt/templates.c | 843 + libxslt/templates.h | 77 + libxslt/transform.c | 6480 +++++ libxslt/transform.h | 207 + libxslt/trio.h | 216 + libxslt/triodef.h | 220 + libxslt/variables.c | 2335 ++ libxslt/variables.h | 91 + libxslt/win32config.h | 129 + libxslt/xslt.c | 6997 ++++++ libxslt/xslt.h | 110 + libxslt/xsltInternals.h | 1972 ++ libxslt/xsltconfig.h.in | 183 + libxslt/xsltexports.h | 142 + libxslt/xsltlocale.c | 525 + libxslt/xsltlocale.h | 67 + libxslt/xsltutils.c | 2482 ++ libxslt/xsltutils.h | 313 + libxslt/xsltwin32config.h | 105 + libxslt/xsltwin32config.h.in | 105 + python/Makefile.am | 77 + python/TODO | 0 python/generator.py | 924 + python/libxml_wrap.h | 86 + python/libxsl.py | 129 + python/libxslt-python-api.xml | 234 + python/libxslt.c | 1206 + python/libxslt_wrap.h | 49 + python/libxsltclass.txt | 238 + python/tests/Makefile.am | 34 + python/tests/basic.py | 29 + python/tests/exslt.py | 56 + python/tests/extelem.py | 89 + python/tests/extfunc.py | 66 + python/tests/pyxsltproc.py | 298 + python/tests/test.xml | 1 + python/tests/test.xsl | 9 + python/types.c | 602 + tests/Makefile.am | 26 + tests/REC/Makefile.am | 218 + tests/REC/article.xsl | 11 + tests/REC/bigfont.xsl | 6 + tests/REC/stand-2.7-1.dtd | 6 + tests/REC/stand-2.7-1.out | 4 + tests/REC/stand-2.7-1.stand.out | 4 + tests/REC/stand-2.7-1.xml | 23 + tests/REC/stand-2.7-1.xsl | 8 + tests/REC/stand-2.7-2.stand.out | 8 + tests/REC/stand-2.7-2.xml | 9 + tests/REC/stand-2.7-3.stand.out | 8 + tests/REC/stand-2.7-3.xml | 9 + tests/REC/test-10-1.out | 2 + tests/REC/test-10-1.xml | 20 + tests/REC/test-10-1.xsl | 19 + tests/REC/test-10-2.out | 2 + tests/REC/test-10-2.xml | 20 + tests/REC/test-10-2.xsl | 19 + tests/REC/test-11.2-1.out | 2 + tests/REC/test-11.2-1.xml | 1 + tests/REC/test-11.2-1.xsl | 10 + tests/REC/test-11.2-2.out | 2 + tests/REC/test-11.2-2.xml | 1 + tests/REC/test-11.2-2.xsl | 10 + tests/REC/test-11.2-3.out | 2 + tests/REC/test-11.2-3.xml | 5 + tests/REC/test-11.2-3.xsl | 11 + tests/REC/test-11.2-4.out | 2 + tests/REC/test-11.2-4.xml | 5 + tests/REC/test-11.2-4.xsl | 11 + tests/REC/test-11.2-5.out | 2 + tests/REC/test-11.2-5.xml | 5 + tests/REC/test-11.2-5.xsl | 11 + tests/REC/test-11.2-6.out | 2 + tests/REC/test-11.2-6.xml | 1 + tests/REC/test-11.2-6.xsl | 10 + tests/REC/test-12.2-1.out | 2 + tests/REC/test-12.2-1.xml | 4 + tests/REC/test-12.2-1.xsl | 11 + tests/REC/test-12.2-2.out | 7 + tests/REC/test-12.2-2.xml | 4 + tests/REC/test-12.2-2.xsl | 11 + tests/REC/test-15-1.out | 2 + tests/REC/test-15-1.xml | 1 + tests/REC/test-15-1.xsl | 12 + tests/REC/test-16.1-1.out | 2 + tests/REC/test-16.1-1.xml | 1 + tests/REC/test-16.1-1.xsl | 10 + tests/REC/test-16.1-2.out | 2 + tests/REC/test-16.1-2.xml | 1 + tests/REC/test-16.1-2.xsl | 10 + tests/REC/test-2.3-1.out | 2 + tests/REC/test-2.3-1.xml | 3 + tests/REC/test-2.3-1.xsl | 10 + tests/REC/test-2.3-2.out | 2 + tests/REC/test-2.3-2.xml | 3 + tests/REC/test-2.3-2.xsl | 14 + tests/REC/test-2.5-1.err | 4 + tests/REC/test-2.5-1.out | 7 + tests/REC/test-2.5-1.xml | 1 + tests/REC/test-2.5-1.xsl | 20 + tests/REC/test-2.6.2-1.out | 2 + tests/REC/test-2.6.2-1.xml | 5 + tests/REC/test-2.6.2-1.xsl | 8 + tests/REC/test-3.4-1.out | 2 + tests/REC/test-3.4-1.xml | 14 + tests/REC/test-3.4-1.xsl | 11 + tests/REC/test-3.4-2.out | 2 + tests/REC/test-3.4-2.xml | 14 + tests/REC/test-3.4-2.xsl | 11 + tests/REC/test-3.4-3.out | 2 + tests/REC/test-3.4-3.xml | 14 + tests/REC/test-3.4-3.xsl | 11 + tests/REC/test-5.2-1.out | 4 + tests/REC/test-5.2-1.xml | 1 + tests/REC/test-5.2-1.xsl | 6 + tests/REC/test-5.2-10.out | 4 + tests/REC/test-5.2-10.xml | 5 + tests/REC/test-5.2-10.xsl | 6 + tests/REC/test-5.2-11.out | 8 + tests/REC/test-5.2-11.xml | 5 + tests/REC/test-5.2-11.xsl | 6 + tests/REC/test-5.2-12.out | 4 + tests/REC/test-5.2-12.xml | 5 + tests/REC/test-5.2-12.xsl | 7 + tests/REC/test-5.2-13.out | 8 + tests/REC/test-5.2-13.xml | 5 + tests/REC/test-5.2-13.xsl | 6 + tests/REC/test-5.2-14.out | 9 + tests/REC/test-5.2-14.xml | 6 + tests/REC/test-5.2-14.xsl | 6 + tests/REC/test-5.2-15.out | 4 + tests/REC/test-5.2-15.xml | 1 + tests/REC/test-5.2-15.xsl | 6 + tests/REC/test-5.2-16.out | 11 + tests/REC/test-5.2-16.xml | 9 + tests/REC/test-5.2-16.xsl | 6 + tests/REC/test-5.2-17.out | 2 + tests/REC/test-5.2-17.xml | 1 + tests/REC/test-5.2-17.xsl | 9 + tests/REC/test-5.2-18.out | 2 + tests/REC/test-5.2-18.xml | 1 + tests/REC/test-5.2-18.xsl | 9 + tests/REC/test-5.2-19.out | 2 + tests/REC/test-5.2-19.xml | 4 + tests/REC/test-5.2-19.xsl | 12 + tests/REC/test-5.2-2.out | 4 + tests/REC/test-5.2-2.xml | 1 + tests/REC/test-5.2-2.xsl | 6 + tests/REC/test-5.2-20.out | 2 + tests/REC/test-5.2-20.xml | 4 + tests/REC/test-5.2-20.xsl | 14 + tests/REC/test-5.2-21.out | 2 + tests/REC/test-5.2-21.xml | 4 + tests/REC/test-5.2-21.xsl | 14 + tests/REC/test-5.2-22.out | 2 + tests/REC/test-5.2-22.xml | 3 + tests/REC/test-5.2-22.xsl | 13 + tests/REC/test-5.2-3.out | 4 + tests/REC/test-5.2-3.xml | 1 + tests/REC/test-5.2-3.xsl | 6 + tests/REC/test-5.2-4.out | 4 + tests/REC/test-5.2-4.xml | 1 + tests/REC/test-5.2-4.xsl | 6 + tests/REC/test-5.2-5.out | 11 + tests/REC/test-5.2-5.xml | 8 + tests/REC/test-5.2-5.xsl | 6 + tests/REC/test-5.2-6.out | 4 + tests/REC/test-5.2-6.xml | 1 + tests/REC/test-5.2-6.xsl | 6 + tests/REC/test-5.2-7.out | 4 + tests/REC/test-5.2-7.xml | 1 + tests/REC/test-5.2-7.xsl | 6 + tests/REC/test-5.2-8.out | 4 + tests/REC/test-5.2-8.xml | 1 + tests/REC/test-5.2-8.xsl | 6 + tests/REC/test-5.2-9.out | 4 + tests/REC/test-5.2-9.xml | 1 + tests/REC/test-5.2-9.xsl | 6 + tests/REC/test-5.3.out | 4 + tests/REC/test-5.3.xml | 3 + tests/REC/test-5.3.xsl | 9 + tests/REC/test-5.4-1.out | 7 + tests/REC/test-5.4-1.xml | 6 + tests/REC/test-5.4-1.xsl | 14 + tests/REC/test-5.4-2.out | 4 + tests/REC/test-5.4-2.xml | 7 + tests/REC/test-5.4-2.xsl | 16 + tests/REC/test-5.4-3.out | 4 + tests/REC/test-5.4-3.xml | 7 + tests/REC/test-5.4-3.xsl | 16 + tests/REC/test-5.4-4.out | 8 + tests/REC/test-5.4-4.xml | 17 + tests/REC/test-5.4-4.xsl | 20 + tests/REC/test-5.4-5.out | 2 + tests/REC/test-5.4-5.xml | 1 + tests/REC/test-5.4-5.xsl | 10 + tests/REC/test-5.8.out | 6 + tests/REC/test-5.8.xml | 7 + tests/REC/test-5.8.xsl | 4 + tests/REC/test-6.1.err | 2 + tests/REC/test-6.1.out | 0 tests/REC/test-6.1.xml | 1 + tests/REC/test-6.1.xsl | 14 + tests/REC/test-6.out | 2 + tests/REC/test-6.xml | 1 + tests/REC/test-6.xsl | 11 + tests/REC/test-7.1.1-2.out | 2 + tests/REC/test-7.1.1-2.xml | 1 + tests/REC/test-7.1.1-2.xsl | 13 + tests/REC/test-7.1.1-3.out | 2 + tests/REC/test-7.1.1-3.xml | 1 + tests/REC/test-7.1.1-3.xsl | 12 + tests/REC/test-7.1.1.out | 8 + tests/REC/test-7.1.1.xml | 7 + tests/REC/test-7.1.1.xsl | 21 + tests/REC/test-7.1.3.out | 2 + tests/REC/test-7.1.3.xml | 1 + tests/REC/test-7.1.3.xsl | 16 + tests/REC/test-7.1.4.out | 6 + tests/REC/test-7.1.4.xml | 5 + tests/REC/test-7.1.4.xsl | 16 + tests/REC/test-7.3.out | 2 + tests/REC/test-7.3.xml | 2 + tests/REC/test-7.3.xsl | 11 + tests/REC/test-7.4.out | 2 + tests/REC/test-7.4.xml | 2 + tests/REC/test-7.4.xsl | 11 + tests/REC/test-7.5-1.out | 4 + tests/REC/test-7.5-1.xml | 3 + tests/REC/test-7.5-1.xsl | 12 + tests/REC/test-7.6.1-1.out | 5 + tests/REC/test-7.6.1-1.xml | 4 + tests/REC/test-7.6.1-1.xsl | 12 + tests/REC/test-7.6.1-2.out | 5 + tests/REC/test-7.6.1-2.xml | 4 + tests/REC/test-7.6.1-2.xsl | 12 + tests/REC/test-7.6.1-3.out | 11 + tests/REC/test-7.6.1-3.xml | 10 + tests/REC/test-7.6.1-3.xsl | 12 + tests/REC/test-7.6.2-1.out | 2 + tests/REC/test-7.6.2-1.xml | 4 + tests/REC/test-7.6.2-1.xsl | 10 + tests/REC/test-7.6.2-2.out | 2 + tests/REC/test-7.6.2-2.xml | 1 + tests/REC/test-7.6.2-2.xsl | 6 + tests/REC/test-7.7-1.out | 2 + tests/REC/test-7.7-1.xml | 6 + tests/REC/test-7.7-1.xsl | 15 + tests/REC/test-7.7-2.out | 9 + tests/REC/test-7.7-2.xml | 8 + tests/REC/test-7.7-2.xsl | 12 + tests/REC/test-7.7-3.out | 29 + tests/REC/test-7.7-3.xml | 28 + tests/REC/test-7.7-3.xsl | 24 + tests/REC/test-7.7-4.out | 16 + tests/REC/test-7.7-4.xml | 15 + tests/REC/test-7.7-4.xsl | 13 + tests/REC/test-7.7-5.out | 10 + tests/REC/test-7.7-5.xml | 9 + tests/REC/test-7.7-5.xsl | 18 + tests/REC/test-8-1.out | 18 + tests/REC/test-8-1.xml | 12 + tests/REC/test-8-1.xsl | 30 + tests/REC/test-9.1-1.out | 2 + tests/REC/test-9.1-1.xml | 5 + tests/REC/test-9.1-1.xsl | 11 + tests/REC/test-9.1-2.out | 8 + tests/REC/test-9.1-2.xml | 8 + tests/REC/test-9.1-2.xsl | 32 + tests/REC/test-9.2-1.xsl | 30 + tests/REC1/Makefile.am | 23 + tests/REC1/doc.dtd | 7 + tests/REC1/doc.xml | 17 + tests/REC1/doc.xsl | 62 + tests/REC1/result.xml | 16 + tests/REC2/Makefile.am | 30 + tests/REC2/data.xml | 21 + tests/REC2/html.xml | 32 + tests/REC2/html.xsl | 43 + tests/REC2/svg.xml | 18 + tests/REC2/svg.xsl | 45 + tests/REC2/vrml.xml | 38 + tests/REC2/vrml.xsl | 34 + tests/XSLTMark/Makefile.am | 742 + tests/XSLTMark/alphabetize.out | 2 + tests/XSLTMark/alphabetize.ref | 2502 ++ tests/XSLTMark/alphabetize.xsl | 21 + tests/XSLTMark/attsets.out | 63 + tests/XSLTMark/attsets.ref | 118 + tests/XSLTMark/attsets.xsl | 33 + tests/XSLTMark/avts.out | 103 + tests/XSLTMark/avts.ref | 102 + tests/XSLTMark/avts.xsl | 21 + tests/XSLTMark/axis.out | 52 + tests/XSLTMark/axis.ref | 70 + tests/XSLTMark/axis.xml | 22 + tests/XSLTMark/axis.xsl | 42 + tests/XSLTMark/backwards.out | 126 + tests/XSLTMark/backwards.ref | 255 + tests/XSLTMark/backwards.xsl | 18 + tests/XSLTMark/bottles.out | 499 + tests/XSLTMark/bottles.ref | 2405 ++ tests/XSLTMark/bottles.xml | 3 + tests/XSLTMark/bottles.xsl | 64 + tests/XSLTMark/breadth.out | 2 + tests/XSLTMark/breadth.ref | 202 + tests/XSLTMark/breadth.xml | 2 + tests/XSLTMark/brutal.out | 165 + tests/XSLTMark/brutal.ref | 380 + tests/XSLTMark/brutal.xml | 74 + tests/XSLTMark/brutal.xsl | 108 + tests/XSLTMark/chart.out | 73 + tests/XSLTMark/chart.ref | 227 + tests/XSLTMark/chart.xml | 63 + tests/XSLTMark/chart.xsl | 60 + tests/XSLTMark/creation.out | 903 + tests/XSLTMark/creation.ref | 902 + tests/XSLTMark/creation.xsl | 24 + tests/XSLTMark/current.out | 14 + tests/XSLTMark/current.ref | 41 + tests/XSLTMark/current.xml | 13 + tests/XSLTMark/current.xsl | 23 + tests/XSLTMark/dbgen.pl | 43 + tests/XSLTMark/dbhtml.xsl | 36 + tests/XSLTMark/dbonerow.out | 42 + tests/XSLTMark/dbonerow.ref | 69 + tests/XSLTMark/dbonerow.xsl | 73 + tests/XSLTMark/dbsql10.ref | 49 + tests/XSLTMark/dbsql10.xsl | 37 + tests/XSLTMark/dbsql100.ref | 472 + tests/XSLTMark/dbsql100.xsl | 55 + tests/XSLTMark/dbsql1000.ref | 4702 ++++ tests/XSLTMark/dbsql1000.xsl | 235 + tests/XSLTMark/dbsql2000.ref | 9402 +++++++ tests/XSLTMark/dbsql2000.xsl | 435 + tests/XSLTMark/dbsql250.ref | 1177 + tests/XSLTMark/dbsql250.xsl | 85 + tests/XSLTMark/dbsql50.ref | 237 + tests/XSLTMark/dbsql50.xsl | 45 + tests/XSLTMark/dbsql500.ref | 2352 ++ tests/XSLTMark/dbsql500.xsl | 135 + tests/XSLTMark/dbsql750.ref | 3527 +++ tests/XSLTMark/dbsql750.xsl | 185 + tests/XSLTMark/dbtail.out | 2 + tests/XSLTMark/dbtail.ref | 802 + tests/XSLTMark/dbtail.xsl | 23 + tests/XSLTMark/decoy.out | 903 + tests/XSLTMark/decoy.xsl | 107 + tests/XSLTMark/depth.out | 2 + tests/XSLTMark/depth.ref | 399 + tests/XSLTMark/depth.xml | 2 + tests/XSLTMark/encrypt.out | 903 + tests/XSLTMark/encrypt.ref | 2502 ++ tests/XSLTMark/encrypt.xsl | 22 + tests/XSLTMark/find.xsl | 16 + tests/XSLTMark/functions.out | 103 + tests/XSLTMark/functions.ref | 542 + tests/XSLTMark/functions.xsl | 41 + tests/XSLTMark/game.out | 41 + tests/XSLTMark/game.ref | 113 + tests/XSLTMark/game.xml | 128 + tests/XSLTMark/game.xsl | 50 + tests/XSLTMark/gettysburg.xml | 29 + tests/XSLTMark/html.out | 32 + tests/XSLTMark/html.ref | 76 + tests/XSLTMark/html.xml | 21 + tests/XSLTMark/html.xsl | 44 + tests/XSLTMark/identity.out | 9003 +++++++ tests/XSLTMark/identity.ref | 25002 +++++++++++++++++++ tests/XSLTMark/identity.xml | 13 + tests/XSLTMark/identity.xsl | 15 + tests/XSLTMark/inventory.out | 2 + tests/XSLTMark/inventory.ref | 278 + tests/XSLTMark/inventory.xml | 145 + tests/XSLTMark/inventory.xsl | 35 + tests/XSLTMark/metric.out | 15 + tests/XSLTMark/metric.ref | 41 + tests/XSLTMark/metric.xml | 42 + tests/XSLTMark/metric.xsl | 43 + tests/XSLTMark/number.out | 70 + tests/XSLTMark/number.xml | 9 + tests/XSLTMark/number.xsl | 49 + tests/XSLTMark/oddtemplate.out | 15 + tests/XSLTMark/oddtemplate.ref | 22 + tests/XSLTMark/oddtemplate.xml | 14 + tests/XSLTMark/oddtemplate.xsl | 37 + tests/XSLTMark/patterns.out | 903 + tests/XSLTMark/patterns.ref | 2502 ++ tests/XSLTMark/patterns.xsl | 48 + tests/XSLTMark/prettyprint.out | 3211 +++ tests/XSLTMark/prettyprint.ref | 8931 +++++++ tests/XSLTMark/prettyprint.xsl | 62 + tests/XSLTMark/priority.out | 2 + tests/XSLTMark/priority.ref | 59 + tests/XSLTMark/priority.xml | 62 + tests/XSLTMark/priority.xsl | 52 + tests/XSLTMark/products.out | 30 + tests/XSLTMark/products.ref | 70 + tests/XSLTMark/products.xml | 107 + tests/XSLTMark/products.xsl | 35 + tests/XSLTMark/queens.out | 2 + tests/XSLTMark/queens.ref | 494 + tests/XSLTMark/queens.xml | 1 + tests/XSLTMark/queens.xsl | 199 + tests/XSLTMark/reverser.out | 2 + tests/XSLTMark/reverser.ref | 245 + tests/XSLTMark/reverser.xsl | 35 + tests/XSLTMark/stringsort.out | 8002 ++++++ tests/XSLTMark/stringsort.ref | 25002 +++++++++++++++++++ tests/XSLTMark/stringsort.xsl | 17 + tests/XSLTMark/summarize.out | 9 + tests/XSLTMark/summarize.ref | 29 + tests/XSLTMark/summarize.xsl | 33 + tests/XSLTMark/total.out | 23 + tests/XSLTMark/total.ref | 51 + tests/XSLTMark/total.xsl | 30 + tests/XSLTMark/tower.out | 2 + tests/XSLTMark/tower.ref | 5122 ++++ tests/XSLTMark/tower.xml | 3 + tests/XSLTMark/tower.xsl | 75 + tests/XSLTMark/tower2.xsl | 194 + tests/XSLTMark/trend.out | 121 + tests/XSLTMark/trend.ref | 1300 + tests/XSLTMark/trend.xml | 121 + tests/XSLTMark/trend.xsl | 19 + tests/XSLTMark/union.out | 8 + tests/XSLTMark/union.ref | 17 + tests/XSLTMark/union.xml | 11 + tests/XSLTMark/union.xsl | 27 + tests/XSLTMark/xpath.out | 19 + tests/XSLTMark/xpath.ref | 20 + tests/XSLTMark/xpath.xml | 18 + tests/XSLTMark/xpath.xsl | 39 + tests/XSLTMark/xslbench1.out | 139 + tests/XSLTMark/xslbench1.xml | 20 + tests/XSLTMark/xslbench1.xsl | 202 + tests/XSLTMark/xslbench2.out | 3227 +++ tests/XSLTMark/xslbench2.xsl | 37 + tests/XSLTMark/xslbench3.out | 47 + tests/XSLTMark/xslbench3.xsl | 32 + tests/XSLTMark/xslbenchdream.xml | 4477 ++++ tests/docbook/BUGS | 6 + tests/docbook/ChangeLog | 34 + tests/docbook/Makefile.am | 198 + tests/docbook/README | 104 + tests/docbook/TODO | 4 + tests/docbook/VERSION | 6 + tests/docbook/WhatsNew | 91 + tests/docbook/common/ChangeLog | 69 + tests/docbook/common/LostLog | 167 + tests/docbook/common/ca.xml | 339 + tests/docbook/common/common.xsl | 1000 + tests/docbook/common/cs.xml | 337 + tests/docbook/common/da.xml | 339 + tests/docbook/common/de.xml | 337 + tests/docbook/common/el.xml | 337 + tests/docbook/common/en.xml | 340 + tests/docbook/common/es.xml | 339 + tests/docbook/common/et.xml | 337 + tests/docbook/common/fi.xml | 337 + tests/docbook/common/fr.xml | 341 + tests/docbook/common/gentext.xsl | 385 + tests/docbook/common/hu.xml | 337 + tests/docbook/common/id.xml | 337 + tests/docbook/common/it.xml | 349 + tests/docbook/common/ja.xml | 340 + tests/docbook/common/ko.xml | 335 + tests/docbook/common/l10n.dtd | 29 + tests/docbook/common/l10n.xml | 61 + tests/docbook/common/l10n.xsl | 295 + tests/docbook/common/labels.xsl | 516 + tests/docbook/common/nl.xml | 338 + tests/docbook/common/no.xml | 337 + tests/docbook/common/pl.xml | 323 + tests/docbook/common/pt.xml | 339 + tests/docbook/common/pt_br.xml | 339 + tests/docbook/common/ro.xml | 343 + tests/docbook/common/ru.xml | 366 + tests/docbook/common/sk.xml | 337 + tests/docbook/common/sl.xml | 337 + tests/docbook/common/sr.xml | 337 + tests/docbook/common/subtitles.xsl | 130 + tests/docbook/common/sv.xml | 339 + tests/docbook/common/titles.xsl | 335 + tests/docbook/common/zh_cn.xml | 337 + tests/docbook/common/zh_tw.xml | 313 + tests/docbook/doc/ChangeLog | 11 + tests/docbook/doc/book.xsl | 49 + tests/docbook/doc/ch01s02.html | 67 + tests/docbook/doc/ch01s03.html | 422 + tests/docbook/doc/ch01s04.html | 250 + tests/docbook/doc/ch02s02.html | 7 + tests/docbook/doc/ch03.html | 3 + tests/docbook/doc/ch04.html | 58 + tests/docbook/doc/common/ChangeLog | 4 + tests/docbook/doc/common/common.html | 379 + tests/docbook/doc/copyright.html | 19 + tests/docbook/doc/extensions.html | 41 + tests/docbook/doc/fo/ChangeLog | 4 + tests/docbook/doc/fo/param.html | 1616 ++ tests/docbook/doc/fo/table.html | 181 + tests/docbook/doc/html/ChangeLog | 4 + tests/docbook/doc/html/ebnf.html | 103 + tests/docbook/doc/html/param.html | 1815 ++ tests/docbook/doc/index.html | 3 + tests/docbook/doc/jrefhtml.xsl | 33 + tests/docbook/doc/lib/ChangeLog | 4 + tests/docbook/doc/lib/lib.html | 161 + tests/docbook/doc/pr01.html | 4 + tests/docbook/doc/publishing.html | 52 + tests/docbook/doc/reference.css | 4 + tests/docbook/doc/reference.html | 9 + tests/docbook/doc/reference.xsl | 50 + tests/docbook/doc/warranty.html | 10 + tests/docbook/dtd/3.1.7/COPYRIGHT | 27 + tests/docbook/dtd/3.1.7/ChangeLog | 249 + tests/docbook/dtd/3.1.7/README | 76 + tests/docbook/dtd/3.1.7/VERSION | 1 + tests/docbook/dtd/3.1.7/calstblx.dtd | 176 + tests/docbook/dtd/3.1.7/dbcentx.mod | 166 + tests/docbook/dtd/3.1.7/dbgenent.ent | 21 + tests/docbook/dtd/3.1.7/dbhierx.mod | 1795 ++ tests/docbook/dtd/3.1.7/dbnotnx.mod | 60 + tests/docbook/dtd/3.1.7/dbpoolx.mod | 7291 ++++++ tests/docbook/dtd/3.1.7/dbtblcals.dtd | 5 + tests/docbook/dtd/3.1.7/dbtblxchg.dtd | 5 + tests/docbook/dtd/3.1.7/docbookx.dtd | 69 + tests/docbook/dtd/3.1.7/ent/ChangeLog | 9 + tests/docbook/dtd/3.1.7/ent/iso-amsa.ent | 61 + tests/docbook/dtd/3.1.7/ent/iso-amsb.ent | 47 + tests/docbook/dtd/3.1.7/ent/iso-amsc.ent | 15 + tests/docbook/dtd/3.1.7/ent/iso-amsn.ent | 64 + tests/docbook/dtd/3.1.7/ent/iso-amso.ent | 24 + tests/docbook/dtd/3.1.7/ent/iso-amsr.ent | 89 + tests/docbook/dtd/3.1.7/ent/iso-box.ent | 45 + tests/docbook/dtd/3.1.7/ent/iso-cyr1.ent | 72 + tests/docbook/dtd/3.1.7/ent/iso-cyr2.ent | 31 + tests/docbook/dtd/3.1.7/ent/iso-dia.ent | 19 + tests/docbook/dtd/3.1.7/ent/iso-grk1.ent | 54 + tests/docbook/dtd/3.1.7/ent/iso-grk2.ent | 25 + tests/docbook/dtd/3.1.7/ent/iso-grk3.ent | 48 + tests/docbook/dtd/3.1.7/ent/iso-grk4.ent | 48 + tests/docbook/dtd/3.1.7/ent/iso-lat1.ent | 67 + tests/docbook/dtd/3.1.7/ent/iso-lat2.ent | 126 + tests/docbook/dtd/3.1.7/ent/iso-num.ent | 81 + tests/docbook/dtd/3.1.7/ent/iso-pub.ent | 90 + tests/docbook/dtd/3.1.7/ent/iso-tech.ent | 67 + tests/docbook/dtd/3.1.7/soextblx.dtd | 307 + tests/docbook/dtd/3.1.7/tblcals.xml | 26 + tests/docbook/dtd/3.1.7/tblxchg.xml | 26 + tests/docbook/dtd/3.1.7/test.xml | 43 + tests/docbook/dtd/4.0/40chg.txt | 51 + tests/docbook/dtd/4.0/calstblx.dtd | 199 + tests/docbook/dtd/4.0/dbcentx.mod | 204 + tests/docbook/dtd/4.0/dbgenent.ent | 41 + tests/docbook/dtd/4.0/dbhierx.mod | 2086 ++ tests/docbook/dtd/4.0/dbnotnx.mod | 97 + tests/docbook/dtd/4.0/dbpoolx.mod | 7573 ++++++ tests/docbook/dtd/4.0/docbookx.dtd | 125 + tests/docbook/dtd/4.0/ent/iso-amsa.ent | 61 + tests/docbook/dtd/4.0/ent/iso-amsb.ent | 47 + tests/docbook/dtd/4.0/ent/iso-amsc.ent | 15 + tests/docbook/dtd/4.0/ent/iso-amsn.ent | 64 + tests/docbook/dtd/4.0/ent/iso-amso.ent | 24 + tests/docbook/dtd/4.0/ent/iso-amsr.ent | 89 + tests/docbook/dtd/4.0/ent/iso-box.ent | 45 + tests/docbook/dtd/4.0/ent/iso-cyr1.ent | 72 + tests/docbook/dtd/4.0/ent/iso-cyr2.ent | 31 + tests/docbook/dtd/4.0/ent/iso-dia.ent | 19 + tests/docbook/dtd/4.0/ent/iso-grk1.ent | 54 + tests/docbook/dtd/4.0/ent/iso-grk2.ent | 25 + tests/docbook/dtd/4.0/ent/iso-grk3.ent | 48 + tests/docbook/dtd/4.0/ent/iso-grk4.ent | 48 + tests/docbook/dtd/4.0/ent/iso-lat1.ent | 67 + tests/docbook/dtd/4.0/ent/iso-lat2.ent | 126 + tests/docbook/dtd/4.0/ent/iso-num.ent | 81 + tests/docbook/dtd/4.0/ent/iso-pub.ent | 90 + tests/docbook/dtd/4.0/ent/iso-tech.ent | 67 + tests/docbook/dtd/4.0/readme.txt | 12 + tests/docbook/dtd/4.0/soextblx.dtd | 308 + tests/docbook/dtd/4.1.2/40chg.txt | 53 + tests/docbook/dtd/4.1.2/41chg.txt | 18 + tests/docbook/dtd/4.1.2/ChangeLog | 118 + tests/docbook/dtd/4.1.2/calstblx.dtd | 199 + tests/docbook/dtd/4.1.2/dbcentx.mod | 204 + tests/docbook/dtd/4.1.2/dbgenent.mod | 41 + tests/docbook/dtd/4.1.2/dbhierx.mod | 2074 ++ tests/docbook/dtd/4.1.2/dbnotnx.mod | 97 + tests/docbook/dtd/4.1.2/dbpoolx.mod | 7516 ++++++ tests/docbook/dtd/4.1.2/docbook.cat | 59 + tests/docbook/dtd/4.1.2/docbookx.dtd | 125 + tests/docbook/dtd/4.1.2/ent/iso-amsa.ent | 63 + tests/docbook/dtd/4.1.2/ent/iso-amsb.ent | 49 + tests/docbook/dtd/4.1.2/ent/iso-amsc.ent | 15 + tests/docbook/dtd/4.1.2/ent/iso-amsn.ent | 66 + tests/docbook/dtd/4.1.2/ent/iso-amso.ent | 26 + tests/docbook/dtd/4.1.2/ent/iso-amsr.ent | 91 + tests/docbook/dtd/4.1.2/ent/iso-box.ent | 45 + tests/docbook/dtd/4.1.2/ent/iso-cyr1.ent | 72 + tests/docbook/dtd/4.1.2/ent/iso-cyr2.ent | 31 + tests/docbook/dtd/4.1.2/ent/iso-dia.ent | 19 + tests/docbook/dtd/4.1.2/ent/iso-grk1.ent | 54 + tests/docbook/dtd/4.1.2/ent/iso-grk2.ent | 25 + tests/docbook/dtd/4.1.2/ent/iso-grk3.ent | 48 + tests/docbook/dtd/4.1.2/ent/iso-grk4.ent | 48 + tests/docbook/dtd/4.1.2/ent/iso-lat1.ent | 67 + tests/docbook/dtd/4.1.2/ent/iso-lat2.ent | 126 + tests/docbook/dtd/4.1.2/ent/iso-num.ent | 81 + tests/docbook/dtd/4.1.2/ent/iso-pub.ent | 90 + tests/docbook/dtd/4.1.2/ent/iso-tech.ent | 69 + tests/docbook/dtd/4.1.2/readme.txt | 16 + tests/docbook/dtd/4.1.2/soextblx.dtd | 308 + tests/docbook/dtd/simple/3.1.7.1/COPYRIGHT | 28 + tests/docbook/dtd/simple/3.1.7.1/ChangeLog | 113 + tests/docbook/dtd/simple/3.1.7.1/README | 105 + tests/docbook/dtd/simple/3.1.7.1/VERSION | 1 + tests/docbook/dtd/simple/3.1.7.1/ent/ChangeLog | 4 + tests/docbook/dtd/simple/3.1.7.1/ent/iso-lat1.ent | 67 + tests/docbook/dtd/simple/3.1.7.1/ent/iso-num.ent | 81 + tests/docbook/dtd/simple/3.1.7.1/ent/iso-pub.ent | 90 + tests/docbook/dtd/simple/3.1.7.1/sdbcent.mod | 47 + tests/docbook/dtd/simple/3.1.7.1/sdbhier.mod | 64 + tests/docbook/dtd/simple/3.1.7.1/sdbpool.mod | 166 + .../docbook/dtd/simple/3.1.7.1/sdocbook-custom.dtd | 238 + tests/docbook/dtd/simple/3.1.7.1/sdocbook.css | 674 + tests/docbook/dtd/simple/3.1.7.1/sdocbook.dtd | 1315 + .../dtd/simple/3.1.7.1/sdocbookref-custom.dtd | 22 + tests/docbook/dtd/simple/3.1.7.1/sdocbookref.dtd | 1460 ++ tests/docbook/dtd/simple/3.1.7.1/sinclist.mod | 252 + tests/docbook/dtd/simple/3.1.7.1/test.xml | 6 + tests/docbook/dtd/simple/3.1.7.1/testcss.xml | 52 + tests/docbook/dtd/simple/3.1.7.1/testcust.xml | 4 + tests/docbook/dtd/simple/3.1.7.1/testrefcust.xml | 10 + tests/docbook/dtd/simple/4.1.2.4/COPYRIGHT | 26 + tests/docbook/dtd/simple/4.1.2.4/ChangeLog | 31 + tests/docbook/dtd/simple/4.1.2.4/LostLog | 173 + tests/docbook/dtd/simple/4.1.2.4/README | 107 + tests/docbook/dtd/simple/4.1.2.4/VERSION | 1 + tests/docbook/dtd/simple/4.1.2.4/sdbcent.mod | 47 + tests/docbook/dtd/simple/4.1.2.4/sdbhier.mod | 68 + tests/docbook/dtd/simple/4.1.2.4/sdbpool.mod | 174 + .../docbook/dtd/simple/4.1.2.4/sdocbook-custom.dtd | 306 + tests/docbook/dtd/simple/4.1.2.4/sdocbook.css | 679 + tests/docbook/dtd/simple/4.1.2.4/sdocbook.dtd | 1530 ++ tests/docbook/dtd/simple/4.1.2.4/sdocbookref.dtd | 1688 ++ tests/docbook/dtd/simple/4.1.2.4/sinclist.mod | 284 + tests/docbook/dtd/simple/4.1.2.4/test.xml | 6 + tests/docbook/dtd/simple/4.1.2.4/testcss.xml | 52 + tests/docbook/dtd/simple/4.1.2.4/testcust.xml | 4 + tests/docbook/dtd/simple/4.1.2.4/testrefcust.xml | 10 + tests/docbook/fo/ChangeLog | 124 + tests/docbook/fo/LostLog | 196 + tests/docbook/fo/admon.xsl | 116 + tests/docbook/fo/autoidx.xsl | 332 + tests/docbook/fo/autotoc.xsl | 182 + tests/docbook/fo/biblio.xsl | 961 + tests/docbook/fo/block.xsl | 213 + tests/docbook/fo/callout.xsl | 192 + tests/docbook/fo/component.xsl | 361 + tests/docbook/fo/division.xsl | 359 + tests/docbook/fo/docbook.xsl | 145 + tests/docbook/fo/fo.xsl | 36 + tests/docbook/fo/footnote.xsl | 58 + tests/docbook/fo/fop.xsl | 126 + tests/docbook/fo/formal.xsl | 133 + tests/docbook/fo/glossary.xsl | 304 + tests/docbook/fo/graphics.xsl | 326 + tests/docbook/fo/index.xsl | 119 + tests/docbook/fo/info.xsl | 34 + tests/docbook/fo/inline.xsl | 598 + tests/docbook/fo/keywords.xsl | 21 + tests/docbook/fo/lists.xsl | 558 + tests/docbook/fo/math.xsl | 32 + tests/docbook/fo/pagesetup.xsl | 431 + tests/docbook/fo/param.xsl | 1170 + tests/docbook/fo/pi.xsl | 183 + tests/docbook/fo/qandaset.xsl | 145 + tests/docbook/fo/refentry.xsl | 236 + tests/docbook/fo/sections.xsl | 361 + tests/docbook/fo/synop.xsl | 240 + tests/docbook/fo/table.xsl | 713 + tests/docbook/fo/titlepage.templates.xml | 889 + tests/docbook/fo/titlepage.templates.xsl | 2742 ++ tests/docbook/fo/titlepage.xsl | 656 + tests/docbook/fo/toc.xsl | 211 + tests/docbook/fo/verbatim.xsl | 246 + tests/docbook/fo/xref.xsl | 313 + tests/docbook/html/ChangeLog | 173 + tests/docbook/html/LostLog | 494 + tests/docbook/html/admon.xsl | 135 + tests/docbook/html/autoidx.xsl | 296 + tests/docbook/html/autotoc.xsl | 566 + tests/docbook/html/biblio.xsl | 932 + tests/docbook/html/block.xsl | 357 + tests/docbook/html/callout.xsl | 150 + tests/docbook/html/changebars.xsl | 81 + tests/docbook/html/chunk-common.xsl | 1200 + tests/docbook/html/chunk.xsl | 16 + tests/docbook/html/chunker.xsl | 163 + tests/docbook/html/component.xsl | 318 + tests/docbook/html/division.xsl | 134 + tests/docbook/html/docbook.xsl | 214 + tests/docbook/html/ebnf.xsl | 350 + tests/docbook/html/footnote.xsl | 142 + tests/docbook/html/formal.xsl | 88 + tests/docbook/html/glossary.xsl | 219 + tests/docbook/html/graphics.xsl | 319 + tests/docbook/html/html.xsl | 56 + tests/docbook/html/index.xsl | 185 + tests/docbook/html/info.xsl | 53 + tests/docbook/html/inline.xsl | 755 + tests/docbook/html/keywords.xsl | 38 + tests/docbook/html/lists.xsl | 652 + tests/docbook/html/math.xsl | 22 + tests/docbook/html/param.xsl | 1152 + tests/docbook/html/pi.xsl | 191 + tests/docbook/html/qandaset.xsl | 207 + tests/docbook/html/refentry.xsl | 216 + tests/docbook/html/sections.xsl | 346 + tests/docbook/html/synop.xsl | 939 + tests/docbook/html/table.xsl | 638 + tests/docbook/html/titlepage.templates.xml | 596 + tests/docbook/html/titlepage.templates.xsl | 2561 ++ tests/docbook/html/titlepage.xsl | 635 + tests/docbook/html/toc.xsl | 173 + tests/docbook/html/verbatim.xsl | 303 + tests/docbook/html/xref.xsl | 382 + tests/docbook/html/xtchunk.xsl | 10 + tests/docbook/html/xtchunker.xsl | 70 + tests/docbook/htmlhelp/ChangeLog | 13 + tests/docbook/htmlhelp/doc/ChangeLog | 8 + tests/docbook/htmlhelp/doc/htmlhelp.xml | 145 + tests/docbook/htmlhelp/htmlhelp-common.xsl | 359 + tests/docbook/htmlhelp/htmlhelp.xsl | 23 + tests/docbook/htmlhelp/langcodes.xml | 103 + tests/docbook/htmlhelp/xthtmlhelp.xsl | 23 + tests/docbook/images/ChangeLog | 5 + tests/docbook/images/callouts/1.png | Bin 0 -> 329 bytes tests/docbook/images/callouts/10.png | Bin 0 -> 361 bytes tests/docbook/images/callouts/2.png | Bin 0 -> 353 bytes tests/docbook/images/callouts/3.png | Bin 0 -> 350 bytes tests/docbook/images/callouts/4.png | Bin 0 -> 345 bytes tests/docbook/images/callouts/5.png | Bin 0 -> 348 bytes tests/docbook/images/callouts/6.png | Bin 0 -> 355 bytes tests/docbook/images/callouts/7.png | Bin 0 -> 344 bytes tests/docbook/images/callouts/8.png | Bin 0 -> 357 bytes tests/docbook/images/callouts/9.png | Bin 0 -> 357 bytes tests/docbook/images/callouts/ChangeLog | 5 + tests/docbook/images/caution.gif | Bin 0 -> 743 bytes tests/docbook/images/caution.png | Bin 0 -> 1250 bytes tests/docbook/images/caution.tif | Bin 0 -> 1978 bytes tests/docbook/images/home.png | Bin 0 -> 1156 bytes tests/docbook/images/important.gif | Bin 0 -> 1003 bytes tests/docbook/images/important.png | Bin 0 -> 722 bytes tests/docbook/images/important.tif | Bin 0 -> 2020 bytes tests/docbook/images/next.png | Bin 0 -> 1150 bytes tests/docbook/images/note.gif | Bin 0 -> 580 bytes tests/docbook/images/note.png | Bin 0 -> 490 bytes tests/docbook/images/note.tif | Bin 0 -> 460 bytes tests/docbook/images/prev.png | Bin 0 -> 1132 bytes tests/docbook/images/tip.gif | Bin 0 -> 598 bytes tests/docbook/images/tip.png | Bin 0 -> 449 bytes tests/docbook/images/tip.tif | Bin 0 -> 420 bytes tests/docbook/images/toc-blank.png | Bin 0 -> 318 bytes tests/docbook/images/toc-minus.png | Bin 0 -> 259 bytes tests/docbook/images/toc-plus.png | Bin 0 -> 264 bytes tests/docbook/images/up.png | Bin 0 -> 1111 bytes tests/docbook/images/warning.gif | Bin 0 -> 743 bytes tests/docbook/images/warning.png | Bin 0 -> 1241 bytes tests/docbook/images/warning.tif | Bin 0 -> 1990 bytes tests/docbook/lib/ChangeLog | 8 + tests/docbook/lib/LostLog | 24 + tests/docbook/lib/lib.xsl | 242 + tests/docbook/result/fo/article.fo | 274 + tests/docbook/result/fo/article2.fo | 265 + tests/docbook/result/fo/article3.fo | 234 + tests/docbook/result/fo/bib.fo | 239 + tests/docbook/result/fo/book.fo | 687 + tests/docbook/result/fo/book2.fo | 5535 ++++ tests/docbook/result/fo/book3.fo | 363 + tests/docbook/result/fo/callout.fo | 181 + tests/docbook/result/fo/chunk.fo | 374 + tests/docbook/result/fo/classsynop.fo | 146 + tests/docbook/result/fo/condition.fo | 5648 +++++ tests/docbook/result/fo/docbook40.fo | 255 + tests/docbook/result/fo/external.fo | 147 + tests/docbook/result/fo/figtest.fo | 129 + tests/docbook/result/fo/foottest.fo | 180 + tests/docbook/result/fo/fotest.fo | 230 + tests/docbook/result/fo/func.fo | 115 + tests/docbook/result/fo/gdp-handbook.fo | 4762 ++++ tests/docbook/result/fo/graphics.fo | 164 + tests/docbook/result/fo/gtest.fo | 111 + tests/docbook/result/fo/idxbook.fo | 271 + tests/docbook/result/fo/kwrite.fo | 2549 ++ tests/docbook/result/fo/multilingual.fo | 1203 + tests/docbook/result/fo/qa.fo | 1447 ++ tests/docbook/result/fo/qa2.fo | 211 + tests/docbook/result/fo/sectest.fo | 948 + tests/docbook/result/fo/set.fo | 417 + tests/docbook/result/fo/table.fo | 576 + tests/docbook/result/fo/test.fo | 112 + tests/docbook/result/fo/verbtest.fo | 137 + tests/docbook/result/html/article.html | 35 + tests/docbook/result/html/article2.html | 15 + tests/docbook/result/html/article3.html | 6 + tests/docbook/result/html/bib.html | 19 + tests/docbook/result/html/book.html | 217 + tests/docbook/result/html/book2.html | 590 + tests/docbook/result/html/book3.html | 54 + tests/docbook/result/html/callout.html | 28 + tests/docbook/result/html/chunk.html | 41 + tests/docbook/result/html/classsynop.html | 43 + tests/docbook/result/html/condition.html | 591 + tests/docbook/result/html/docbook40.html | 24 + tests/docbook/result/html/emc2.gif | Bin 0 -> 1342 bytes tests/docbook/result/html/emc2.png | Bin 0 -> 1423 bytes tests/docbook/result/html/external.html | 1 + tests/docbook/result/html/figtest.html | 16 + tests/docbook/result/html/foottest.html | 8 + tests/docbook/result/html/fotest.html | 1 + tests/docbook/result/html/func.html | 9 + tests/docbook/result/html/gdp-handbook.err | 18 + tests/docbook/result/html/gdp-handbook.html | 3300 +++ tests/docbook/result/html/graphics.html | 1 + tests/docbook/result/html/gtest.html | 1 + tests/docbook/result/html/idxbook.html | 33 + tests/docbook/result/html/kwrite.html | 421 + tests/docbook/result/html/multilingual.html | 501 + tests/docbook/result/html/qa.html | 1 + tests/docbook/result/html/qa2.html | 2 + tests/docbook/result/html/sectest.html | 555 + tests/docbook/result/html/set.html | 1 + tests/docbook/result/html/table.html | 1 + tests/docbook/result/html/test.html | 12 + tests/docbook/result/html/testmath.html | 64 + tests/docbook/result/html/verbtest.html | 4 + tests/docbook/result/xhtml/article.xhtml | 36 + tests/docbook/result/xhtml/article2.xhtml | 16 + tests/docbook/result/xhtml/article3.xhtml | 7 + tests/docbook/result/xhtml/bib.xhtml | 20 + tests/docbook/result/xhtml/book.xhtml | 218 + tests/docbook/result/xhtml/book2.xhtml | 591 + tests/docbook/result/xhtml/book3.xhtml | 55 + tests/docbook/result/xhtml/callout.xhtml | 29 + tests/docbook/result/xhtml/chunk.xhtml | 42 + tests/docbook/result/xhtml/classsynop.xhtml | 44 + tests/docbook/result/xhtml/condition.xhtml | 592 + tests/docbook/result/xhtml/docbook40.xhtml | 25 + tests/docbook/result/xhtml/external.xhtml | 2 + tests/docbook/result/xhtml/figtest.xhtml | 17 + tests/docbook/result/xhtml/foottest.xhtml | 9 + tests/docbook/result/xhtml/fotest.xhtml | 2 + tests/docbook/result/xhtml/func.xhtml | 10 + tests/docbook/result/xhtml/gdp-handbook.xhtml | 3300 +++ tests/docbook/result/xhtml/graphics.xhtml | 2 + tests/docbook/result/xhtml/gtest.xhtml | 2 + tests/docbook/result/xhtml/idxbook.xhtml | 34 + tests/docbook/result/xhtml/kwrite.xhtml | 422 + tests/docbook/result/xhtml/multilingual.xhtml | 502 + tests/docbook/result/xhtml/qa.xhtml | 2 + tests/docbook/result/xhtml/qa2.xhtml | 3 + tests/docbook/result/xhtml/sectest.xhtml | 556 + tests/docbook/result/xhtml/set.xhtml | 2 + tests/docbook/result/xhtml/table.xhtml | 2 + tests/docbook/result/xhtml/test.xhtml | 13 + tests/docbook/result/xhtml/verbtest.xhtml | 5 + tests/docbook/result/xtchunk/html/apa.orig | 737 + tests/docbook/result/xtchunk/html/apas02.orig | 323 + tests/docbook/result/xtchunk/html/apas03.orig | 625 + tests/docbook/result/xtchunk/html/index.orig | 107 + tests/docbook/result/xtchunk/html/indexs02.orig | 431 + tests/docbook/result/xtchunk/html/indexs03.orig | 103 + tests/docbook/result/xtchunk/html/indexs04.orig | 513 + tests/docbook/result/xtchunk/html/indexs05.orig | 39 + tests/docbook/result/xtchunk/html/indexs06.orig | 43 + tests/docbook/result/xtchunk/html/indexs07.orig | 59 + tests/docbook/result/xtchunk/html/indexs08.orig | 29 + tests/docbook/result/xtchunk/html/indexs09.orig | 72 + tests/docbook/result/xtchunk/html/indexs10.orig | 32 + tests/docbook/result/xtchunk/html/indexs11.orig | 8 + tests/docbook/result/xtchunk/html/indexs12.orig | 118 + tests/docbook/result/xtchunk/html/indexs13.orig | 32 + tests/docbook/result/xtchunk/html/indexs14.orig | 23 + tests/docbook/result/xtchunk/html/indexs15.orig | 29 + tests/docbook/template/ChangeLog | 15 + tests/docbook/template/README | 15 + tests/docbook/template/biblioentry.xsl | 72 + tests/docbook/template/testtemplate.xml | 38 + tests/docbook/template/titlepage.xsl | 1129 + tests/docbook/test/ChangeLog | 70 + tests/docbook/test/LostLog | 127 + tests/docbook/test/article.xml | 120 + tests/docbook/test/article2.xml | 80 + tests/docbook/test/article3.xml | 60 + tests/docbook/test/bib.xml | 229 + tests/docbook/test/book.xml | 410 + tests/docbook/test/book2.xml | 3249 +++ tests/docbook/test/book3.xml | 391 + tests/docbook/test/callout.xml | 55 + tests/docbook/test/chunk.xml | 127 + tests/docbook/test/classsynop.xml | 160 + tests/docbook/test/condition.xml | 3303 +++ tests/docbook/test/docbook.css | 2 + tests/docbook/test/docbook40.xml | 128 + tests/docbook/test/emc2.gif | Bin 0 -> 1342 bytes tests/docbook/test/emc2.png | Bin 0 -> 1423 bytes tests/docbook/test/external.xml | 15 + tests/docbook/test/figtest.xml | 46 + tests/docbook/test/foottest.xml | 67 + tests/docbook/test/fotest.xml | 57 + tests/docbook/test/func.xml | 24 + tests/docbook/test/gdp-handbook.xml | 4448 ++++ tests/docbook/test/graphics.xml | 89 + tests/docbook/test/gtest.xml | 23 + tests/docbook/test/idxbook.xml | 142 + tests/docbook/test/kwrite.xml | 1784 ++ tests/docbook/test/multilingual.xml | 700 + tests/docbook/test/qa.xml | 136 + tests/docbook/test/qa2.xml | 50 + tests/docbook/test/sectest.xml | 832 + tests/docbook/test/set.xml | 79 + tests/docbook/test/subdoc.ent | 3 + tests/docbook/test/table.xml | 94 + tests/docbook/test/test.xml | 46 + tests/docbook/test/test.xsl | 9 + tests/docbook/test/verbtest.xml | 20 + tests/docbook/xhtml/ChangeLog | 8 + tests/docbook/xhtml/LostLog | 14 + tests/docbook/xhtml/chunk.xsl | 20 + tests/docbook/xhtml/docbook.xsl | 28 + tests/docbook/xhtml/xtchunk.xsl | 18 + tests/docs/Makefile.am | 195 + tests/docs/array.xml | 7 + tests/docs/bug-1-.xml | 7 + tests/docs/bug-10-.xml | 3 + tests/docs/bug-100.xml | 1 + tests/docs/bug-101.xml | 1 + tests/docs/bug-102.xml | 1 + tests/docs/bug-103.xml | 1 + tests/docs/bug-104.xml | 1 + tests/docs/bug-105.xml | 1 + tests/docs/bug-106.xml | 2 + tests/docs/bug-107.xml | 7 + tests/docs/bug-108.xml | 4 + tests/docs/bug-109.xml | 4 + tests/docs/bug-11-.xml | 4 + tests/docs/bug-110.ent | 1 + tests/docs/bug-110.xml | 9 + tests/docs/bug-111.xml | 17 + tests/docs/bug-112.xml | 1 + tests/docs/bug-113.xml | 7 + tests/docs/bug-114.xml | 7 + tests/docs/bug-115.xml | 1 + tests/docs/bug-116.xml | 1 + tests/docs/bug-117.xml | 10 + tests/docs/bug-118.xml | 6 + tests/docs/bug-119.xml | 12 + tests/docs/bug-12-.xml | 9 + tests/docs/bug-120.xml | 15 + tests/docs/bug-121.xml | 1 + tests/docs/bug-122.xml | 11 + tests/docs/bug-123.xml | 2 + tests/docs/bug-124.xml | 6 + tests/docs/bug-125.xml | 118 + tests/docs/bug-126.xml | 1 + tests/docs/bug-127.xml | 1 + tests/docs/bug-128.xml | 26 + tests/docs/bug-129.xml | 6 + tests/docs/bug-13-.xml | 1 + tests/docs/bug-130.doc | 7 + tests/docs/bug-130.xml | 4 + tests/docs/bug-131.xml | 3 + tests/docs/bug-132.xml | 6 + tests/docs/bug-133.xml | 7 + tests/docs/bug-134.xml | 5 + tests/docs/bug-135.xml | 5 + tests/docs/bug-136.xml | 4 + tests/docs/bug-137.xml | 1 + tests/docs/bug-138.xml | 15 + tests/docs/bug-139.xml | 9 + tests/docs/bug-14-.xml | 7 + tests/docs/bug-140.xml | 6 + tests/docs/bug-141.xml | 9 + tests/docs/bug-142.xml | 65 + tests/docs/bug-143.xml | 1 + tests/docs/bug-144.xml | 1 + tests/docs/bug-145.xml | 10 + tests/docs/bug-146.xml | 28 + tests/docs/bug-147.xml | 21 + tests/docs/bug-148.xml | 1 + tests/docs/bug-149.xml | 1 + tests/docs/bug-15-.xml | 5 + tests/docs/bug-150.xml | 1 + tests/docs/bug-151.xml | 1 + tests/docs/bug-152.xml | 1 + tests/docs/bug-153.doc | 4 + tests/docs/bug-153.xml | 9 + tests/docs/bug-154.xml | 1 + tests/docs/bug-155.xml | 5 + tests/docs/bug-156.xml | 1 + tests/docs/bug-157.xml | 6 + tests/docs/bug-158.doc | 3 + tests/docs/bug-158.xml | 2 + tests/docs/bug-159.xml | 1 + tests/docs/bug-16-.xml | 17 + tests/docs/bug-160.xml | 8 + tests/docs/bug-161.xml | 5 + tests/docs/bug-163.xml | 5 + tests/docs/bug-164.xml | 4 + tests/docs/bug-165.xml | 10 + tests/docs/bug-166.xml | 15255 +++++++++++ tests/docs/bug-167.xml | 1 + tests/docs/bug-168.xml | 9 + tests/docs/bug-169.xml | 1 + tests/docs/bug-17-.xml | 1 + tests/docs/bug-170.xml | 3 + tests/docs/bug-171.xml | 4 + tests/docs/bug-172.xml | 6 + tests/docs/bug-173.xml | 1 + tests/docs/bug-174.xml | 1 + tests/docs/bug-175.xml | 1 + tests/docs/bug-176.xml | 1 + tests/docs/bug-177.xml | 1 + tests/docs/bug-178.xml | 1 + tests/docs/bug-179.xml | 1 + tests/docs/bug-18-.xml | 3 + tests/docs/bug-180.xml | 2 + tests/docs/bug-181.xml | 4 + tests/docs/bug-182.xml | 4 + tests/docs/bug-183.xml | 5 + tests/docs/bug-184.xml | 1 + tests/docs/bug-185-data.xml | 5 + tests/docs/bug-185.xml | 2 + tests/docs/bug-186.xml | 4 + tests/docs/bug-187.xml | 1 + tests/docs/bug-19-.xml | 3 + tests/docs/bug-2-.xml | 12 + tests/docs/bug-20-.xml | 7 + tests/docs/bug-21-.xml | 8 + tests/docs/bug-22-.xml | 18 + tests/docs/bug-23-.xml | 21 + tests/docs/bug-24-.xml | 2419 ++ tests/docs/bug-25-.xml | 1 + tests/docs/bug-26-.xml | 1 + tests/docs/bug-27-.xml | 1 + tests/docs/bug-28-.xml | 1 + tests/docs/bug-29-.ent | 7 + tests/docs/bug-29-.xml | 5 + tests/docs/bug-3-.xml | 1 + tests/docs/bug-30-.xml | 1 + tests/docs/bug-31-.xml | 4 + tests/docs/bug-32-.xml | 1 + tests/docs/bug-33-.xml | 14 + tests/docs/bug-35-.xml | 1 + tests/docs/bug-36-.xml | 5 + tests/docs/bug-37-.xml | 5 + tests/docs/bug-38-.xml | 17 + tests/docs/bug-39-.xml | 3 + tests/docs/bug-4-.xml | 38 + tests/docs/bug-40-.xml | 1 + tests/docs/bug-41-.xml | 1 + tests/docs/bug-42-.xml | 1 + tests/docs/bug-43-.xml | 1 + tests/docs/bug-44-.xml | 1 + tests/docs/bug-45-.xml | 1 + tests/docs/bug-46-.xml | 1 + tests/docs/bug-47-.xml | 1 + tests/docs/bug-48-.xml | 1 + tests/docs/bug-49-.xml | 1 + tests/docs/bug-5-.xml | 475 + tests/docs/bug-50-.xml | 3 + tests/docs/bug-52.xml | 12 + tests/docs/bug-53.xml | 6 + tests/docs/bug-54.xml | 2 + tests/docs/bug-55.xml | 3 + tests/docs/bug-56.xml | 1 + tests/docs/bug-57.xml | 8 + tests/docs/bug-59.xml | 1 + tests/docs/bug-6-.xml | 6 + tests/docs/bug-60.xml | 1 + tests/docs/bug-61.xml | 1 + tests/docs/bug-62.xml | 1 + tests/docs/bug-63.xml | 13 + tests/docs/bug-64.xml | 1 + tests/docs/bug-65.xml | 5 + tests/docs/bug-66.xml | 8 + tests/docs/bug-68.xml | 1 + tests/docs/bug-69.xml | 2 + tests/docs/bug-7-.xml | 3 + tests/docs/bug-70.xml | 10 + tests/docs/bug-71.xml | 1 + tests/docs/bug-72.xml | 3 + tests/docs/bug-73.xml | 5 + tests/docs/bug-74.xml | 3 + tests/docs/bug-75.xml | 1 + tests/docs/bug-76.xml | 4 + tests/docs/bug-77.xml | 4 + tests/docs/bug-78.xml | 8 + tests/docs/bug-79.xml | 4 + tests/docs/bug-8-.xml | 5 + tests/docs/bug-80.xml | 6 + tests/docs/bug-81.xml | 12 + tests/docs/bug-82.xml | 4 + tests/docs/bug-83.xml | 1 + tests/docs/bug-84.xml | 22 + tests/docs/bug-86.xml | 7 + tests/docs/bug-87.xml | 6 + tests/docs/bug-88.xml | 1 + tests/docs/bug-89.xml | 13 + tests/docs/bug-9-.xml | 3 + tests/docs/bug-90.xml | 15 + tests/docs/bug-91.xml | 4 + tests/docs/bug-92.xml | 19 + tests/docs/bug-93.xml | 1 + tests/docs/bug-94.xml | 9 + tests/docs/bug-95.xml | 5 + tests/docs/bug-96.xml | 5 + tests/docs/bug-97.xml | 16 + tests/docs/bug-98.xml | 10 + tests/docs/bug-99.xml | 1 + tests/docs/character.xml | 23 + tests/docs/date_add.xml | 1 + tests/docs/items.xml | 34 + tests/documents/Makefile.am | 42 + tests/documents/bredfort.css | 53 + tests/documents/bredfort.xsl | 104 + tests/documents/doc_file.xml | 2 + tests/documents/docfile.xml | 2 + tests/documents/fragment.result | 2 + tests/documents/fragment.xml | 1 + tests/documents/fragment.xsl | 12 + tests/documents/fragment2.xml | 3 + tests/documents/index.xml | 10 + tests/documents/menu.xml | 5 + tests/documents/message.result | 2 + tests/documents/message.xml | 5 + tests/documents/message.xsl | 19 + tests/documents/result.xhtml | 16 + tests/documents/system.xml | 29 + tests/documents/test.result | 3 + tests/documents/test.xml | 5 + tests/documents/test.xsl | 16 + tests/documents/test_bad.err | 2 + tests/documents/test_bad.result | 3 + tests/documents/test_bad.xml | 5 + tests/documents/worklog.xml | 64 + tests/exslt/Makefile.am | 11 + tests/exslt/common/Makefile.am | 56 + tests/exslt/common/import-test1.out | 5 + tests/exslt/common/import-test1.xml | 5 + tests/exslt/common/import-test1.xsl | 33 + tests/exslt/common/import-test1a.imp | 31 + tests/exslt/common/import-test1b.imp | 28 + tests/exslt/common/node-set.1.out | 2 + tests/exslt/common/node-set.1.xml | 5 + tests/exslt/common/node-set.1.xsl | 18 + tests/exslt/common/node-set.2.out | 2 + tests/exslt/common/node-set.2.xml | 5 + tests/exslt/common/node-set.2.xsl | 18 + tests/exslt/common/node-set.3.out | 6 + tests/exslt/common/node-set.3.xml | 5 + tests/exslt/common/node-set.3.xsl | 13 + tests/exslt/common/node-set.4.out | 2 + tests/exslt/common/node-set.4.xml | 37 + tests/exslt/common/node-set.4.xsl | 37 + tests/exslt/common/node-set.5.out | 300 + tests/exslt/common/node-set.5.xml | 210 + tests/exslt/common/node-set.5.xsl | 133 + tests/exslt/common/node-set.6.out | 1206 + tests/exslt/common/node-set.6.xml | 210 + tests/exslt/common/node-set.6.xsl | 142 + tests/exslt/common/node-set.7.out | 2 + tests/exslt/common/node-set.7.xml | 1 + tests/exslt/common/node-set.7.xsl | 28 + tests/exslt/common/node-set.8.out | 2 + tests/exslt/common/node-set.8.xml | 2 + tests/exslt/common/node-set.8.xsl | 30 + tests/exslt/common/object-type.1.out | 9 + tests/exslt/common/object-type.1.xml | 5 + tests/exslt/common/object-type.1.xsl | 31 + tests/exslt/crypto/Makefile.am | 47 + tests/exslt/crypto/crypt.1.out | 19 + tests/exslt/crypto/crypt.1.xml | 19 + tests/exslt/crypto/crypt.1.xsl | 32 + tests/exslt/crypto/hash.1.out | 21 + tests/exslt/crypto/hash.1.xml | 31 + tests/exslt/crypto/hash.1.xsl | 36 + tests/exslt/date/Makefile.am | 87 + tests/exslt/date/add-duration.1.out | 47 + tests/exslt/date/add-duration.1.xml | 27 + tests/exslt/date/add-duration.1.xsl | 16 + tests/exslt/date/add-duration.2.out | 13 + tests/exslt/date/add-duration.2.xml | 12 + tests/exslt/date/add-duration.2.xsl | 16 + tests/exslt/date/add.1.out | 31 + tests/exslt/date/add.1.xml | 19 + tests/exslt/date/add.1.xsl | 16 + tests/exslt/date/add.2.out | 13 + tests/exslt/date/add.2.xml | 12 + tests/exslt/date/add.2.xsl | 16 + tests/exslt/date/current.xsl | 47 + tests/exslt/date/date.1.out | 182 + tests/exslt/date/date.1.xml | 15 + tests/exslt/date/date.1.xsl | 46 + tests/exslt/date/date.2.out | 129 + tests/exslt/date/date.2.xml | 13 + tests/exslt/date/date.2.xsl | 46 + tests/exslt/date/datetime.1.out | 92 + tests/exslt/date/datetime.1.xml | 10 + tests/exslt/date/datetime.1.xsl | 46 + tests/exslt/date/datetime.2.out | 309 + tests/exslt/date/datetime.2.xml | 22 + tests/exslt/date/datetime.2.xsl | 46 + tests/exslt/date/difference.1.out | 37 + tests/exslt/date/difference.1.xml | 27 + tests/exslt/date/difference.1.xsl | 16 + tests/exslt/date/difference.2.out | 9 + tests/exslt/date/difference.2.xml | 9 + tests/exslt/date/difference.2.xsl | 16 + tests/exslt/date/duration.1.out | 29 + tests/exslt/date/duration.1.xml | 18 + tests/exslt/date/duration.1.xsl | 16 + tests/exslt/date/duration.2.out | 15 + tests/exslt/date/duration.2.xml | 12 + tests/exslt/date/duration.2.xsl | 16 + tests/exslt/date/gday.1.out | 74 + tests/exslt/date/gday.1.xml | 9 + tests/exslt/date/gday.1.xsl | 46 + tests/exslt/date/gday.2.out | 75 + tests/exslt/date/gday.2.xml | 10 + tests/exslt/date/gday.2.xsl | 46 + tests/exslt/date/gmonth.1.out | 74 + tests/exslt/date/gmonth.1.xml | 9 + tests/exslt/date/gmonth.1.xsl | 46 + tests/exslt/date/gmonth.2.out | 57 + tests/exslt/date/gmonth.2.xml | 9 + tests/exslt/date/gmonth.2.xsl | 46 + tests/exslt/date/gmonthday.1.out | 110 + tests/exslt/date/gmonthday.1.xml | 11 + tests/exslt/date/gmonthday.1.xsl | 46 + tests/exslt/date/gmonthday.2.out | 57 + tests/exslt/date/gmonthday.2.xml | 9 + tests/exslt/date/gmonthday.2.xsl | 46 + tests/exslt/date/gyear.1.out | 92 + tests/exslt/date/gyear.1.xml | 10 + tests/exslt/date/gyear.1.xsl | 46 + tests/exslt/date/gyear.2.out | 39 + tests/exslt/date/gyear.2.xml | 8 + tests/exslt/date/gyear.2.xsl | 46 + tests/exslt/date/gyearmonth.1.out | 92 + tests/exslt/date/gyearmonth.1.xml | 10 + tests/exslt/date/gyearmonth.1.xsl | 46 + tests/exslt/date/gyearmonth.2.out | 39 + tests/exslt/date/gyearmonth.2.xml | 8 + tests/exslt/date/gyearmonth.2.xsl | 46 + tests/exslt/date/seconds.1.out | 53 + tests/exslt/date/seconds.1.xml | 33 + tests/exslt/date/seconds.1.xsl | 16 + tests/exslt/date/seconds.2.out | 27 + tests/exslt/date/seconds.2.xml | 21 + tests/exslt/date/seconds.2.xsl | 16 + tests/exslt/date/sum.1.out | 21 + tests/exslt/date/sum.1.xml | 63 + tests/exslt/date/sum.1.xsl | 20 + tests/exslt/date/sum.2.err | 0 tests/exslt/date/sum.2.out | 21 + tests/exslt/date/sum.2.xml | 55 + tests/exslt/date/sum.2.xsl | 20 + tests/exslt/date/time.1.out | 128 + tests/exslt/date/time.1.xml | 12 + tests/exslt/date/time.1.xsl | 46 + tests/exslt/date/time.2.out | 219 + tests/exslt/date/time.2.xml | 18 + tests/exslt/date/time.2.xsl | 46 + tests/exslt/dynamic/Makefile.am | 46 + tests/exslt/dynamic/dynmap.out | 44 + tests/exslt/dynamic/dynmap.xml | 29 + tests/exslt/dynamic/dynmap.xsl | 27 + tests/exslt/functions/Makefile.am | 55 + tests/exslt/functions/function.1.out | 2 + tests/exslt/functions/function.1.xml | 26 + tests/exslt/functions/function.1.xsl | 19 + tests/exslt/functions/function.10.out | 2 + tests/exslt/functions/function.10.xml | 5 + tests/exslt/functions/function.10.xsl | 25 + tests/exslt/functions/function.2.out | 4 + tests/exslt/functions/function.2.xml | 26 + tests/exslt/functions/function.2.xsl | 22 + tests/exslt/functions/function.3.out | 25 + tests/exslt/functions/function.3.xml | 26 + tests/exslt/functions/function.3.xsl | 23 + tests/exslt/functions/function.4.out | 2 + tests/exslt/functions/function.4.xml | 26 + tests/exslt/functions/function.4.xsl | 21 + tests/exslt/functions/function.5.out | 2 + tests/exslt/functions/function.5.xml | 26 + tests/exslt/functions/function.5.xsl | 24 + tests/exslt/functions/function.6.out | 8 + tests/exslt/functions/function.6.xml | 26 + tests/exslt/functions/function.6.xsl | 32 + tests/exslt/functions/function.7.out | 2 + tests/exslt/functions/function.7.xml | 26 + tests/exslt/functions/function.7.xsl | 13 + tests/exslt/functions/function.8.out | 2 + tests/exslt/functions/function.8.xml | 22 + tests/exslt/functions/function.8.xsl | 64 + tests/exslt/functions/function.9.out | 6 + tests/exslt/functions/function.9.xml | 9 + tests/exslt/functions/function.9.xsl | 24 + tests/exslt/math/Makefile.am | 57 + tests/exslt/math/highest.1.out | 2 + tests/exslt/math/highest.1.xml | 7 + tests/exslt/math/highest.1.xsl | 14 + tests/exslt/math/highest.2.out | 2 + tests/exslt/math/highest.2.xml | 2 + tests/exslt/math/highest.2.xsl | 14 + tests/exslt/math/highest.5.out | 8 + tests/exslt/math/highest.5.xml | 10 + tests/exslt/math/highest.5.xsl | 18 + tests/exslt/math/lowest.1.out | 2 + tests/exslt/math/lowest.1.xml | 7 + tests/exslt/math/lowest.1.xsl | 14 + tests/exslt/math/lowest.2.out | 2 + tests/exslt/math/lowest.2.xml | 2 + tests/exslt/math/lowest.2.xsl | 14 + tests/exslt/math/max.1.out | 2 + tests/exslt/math/max.1.xml | 7 + tests/exslt/math/max.1.xsl | 14 + tests/exslt/math/max.2.out | 2 + tests/exslt/math/max.2.xml | 2 + tests/exslt/math/max.2.xsl | 14 + tests/exslt/math/max.3.out | 4 + tests/exslt/math/max.3.xml | 9 + tests/exslt/math/max.3.xsl | 80 + tests/exslt/math/max.5.out | 4 + tests/exslt/math/max.5.xml | 6 + tests/exslt/math/max.5.xsl | 10 + tests/exslt/math/min.1.out | 2 + tests/exslt/math/min.1.xml | 7 + tests/exslt/math/min.1.xsl | 14 + tests/exslt/math/min.2.out | 2 + tests/exslt/math/min.2.xml | 2 + tests/exslt/math/min.2.xsl | 14 + tests/exslt/math/power.1.out | 8 + tests/exslt/math/power.1.xml | 8 + tests/exslt/math/power.1.xsl | 19 + tests/exslt/saxon/Makefile.am | 49 + tests/exslt/saxon/eval.1.out | 4 + tests/exslt/saxon/eval.1.xml | 3 + tests/exslt/saxon/eval.1.xsl | 22 + tests/exslt/saxon/eval.2.err | 7 + tests/exslt/saxon/eval.2.out | 2 + tests/exslt/saxon/eval.2.xml | 1 + tests/exslt/saxon/eval.2.xsl | 16 + tests/exslt/saxon/eval.3.err | 6 + tests/exslt/saxon/eval.3.out | 2 + tests/exslt/saxon/eval.3.xml | 1 + tests/exslt/saxon/eval.3.xsl | 16 + tests/exslt/saxon/lineno.1.out | 6 + tests/exslt/saxon/lineno.1.xml | 9 + tests/exslt/saxon/lineno.1.xsl | 24 + tests/exslt/sets/Makefile.am | 50 + tests/exslt/sets/difference.1.out | 28 + tests/exslt/sets/difference.1.xml | 14 + tests/exslt/sets/difference.1.xsl | 46 + tests/exslt/sets/distinct.1.out | 19 + tests/exslt/sets/distinct.1.xml | 14 + tests/exslt/sets/distinct.1.xsl | 24 + tests/exslt/sets/has-same-node.1.out | 11 + tests/exslt/sets/has-same-node.1.xml | 14 + tests/exslt/sets/has-same-node.1.xsl | 24 + tests/exslt/sets/leading.1.out | 10 + tests/exslt/sets/leading.1.xml | 5 + tests/exslt/sets/leading.1.xsl | 22 + tests/exslt/sets/trailing.1.out | 9 + tests/exslt/sets/trailing.1.xml | 5 + tests/exslt/sets/trailing.1.xsl | 21 + tests/exslt/strings/Makefile.am | 52 + tests/exslt/strings/align.1.out | 8 + tests/exslt/strings/align.1.xml | 9 + tests/exslt/strings/align.1.xsl | 22 + tests/exslt/strings/padding.1.out | 27 + tests/exslt/strings/padding.1.xml | 10 + tests/exslt/strings/padding.1.xsl | 40 + tests/exslt/strings/replace.1.out | 32 + tests/exslt/strings/replace.1.xml | 16 + tests/exslt/strings/replace.1.xsl | 49 + tests/exslt/strings/split.1.out | 16 + tests/exslt/strings/split.1.xml | 1 + tests/exslt/strings/split.1.xsl | 26 + tests/exslt/strings/tokenize.1.out | 17 + tests/exslt/strings/tokenize.1.xml | 5 + tests/exslt/strings/tokenize.1.xsl | 26 + tests/exslt/strings/tokenize.2.out | 2 + tests/exslt/strings/tokenize.2.xml | 1 + tests/exslt/strings/tokenize.2.xsl | 13 + tests/exslt/strings/tokenize.3.out | 17 + tests/exslt/strings/tokenize.3.xml | 25 + tests/exslt/strings/tokenize.3.xsl | 28 + tests/extensions/Makefile.am | 51 + tests/extensions/evaluate.out | 2 + tests/extensions/evaluate.xml | 11 + tests/extensions/evaluate.xsl | 26 + tests/extensions/list.out | 40 + tests/extensions/list.xml | 1 + tests/extensions/list.xsl | 88 + tests/extensions/module.out | 3 + tests/extensions/module.xml | 1 + tests/extensions/module.xsl | 12 + tests/general/Makefile.am | 276 + tests/general/array.out | 4 + tests/general/array.xsl | 26 + tests/general/bug-1-.out | 6 + tests/general/bug-1-.xsl | 21 + tests/general/bug-10-.out | 2 + tests/general/bug-10-.xsl | 10 + tests/general/bug-100.out | 2 + tests/general/bug-100.xsl | 9 + tests/general/bug-101.out | 2 + tests/general/bug-101.xsl | 8 + tests/general/bug-102-inc.out | 3 + tests/general/bug-102-inc.xsl | 21 + tests/general/bug-102.out | 3 + tests/general/bug-102.xsl | 10 + tests/general/bug-103.out | 2 + tests/general/bug-103.xsl | 13 + tests/general/bug-104.out | 2 + tests/general/bug-104.xsl | 10 + tests/general/bug-105.out | 2 + tests/general/bug-105.xsl | 8 + tests/general/bug-106.out | 2 + tests/general/bug-106.xsl | 12 + tests/general/bug-107.out | 8 + tests/general/bug-107.xsl | 11 + tests/general/bug-108.out | 25 + tests/general/bug-108.xsl | 21 + tests/general/bug-109.out | 3 + tests/general/bug-109.xsl | 7 + tests/general/bug-11-.out | 1 + tests/general/bug-11-.xsl | 12 + tests/general/bug-110.err | 0 tests/general/bug-110.out | 1 + tests/general/bug-110.xsl | 20 + tests/general/bug-111.out | 6 + tests/general/bug-111.xsl | 45 + tests/general/bug-112.out | 2 + tests/general/bug-112.xsl | 22 + tests/general/bug-113.out | 4 + tests/general/bug-113.xsl | 15 + tests/general/bug-114.out | 3 + tests/general/bug-114.xsl | 16 + tests/general/bug-115.out | 2 + tests/general/bug-115.xsl | 19 + tests/general/bug-116.out | 2 + tests/general/bug-116.xsl | 22 + tests/general/bug-117.out | 5 + tests/general/bug-117.xsl | 59 + tests/general/bug-118.out | 3 + tests/general/bug-118.xsl | 14 + tests/general/bug-119.out | 10 + tests/general/bug-119.xsl | 12 + tests/general/bug-12-.out | 2 + tests/general/bug-12-.xsl | 16 + tests/general/bug-120.out | 8 + tests/general/bug-120.xsl | 27 + tests/general/bug-121.out | 1 + tests/general/bug-121.xsl | 8 + tests/general/bug-122.out | 2 + tests/general/bug-122.xsl | 17 + tests/general/bug-123.out | 2 + tests/general/bug-123.xsl | 14 + tests/general/bug-124.out | 2 + tests/general/bug-124.xsl | 14 + tests/general/bug-125.out | 351 + tests/general/bug-125.xsl | 99 + tests/general/bug-126.out | 9 + tests/general/bug-126.xsl | 17 + tests/general/bug-127.out | 1 + tests/general/bug-127.xsl | 18 + tests/general/bug-128.out | 5 + tests/general/bug-128.xsl | 26 + tests/general/bug-129.out | 6 + tests/general/bug-129.xsl | 10 + tests/general/bug-13-.out | 2 + tests/general/bug-13-.xsl | 10 + tests/general/bug-130-imp1.imp | 25 + tests/general/bug-130-imp2.imp | 14 + tests/general/bug-130-imp3.imp | 16 + tests/general/bug-130-imp4.imp | 22 + tests/general/bug-130.out | 1 + tests/general/bug-130.xsl | 22 + tests/general/bug-131-imp.imp | 19 + tests/general/bug-131.out | 2 + tests/general/bug-131.xsl | 13 + tests/general/bug-132.out | 6 + tests/general/bug-132.xsl | 13 + tests/general/bug-133.out | 6 + tests/general/bug-133.xsl | 32 + tests/general/bug-134.out | 2 + tests/general/bug-134.xsl | 12 + tests/general/bug-135.out | 2 + tests/general/bug-135.xsl | 10 + tests/general/bug-136.out | 4 + tests/general/bug-136.xsl | 8 + tests/general/bug-137.imp | 12 + tests/general/bug-137.out | 2 + tests/general/bug-137.xsl | 8 + tests/general/bug-138.out | 23 + tests/general/bug-138.xsl | 28 + tests/general/bug-139.out | 4 + tests/general/bug-139.xsl | 14 + tests/general/bug-14-.out | 4 + tests/general/bug-14-.xsl | 23 + tests/general/bug-140.out | 4 + tests/general/bug-140.xsl | 32 + tests/general/bug-141.out | 46 + tests/general/bug-141.xsl | 25 + tests/general/bug-142.out | 35 + tests/general/bug-142.xsl | 85 + tests/general/bug-143.out | 2 + tests/general/bug-143.xsl | 10 + tests/general/bug-144.out | 2 + tests/general/bug-144.xsl | 10 + tests/general/bug-145.err | 5 + tests/general/bug-145.out | 0 tests/general/bug-145.xsl | 10 + tests/general/bug-146.out | 6 + tests/general/bug-146.xsl | 24 + tests/general/bug-147-1.imp | 11 + tests/general/bug-147-2.imp | 11 + tests/general/bug-147-3.imp | 57 + tests/general/bug-147-4.imp | 15 + tests/general/bug-147-5.imp | 27 + tests/general/bug-147-6.imp | 31 + tests/general/bug-147.out | 17 + tests/general/bug-147.xsl | 29 + tests/general/bug-148.out | 2 + tests/general/bug-148.xsl | 13 + tests/general/bug-149.out | 2 + tests/general/bug-149.xsl | 11 + tests/general/bug-15-.out | 5 + tests/general/bug-15-.xsl | 15 + tests/general/bug-150.out | 2 + tests/general/bug-150.xsl | 9 + tests/general/bug-151.out | 0 tests/general/bug-151.xsl | 15 + tests/general/bug-152.out | 12 + tests/general/bug-152.xsl | 30 + tests/general/bug-153.out | 2 + tests/general/bug-153.xsl | 19 + tests/general/bug-154.out | 0 tests/general/bug-154.xsl | 4 + tests/general/bug-155.out | 3 + tests/general/bug-155.xsl | 10 + tests/general/bug-156.err | 2 + tests/general/bug-156.imp1.imp | 16 + tests/general/bug-156.imp2.imp | 10 + tests/general/bug-156.out | 0 tests/general/bug-156.xsl | 12 + tests/general/bug-157.err | 3 + tests/general/bug-157.out | 9 + tests/general/bug-157.xsl | 22 + tests/general/bug-158.out | 4 + tests/general/bug-158.xsl | 19 + tests/general/bug-159.out | 8 + tests/general/bug-159.xsl | 17 + tests/general/bug-16-.out | 14 + tests/general/bug-16-.xsl | 13 + tests/general/bug-160.out | 7 + tests/general/bug-160.xsl | 14 + tests/general/bug-161.out | 6 + tests/general/bug-161.xsl | 18 + tests/general/bug-163.out | 2 + tests/general/bug-163.xsl | 6 + tests/general/bug-164.out | 4 + tests/general/bug-164.xsl | 13 + tests/general/bug-165.err | 4 + tests/general/bug-165.out | 8 + tests/general/bug-165.xsl | 9 + tests/general/bug-166.out | 15256 +++++++++++ tests/general/bug-166.xsl | 131 + tests/general/bug-167.out | 1 + tests/general/bug-167.xsl | 20 + tests/general/bug-168.out | 2 + tests/general/bug-168.xsl | 9 + tests/general/bug-169.imp | 5 + tests/general/bug-169.out | 2 + tests/general/bug-169.xsl | 11 + tests/general/bug-17-.out | 2 + tests/general/bug-17-.xsl | 7 + tests/general/bug-170.out | 4 + tests/general/bug-170.xsl | 6 + tests/general/bug-171.out | 2 + tests/general/bug-171.xsl | 7 + tests/general/bug-172.out | 6 + tests/general/bug-172.xsl | 22 + tests/general/bug-173.out | 1 + tests/general/bug-173.xsl | 11 + tests/general/bug-174.err | 1 + tests/general/bug-174.out | 0 tests/general/bug-174.xsl | 18 + tests/general/bug-175.err | 6 + tests/general/bug-175.out | 8 + tests/general/bug-175.xsl | 30 + tests/general/bug-176.out | 2 + tests/general/bug-176.xsl | 11 + tests/general/bug-177.out | 2 + tests/general/bug-177.xsl | 7 + tests/general/bug-178.out | 2 + tests/general/bug-178.xsl | 18 + tests/general/bug-179.out | 9 + tests/general/bug-179.xsl | 24 + tests/general/bug-18-.out | 2 + tests/general/bug-18-.xsl | 17 + tests/general/bug-180.err | 2 + tests/general/bug-180.out | 0 tests/general/bug-180.xsl | 8 + tests/general/bug-181.out | 5 + tests/general/bug-181.xsl | 13 + tests/general/bug-182.out | 2 + tests/general/bug-182.xsl | 21 + tests/general/bug-183.out | 2 + tests/general/bug-183.xsl | 9 + tests/general/bug-184.err | 5 + tests/general/bug-184.out | 2 + tests/general/bug-184.xsl | 8 + tests/general/bug-185.err | 3 + tests/general/bug-185.out | 0 tests/general/bug-185.xsl | 14 + tests/general/bug-186.out | 5 + tests/general/bug-186.xsl | 7 + tests/general/bug-187.err | 6 + tests/general/bug-187.out | 14 + tests/general/bug-187.xsl | 42 + tests/general/bug-19-.out | 2 + tests/general/bug-19-.xsl | 17 + tests/general/bug-2-.out | 8 + tests/general/bug-2-.xsl | 16 + tests/general/bug-20-.out | 4 + tests/general/bug-20-.xsl | 22 + tests/general/bug-21-.out | 2 + tests/general/bug-21-.xsl | 7 + tests/general/bug-22-.out | 12 + tests/general/bug-22-.xsl | 19 + tests/general/bug-23-.out | 15 + tests/general/bug-23-.xsl | 20 + tests/general/bug-24-.out | 27 + tests/general/bug-24-.xsl | 22 + tests/general/bug-25-.out | 3 + tests/general/bug-25-.xsl | 10 + tests/general/bug-26-.out | 2 + tests/general/bug-26-.xsl | 9 + tests/general/bug-27-.out | 2 + tests/general/bug-27-.xsl | 14 + tests/general/bug-28-.out | 1 + tests/general/bug-28-.xsl | 9 + tests/general/bug-29-.out | 10 + tests/general/bug-29-.xsl | 16 + tests/general/bug-3-.out | 2 + tests/general/bug-3-.xsl | 13 + tests/general/bug-30-.out | 2 + tests/general/bug-30-.xsl | 7 + tests/general/bug-31-.out | 3 + tests/general/bug-31-.xsl | 10 + tests/general/bug-32-.out | 2 + tests/general/bug-32-.xsl | 17 + tests/general/bug-33-.out | 16 + tests/general/bug-33-.xsl | 29 + tests/general/bug-35-.out | 2 + tests/general/bug-35-.xsl | 10 + tests/general/bug-36-.out | 4 + tests/general/bug-36-.xsl | 8 + tests/general/bug-36-inc.out | 4 + tests/general/bug-36-inc.xsl | 16 + tests/general/bug-37-.out | 4 + tests/general/bug-37-.xsl | 8 + tests/general/bug-37-inc.out | 4 + tests/general/bug-37-inc.xsl | 15 + tests/general/bug-38-.out | 2 + tests/general/bug-38-.xsl | 17 + tests/general/bug-39-.out | 3 + tests/general/bug-39-.xsl | 34 + tests/general/bug-4-.out | 6 + tests/general/bug-4-.xsl | 12 + tests/general/bug-40-.out | 2 + tests/general/bug-40-.xsl | 16 + tests/general/bug-41-.out | 2 + tests/general/bug-41-.xsl | 19 + tests/general/bug-42-.out | 2 + tests/general/bug-42-.xsl | 16 + tests/general/bug-43-.out | 2 + tests/general/bug-43-.xsl | 19 + tests/general/bug-44-.out | 2 + tests/general/bug-44-.xsl | 19 + tests/general/bug-45-.out | 2 + tests/general/bug-45-.xsl | 27 + tests/general/bug-46-.out | 2 + tests/general/bug-46-.xsl | 16 + tests/general/bug-47-.out | 2 + tests/general/bug-47-.xsl | 18 + tests/general/bug-48-.out | 2 + tests/general/bug-48-.xsl | 24 + tests/general/bug-49-.out | 2 + tests/general/bug-49-.xsl | 15 + tests/general/bug-5-.out | 954 + tests/general/bug-5-.xsl | 158 + tests/general/bug-50-.out | 7 + tests/general/bug-50-.xsl | 14 + tests/general/bug-52.out | 3 + tests/general/bug-52.xsl | 16 + tests/general/bug-53.out | 1 + tests/general/bug-53.xsl | 11 + tests/general/bug-54.out | 2 + tests/general/bug-54.xsl | 22 + tests/general/bug-55.out | 2 + tests/general/bug-55.xsl | 9 + tests/general/bug-56.out | 3 + tests/general/bug-56.xsl | 28 + tests/general/bug-57.out | 2 + tests/general/bug-57.xsl | 21 + tests/general/bug-58.xsl | 274 + tests/general/bug-59.out | 2 + tests/general/bug-59.xsl | 9 + tests/general/bug-6-.out | 4 + tests/general/bug-6-.xsl | 32 + tests/general/bug-60.err | 2 + tests/general/bug-60.out | 2 + tests/general/bug-60.xsl | 15 + tests/general/bug-61.out | 10 + tests/general/bug-61.xsl | 14 + tests/general/bug-62-inc.out | 0 tests/general/bug-62-inc.xsl | 4 + tests/general/bug-62.out | 2 + tests/general/bug-62.xsl | 8 + tests/general/bug-63.out | 22 + tests/general/bug-63.xsl | 13 + tests/general/bug-64.out | 2 + tests/general/bug-64.xsl | 8 + tests/general/bug-65.ent | 7 + tests/general/bug-65.out | 8 + tests/general/bug-65.xsl | 26 + tests/general/bug-66.out | 2 + tests/general/bug-66.xsl | 12 + tests/general/bug-68.out | 1 + tests/general/bug-68.xsl | 8 + tests/general/bug-69.out | 2 + tests/general/bug-69.xsl | 12 + tests/general/bug-7-.out | 2 + tests/general/bug-7-.xsl | 11 + tests/general/bug-70.out | 9 + tests/general/bug-70.xsl | 13 + tests/general/bug-71.out | 2 + tests/general/bug-71.xsl | 17 + tests/general/bug-72.out | 6 + tests/general/bug-72.xsl | 31 + tests/general/bug-73.out | 3 + tests/general/bug-73.xsl | 17 + tests/general/bug-74.out | 2 + tests/general/bug-74.xsl | 12 + tests/general/bug-75.out | 6 + tests/general/bug-75.xsl | 9 + tests/general/bug-76.out | 4 + tests/general/bug-76.xsl | 16 + tests/general/bug-77.out | 5 + tests/general/bug-77.xsl | 18 + tests/general/bug-78.out | 3 + tests/general/bug-78.xsl | 17 + tests/general/bug-79.out | 5 + tests/general/bug-79.xsl | 4 + tests/general/bug-8-.out | 3 + tests/general/bug-8-.xsl | 13 + tests/general/bug-80.out | 2 + tests/general/bug-80.xsl | 29 + tests/general/bug-81.out | 4 + tests/general/bug-81.xsl | 18 + tests/general/bug-82.out | 5 + tests/general/bug-82.xsl | 12 + tests/general/bug-83.out | 1 + tests/general/bug-83.xsl | 14 + tests/general/bug-84.out | 15 + tests/general/bug-84.xsl | 14 + tests/general/bug-86.out | 6 + tests/general/bug-86.xsl | 7 + tests/general/bug-87.out | 5 + tests/general/bug-87.xsl | 16 + tests/general/bug-88.out | 2 + tests/general/bug-88.xsl | 6 + tests/general/bug-89.out | 12 + tests/general/bug-89.xsl | 105 + tests/general/bug-9-.out | 2 + tests/general/bug-9-.xsl | 10 + tests/general/bug-90.out | 13 + tests/general/bug-90.xsl | 35 + tests/general/bug-91.out | 3 + tests/general/bug-91.xsl | 8 + tests/general/bug-92.out | 15 + tests/general/bug-92.xsl | 19 + tests/general/bug-93-inc.out | 3 + tests/general/bug-93-inc.xsl | 12 + tests/general/bug-93.out | 3 + tests/general/bug-93.xsl | 7 + tests/general/bug-94.out | 2 + tests/general/bug-94.xsl | 35 + tests/general/bug-95.out | 4 + tests/general/bug-95.xsl | 22 + tests/general/bug-96.out | 5 + tests/general/bug-96.xsl | 10 + tests/general/bug-97.out | 9 + tests/general/bug-97.xsl | 32 + tests/general/bug-98.out | 6 + tests/general/bug-98.xsl | 31 + tests/general/bug-99.out | 2 + tests/general/bug-99.xsl | 16 + tests/general/character.out | 2 + tests/general/character.xsl | 16 + tests/general/character2.out | 2 + tests/general/character2.xsl | 16 + tests/general/date_add.out | 9 + tests/general/date_add.xsl | 16 + tests/general/inner.xsl | 12 + tests/general/itemschoose.out | 35 + tests/general/itemschoose.xsl | 37 + tests/keys/Makefile.am | 23 + tests/keys/dates.xml | 7 + tests/keys/month.out | 7 + tests/keys/month.xml | 9 + tests/keys/month.xsl | 19 + tests/multiple/Makefile.am | 52 + tests/multiple/dict.dtd | 114 + tests/multiple/dict.xml | 7827 ++++++ tests/multiple/dict.xsl | 141 + tests/multiple/out/lettera.orig | 223 + tests/multiple/out/letterb.orig | 985 + tests/multiple/out/letterc.orig | 1047 + tests/multiple/out/letterd.orig | 367 + tests/multiple/out/lettere.orig | 94 + tests/multiple/out/letterf.orig | 558 + tests/multiple/out/letterg.orig | 555 + tests/multiple/out/letterh.orig | 467 + tests/multiple/out/letterij.orig | 216 + tests/multiple/out/letterk.orig | 210 + tests/multiple/out/letterl.orig | 327 + tests/multiple/out/letterm.orig | 393 + tests/multiple/out/lettern.orig | 269 + tests/multiple/out/lettero.orig | 80 + tests/multiple/out/letterp.orig | 482 + tests/multiple/out/letterq.orig | 179 + tests/multiple/out/letterr.orig | 608 + tests/multiple/out/letters.orig | 1050 + tests/multiple/out/lettert.orig | 704 + tests/multiple/out/letteruv.orig | 158 + tests/multiple/out/letterw.orig | 489 + tests/multiple/out/letterx.orig | 18 + tests/multiple/out/lettery.orig | 78 + tests/multiple/out/letterz.orig | 37 + tests/multiple/out/titlepage.orig | 29 + tests/multiple/result.xml | 0 tests/namespaces/Makefile.am | 59 + tests/namespaces/extra.out | 2 + tests/namespaces/extra.xml | 1 + tests/namespaces/extra.xsl | 8 + tests/namespaces/extra2.err | 3 + tests/namespaces/extra2.out | 0 tests/namespaces/extra2.xml | 1 + tests/namespaces/extra2.xsl | 10 + tests/namespaces/tst.out | 13 + tests/namespaces/tst.xml | 10 + tests/namespaces/tst.xsl | 8 + tests/namespaces/tst2.out | 13 + tests/namespaces/tst2.xml | 10 + tests/namespaces/tst2.xsl | 9 + tests/namespaces/tst3.out | 13 + tests/namespaces/tst3.xml | 10 + tests/namespaces/tst3.xsl | 9 + tests/namespaces/tst4.out | 6 + tests/namespaces/tst4.xml | 6 + tests/namespaces/tst4.xsl | 14 + tests/namespaces/tst5.out | 11 + tests/namespaces/tst5.xml | 4 + tests/namespaces/tst5.xsl | 24 + tests/namespaces/tst6.out | 13 + tests/namespaces/tst6.xml | 12 + tests/namespaces/tst6.xsl | 7 + tests/namespaces/tst7.out | 13 + tests/namespaces/tst7.xml | 2 + tests/namespaces/tst7.xsl | 21 + tests/namespaces/tst8.out | 7 + tests/namespaces/tst8.xml | 2 + tests/namespaces/tst8.xsl | 18 + tests/namespaces/tst9.out | 8 + tests/namespaces/tst9.xml | 11 + tests/namespaces/tst9.xsl | 11 + tests/numbers/Makefile.am | 21 + tests/numbers/format-number.out | 94 + tests/numbers/format-number.xml | 13 + tests/numbers/format-number.xsl | 130 + tests/plugins/Makefile.am | 42 + tests/plugins/plugin.out | 3 + tests/plugins/plugin.xml | 1 + tests/plugins/plugin.xsl | 12 + tests/plugins/testplugin.c | 339 + tests/reports/Makefile.am | 57 + tests/reports/cmdlineparams.out | 4 + tests/reports/cmdlineparams.xml | 2 + tests/reports/cmdlineparams.xsl | 11 + tests/reports/recglobparam.err | 8 + tests/reports/recglobparam.out | 0 tests/reports/recglobparam.xml | 1 + tests/reports/recglobparam.xsl | 5 + tests/reports/recglobvar.err | 8 + tests/reports/recglobvar.out | 0 tests/reports/recglobvar.xml | 1 + tests/reports/recglobvar.xsl | 5 + tests/reports/reclocparam.err | 6 + tests/reports/reclocparam.out | 0 tests/reports/reclocparam.xml | 1 + tests/reports/reclocparam.xsl | 8 + tests/reports/reclocvar.err | 6 + tests/reports/reclocvar.out | 0 tests/reports/reclocvar.xml | 1 + tests/reports/reclocvar.xsl | 8 + tests/reports/tst-1.err | 2 + tests/reports/tst-1.out | 0 tests/reports/tst-1.xml | 1 + tests/reports/tst-1.xsl | 8 + tests/reports/tst-2.err | 6 + tests/reports/tst-2.out | 0 tests/reports/tst-2.xml | 1 + tests/reports/tst-2.xsl | 10 + tests/reports/undefvar.err | 7 + tests/reports/undefvar.out | 0 tests/reports/undefvar.xml | 4 + tests/reports/undefvar.xsl | 8 + tests/xinclude/Makefile.am | 33 + tests/xinclude/e.xml | 2 + tests/xinclude/e.xsl | 14 + tests/xinclude/normal.out | 5 + tests/xinclude/x1.xml | 5 + tests/xinclude/x2.xml | 4 + tests/xinclude/xinclude.out | 7 + tests/xmlspec/Makefile.am | 46 + tests/xmlspec/REC-xml-20001006-review.html | 2585 ++ tests/xmlspec/REC-xml-20001006.html | 2495 ++ tests/xmlspec/REC-xml-20001006.xml | 3277 +++ tests/xmlspec/REC-xml-2e.xsl | 31 + tests/xmlspec/W3C-REC.css | 94 + tests/xmlspec/diffspec.xsl | 329 + tests/xmlspec/logo-REC | Bin 0 -> 778 bytes tests/xmlspec/xmlspec-v21.dtd | 1734 ++ tests/xmlspec/xmlspec.xsl | 2092 ++ vms/build_xslt.com | 342 + vms/diffs.vms | 34 + vms/readme.vms | 141 + win32/Makefile.mingw | 308 + win32/Makefile.msvc | 369 + win32/Readme.txt | 133 + win32/configure.js | 507 + win32/defgen.xsl | 44 + win32/libexslt.def.src | 20 + win32/libxslt.def.src | 258 + win32/libxslt/libxslt.def | 149 + win32/libxslt/libxslt.dsw | 44 + win32/libxslt/libxslt_so.dsp | 247 + win32/libxslt/xsltproc.dsp | 102 + win32/runtests.py | 87 + xslt-config.in | 137 + xsltConf.sh.in | 7 + xsltproc/Makefile.am | 44 + xsltproc/testThreads.c | 273 + xsltproc/xsltproc.c | 941 + 2183 files changed, 490437 insertions(+) create mode 100644 .gitignore create mode 100644 AUTHORS create mode 100644 ChangeLog create mode 100644 Copyright create mode 100644 FEATURES create mode 100644 HACKING create mode 100644 INSTALL create mode 100644 MAINTAINERS create mode 100644 Makefile.am create mode 100644 NEWS create mode 100644 NOTES create mode 100644 README create mode 100644 README.cvs-commits create mode 100644 TODO create mode 100755 autogen.sh create mode 100644 config.h.in create mode 100644 configure.in create mode 100644 doc/API.html create mode 100644 doc/APIchunk0.html create mode 100644 doc/APIchunk1.html create mode 100644 doc/APIchunk10.html create mode 100644 doc/APIchunk11.html create mode 100644 doc/APIchunk12.html create mode 100644 doc/APIchunk13.html create mode 100644 doc/APIchunk2.html create mode 100644 doc/APIchunk3.html create mode 100644 doc/APIchunk4.html create mode 100644 doc/APIchunk5.html create mode 100644 doc/APIchunk6.html create mode 100644 doc/APIchunk7.html create mode 100644 doc/APIchunk8.html create mode 100644 doc/APIchunk9.html create mode 100644 doc/APIconstructors.html create mode 100644 doc/APIfiles.html create mode 100644 doc/APIfunctions.html create mode 100644 doc/APIsymbols.html create mode 100644 doc/ChangeLog.xsl create mode 100644 doc/EXSLT/APIchunk0.html create mode 100644 doc/EXSLT/APIconstructors.html create mode 100644 doc/EXSLT/APIfiles.html create mode 100644 doc/EXSLT/APIfunctions.html create mode 100644 doc/EXSLT/APIsymbols.html create mode 100644 doc/EXSLT/bugs.html create mode 100644 doc/EXSLT/docs.html create mode 100644 doc/EXSLT/downloads.html create mode 100644 doc/EXSLT/exslt.html create mode 100644 doc/EXSLT/help.html create mode 100644 doc/EXSLT/html/book1.html create mode 100644 doc/EXSLT/html/home.png create mode 100644 doc/EXSLT/html/index.html create mode 100644 doc/EXSLT/html/left.png create mode 100644 doc/EXSLT/html/libexslt-exslt.html create mode 100644 doc/EXSLT/html/libexslt-exsltexports.html create mode 100644 doc/EXSLT/html/libexslt-lib.html create mode 100644 doc/EXSLT/html/right.png create mode 100644 doc/EXSLT/html/up.png create mode 100644 doc/EXSLT/index.html create mode 100644 doc/EXSLT/intro.html create mode 100644 doc/EXSLT/libexslt-api.xml create mode 100644 doc/EXSLT/libexslt-refs.xml create mode 100644 doc/FAQ.html create mode 100644 doc/Libxslt-Logo-180x168.gif create mode 100644 doc/Libxslt-Logo-90x34.gif create mode 100644 doc/Makefile.am create mode 100644 doc/api.xsl create mode 100755 doc/apibuild.py create mode 100644 doc/bugs.html create mode 100644 doc/checkapisym.xsl create mode 100644 doc/contexts.fig create mode 100644 doc/contexts.gif create mode 100644 doc/contribs.html create mode 100644 doc/docbook.html create mode 100644 doc/docs.html create mode 100644 doc/downloads.html create mode 100644 doc/duck.png create mode 100644 doc/epatents.png create mode 100644 doc/extensions.html create mode 100644 doc/gnome2.png create mode 100644 doc/help.html create mode 100644 doc/html/book1.html create mode 100644 doc/html/home.png create mode 100644 doc/html/index.html create mode 100644 doc/html/left.png create mode 100644 doc/html/libxslt-attributes.html create mode 100644 doc/html/libxslt-documents.html create mode 100644 doc/html/libxslt-extensions.html create mode 100644 doc/html/libxslt-extra.html create mode 100644 doc/html/libxslt-functions.html create mode 100644 doc/html/libxslt-imports.html create mode 100644 doc/html/libxslt-keys.html create mode 100644 doc/html/libxslt-lib.html create mode 100644 doc/html/libxslt-namespaces.html create mode 100644 doc/html/libxslt-numbersInternals.html create mode 100644 doc/html/libxslt-pattern.html create mode 100644 doc/html/libxslt-preproc.html create mode 100644 doc/html/libxslt-security.html create mode 100644 doc/html/libxslt-templates.html create mode 100644 doc/html/libxslt-transform.html create mode 100644 doc/html/libxslt-variables.html create mode 100644 doc/html/libxslt-xslt.html create mode 100644 doc/html/libxslt-xsltInternals.html create mode 100644 doc/html/libxslt-xsltexports.html create mode 100644 doc/html/libxslt-xsltlocale.html create mode 100644 doc/html/libxslt-xsltutils.html create mode 100644 doc/html/right.png create mode 100644 doc/html/up.png create mode 100644 doc/images/callouts/1.png create mode 100644 doc/images/callouts/10.png create mode 100644 doc/images/callouts/2.png create mode 100644 doc/images/callouts/3.png create mode 100644 doc/images/callouts/4.png create mode 100644 doc/images/callouts/5.png create mode 100644 doc/images/callouts/6.png create mode 100644 doc/images/callouts/7.png create mode 100644 doc/images/callouts/8.png create mode 100644 doc/images/callouts/9.png create mode 100644 doc/index.html create mode 100755 doc/index.py create mode 100644 doc/internals.html create mode 100644 doc/intro.html create mode 100644 doc/libxslt-api.xml create mode 100644 doc/libxslt-decl.txt create mode 100644 doc/libxslt-refs.xml create mode 100644 doc/libxslt.xml create mode 100644 doc/libxslt.xsa create mode 100644 doc/newapi.xsl create mode 100644 doc/news.html create mode 100644 doc/news.xsl create mode 100644 doc/node.fig create mode 100644 doc/node.gif create mode 100644 doc/object.fig create mode 100644 doc/object.gif create mode 100644 doc/processing.fig create mode 100644 doc/processing.gif create mode 100644 doc/python.html create mode 100644 doc/redhat.gif create mode 100644 doc/search.php create mode 100644 doc/search.php.inc create mode 100644 doc/search.templ create mode 100644 doc/search.xml create mode 100644 doc/site.xsl create mode 100644 doc/smallfootonly.gif create mode 100644 doc/stylesheet.fig create mode 100644 doc/stylesheet.gif create mode 100644 doc/symbols.xml create mode 100644 doc/syms.xsl create mode 100644 doc/templates.fig create mode 100644 doc/templates.gif create mode 100644 doc/tutorial/libxslt_tutorial.c create mode 100644 doc/tutorial/libxslttutorial.html create mode 100644 doc/tutorial/libxslttutorial.xml create mode 100644 doc/tutorial2/libxslt_pipes.c create mode 100644 doc/tutorial2/libxslt_pipes.html create mode 100644 doc/tutorial2/libxslt_pipes.xml create mode 100644 doc/w3c.png create mode 100644 doc/xsa.xsl create mode 100644 doc/xslt.html create mode 100644 doc/xsltproc.1 create mode 100644 doc/xsltproc.html create mode 100644 doc/xsltproc.xml create mode 100644 doc/xsltproc2.html create mode 100644 examples/xsltICUSort.c create mode 100644 libexslt.pc.in create mode 100644 libexslt/Makefile.am create mode 100644 libexslt/common.c create mode 100644 libexslt/crypto.c create mode 100644 libexslt/date.c create mode 100644 libexslt/dynamic.c create mode 100644 libexslt/exslt.c create mode 100644 libexslt/exslt.h create mode 100644 libexslt/exsltconfig.h.in create mode 100644 libexslt/exsltexports.h create mode 100644 libexslt/functions.c create mode 100644 libexslt/libexslt.3 create mode 100644 libexslt/libexslt.h create mode 100644 libexslt/math.c create mode 100644 libexslt/saxon.c create mode 100644 libexslt/sets.c create mode 100644 libexslt/strings.c create mode 100644 libxslt.doap create mode 100644 libxslt.m4 create mode 100644 libxslt.pc.in create mode 100644 libxslt.spec.in create mode 100644 libxslt/Makefile.am create mode 100644 libxslt/attributes.c create mode 100644 libxslt/attributes.h create mode 100644 libxslt/attrvt.c create mode 100644 libxslt/documents.c create mode 100644 libxslt/documents.h create mode 100644 libxslt/extensions.c create mode 100644 libxslt/extensions.h create mode 100644 libxslt/extra.c create mode 100644 libxslt/extra.h create mode 100644 libxslt/functions.c create mode 100644 libxslt/functions.h create mode 100644 libxslt/imports.c create mode 100644 libxslt/imports.h create mode 100644 libxslt/keys.c create mode 100644 libxslt/keys.h create mode 100644 libxslt/libxslt.3 create mode 100644 libxslt/libxslt.h create mode 100644 libxslt/libxslt.syms create mode 100644 libxslt/namespaces.c create mode 100644 libxslt/namespaces.h create mode 100644 libxslt/numbers.c create mode 100644 libxslt/numbersInternals.h create mode 100644 libxslt/pattern.c create mode 100644 libxslt/pattern.h create mode 100644 libxslt/preproc.c create mode 100644 libxslt/preproc.h create mode 100644 libxslt/security.c create mode 100644 libxslt/security.h create mode 100644 libxslt/templates.c create mode 100644 libxslt/templates.h create mode 100644 libxslt/transform.c create mode 100644 libxslt/transform.h create mode 100644 libxslt/trio.h create mode 100644 libxslt/triodef.h create mode 100644 libxslt/variables.c create mode 100644 libxslt/variables.h create mode 100644 libxslt/win32config.h create mode 100644 libxslt/xslt.c create mode 100644 libxslt/xslt.h create mode 100644 libxslt/xsltInternals.h create mode 100644 libxslt/xsltconfig.h.in create mode 100644 libxslt/xsltexports.h create mode 100644 libxslt/xsltlocale.c create mode 100644 libxslt/xsltlocale.h create mode 100644 libxslt/xsltutils.c create mode 100644 libxslt/xsltutils.h create mode 100644 libxslt/xsltwin32config.h create mode 100644 libxslt/xsltwin32config.h.in create mode 100644 python/Makefile.am create mode 100644 python/TODO create mode 100755 python/generator.py create mode 100644 python/libxml_wrap.h create mode 100644 python/libxsl.py create mode 100644 python/libxslt-python-api.xml create mode 100644 python/libxslt.c create mode 100644 python/libxslt_wrap.h create mode 100644 python/libxsltclass.txt create mode 100644 python/tests/Makefile.am create mode 100755 python/tests/basic.py create mode 100755 python/tests/exslt.py create mode 100644 python/tests/extelem.py create mode 100755 python/tests/extfunc.py create mode 100755 python/tests/pyxsltproc.py create mode 100644 python/tests/test.xml create mode 100644 python/tests/test.xsl create mode 100644 python/types.c create mode 100644 tests/Makefile.am create mode 100644 tests/REC/Makefile.am create mode 100644 tests/REC/article.xsl create mode 100644 tests/REC/bigfont.xsl create mode 100644 tests/REC/stand-2.7-1.dtd create mode 100644 tests/REC/stand-2.7-1.out create mode 100644 tests/REC/stand-2.7-1.stand.out create mode 100644 tests/REC/stand-2.7-1.xml create mode 100644 tests/REC/stand-2.7-1.xsl create mode 100644 tests/REC/stand-2.7-2.stand.out create mode 100644 tests/REC/stand-2.7-2.xml create mode 100644 tests/REC/stand-2.7-3.stand.out create mode 100644 tests/REC/stand-2.7-3.xml create mode 100644 tests/REC/test-10-1.out create mode 100644 tests/REC/test-10-1.xml create mode 100644 tests/REC/test-10-1.xsl create mode 100644 tests/REC/test-10-2.out create mode 100644 tests/REC/test-10-2.xml create mode 100644 tests/REC/test-10-2.xsl create mode 100644 tests/REC/test-11.2-1.out create mode 100644 tests/REC/test-11.2-1.xml create mode 100644 tests/REC/test-11.2-1.xsl create mode 100644 tests/REC/test-11.2-2.out create mode 100644 tests/REC/test-11.2-2.xml create mode 100644 tests/REC/test-11.2-2.xsl create mode 100644 tests/REC/test-11.2-3.out create mode 100644 tests/REC/test-11.2-3.xml create mode 100644 tests/REC/test-11.2-3.xsl create mode 100644 tests/REC/test-11.2-4.out create mode 100644 tests/REC/test-11.2-4.xml create mode 100644 tests/REC/test-11.2-4.xsl create mode 100644 tests/REC/test-11.2-5.out create mode 100644 tests/REC/test-11.2-5.xml create mode 100644 tests/REC/test-11.2-5.xsl create mode 100644 tests/REC/test-11.2-6.out create mode 100644 tests/REC/test-11.2-6.xml create mode 100644 tests/REC/test-11.2-6.xsl create mode 100644 tests/REC/test-12.2-1.out create mode 100644 tests/REC/test-12.2-1.xml create mode 100644 tests/REC/test-12.2-1.xsl create mode 100644 tests/REC/test-12.2-2.out create mode 100644 tests/REC/test-12.2-2.xml create mode 100644 tests/REC/test-12.2-2.xsl create mode 100644 tests/REC/test-15-1.out create mode 100644 tests/REC/test-15-1.xml create mode 100644 tests/REC/test-15-1.xsl create mode 100644 tests/REC/test-16.1-1.out create mode 100644 tests/REC/test-16.1-1.xml create mode 100644 tests/REC/test-16.1-1.xsl create mode 100644 tests/REC/test-16.1-2.out create mode 100644 tests/REC/test-16.1-2.xml create mode 100644 tests/REC/test-16.1-2.xsl create mode 100644 tests/REC/test-2.3-1.out create mode 100644 tests/REC/test-2.3-1.xml create mode 100644 tests/REC/test-2.3-1.xsl create mode 100644 tests/REC/test-2.3-2.out create mode 100644 tests/REC/test-2.3-2.xml create mode 100644 tests/REC/test-2.3-2.xsl create mode 100644 tests/REC/test-2.5-1.err create mode 100644 tests/REC/test-2.5-1.out create mode 100644 tests/REC/test-2.5-1.xml create mode 100644 tests/REC/test-2.5-1.xsl create mode 100644 tests/REC/test-2.6.2-1.out create mode 100644 tests/REC/test-2.6.2-1.xml create mode 100644 tests/REC/test-2.6.2-1.xsl create mode 100644 tests/REC/test-3.4-1.out create mode 100644 tests/REC/test-3.4-1.xml create mode 100644 tests/REC/test-3.4-1.xsl create mode 100644 tests/REC/test-3.4-2.out create mode 100644 tests/REC/test-3.4-2.xml create mode 100644 tests/REC/test-3.4-2.xsl create mode 100644 tests/REC/test-3.4-3.out create mode 100644 tests/REC/test-3.4-3.xml create mode 100644 tests/REC/test-3.4-3.xsl create mode 100644 tests/REC/test-5.2-1.out create mode 100644 tests/REC/test-5.2-1.xml create mode 100644 tests/REC/test-5.2-1.xsl create mode 100644 tests/REC/test-5.2-10.out create mode 100644 tests/REC/test-5.2-10.xml create mode 100644 tests/REC/test-5.2-10.xsl create mode 100644 tests/REC/test-5.2-11.out create mode 100644 tests/REC/test-5.2-11.xml create mode 100644 tests/REC/test-5.2-11.xsl create mode 100644 tests/REC/test-5.2-12.out create mode 100644 tests/REC/test-5.2-12.xml create mode 100644 tests/REC/test-5.2-12.xsl create mode 100644 tests/REC/test-5.2-13.out create mode 100644 tests/REC/test-5.2-13.xml create mode 100644 tests/REC/test-5.2-13.xsl create mode 100644 tests/REC/test-5.2-14.out create mode 100644 tests/REC/test-5.2-14.xml create mode 100644 tests/REC/test-5.2-14.xsl create mode 100644 tests/REC/test-5.2-15.out create mode 100644 tests/REC/test-5.2-15.xml create mode 100644 tests/REC/test-5.2-15.xsl create mode 100644 tests/REC/test-5.2-16.out create mode 100644 tests/REC/test-5.2-16.xml create mode 100644 tests/REC/test-5.2-16.xsl create mode 100644 tests/REC/test-5.2-17.out create mode 100644 tests/REC/test-5.2-17.xml create mode 100644 tests/REC/test-5.2-17.xsl create mode 100644 tests/REC/test-5.2-18.out create mode 100644 tests/REC/test-5.2-18.xml create mode 100644 tests/REC/test-5.2-18.xsl create mode 100644 tests/REC/test-5.2-19.out create mode 100644 tests/REC/test-5.2-19.xml create mode 100644 tests/REC/test-5.2-19.xsl create mode 100644 tests/REC/test-5.2-2.out create mode 100644 tests/REC/test-5.2-2.xml create mode 100644 tests/REC/test-5.2-2.xsl create mode 100644 tests/REC/test-5.2-20.out create mode 100644 tests/REC/test-5.2-20.xml create mode 100644 tests/REC/test-5.2-20.xsl create mode 100644 tests/REC/test-5.2-21.out create mode 100644 tests/REC/test-5.2-21.xml create mode 100644 tests/REC/test-5.2-21.xsl create mode 100644 tests/REC/test-5.2-22.out create mode 100644 tests/REC/test-5.2-22.xml create mode 100644 tests/REC/test-5.2-22.xsl create mode 100644 tests/REC/test-5.2-3.out create mode 100644 tests/REC/test-5.2-3.xml create mode 100644 tests/REC/test-5.2-3.xsl create mode 100644 tests/REC/test-5.2-4.out create mode 100644 tests/REC/test-5.2-4.xml create mode 100644 tests/REC/test-5.2-4.xsl create mode 100644 tests/REC/test-5.2-5.out create mode 100644 tests/REC/test-5.2-5.xml create mode 100644 tests/REC/test-5.2-5.xsl create mode 100644 tests/REC/test-5.2-6.out create mode 100644 tests/REC/test-5.2-6.xml create mode 100644 tests/REC/test-5.2-6.xsl create mode 100644 tests/REC/test-5.2-7.out create mode 100644 tests/REC/test-5.2-7.xml create mode 100644 tests/REC/test-5.2-7.xsl create mode 100644 tests/REC/test-5.2-8.out create mode 100644 tests/REC/test-5.2-8.xml create mode 100644 tests/REC/test-5.2-8.xsl create mode 100644 tests/REC/test-5.2-9.out create mode 100644 tests/REC/test-5.2-9.xml create mode 100644 tests/REC/test-5.2-9.xsl create mode 100644 tests/REC/test-5.3.out create mode 100644 tests/REC/test-5.3.xml create mode 100644 tests/REC/test-5.3.xsl create mode 100644 tests/REC/test-5.4-1.out create mode 100644 tests/REC/test-5.4-1.xml create mode 100644 tests/REC/test-5.4-1.xsl create mode 100644 tests/REC/test-5.4-2.out create mode 100644 tests/REC/test-5.4-2.xml create mode 100644 tests/REC/test-5.4-2.xsl create mode 100644 tests/REC/test-5.4-3.out create mode 100644 tests/REC/test-5.4-3.xml create mode 100644 tests/REC/test-5.4-3.xsl create mode 100644 tests/REC/test-5.4-4.out create mode 100644 tests/REC/test-5.4-4.xml create mode 100644 tests/REC/test-5.4-4.xsl create mode 100644 tests/REC/test-5.4-5.out create mode 100644 tests/REC/test-5.4-5.xml create mode 100644 tests/REC/test-5.4-5.xsl create mode 100644 tests/REC/test-5.8.out create mode 100644 tests/REC/test-5.8.xml create mode 100644 tests/REC/test-5.8.xsl create mode 100644 tests/REC/test-6.1.err create mode 100644 tests/REC/test-6.1.out create mode 100644 tests/REC/test-6.1.xml create mode 100644 tests/REC/test-6.1.xsl create mode 100644 tests/REC/test-6.out create mode 100644 tests/REC/test-6.xml create mode 100644 tests/REC/test-6.xsl create mode 100644 tests/REC/test-7.1.1-2.out create mode 100644 tests/REC/test-7.1.1-2.xml create mode 100644 tests/REC/test-7.1.1-2.xsl create mode 100644 tests/REC/test-7.1.1-3.out create mode 100644 tests/REC/test-7.1.1-3.xml create mode 100644 tests/REC/test-7.1.1-3.xsl create mode 100644 tests/REC/test-7.1.1.out create mode 100644 tests/REC/test-7.1.1.xml create mode 100644 tests/REC/test-7.1.1.xsl create mode 100644 tests/REC/test-7.1.3.out create mode 100644 tests/REC/test-7.1.3.xml create mode 100644 tests/REC/test-7.1.3.xsl create mode 100644 tests/REC/test-7.1.4.out create mode 100644 tests/REC/test-7.1.4.xml create mode 100644 tests/REC/test-7.1.4.xsl create mode 100644 tests/REC/test-7.3.out create mode 100644 tests/REC/test-7.3.xml create mode 100644 tests/REC/test-7.3.xsl create mode 100644 tests/REC/test-7.4.out create mode 100644 tests/REC/test-7.4.xml create mode 100644 tests/REC/test-7.4.xsl create mode 100644 tests/REC/test-7.5-1.out create mode 100644 tests/REC/test-7.5-1.xml create mode 100644 tests/REC/test-7.5-1.xsl create mode 100644 tests/REC/test-7.6.1-1.out create mode 100644 tests/REC/test-7.6.1-1.xml create mode 100644 tests/REC/test-7.6.1-1.xsl create mode 100644 tests/REC/test-7.6.1-2.out create mode 100644 tests/REC/test-7.6.1-2.xml create mode 100644 tests/REC/test-7.6.1-2.xsl create mode 100644 tests/REC/test-7.6.1-3.out create mode 100644 tests/REC/test-7.6.1-3.xml create mode 100644 tests/REC/test-7.6.1-3.xsl create mode 100644 tests/REC/test-7.6.2-1.out create mode 100644 tests/REC/test-7.6.2-1.xml create mode 100644 tests/REC/test-7.6.2-1.xsl create mode 100644 tests/REC/test-7.6.2-2.out create mode 100644 tests/REC/test-7.6.2-2.xml create mode 100644 tests/REC/test-7.6.2-2.xsl create mode 100644 tests/REC/test-7.7-1.out create mode 100644 tests/REC/test-7.7-1.xml create mode 100644 tests/REC/test-7.7-1.xsl create mode 100644 tests/REC/test-7.7-2.out create mode 100644 tests/REC/test-7.7-2.xml create mode 100644 tests/REC/test-7.7-2.xsl create mode 100644 tests/REC/test-7.7-3.out create mode 100644 tests/REC/test-7.7-3.xml create mode 100644 tests/REC/test-7.7-3.xsl create mode 100644 tests/REC/test-7.7-4.out create mode 100644 tests/REC/test-7.7-4.xml create mode 100644 tests/REC/test-7.7-4.xsl create mode 100644 tests/REC/test-7.7-5.out create mode 100644 tests/REC/test-7.7-5.xml create mode 100644 tests/REC/test-7.7-5.xsl create mode 100644 tests/REC/test-8-1.out create mode 100644 tests/REC/test-8-1.xml create mode 100644 tests/REC/test-8-1.xsl create mode 100644 tests/REC/test-9.1-1.out create mode 100644 tests/REC/test-9.1-1.xml create mode 100644 tests/REC/test-9.1-1.xsl create mode 100644 tests/REC/test-9.1-2.out create mode 100644 tests/REC/test-9.1-2.xml create mode 100644 tests/REC/test-9.1-2.xsl create mode 100644 tests/REC/test-9.2-1.xsl create mode 100644 tests/REC1/Makefile.am create mode 100644 tests/REC1/doc.dtd create mode 100644 tests/REC1/doc.xml create mode 100644 tests/REC1/doc.xsl create mode 100644 tests/REC1/result.xml create mode 100644 tests/REC2/Makefile.am create mode 100644 tests/REC2/data.xml create mode 100644 tests/REC2/html.xml create mode 100644 tests/REC2/html.xsl create mode 100644 tests/REC2/svg.xml create mode 100644 tests/REC2/svg.xsl create mode 100644 tests/REC2/vrml.xml create mode 100644 tests/REC2/vrml.xsl create mode 100644 tests/XSLTMark/Makefile.am create mode 100644 tests/XSLTMark/alphabetize.out create mode 100644 tests/XSLTMark/alphabetize.ref create mode 100644 tests/XSLTMark/alphabetize.xsl create mode 100644 tests/XSLTMark/attsets.out create mode 100644 tests/XSLTMark/attsets.ref create mode 100644 tests/XSLTMark/attsets.xsl create mode 100644 tests/XSLTMark/avts.out create mode 100644 tests/XSLTMark/avts.ref create mode 100644 tests/XSLTMark/avts.xsl create mode 100644 tests/XSLTMark/axis.out create mode 100644 tests/XSLTMark/axis.ref create mode 100644 tests/XSLTMark/axis.xml create mode 100644 tests/XSLTMark/axis.xsl create mode 100644 tests/XSLTMark/backwards.out create mode 100644 tests/XSLTMark/backwards.ref create mode 100644 tests/XSLTMark/backwards.xsl create mode 100644 tests/XSLTMark/bottles.out create mode 100644 tests/XSLTMark/bottles.ref create mode 100644 tests/XSLTMark/bottles.xml create mode 100644 tests/XSLTMark/bottles.xsl create mode 100644 tests/XSLTMark/breadth.out create mode 100644 tests/XSLTMark/breadth.ref create mode 100644 tests/XSLTMark/breadth.xml create mode 100644 tests/XSLTMark/brutal.out create mode 100644 tests/XSLTMark/brutal.ref create mode 100644 tests/XSLTMark/brutal.xml create mode 100644 tests/XSLTMark/brutal.xsl create mode 100644 tests/XSLTMark/chart.out create mode 100644 tests/XSLTMark/chart.ref create mode 100644 tests/XSLTMark/chart.xml create mode 100644 tests/XSLTMark/chart.xsl create mode 100644 tests/XSLTMark/creation.out create mode 100644 tests/XSLTMark/creation.ref create mode 100644 tests/XSLTMark/creation.xsl create mode 100644 tests/XSLTMark/current.out create mode 100644 tests/XSLTMark/current.ref create mode 100644 tests/XSLTMark/current.xml create mode 100644 tests/XSLTMark/current.xsl create mode 100755 tests/XSLTMark/dbgen.pl create mode 100644 tests/XSLTMark/dbhtml.xsl create mode 100644 tests/XSLTMark/dbonerow.out create mode 100644 tests/XSLTMark/dbonerow.ref create mode 100644 tests/XSLTMark/dbonerow.xsl create mode 100644 tests/XSLTMark/dbsql10.ref create mode 100644 tests/XSLTMark/dbsql10.xsl create mode 100644 tests/XSLTMark/dbsql100.ref create mode 100644 tests/XSLTMark/dbsql100.xsl create mode 100644 tests/XSLTMark/dbsql1000.ref create mode 100644 tests/XSLTMark/dbsql1000.xsl create mode 100644 tests/XSLTMark/dbsql2000.ref create mode 100644 tests/XSLTMark/dbsql2000.xsl create mode 100644 tests/XSLTMark/dbsql250.ref create mode 100644 tests/XSLTMark/dbsql250.xsl create mode 100644 tests/XSLTMark/dbsql50.ref create mode 100644 tests/XSLTMark/dbsql50.xsl create mode 100644 tests/XSLTMark/dbsql500.ref create mode 100644 tests/XSLTMark/dbsql500.xsl create mode 100644 tests/XSLTMark/dbsql750.ref create mode 100644 tests/XSLTMark/dbsql750.xsl create mode 100644 tests/XSLTMark/dbtail.out create mode 100644 tests/XSLTMark/dbtail.ref create mode 100644 tests/XSLTMark/dbtail.xsl create mode 100644 tests/XSLTMark/decoy.out create mode 100644 tests/XSLTMark/decoy.xsl create mode 100644 tests/XSLTMark/depth.out create mode 100644 tests/XSLTMark/depth.ref create mode 100644 tests/XSLTMark/depth.xml create mode 100644 tests/XSLTMark/encrypt.out create mode 100644 tests/XSLTMark/encrypt.ref create mode 100644 tests/XSLTMark/encrypt.xsl create mode 100644 tests/XSLTMark/find.xsl create mode 100644 tests/XSLTMark/functions.out create mode 100644 tests/XSLTMark/functions.ref create mode 100644 tests/XSLTMark/functions.xsl create mode 100644 tests/XSLTMark/game.out create mode 100644 tests/XSLTMark/game.ref create mode 100644 tests/XSLTMark/game.xml create mode 100644 tests/XSLTMark/game.xsl create mode 100644 tests/XSLTMark/gettysburg.xml create mode 100644 tests/XSLTMark/html.out create mode 100644 tests/XSLTMark/html.ref create mode 100644 tests/XSLTMark/html.xml create mode 100644 tests/XSLTMark/html.xsl create mode 100644 tests/XSLTMark/identity.out create mode 100644 tests/XSLTMark/identity.ref create mode 100644 tests/XSLTMark/identity.xml create mode 100644 tests/XSLTMark/identity.xsl create mode 100644 tests/XSLTMark/inventory.out create mode 100644 tests/XSLTMark/inventory.ref create mode 100644 tests/XSLTMark/inventory.xml create mode 100644 tests/XSLTMark/inventory.xsl create mode 100644 tests/XSLTMark/metric.out create mode 100644 tests/XSLTMark/metric.ref create mode 100644 tests/XSLTMark/metric.xml create mode 100644 tests/XSLTMark/metric.xsl create mode 100644 tests/XSLTMark/number.out create mode 100644 tests/XSLTMark/number.xml create mode 100644 tests/XSLTMark/number.xsl create mode 100644 tests/XSLTMark/oddtemplate.out create mode 100644 tests/XSLTMark/oddtemplate.ref create mode 100644 tests/XSLTMark/oddtemplate.xml create mode 100644 tests/XSLTMark/oddtemplate.xsl create mode 100644 tests/XSLTMark/patterns.out create mode 100644 tests/XSLTMark/patterns.ref create mode 100644 tests/XSLTMark/patterns.xsl create mode 100644 tests/XSLTMark/prettyprint.out create mode 100644 tests/XSLTMark/prettyprint.ref create mode 100644 tests/XSLTMark/prettyprint.xsl create mode 100644 tests/XSLTMark/priority.out create mode 100644 tests/XSLTMark/priority.ref create mode 100644 tests/XSLTMark/priority.xml create mode 100644 tests/XSLTMark/priority.xsl create mode 100644 tests/XSLTMark/products.out create mode 100644 tests/XSLTMark/products.ref create mode 100644 tests/XSLTMark/products.xml create mode 100644 tests/XSLTMark/products.xsl create mode 100644 tests/XSLTMark/queens.out create mode 100644 tests/XSLTMark/queens.ref create mode 100644 tests/XSLTMark/queens.xml create mode 100644 tests/XSLTMark/queens.xsl create mode 100644 tests/XSLTMark/reverser.out create mode 100644 tests/XSLTMark/reverser.ref create mode 100644 tests/XSLTMark/reverser.xsl create mode 100644 tests/XSLTMark/stringsort.out create mode 100644 tests/XSLTMark/stringsort.ref create mode 100644 tests/XSLTMark/stringsort.xsl create mode 100644 tests/XSLTMark/summarize.out create mode 100644 tests/XSLTMark/summarize.ref create mode 100644 tests/XSLTMark/summarize.xsl create mode 100644 tests/XSLTMark/total.out create mode 100644 tests/XSLTMark/total.ref create mode 100644 tests/XSLTMark/total.xsl create mode 100644 tests/XSLTMark/tower.out create mode 100644 tests/XSLTMark/tower.ref create mode 100644 tests/XSLTMark/tower.xml create mode 100644 tests/XSLTMark/tower.xsl create mode 100644 tests/XSLTMark/tower2.xsl create mode 100644 tests/XSLTMark/trend.out create mode 100644 tests/XSLTMark/trend.ref create mode 100644 tests/XSLTMark/trend.xml create mode 100644 tests/XSLTMark/trend.xsl create mode 100644 tests/XSLTMark/union.out create mode 100644 tests/XSLTMark/union.ref create mode 100644 tests/XSLTMark/union.xml create mode 100644 tests/XSLTMark/union.xsl create mode 100644 tests/XSLTMark/xpath.out create mode 100644 tests/XSLTMark/xpath.ref create mode 100644 tests/XSLTMark/xpath.xml create mode 100644 tests/XSLTMark/xpath.xsl create mode 100644 tests/XSLTMark/xslbench1.out create mode 100644 tests/XSLTMark/xslbench1.xml create mode 100644 tests/XSLTMark/xslbench1.xsl create mode 100644 tests/XSLTMark/xslbench2.out create mode 100644 tests/XSLTMark/xslbench2.xsl create mode 100644 tests/XSLTMark/xslbench3.out create mode 100644 tests/XSLTMark/xslbench3.xsl create mode 100644 tests/XSLTMark/xslbenchdream.xml create mode 100644 tests/docbook/BUGS create mode 100644 tests/docbook/ChangeLog create mode 100644 tests/docbook/Makefile.am create mode 100644 tests/docbook/README create mode 100644 tests/docbook/TODO create mode 100644 tests/docbook/VERSION create mode 100644 tests/docbook/WhatsNew create mode 100644 tests/docbook/common/ChangeLog create mode 100644 tests/docbook/common/LostLog create mode 100644 tests/docbook/common/ca.xml create mode 100644 tests/docbook/common/common.xsl create mode 100644 tests/docbook/common/cs.xml create mode 100644 tests/docbook/common/da.xml create mode 100644 tests/docbook/common/de.xml create mode 100644 tests/docbook/common/el.xml create mode 100644 tests/docbook/common/en.xml create mode 100644 tests/docbook/common/es.xml create mode 100644 tests/docbook/common/et.xml create mode 100644 tests/docbook/common/fi.xml create mode 100644 tests/docbook/common/fr.xml create mode 100644 tests/docbook/common/gentext.xsl create mode 100644 tests/docbook/common/hu.xml create mode 100644 tests/docbook/common/id.xml create mode 100644 tests/docbook/common/it.xml create mode 100644 tests/docbook/common/ja.xml create mode 100644 tests/docbook/common/ko.xml create mode 100644 tests/docbook/common/l10n.dtd create mode 100644 tests/docbook/common/l10n.xml create mode 100644 tests/docbook/common/l10n.xsl create mode 100644 tests/docbook/common/labels.xsl create mode 100644 tests/docbook/common/nl.xml create mode 100644 tests/docbook/common/no.xml create mode 100644 tests/docbook/common/pl.xml create mode 100644 tests/docbook/common/pt.xml create mode 100644 tests/docbook/common/pt_br.xml create mode 100644 tests/docbook/common/ro.xml create mode 100644 tests/docbook/common/ru.xml create mode 100644 tests/docbook/common/sk.xml create mode 100644 tests/docbook/common/sl.xml create mode 100644 tests/docbook/common/sr.xml create mode 100644 tests/docbook/common/subtitles.xsl create mode 100644 tests/docbook/common/sv.xml create mode 100644 tests/docbook/common/titles.xsl create mode 100644 tests/docbook/common/zh_cn.xml create mode 100644 tests/docbook/common/zh_tw.xml create mode 100644 tests/docbook/doc/ChangeLog create mode 100644 tests/docbook/doc/book.xsl create mode 100644 tests/docbook/doc/ch01s02.html create mode 100644 tests/docbook/doc/ch01s03.html create mode 100644 tests/docbook/doc/ch01s04.html create mode 100644 tests/docbook/doc/ch02s02.html create mode 100644 tests/docbook/doc/ch03.html create mode 100644 tests/docbook/doc/ch04.html create mode 100644 tests/docbook/doc/common/ChangeLog create mode 100644 tests/docbook/doc/common/common.html create mode 100644 tests/docbook/doc/copyright.html create mode 100644 tests/docbook/doc/extensions.html create mode 100644 tests/docbook/doc/fo/ChangeLog create mode 100644 tests/docbook/doc/fo/param.html create mode 100644 tests/docbook/doc/fo/table.html create mode 100644 tests/docbook/doc/html/ChangeLog create mode 100644 tests/docbook/doc/html/ebnf.html create mode 100644 tests/docbook/doc/html/param.html create mode 100644 tests/docbook/doc/index.html create mode 100644 tests/docbook/doc/jrefhtml.xsl create mode 100644 tests/docbook/doc/lib/ChangeLog create mode 100644 tests/docbook/doc/lib/lib.html create mode 100644 tests/docbook/doc/pr01.html create mode 100644 tests/docbook/doc/publishing.html create mode 100644 tests/docbook/doc/reference.css create mode 100644 tests/docbook/doc/reference.html create mode 100644 tests/docbook/doc/reference.xsl create mode 100644 tests/docbook/doc/warranty.html create mode 100644 tests/docbook/dtd/3.1.7/COPYRIGHT create mode 100644 tests/docbook/dtd/3.1.7/ChangeLog create mode 100644 tests/docbook/dtd/3.1.7/README create mode 100644 tests/docbook/dtd/3.1.7/VERSION create mode 100644 tests/docbook/dtd/3.1.7/calstblx.dtd create mode 100644 tests/docbook/dtd/3.1.7/dbcentx.mod create mode 100644 tests/docbook/dtd/3.1.7/dbgenent.ent create mode 100644 tests/docbook/dtd/3.1.7/dbhierx.mod create mode 100644 tests/docbook/dtd/3.1.7/dbnotnx.mod create mode 100644 tests/docbook/dtd/3.1.7/dbpoolx.mod create mode 100644 tests/docbook/dtd/3.1.7/dbtblcals.dtd create mode 100644 tests/docbook/dtd/3.1.7/dbtblxchg.dtd create mode 100644 tests/docbook/dtd/3.1.7/docbookx.dtd create mode 100644 tests/docbook/dtd/3.1.7/ent/ChangeLog create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-amsa.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-amsb.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-amsc.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-amsn.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-amso.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-amsr.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-box.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-cyr1.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-cyr2.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-dia.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-grk1.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-grk2.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-grk3.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-grk4.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-lat1.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-lat2.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-num.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-pub.ent create mode 100644 tests/docbook/dtd/3.1.7/ent/iso-tech.ent create mode 100644 tests/docbook/dtd/3.1.7/soextblx.dtd create mode 100644 tests/docbook/dtd/3.1.7/tblcals.xml create mode 100644 tests/docbook/dtd/3.1.7/tblxchg.xml create mode 100644 tests/docbook/dtd/3.1.7/test.xml create mode 100644 tests/docbook/dtd/4.0/40chg.txt create mode 100755 tests/docbook/dtd/4.0/calstblx.dtd create mode 100755 tests/docbook/dtd/4.0/dbcentx.mod create mode 100644 tests/docbook/dtd/4.0/dbgenent.ent create mode 100755 tests/docbook/dtd/4.0/dbhierx.mod create mode 100755 tests/docbook/dtd/4.0/dbnotnx.mod create mode 100755 tests/docbook/dtd/4.0/dbpoolx.mod create mode 100755 tests/docbook/dtd/4.0/docbookx.dtd create mode 100755 tests/docbook/dtd/4.0/ent/iso-amsa.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-amsb.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-amsc.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-amsn.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-amso.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-amsr.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-box.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-cyr1.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-cyr2.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-dia.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-grk1.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-grk2.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-grk3.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-grk4.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-lat1.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-lat2.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-num.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-pub.ent create mode 100755 tests/docbook/dtd/4.0/ent/iso-tech.ent create mode 100644 tests/docbook/dtd/4.0/readme.txt create mode 100644 tests/docbook/dtd/4.0/soextblx.dtd create mode 100644 tests/docbook/dtd/4.1.2/40chg.txt create mode 100644 tests/docbook/dtd/4.1.2/41chg.txt create mode 100644 tests/docbook/dtd/4.1.2/ChangeLog create mode 100755 tests/docbook/dtd/4.1.2/calstblx.dtd create mode 100755 tests/docbook/dtd/4.1.2/dbcentx.mod create mode 100644 tests/docbook/dtd/4.1.2/dbgenent.mod create mode 100755 tests/docbook/dtd/4.1.2/dbhierx.mod create mode 100755 tests/docbook/dtd/4.1.2/dbnotnx.mod create mode 100755 tests/docbook/dtd/4.1.2/dbpoolx.mod create mode 100644 tests/docbook/dtd/4.1.2/docbook.cat create mode 100755 tests/docbook/dtd/4.1.2/docbookx.dtd create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-amsa.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-amsb.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-amsc.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-amsn.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-amso.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-amsr.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-box.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-cyr1.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-cyr2.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-dia.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-grk1.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-grk2.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-grk3.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-grk4.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-lat1.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-lat2.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-num.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-pub.ent create mode 100644 tests/docbook/dtd/4.1.2/ent/iso-tech.ent create mode 100644 tests/docbook/dtd/4.1.2/readme.txt create mode 100644 tests/docbook/dtd/4.1.2/soextblx.dtd create mode 100644 tests/docbook/dtd/simple/3.1.7.1/COPYRIGHT create mode 100644 tests/docbook/dtd/simple/3.1.7.1/ChangeLog create mode 100644 tests/docbook/dtd/simple/3.1.7.1/README create mode 100644 tests/docbook/dtd/simple/3.1.7.1/VERSION create mode 100644 tests/docbook/dtd/simple/3.1.7.1/ent/ChangeLog create mode 100644 tests/docbook/dtd/simple/3.1.7.1/ent/iso-lat1.ent create mode 100644 tests/docbook/dtd/simple/3.1.7.1/ent/iso-num.ent create mode 100644 tests/docbook/dtd/simple/3.1.7.1/ent/iso-pub.ent create mode 100644 tests/docbook/dtd/simple/3.1.7.1/sdbcent.mod create mode 100644 tests/docbook/dtd/simple/3.1.7.1/sdbhier.mod create mode 100644 tests/docbook/dtd/simple/3.1.7.1/sdbpool.mod create mode 100644 tests/docbook/dtd/simple/3.1.7.1/sdocbook-custom.dtd create mode 100644 tests/docbook/dtd/simple/3.1.7.1/sdocbook.css create mode 100644 tests/docbook/dtd/simple/3.1.7.1/sdocbook.dtd create mode 100644 tests/docbook/dtd/simple/3.1.7.1/sdocbookref-custom.dtd create mode 100644 tests/docbook/dtd/simple/3.1.7.1/sdocbookref.dtd create mode 100644 tests/docbook/dtd/simple/3.1.7.1/sinclist.mod create mode 100644 tests/docbook/dtd/simple/3.1.7.1/test.xml create mode 100644 tests/docbook/dtd/simple/3.1.7.1/testcss.xml create mode 100644 tests/docbook/dtd/simple/3.1.7.1/testcust.xml create mode 100644 tests/docbook/dtd/simple/3.1.7.1/testrefcust.xml create mode 100644 tests/docbook/dtd/simple/4.1.2.4/COPYRIGHT create mode 100644 tests/docbook/dtd/simple/4.1.2.4/ChangeLog create mode 100644 tests/docbook/dtd/simple/4.1.2.4/LostLog create mode 100644 tests/docbook/dtd/simple/4.1.2.4/README create mode 100644 tests/docbook/dtd/simple/4.1.2.4/VERSION create mode 100644 tests/docbook/dtd/simple/4.1.2.4/sdbcent.mod create mode 100644 tests/docbook/dtd/simple/4.1.2.4/sdbhier.mod create mode 100644 tests/docbook/dtd/simple/4.1.2.4/sdbpool.mod create mode 100644 tests/docbook/dtd/simple/4.1.2.4/sdocbook-custom.dtd create mode 100644 tests/docbook/dtd/simple/4.1.2.4/sdocbook.css create mode 100644 tests/docbook/dtd/simple/4.1.2.4/sdocbook.dtd create mode 100644 tests/docbook/dtd/simple/4.1.2.4/sdocbookref.dtd create mode 100644 tests/docbook/dtd/simple/4.1.2.4/sinclist.mod create mode 100644 tests/docbook/dtd/simple/4.1.2.4/test.xml create mode 100644 tests/docbook/dtd/simple/4.1.2.4/testcss.xml create mode 100644 tests/docbook/dtd/simple/4.1.2.4/testcust.xml create mode 100644 tests/docbook/dtd/simple/4.1.2.4/testrefcust.xml create mode 100644 tests/docbook/fo/ChangeLog create mode 100644 tests/docbook/fo/LostLog create mode 100644 tests/docbook/fo/admon.xsl create mode 100644 tests/docbook/fo/autoidx.xsl create mode 100644 tests/docbook/fo/autotoc.xsl create mode 100644 tests/docbook/fo/biblio.xsl create mode 100644 tests/docbook/fo/block.xsl create mode 100644 tests/docbook/fo/callout.xsl create mode 100644 tests/docbook/fo/component.xsl create mode 100644 tests/docbook/fo/division.xsl create mode 100644 tests/docbook/fo/docbook.xsl create mode 100644 tests/docbook/fo/fo.xsl create mode 100644 tests/docbook/fo/footnote.xsl create mode 100644 tests/docbook/fo/fop.xsl create mode 100644 tests/docbook/fo/formal.xsl create mode 100644 tests/docbook/fo/glossary.xsl create mode 100644 tests/docbook/fo/graphics.xsl create mode 100644 tests/docbook/fo/index.xsl create mode 100644 tests/docbook/fo/info.xsl create mode 100644 tests/docbook/fo/inline.xsl create mode 100644 tests/docbook/fo/keywords.xsl create mode 100644 tests/docbook/fo/lists.xsl create mode 100644 tests/docbook/fo/math.xsl create mode 100644 tests/docbook/fo/pagesetup.xsl create mode 100644 tests/docbook/fo/param.xsl create mode 100644 tests/docbook/fo/pi.xsl create mode 100644 tests/docbook/fo/qandaset.xsl create mode 100644 tests/docbook/fo/refentry.xsl create mode 100644 tests/docbook/fo/sections.xsl create mode 100644 tests/docbook/fo/synop.xsl create mode 100644 tests/docbook/fo/table.xsl create mode 100644 tests/docbook/fo/titlepage.templates.xml create mode 100644 tests/docbook/fo/titlepage.templates.xsl create mode 100644 tests/docbook/fo/titlepage.xsl create mode 100644 tests/docbook/fo/toc.xsl create mode 100644 tests/docbook/fo/verbatim.xsl create mode 100644 tests/docbook/fo/xref.xsl create mode 100644 tests/docbook/html/ChangeLog create mode 100644 tests/docbook/html/LostLog create mode 100644 tests/docbook/html/admon.xsl create mode 100644 tests/docbook/html/autoidx.xsl create mode 100644 tests/docbook/html/autotoc.xsl create mode 100644 tests/docbook/html/biblio.xsl create mode 100644 tests/docbook/html/block.xsl create mode 100644 tests/docbook/html/callout.xsl create mode 100644 tests/docbook/html/changebars.xsl create mode 100644 tests/docbook/html/chunk-common.xsl create mode 100644 tests/docbook/html/chunk.xsl create mode 100644 tests/docbook/html/chunker.xsl create mode 100644 tests/docbook/html/component.xsl create mode 100644 tests/docbook/html/division.xsl create mode 100644 tests/docbook/html/docbook.xsl create mode 100644 tests/docbook/html/ebnf.xsl create mode 100644 tests/docbook/html/footnote.xsl create mode 100644 tests/docbook/html/formal.xsl create mode 100644 tests/docbook/html/glossary.xsl create mode 100644 tests/docbook/html/graphics.xsl create mode 100644 tests/docbook/html/html.xsl create mode 100644 tests/docbook/html/index.xsl create mode 100644 tests/docbook/html/info.xsl create mode 100644 tests/docbook/html/inline.xsl create mode 100644 tests/docbook/html/keywords.xsl create mode 100644 tests/docbook/html/lists.xsl create mode 100644 tests/docbook/html/math.xsl create mode 100644 tests/docbook/html/param.xsl create mode 100644 tests/docbook/html/pi.xsl create mode 100644 tests/docbook/html/qandaset.xsl create mode 100644 tests/docbook/html/refentry.xsl create mode 100644 tests/docbook/html/sections.xsl create mode 100644 tests/docbook/html/synop.xsl create mode 100644 tests/docbook/html/table.xsl create mode 100644 tests/docbook/html/titlepage.templates.xml create mode 100644 tests/docbook/html/titlepage.templates.xsl create mode 100644 tests/docbook/html/titlepage.xsl create mode 100644 tests/docbook/html/toc.xsl create mode 100644 tests/docbook/html/verbatim.xsl create mode 100644 tests/docbook/html/xref.xsl create mode 100644 tests/docbook/html/xtchunk.xsl create mode 100644 tests/docbook/html/xtchunker.xsl create mode 100644 tests/docbook/htmlhelp/ChangeLog create mode 100644 tests/docbook/htmlhelp/doc/ChangeLog create mode 100644 tests/docbook/htmlhelp/doc/htmlhelp.xml create mode 100644 tests/docbook/htmlhelp/htmlhelp-common.xsl create mode 100644 tests/docbook/htmlhelp/htmlhelp.xsl create mode 100644 tests/docbook/htmlhelp/langcodes.xml create mode 100644 tests/docbook/htmlhelp/xthtmlhelp.xsl create mode 100644 tests/docbook/images/ChangeLog create mode 100644 tests/docbook/images/callouts/1.png create mode 100644 tests/docbook/images/callouts/10.png create mode 100644 tests/docbook/images/callouts/2.png create mode 100644 tests/docbook/images/callouts/3.png create mode 100644 tests/docbook/images/callouts/4.png create mode 100644 tests/docbook/images/callouts/5.png create mode 100644 tests/docbook/images/callouts/6.png create mode 100644 tests/docbook/images/callouts/7.png create mode 100644 tests/docbook/images/callouts/8.png create mode 100644 tests/docbook/images/callouts/9.png create mode 100644 tests/docbook/images/callouts/ChangeLog create mode 100644 tests/docbook/images/caution.gif create mode 100644 tests/docbook/images/caution.png create mode 100644 tests/docbook/images/caution.tif create mode 100644 tests/docbook/images/home.png create mode 100644 tests/docbook/images/important.gif create mode 100644 tests/docbook/images/important.png create mode 100644 tests/docbook/images/important.tif create mode 100644 tests/docbook/images/next.png create mode 100644 tests/docbook/images/note.gif create mode 100644 tests/docbook/images/note.png create mode 100644 tests/docbook/images/note.tif create mode 100644 tests/docbook/images/prev.png create mode 100644 tests/docbook/images/tip.gif create mode 100644 tests/docbook/images/tip.png create mode 100644 tests/docbook/images/tip.tif create mode 100644 tests/docbook/images/toc-blank.png create mode 100644 tests/docbook/images/toc-minus.png create mode 100644 tests/docbook/images/toc-plus.png create mode 100644 tests/docbook/images/up.png create mode 100644 tests/docbook/images/warning.gif create mode 100644 tests/docbook/images/warning.png create mode 100644 tests/docbook/images/warning.tif create mode 100644 tests/docbook/lib/ChangeLog create mode 100644 tests/docbook/lib/LostLog create mode 100644 tests/docbook/lib/lib.xsl create mode 100644 tests/docbook/result/fo/article.fo create mode 100644 tests/docbook/result/fo/article2.fo create mode 100644 tests/docbook/result/fo/article3.fo create mode 100644 tests/docbook/result/fo/bib.fo create mode 100644 tests/docbook/result/fo/book.fo create mode 100644 tests/docbook/result/fo/book2.fo create mode 100644 tests/docbook/result/fo/book3.fo create mode 100644 tests/docbook/result/fo/callout.fo create mode 100644 tests/docbook/result/fo/chunk.fo create mode 100644 tests/docbook/result/fo/classsynop.fo create mode 100644 tests/docbook/result/fo/condition.fo create mode 100644 tests/docbook/result/fo/docbook40.fo create mode 100644 tests/docbook/result/fo/external.fo create mode 100644 tests/docbook/result/fo/figtest.fo create mode 100644 tests/docbook/result/fo/foottest.fo create mode 100644 tests/docbook/result/fo/fotest.fo create mode 100644 tests/docbook/result/fo/func.fo create mode 100644 tests/docbook/result/fo/gdp-handbook.fo create mode 100644 tests/docbook/result/fo/graphics.fo create mode 100644 tests/docbook/result/fo/gtest.fo create mode 100644 tests/docbook/result/fo/idxbook.fo create mode 100644 tests/docbook/result/fo/kwrite.fo create mode 100644 tests/docbook/result/fo/multilingual.fo create mode 100644 tests/docbook/result/fo/qa.fo create mode 100644 tests/docbook/result/fo/qa2.fo create mode 100644 tests/docbook/result/fo/sectest.fo create mode 100644 tests/docbook/result/fo/set.fo create mode 100644 tests/docbook/result/fo/table.fo create mode 100644 tests/docbook/result/fo/test.fo create mode 100644 tests/docbook/result/fo/verbtest.fo create mode 100644 tests/docbook/result/html/article.html create mode 100644 tests/docbook/result/html/article2.html create mode 100644 tests/docbook/result/html/article3.html create mode 100644 tests/docbook/result/html/bib.html create mode 100644 tests/docbook/result/html/book.html create mode 100644 tests/docbook/result/html/book2.html create mode 100644 tests/docbook/result/html/book3.html create mode 100644 tests/docbook/result/html/callout.html create mode 100644 tests/docbook/result/html/chunk.html create mode 100644 tests/docbook/result/html/classsynop.html create mode 100644 tests/docbook/result/html/condition.html create mode 100644 tests/docbook/result/html/docbook40.html create mode 100644 tests/docbook/result/html/emc2.gif create mode 100644 tests/docbook/result/html/emc2.png create mode 100644 tests/docbook/result/html/external.html create mode 100644 tests/docbook/result/html/figtest.html create mode 100644 tests/docbook/result/html/foottest.html create mode 100644 tests/docbook/result/html/fotest.html create mode 100644 tests/docbook/result/html/func.html create mode 100644 tests/docbook/result/html/gdp-handbook.err create mode 100644 tests/docbook/result/html/gdp-handbook.html create mode 100644 tests/docbook/result/html/graphics.html create mode 100644 tests/docbook/result/html/gtest.html create mode 100644 tests/docbook/result/html/idxbook.html create mode 100644 tests/docbook/result/html/kwrite.html create mode 100644 tests/docbook/result/html/multilingual.html create mode 100644 tests/docbook/result/html/qa.html create mode 100644 tests/docbook/result/html/qa2.html create mode 100644 tests/docbook/result/html/sectest.html create mode 100644 tests/docbook/result/html/set.html create mode 100644 tests/docbook/result/html/table.html create mode 100644 tests/docbook/result/html/test.html create mode 100644 tests/docbook/result/html/testmath.html create mode 100644 tests/docbook/result/html/verbtest.html create mode 100644 tests/docbook/result/xhtml/article.xhtml create mode 100644 tests/docbook/result/xhtml/article2.xhtml create mode 100644 tests/docbook/result/xhtml/article3.xhtml create mode 100644 tests/docbook/result/xhtml/bib.xhtml create mode 100644 tests/docbook/result/xhtml/book.xhtml create mode 100644 tests/docbook/result/xhtml/book2.xhtml create mode 100644 tests/docbook/result/xhtml/book3.xhtml create mode 100644 tests/docbook/result/xhtml/callout.xhtml create mode 100644 tests/docbook/result/xhtml/chunk.xhtml create mode 100644 tests/docbook/result/xhtml/classsynop.xhtml create mode 100644 tests/docbook/result/xhtml/condition.xhtml create mode 100644 tests/docbook/result/xhtml/docbook40.xhtml create mode 100644 tests/docbook/result/xhtml/external.xhtml create mode 100644 tests/docbook/result/xhtml/figtest.xhtml create mode 100644 tests/docbook/result/xhtml/foottest.xhtml create mode 100644 tests/docbook/result/xhtml/fotest.xhtml create mode 100644 tests/docbook/result/xhtml/func.xhtml create mode 100644 tests/docbook/result/xhtml/gdp-handbook.xhtml create mode 100644 tests/docbook/result/xhtml/graphics.xhtml create mode 100644 tests/docbook/result/xhtml/gtest.xhtml create mode 100644 tests/docbook/result/xhtml/idxbook.xhtml create mode 100644 tests/docbook/result/xhtml/kwrite.xhtml create mode 100644 tests/docbook/result/xhtml/multilingual.xhtml create mode 100644 tests/docbook/result/xhtml/qa.xhtml create mode 100644 tests/docbook/result/xhtml/qa2.xhtml create mode 100644 tests/docbook/result/xhtml/sectest.xhtml create mode 100644 tests/docbook/result/xhtml/set.xhtml create mode 100644 tests/docbook/result/xhtml/table.xhtml create mode 100644 tests/docbook/result/xhtml/test.xhtml create mode 100644 tests/docbook/result/xhtml/verbtest.xhtml create mode 100644 tests/docbook/result/xtchunk/html/apa.orig create mode 100644 tests/docbook/result/xtchunk/html/apas02.orig create mode 100644 tests/docbook/result/xtchunk/html/apas03.orig create mode 100644 tests/docbook/result/xtchunk/html/index.orig create mode 100644 tests/docbook/result/xtchunk/html/indexs02.orig create mode 100644 tests/docbook/result/xtchunk/html/indexs03.orig create mode 100644 tests/docbook/result/xtchunk/html/indexs04.orig create mode 100644 tests/docbook/result/xtchunk/html/indexs05.orig create mode 100644 tests/docbook/result/xtchunk/html/indexs06.orig create mode 100644 tests/docbook/result/xtchunk/html/indexs07.orig create mode 100644 tests/docbook/result/xtchunk/html/indexs08.orig create mode 100644 tests/docbook/result/xtchunk/html/indexs09.orig create mode 100644 tests/docbook/result/xtchunk/html/indexs10.orig create mode 100644 tests/docbook/result/xtchunk/html/indexs11.orig create mode 100644 tests/docbook/result/xtchunk/html/indexs12.orig create mode 100644 tests/docbook/result/xtchunk/html/indexs13.orig create mode 100644 tests/docbook/result/xtchunk/html/indexs14.orig create mode 100644 tests/docbook/result/xtchunk/html/indexs15.orig create mode 100644 tests/docbook/template/ChangeLog create mode 100644 tests/docbook/template/README create mode 100644 tests/docbook/template/biblioentry.xsl create mode 100644 tests/docbook/template/testtemplate.xml create mode 100644 tests/docbook/template/titlepage.xsl create mode 100644 tests/docbook/test/ChangeLog create mode 100644 tests/docbook/test/LostLog create mode 100644 tests/docbook/test/article.xml create mode 100644 tests/docbook/test/article2.xml create mode 100644 tests/docbook/test/article3.xml create mode 100644 tests/docbook/test/bib.xml create mode 100644 tests/docbook/test/book.xml create mode 100644 tests/docbook/test/book2.xml create mode 100644 tests/docbook/test/book3.xml create mode 100644 tests/docbook/test/callout.xml create mode 100644 tests/docbook/test/chunk.xml create mode 100644 tests/docbook/test/classsynop.xml create mode 100644 tests/docbook/test/condition.xml create mode 100644 tests/docbook/test/docbook.css create mode 100644 tests/docbook/test/docbook40.xml create mode 100644 tests/docbook/test/emc2.gif create mode 100644 tests/docbook/test/emc2.png create mode 100644 tests/docbook/test/external.xml create mode 100644 tests/docbook/test/figtest.xml create mode 100644 tests/docbook/test/foottest.xml create mode 100644 tests/docbook/test/fotest.xml create mode 100644 tests/docbook/test/func.xml create mode 100644 tests/docbook/test/gdp-handbook.xml create mode 100644 tests/docbook/test/graphics.xml create mode 100644 tests/docbook/test/gtest.xml create mode 100644 tests/docbook/test/idxbook.xml create mode 100644 tests/docbook/test/kwrite.xml create mode 100644 tests/docbook/test/multilingual.xml create mode 100644 tests/docbook/test/qa.xml create mode 100644 tests/docbook/test/qa2.xml create mode 100644 tests/docbook/test/sectest.xml create mode 100644 tests/docbook/test/set.xml create mode 100644 tests/docbook/test/subdoc.ent create mode 100644 tests/docbook/test/table.xml create mode 100644 tests/docbook/test/test.xml create mode 100644 tests/docbook/test/test.xsl create mode 100644 tests/docbook/test/verbtest.xml create mode 100644 tests/docbook/xhtml/ChangeLog create mode 100644 tests/docbook/xhtml/LostLog create mode 100644 tests/docbook/xhtml/chunk.xsl create mode 100644 tests/docbook/xhtml/docbook.xsl create mode 100644 tests/docbook/xhtml/xtchunk.xsl create mode 100644 tests/docs/Makefile.am create mode 100644 tests/docs/array.xml create mode 100644 tests/docs/bug-1-.xml create mode 100644 tests/docs/bug-10-.xml create mode 100644 tests/docs/bug-100.xml create mode 100644 tests/docs/bug-101.xml create mode 100644 tests/docs/bug-102.xml create mode 100644 tests/docs/bug-103.xml create mode 100644 tests/docs/bug-104.xml create mode 100644 tests/docs/bug-105.xml create mode 100644 tests/docs/bug-106.xml create mode 100644 tests/docs/bug-107.xml create mode 100644 tests/docs/bug-108.xml create mode 100644 tests/docs/bug-109.xml create mode 100644 tests/docs/bug-11-.xml create mode 100644 tests/docs/bug-110.ent create mode 100644 tests/docs/bug-110.xml create mode 100644 tests/docs/bug-111.xml create mode 100644 tests/docs/bug-112.xml create mode 100644 tests/docs/bug-113.xml create mode 100644 tests/docs/bug-114.xml create mode 100644 tests/docs/bug-115.xml create mode 100644 tests/docs/bug-116.xml create mode 100644 tests/docs/bug-117.xml create mode 100644 tests/docs/bug-118.xml create mode 100644 tests/docs/bug-119.xml create mode 100644 tests/docs/bug-12-.xml create mode 100644 tests/docs/bug-120.xml create mode 100644 tests/docs/bug-121.xml create mode 100644 tests/docs/bug-122.xml create mode 100644 tests/docs/bug-123.xml create mode 100644 tests/docs/bug-124.xml create mode 100644 tests/docs/bug-125.xml create mode 100644 tests/docs/bug-126.xml create mode 100644 tests/docs/bug-127.xml create mode 100644 tests/docs/bug-128.xml create mode 100644 tests/docs/bug-129.xml create mode 100644 tests/docs/bug-13-.xml create mode 100644 tests/docs/bug-130.doc create mode 100644 tests/docs/bug-130.xml create mode 100644 tests/docs/bug-131.xml create mode 100644 tests/docs/bug-132.xml create mode 100644 tests/docs/bug-133.xml create mode 100644 tests/docs/bug-134.xml create mode 100644 tests/docs/bug-135.xml create mode 100644 tests/docs/bug-136.xml create mode 100644 tests/docs/bug-137.xml create mode 100644 tests/docs/bug-138.xml create mode 100644 tests/docs/bug-139.xml create mode 100644 tests/docs/bug-14-.xml create mode 100644 tests/docs/bug-140.xml create mode 100644 tests/docs/bug-141.xml create mode 100755 tests/docs/bug-142.xml create mode 100644 tests/docs/bug-143.xml create mode 100644 tests/docs/bug-144.xml create mode 100644 tests/docs/bug-145.xml create mode 100644 tests/docs/bug-146.xml create mode 100644 tests/docs/bug-147.xml create mode 100644 tests/docs/bug-148.xml create mode 100644 tests/docs/bug-149.xml create mode 100644 tests/docs/bug-15-.xml create mode 100644 tests/docs/bug-150.xml create mode 100644 tests/docs/bug-151.xml create mode 100644 tests/docs/bug-152.xml create mode 100644 tests/docs/bug-153.doc create mode 100644 tests/docs/bug-153.xml create mode 100644 tests/docs/bug-154.xml create mode 100644 tests/docs/bug-155.xml create mode 100644 tests/docs/bug-156.xml create mode 100644 tests/docs/bug-157.xml create mode 100644 tests/docs/bug-158.doc create mode 100644 tests/docs/bug-158.xml create mode 100644 tests/docs/bug-159.xml create mode 100644 tests/docs/bug-16-.xml create mode 100644 tests/docs/bug-160.xml create mode 100644 tests/docs/bug-161.xml create mode 100644 tests/docs/bug-163.xml create mode 100644 tests/docs/bug-164.xml create mode 100644 tests/docs/bug-165.xml create mode 100644 tests/docs/bug-166.xml create mode 100644 tests/docs/bug-167.xml create mode 100644 tests/docs/bug-168.xml create mode 100644 tests/docs/bug-169.xml create mode 100644 tests/docs/bug-17-.xml create mode 100644 tests/docs/bug-170.xml create mode 100644 tests/docs/bug-171.xml create mode 100644 tests/docs/bug-172.xml create mode 100644 tests/docs/bug-173.xml create mode 100644 tests/docs/bug-174.xml create mode 100644 tests/docs/bug-175.xml create mode 100644 tests/docs/bug-176.xml create mode 100644 tests/docs/bug-177.xml create mode 100644 tests/docs/bug-178.xml create mode 100644 tests/docs/bug-179.xml create mode 100644 tests/docs/bug-18-.xml create mode 100644 tests/docs/bug-180.xml create mode 100644 tests/docs/bug-181.xml create mode 100644 tests/docs/bug-182.xml create mode 100644 tests/docs/bug-183.xml create mode 100644 tests/docs/bug-184.xml create mode 100644 tests/docs/bug-185-data.xml create mode 100644 tests/docs/bug-185.xml create mode 100644 tests/docs/bug-186.xml create mode 100644 tests/docs/bug-187.xml create mode 100644 tests/docs/bug-19-.xml create mode 100644 tests/docs/bug-2-.xml create mode 100644 tests/docs/bug-20-.xml create mode 100644 tests/docs/bug-21-.xml create mode 100644 tests/docs/bug-22-.xml create mode 100644 tests/docs/bug-23-.xml create mode 100644 tests/docs/bug-24-.xml create mode 100644 tests/docs/bug-25-.xml create mode 100644 tests/docs/bug-26-.xml create mode 100644 tests/docs/bug-27-.xml create mode 100644 tests/docs/bug-28-.xml create mode 100644 tests/docs/bug-29-.ent create mode 100644 tests/docs/bug-29-.xml create mode 100644 tests/docs/bug-3-.xml create mode 100644 tests/docs/bug-30-.xml create mode 100644 tests/docs/bug-31-.xml create mode 100644 tests/docs/bug-32-.xml create mode 100644 tests/docs/bug-33-.xml create mode 100644 tests/docs/bug-35-.xml create mode 100644 tests/docs/bug-36-.xml create mode 100644 tests/docs/bug-37-.xml create mode 100644 tests/docs/bug-38-.xml create mode 100644 tests/docs/bug-39-.xml create mode 100644 tests/docs/bug-4-.xml create mode 100644 tests/docs/bug-40-.xml create mode 100644 tests/docs/bug-41-.xml create mode 100644 tests/docs/bug-42-.xml create mode 100644 tests/docs/bug-43-.xml create mode 100644 tests/docs/bug-44-.xml create mode 100644 tests/docs/bug-45-.xml create mode 100644 tests/docs/bug-46-.xml create mode 100644 tests/docs/bug-47-.xml create mode 100644 tests/docs/bug-48-.xml create mode 100644 tests/docs/bug-49-.xml create mode 100644 tests/docs/bug-5-.xml create mode 100644 tests/docs/bug-50-.xml create mode 100644 tests/docs/bug-52.xml create mode 100644 tests/docs/bug-53.xml create mode 100644 tests/docs/bug-54.xml create mode 100644 tests/docs/bug-55.xml create mode 100644 tests/docs/bug-56.xml create mode 100644 tests/docs/bug-57.xml create mode 100644 tests/docs/bug-59.xml create mode 100644 tests/docs/bug-6-.xml create mode 100644 tests/docs/bug-60.xml create mode 100644 tests/docs/bug-61.xml create mode 100644 tests/docs/bug-62.xml create mode 100644 tests/docs/bug-63.xml create mode 100644 tests/docs/bug-64.xml create mode 100644 tests/docs/bug-65.xml create mode 100644 tests/docs/bug-66.xml create mode 100644 tests/docs/bug-68.xml create mode 100644 tests/docs/bug-69.xml create mode 100644 tests/docs/bug-7-.xml create mode 100644 tests/docs/bug-70.xml create mode 100644 tests/docs/bug-71.xml create mode 100644 tests/docs/bug-72.xml create mode 100644 tests/docs/bug-73.xml create mode 100644 tests/docs/bug-74.xml create mode 100644 tests/docs/bug-75.xml create mode 100644 tests/docs/bug-76.xml create mode 100644 tests/docs/bug-77.xml create mode 100644 tests/docs/bug-78.xml create mode 100644 tests/docs/bug-79.xml create mode 100644 tests/docs/bug-8-.xml create mode 100644 tests/docs/bug-80.xml create mode 100644 tests/docs/bug-81.xml create mode 100644 tests/docs/bug-82.xml create mode 100644 tests/docs/bug-83.xml create mode 100644 tests/docs/bug-84.xml create mode 100644 tests/docs/bug-86.xml create mode 100644 tests/docs/bug-87.xml create mode 100644 tests/docs/bug-88.xml create mode 100644 tests/docs/bug-89.xml create mode 100644 tests/docs/bug-9-.xml create mode 100644 tests/docs/bug-90.xml create mode 100644 tests/docs/bug-91.xml create mode 100644 tests/docs/bug-92.xml create mode 100644 tests/docs/bug-93.xml create mode 100644 tests/docs/bug-94.xml create mode 100644 tests/docs/bug-95.xml create mode 100644 tests/docs/bug-96.xml create mode 100644 tests/docs/bug-97.xml create mode 100644 tests/docs/bug-98.xml create mode 100644 tests/docs/bug-99.xml create mode 100644 tests/docs/character.xml create mode 100644 tests/docs/date_add.xml create mode 100644 tests/docs/items.xml create mode 100644 tests/documents/Makefile.am create mode 100644 tests/documents/bredfort.css create mode 100644 tests/documents/bredfort.xsl create mode 100644 tests/documents/doc_file.xml create mode 100644 tests/documents/docfile.xml create mode 100644 tests/documents/fragment.result create mode 100644 tests/documents/fragment.xml create mode 100644 tests/documents/fragment.xsl create mode 100644 tests/documents/fragment2.xml create mode 100644 tests/documents/index.xml create mode 100644 tests/documents/menu.xml create mode 100644 tests/documents/message.result create mode 100644 tests/documents/message.xml create mode 100644 tests/documents/message.xsl create mode 100644 tests/documents/result.xhtml create mode 100644 tests/documents/system.xml create mode 100644 tests/documents/test.result create mode 100644 tests/documents/test.xml create mode 100644 tests/documents/test.xsl create mode 100644 tests/documents/test_bad.err create mode 100644 tests/documents/test_bad.result create mode 100644 tests/documents/test_bad.xml create mode 100644 tests/documents/worklog.xml create mode 100644 tests/exslt/Makefile.am create mode 100644 tests/exslt/common/Makefile.am create mode 100644 tests/exslt/common/import-test1.out create mode 100644 tests/exslt/common/import-test1.xml create mode 100644 tests/exslt/common/import-test1.xsl create mode 100644 tests/exslt/common/import-test1a.imp create mode 100644 tests/exslt/common/import-test1b.imp create mode 100644 tests/exslt/common/node-set.1.out create mode 100644 tests/exslt/common/node-set.1.xml create mode 100644 tests/exslt/common/node-set.1.xsl create mode 100644 tests/exslt/common/node-set.2.out create mode 100644 tests/exslt/common/node-set.2.xml create mode 100644 tests/exslt/common/node-set.2.xsl create mode 100644 tests/exslt/common/node-set.3.out create mode 100644 tests/exslt/common/node-set.3.xml create mode 100644 tests/exslt/common/node-set.3.xsl create mode 100644 tests/exslt/common/node-set.4.out create mode 100644 tests/exslt/common/node-set.4.xml create mode 100644 tests/exslt/common/node-set.4.xsl create mode 100644 tests/exslt/common/node-set.5.out create mode 100644 tests/exslt/common/node-set.5.xml create mode 100644 tests/exslt/common/node-set.5.xsl create mode 100644 tests/exslt/common/node-set.6.out create mode 100644 tests/exslt/common/node-set.6.xml create mode 100644 tests/exslt/common/node-set.6.xsl create mode 100644 tests/exslt/common/node-set.7.out create mode 100644 tests/exslt/common/node-set.7.xml create mode 100644 tests/exslt/common/node-set.7.xsl create mode 100644 tests/exslt/common/node-set.8.out create mode 100644 tests/exslt/common/node-set.8.xml create mode 100644 tests/exslt/common/node-set.8.xsl create mode 100644 tests/exslt/common/object-type.1.out create mode 100644 tests/exslt/common/object-type.1.xml create mode 100644 tests/exslt/common/object-type.1.xsl create mode 100644 tests/exslt/crypto/Makefile.am create mode 100644 tests/exslt/crypto/crypt.1.out create mode 100644 tests/exslt/crypto/crypt.1.xml create mode 100644 tests/exslt/crypto/crypt.1.xsl create mode 100644 tests/exslt/crypto/hash.1.out create mode 100644 tests/exslt/crypto/hash.1.xml create mode 100644 tests/exslt/crypto/hash.1.xsl create mode 100644 tests/exslt/date/Makefile.am create mode 100644 tests/exslt/date/add-duration.1.out create mode 100644 tests/exslt/date/add-duration.1.xml create mode 100644 tests/exslt/date/add-duration.1.xsl create mode 100644 tests/exslt/date/add-duration.2.out create mode 100644 tests/exslt/date/add-duration.2.xml create mode 100644 tests/exslt/date/add-duration.2.xsl create mode 100644 tests/exslt/date/add.1.out create mode 100644 tests/exslt/date/add.1.xml create mode 100644 tests/exslt/date/add.1.xsl create mode 100644 tests/exslt/date/add.2.out create mode 100644 tests/exslt/date/add.2.xml create mode 100644 tests/exslt/date/add.2.xsl create mode 100644 tests/exslt/date/current.xsl create mode 100644 tests/exslt/date/date.1.out create mode 100644 tests/exslt/date/date.1.xml create mode 100644 tests/exslt/date/date.1.xsl create mode 100644 tests/exslt/date/date.2.out create mode 100644 tests/exslt/date/date.2.xml create mode 100644 tests/exslt/date/date.2.xsl create mode 100644 tests/exslt/date/datetime.1.out create mode 100644 tests/exslt/date/datetime.1.xml create mode 100644 tests/exslt/date/datetime.1.xsl create mode 100644 tests/exslt/date/datetime.2.out create mode 100644 tests/exslt/date/datetime.2.xml create mode 100644 tests/exslt/date/datetime.2.xsl create mode 100644 tests/exslt/date/difference.1.out create mode 100644 tests/exslt/date/difference.1.xml create mode 100644 tests/exslt/date/difference.1.xsl create mode 100644 tests/exslt/date/difference.2.out create mode 100644 tests/exslt/date/difference.2.xml create mode 100644 tests/exslt/date/difference.2.xsl create mode 100644 tests/exslt/date/duration.1.out create mode 100644 tests/exslt/date/duration.1.xml create mode 100644 tests/exslt/date/duration.1.xsl create mode 100644 tests/exslt/date/duration.2.out create mode 100644 tests/exslt/date/duration.2.xml create mode 100644 tests/exslt/date/duration.2.xsl create mode 100644 tests/exslt/date/gday.1.out create mode 100644 tests/exslt/date/gday.1.xml create mode 100644 tests/exslt/date/gday.1.xsl create mode 100644 tests/exslt/date/gday.2.out create mode 100644 tests/exslt/date/gday.2.xml create mode 100644 tests/exslt/date/gday.2.xsl create mode 100644 tests/exslt/date/gmonth.1.out create mode 100644 tests/exslt/date/gmonth.1.xml create mode 100644 tests/exslt/date/gmonth.1.xsl create mode 100644 tests/exslt/date/gmonth.2.out create mode 100644 tests/exslt/date/gmonth.2.xml create mode 100644 tests/exslt/date/gmonth.2.xsl create mode 100644 tests/exslt/date/gmonthday.1.out create mode 100644 tests/exslt/date/gmonthday.1.xml create mode 100644 tests/exslt/date/gmonthday.1.xsl create mode 100644 tests/exslt/date/gmonthday.2.out create mode 100644 tests/exslt/date/gmonthday.2.xml create mode 100644 tests/exslt/date/gmonthday.2.xsl create mode 100644 tests/exslt/date/gyear.1.out create mode 100644 tests/exslt/date/gyear.1.xml create mode 100644 tests/exslt/date/gyear.1.xsl create mode 100644 tests/exslt/date/gyear.2.out create mode 100644 tests/exslt/date/gyear.2.xml create mode 100644 tests/exslt/date/gyear.2.xsl create mode 100644 tests/exslt/date/gyearmonth.1.out create mode 100644 tests/exslt/date/gyearmonth.1.xml create mode 100644 tests/exslt/date/gyearmonth.1.xsl create mode 100644 tests/exslt/date/gyearmonth.2.out create mode 100644 tests/exslt/date/gyearmonth.2.xml create mode 100644 tests/exslt/date/gyearmonth.2.xsl create mode 100644 tests/exslt/date/seconds.1.out create mode 100644 tests/exslt/date/seconds.1.xml create mode 100644 tests/exslt/date/seconds.1.xsl create mode 100644 tests/exslt/date/seconds.2.out create mode 100644 tests/exslt/date/seconds.2.xml create mode 100644 tests/exslt/date/seconds.2.xsl create mode 100644 tests/exslt/date/sum.1.out create mode 100644 tests/exslt/date/sum.1.xml create mode 100644 tests/exslt/date/sum.1.xsl create mode 100644 tests/exslt/date/sum.2.err create mode 100644 tests/exslt/date/sum.2.out create mode 100644 tests/exslt/date/sum.2.xml create mode 100644 tests/exslt/date/sum.2.xsl create mode 100644 tests/exslt/date/time.1.out create mode 100644 tests/exslt/date/time.1.xml create mode 100644 tests/exslt/date/time.1.xsl create mode 100644 tests/exslt/date/time.2.out create mode 100644 tests/exslt/date/time.2.xml create mode 100644 tests/exslt/date/time.2.xsl create mode 100644 tests/exslt/dynamic/Makefile.am create mode 100644 tests/exslt/dynamic/dynmap.out create mode 100644 tests/exslt/dynamic/dynmap.xml create mode 100644 tests/exslt/dynamic/dynmap.xsl create mode 100644 tests/exslt/functions/Makefile.am create mode 100644 tests/exslt/functions/function.1.out create mode 100644 tests/exslt/functions/function.1.xml create mode 100644 tests/exslt/functions/function.1.xsl create mode 100644 tests/exslt/functions/function.10.out create mode 100644 tests/exslt/functions/function.10.xml create mode 100644 tests/exslt/functions/function.10.xsl create mode 100644 tests/exslt/functions/function.2.out create mode 100644 tests/exslt/functions/function.2.xml create mode 100644 tests/exslt/functions/function.2.xsl create mode 100644 tests/exslt/functions/function.3.out create mode 100644 tests/exslt/functions/function.3.xml create mode 100644 tests/exslt/functions/function.3.xsl create mode 100644 tests/exslt/functions/function.4.out create mode 100644 tests/exslt/functions/function.4.xml create mode 100644 tests/exslt/functions/function.4.xsl create mode 100644 tests/exslt/functions/function.5.out create mode 100644 tests/exslt/functions/function.5.xml create mode 100644 tests/exslt/functions/function.5.xsl create mode 100644 tests/exslt/functions/function.6.out create mode 100644 tests/exslt/functions/function.6.xml create mode 100644 tests/exslt/functions/function.6.xsl create mode 100644 tests/exslt/functions/function.7.out create mode 100644 tests/exslt/functions/function.7.xml create mode 100644 tests/exslt/functions/function.7.xsl create mode 100644 tests/exslt/functions/function.8.out create mode 100644 tests/exslt/functions/function.8.xml create mode 100644 tests/exslt/functions/function.8.xsl create mode 100644 tests/exslt/functions/function.9.out create mode 100644 tests/exslt/functions/function.9.xml create mode 100644 tests/exslt/functions/function.9.xsl create mode 100644 tests/exslt/math/Makefile.am create mode 100644 tests/exslt/math/highest.1.out create mode 100644 tests/exslt/math/highest.1.xml create mode 100644 tests/exslt/math/highest.1.xsl create mode 100644 tests/exslt/math/highest.2.out create mode 100644 tests/exslt/math/highest.2.xml create mode 100644 tests/exslt/math/highest.2.xsl create mode 100644 tests/exslt/math/highest.5.out create mode 100644 tests/exslt/math/highest.5.xml create mode 100644 tests/exslt/math/highest.5.xsl create mode 100644 tests/exslt/math/lowest.1.out create mode 100644 tests/exslt/math/lowest.1.xml create mode 100644 tests/exslt/math/lowest.1.xsl create mode 100644 tests/exslt/math/lowest.2.out create mode 100644 tests/exslt/math/lowest.2.xml create mode 100644 tests/exslt/math/lowest.2.xsl create mode 100644 tests/exslt/math/max.1.out create mode 100644 tests/exslt/math/max.1.xml create mode 100644 tests/exslt/math/max.1.xsl create mode 100644 tests/exslt/math/max.2.out create mode 100644 tests/exslt/math/max.2.xml create mode 100644 tests/exslt/math/max.2.xsl create mode 100644 tests/exslt/math/max.3.out create mode 100644 tests/exslt/math/max.3.xml create mode 100644 tests/exslt/math/max.3.xsl create mode 100644 tests/exslt/math/max.5.out create mode 100644 tests/exslt/math/max.5.xml create mode 100644 tests/exslt/math/max.5.xsl create mode 100644 tests/exslt/math/min.1.out create mode 100644 tests/exslt/math/min.1.xml create mode 100644 tests/exslt/math/min.1.xsl create mode 100644 tests/exslt/math/min.2.out create mode 100644 tests/exslt/math/min.2.xml create mode 100644 tests/exslt/math/min.2.xsl create mode 100644 tests/exslt/math/power.1.out create mode 100644 tests/exslt/math/power.1.xml create mode 100644 tests/exslt/math/power.1.xsl create mode 100644 tests/exslt/saxon/Makefile.am create mode 100644 tests/exslt/saxon/eval.1.out create mode 100644 tests/exslt/saxon/eval.1.xml create mode 100644 tests/exslt/saxon/eval.1.xsl create mode 100644 tests/exslt/saxon/eval.2.err create mode 100644 tests/exslt/saxon/eval.2.out create mode 100644 tests/exslt/saxon/eval.2.xml create mode 100644 tests/exslt/saxon/eval.2.xsl create mode 100644 tests/exslt/saxon/eval.3.err create mode 100644 tests/exslt/saxon/eval.3.out create mode 100644 tests/exslt/saxon/eval.3.xml create mode 100644 tests/exslt/saxon/eval.3.xsl create mode 100644 tests/exslt/saxon/lineno.1.out create mode 100644 tests/exslt/saxon/lineno.1.xml create mode 100644 tests/exslt/saxon/lineno.1.xsl create mode 100644 tests/exslt/sets/Makefile.am create mode 100644 tests/exslt/sets/difference.1.out create mode 100644 tests/exslt/sets/difference.1.xml create mode 100644 tests/exslt/sets/difference.1.xsl create mode 100644 tests/exslt/sets/distinct.1.out create mode 100644 tests/exslt/sets/distinct.1.xml create mode 100644 tests/exslt/sets/distinct.1.xsl create mode 100644 tests/exslt/sets/has-same-node.1.out create mode 100644 tests/exslt/sets/has-same-node.1.xml create mode 100644 tests/exslt/sets/has-same-node.1.xsl create mode 100644 tests/exslt/sets/leading.1.out create mode 100644 tests/exslt/sets/leading.1.xml create mode 100644 tests/exslt/sets/leading.1.xsl create mode 100644 tests/exslt/sets/trailing.1.out create mode 100644 tests/exslt/sets/trailing.1.xml create mode 100644 tests/exslt/sets/trailing.1.xsl create mode 100644 tests/exslt/strings/Makefile.am create mode 100644 tests/exslt/strings/align.1.out create mode 100644 tests/exslt/strings/align.1.xml create mode 100644 tests/exslt/strings/align.1.xsl create mode 100644 tests/exslt/strings/padding.1.out create mode 100644 tests/exslt/strings/padding.1.xml create mode 100644 tests/exslt/strings/padding.1.xsl create mode 100644 tests/exslt/strings/replace.1.out create mode 100644 tests/exslt/strings/replace.1.xml create mode 100644 tests/exslt/strings/replace.1.xsl create mode 100644 tests/exslt/strings/split.1.out create mode 100644 tests/exslt/strings/split.1.xml create mode 100644 tests/exslt/strings/split.1.xsl create mode 100644 tests/exslt/strings/tokenize.1.out create mode 100644 tests/exslt/strings/tokenize.1.xml create mode 100644 tests/exslt/strings/tokenize.1.xsl create mode 100644 tests/exslt/strings/tokenize.2.out create mode 100644 tests/exslt/strings/tokenize.2.xml create mode 100644 tests/exslt/strings/tokenize.2.xsl create mode 100644 tests/exslt/strings/tokenize.3.out create mode 100644 tests/exslt/strings/tokenize.3.xml create mode 100644 tests/exslt/strings/tokenize.3.xsl create mode 100644 tests/extensions/Makefile.am create mode 100644 tests/extensions/evaluate.out create mode 100644 tests/extensions/evaluate.xml create mode 100644 tests/extensions/evaluate.xsl create mode 100644 tests/extensions/list.out create mode 100644 tests/extensions/list.xml create mode 100644 tests/extensions/list.xsl create mode 100644 tests/extensions/module.out create mode 100644 tests/extensions/module.xml create mode 100644 tests/extensions/module.xsl create mode 100644 tests/general/Makefile.am create mode 100644 tests/general/array.out create mode 100644 tests/general/array.xsl create mode 100644 tests/general/bug-1-.out create mode 100644 tests/general/bug-1-.xsl create mode 100644 tests/general/bug-10-.out create mode 100644 tests/general/bug-10-.xsl create mode 100644 tests/general/bug-100.out create mode 100644 tests/general/bug-100.xsl create mode 100644 tests/general/bug-101.out create mode 100644 tests/general/bug-101.xsl create mode 100644 tests/general/bug-102-inc.out create mode 100644 tests/general/bug-102-inc.xsl create mode 100644 tests/general/bug-102.out create mode 100644 tests/general/bug-102.xsl create mode 100644 tests/general/bug-103.out create mode 100644 tests/general/bug-103.xsl create mode 100644 tests/general/bug-104.out create mode 100644 tests/general/bug-104.xsl create mode 100644 tests/general/bug-105.out create mode 100644 tests/general/bug-105.xsl create mode 100644 tests/general/bug-106.out create mode 100644 tests/general/bug-106.xsl create mode 100644 tests/general/bug-107.out create mode 100644 tests/general/bug-107.xsl create mode 100644 tests/general/bug-108.out create mode 100644 tests/general/bug-108.xsl create mode 100644 tests/general/bug-109.out create mode 100644 tests/general/bug-109.xsl create mode 100644 tests/general/bug-11-.out create mode 100644 tests/general/bug-11-.xsl create mode 100644 tests/general/bug-110.err create mode 100644 tests/general/bug-110.out create mode 100644 tests/general/bug-110.xsl create mode 100644 tests/general/bug-111.out create mode 100644 tests/general/bug-111.xsl create mode 100644 tests/general/bug-112.out create mode 100644 tests/general/bug-112.xsl create mode 100644 tests/general/bug-113.out create mode 100644 tests/general/bug-113.xsl create mode 100644 tests/general/bug-114.out create mode 100644 tests/general/bug-114.xsl create mode 100644 tests/general/bug-115.out create mode 100644 tests/general/bug-115.xsl create mode 100644 tests/general/bug-116.out create mode 100644 tests/general/bug-116.xsl create mode 100644 tests/general/bug-117.out create mode 100644 tests/general/bug-117.xsl create mode 100644 tests/general/bug-118.out create mode 100644 tests/general/bug-118.xsl create mode 100644 tests/general/bug-119.out create mode 100644 tests/general/bug-119.xsl create mode 100644 tests/general/bug-12-.out create mode 100644 tests/general/bug-12-.xsl create mode 100644 tests/general/bug-120.out create mode 100644 tests/general/bug-120.xsl create mode 100644 tests/general/bug-121.out create mode 100644 tests/general/bug-121.xsl create mode 100644 tests/general/bug-122.out create mode 100644 tests/general/bug-122.xsl create mode 100644 tests/general/bug-123.out create mode 100644 tests/general/bug-123.xsl create mode 100644 tests/general/bug-124.out create mode 100644 tests/general/bug-124.xsl create mode 100644 tests/general/bug-125.out create mode 100644 tests/general/bug-125.xsl create mode 100644 tests/general/bug-126.out create mode 100644 tests/general/bug-126.xsl create mode 100644 tests/general/bug-127.out create mode 100644 tests/general/bug-127.xsl create mode 100644 tests/general/bug-128.out create mode 100644 tests/general/bug-128.xsl create mode 100644 tests/general/bug-129.out create mode 100644 tests/general/bug-129.xsl create mode 100644 tests/general/bug-13-.out create mode 100644 tests/general/bug-13-.xsl create mode 100644 tests/general/bug-130-imp1.imp create mode 100644 tests/general/bug-130-imp2.imp create mode 100644 tests/general/bug-130-imp3.imp create mode 100644 tests/general/bug-130-imp4.imp create mode 100644 tests/general/bug-130.out create mode 100644 tests/general/bug-130.xsl create mode 100644 tests/general/bug-131-imp.imp create mode 100644 tests/general/bug-131.out create mode 100644 tests/general/bug-131.xsl create mode 100644 tests/general/bug-132.out create mode 100644 tests/general/bug-132.xsl create mode 100644 tests/general/bug-133.out create mode 100644 tests/general/bug-133.xsl create mode 100644 tests/general/bug-134.out create mode 100644 tests/general/bug-134.xsl create mode 100644 tests/general/bug-135.out create mode 100644 tests/general/bug-135.xsl create mode 100644 tests/general/bug-136.out create mode 100644 tests/general/bug-136.xsl create mode 100644 tests/general/bug-137.imp create mode 100644 tests/general/bug-137.out create mode 100644 tests/general/bug-137.xsl create mode 100644 tests/general/bug-138.out create mode 100644 tests/general/bug-138.xsl create mode 100644 tests/general/bug-139.out create mode 100644 tests/general/bug-139.xsl create mode 100644 tests/general/bug-14-.out create mode 100644 tests/general/bug-14-.xsl create mode 100644 tests/general/bug-140.out create mode 100644 tests/general/bug-140.xsl create mode 100644 tests/general/bug-141.out create mode 100644 tests/general/bug-141.xsl create mode 100644 tests/general/bug-142.out create mode 100755 tests/general/bug-142.xsl create mode 100644 tests/general/bug-143.out create mode 100644 tests/general/bug-143.xsl create mode 100644 tests/general/bug-144.out create mode 100644 tests/general/bug-144.xsl create mode 100644 tests/general/bug-145.err create mode 100644 tests/general/bug-145.out create mode 100644 tests/general/bug-145.xsl create mode 100644 tests/general/bug-146.out create mode 100644 tests/general/bug-146.xsl create mode 100644 tests/general/bug-147-1.imp create mode 100644 tests/general/bug-147-2.imp create mode 100644 tests/general/bug-147-3.imp create mode 100644 tests/general/bug-147-4.imp create mode 100644 tests/general/bug-147-5.imp create mode 100644 tests/general/bug-147-6.imp create mode 100644 tests/general/bug-147.out create mode 100644 tests/general/bug-147.xsl create mode 100644 tests/general/bug-148.out create mode 100644 tests/general/bug-148.xsl create mode 100644 tests/general/bug-149.out create mode 100644 tests/general/bug-149.xsl create mode 100644 tests/general/bug-15-.out create mode 100644 tests/general/bug-15-.xsl create mode 100644 tests/general/bug-150.out create mode 100644 tests/general/bug-150.xsl create mode 100644 tests/general/bug-151.out create mode 100644 tests/general/bug-151.xsl create mode 100644 tests/general/bug-152.out create mode 100644 tests/general/bug-152.xsl create mode 100644 tests/general/bug-153.out create mode 100644 tests/general/bug-153.xsl create mode 100644 tests/general/bug-154.out create mode 100644 tests/general/bug-154.xsl create mode 100644 tests/general/bug-155.out create mode 100644 tests/general/bug-155.xsl create mode 100644 tests/general/bug-156.err create mode 100644 tests/general/bug-156.imp1.imp create mode 100644 tests/general/bug-156.imp2.imp create mode 100644 tests/general/bug-156.out create mode 100644 tests/general/bug-156.xsl create mode 100644 tests/general/bug-157.err create mode 100644 tests/general/bug-157.out create mode 100644 tests/general/bug-157.xsl create mode 100644 tests/general/bug-158.out create mode 100644 tests/general/bug-158.xsl create mode 100644 tests/general/bug-159.out create mode 100644 tests/general/bug-159.xsl create mode 100644 tests/general/bug-16-.out create mode 100644 tests/general/bug-16-.xsl create mode 100644 tests/general/bug-160.out create mode 100644 tests/general/bug-160.xsl create mode 100644 tests/general/bug-161.out create mode 100644 tests/general/bug-161.xsl create mode 100644 tests/general/bug-163.out create mode 100644 tests/general/bug-163.xsl create mode 100644 tests/general/bug-164.out create mode 100644 tests/general/bug-164.xsl create mode 100644 tests/general/bug-165.err create mode 100644 tests/general/bug-165.out create mode 100644 tests/general/bug-165.xsl create mode 100644 tests/general/bug-166.out create mode 100644 tests/general/bug-166.xsl create mode 100644 tests/general/bug-167.out create mode 100644 tests/general/bug-167.xsl create mode 100644 tests/general/bug-168.out create mode 100644 tests/general/bug-168.xsl create mode 100644 tests/general/bug-169.imp create mode 100644 tests/general/bug-169.out create mode 100644 tests/general/bug-169.xsl create mode 100644 tests/general/bug-17-.out create mode 100644 tests/general/bug-17-.xsl create mode 100644 tests/general/bug-170.out create mode 100644 tests/general/bug-170.xsl create mode 100644 tests/general/bug-171.out create mode 100644 tests/general/bug-171.xsl create mode 100644 tests/general/bug-172.out create mode 100644 tests/general/bug-172.xsl create mode 100644 tests/general/bug-173.out create mode 100644 tests/general/bug-173.xsl create mode 100644 tests/general/bug-174.err create mode 100644 tests/general/bug-174.out create mode 100644 tests/general/bug-174.xsl create mode 100644 tests/general/bug-175.err create mode 100644 tests/general/bug-175.out create mode 100644 tests/general/bug-175.xsl create mode 100644 tests/general/bug-176.out create mode 100644 tests/general/bug-176.xsl create mode 100644 tests/general/bug-177.out create mode 100644 tests/general/bug-177.xsl create mode 100644 tests/general/bug-178.out create mode 100644 tests/general/bug-178.xsl create mode 100644 tests/general/bug-179.out create mode 100644 tests/general/bug-179.xsl create mode 100644 tests/general/bug-18-.out create mode 100644 tests/general/bug-18-.xsl create mode 100644 tests/general/bug-180.err create mode 100644 tests/general/bug-180.out create mode 100644 tests/general/bug-180.xsl create mode 100644 tests/general/bug-181.out create mode 100644 tests/general/bug-181.xsl create mode 100644 tests/general/bug-182.out create mode 100644 tests/general/bug-182.xsl create mode 100644 tests/general/bug-183.out create mode 100644 tests/general/bug-183.xsl create mode 100644 tests/general/bug-184.err create mode 100644 tests/general/bug-184.out create mode 100644 tests/general/bug-184.xsl create mode 100644 tests/general/bug-185.err create mode 100644 tests/general/bug-185.out create mode 100644 tests/general/bug-185.xsl create mode 100644 tests/general/bug-186.out create mode 100644 tests/general/bug-186.xsl create mode 100644 tests/general/bug-187.err create mode 100644 tests/general/bug-187.out create mode 100644 tests/general/bug-187.xsl create mode 100644 tests/general/bug-19-.out create mode 100644 tests/general/bug-19-.xsl create mode 100644 tests/general/bug-2-.out create mode 100644 tests/general/bug-2-.xsl create mode 100644 tests/general/bug-20-.out create mode 100644 tests/general/bug-20-.xsl create mode 100644 tests/general/bug-21-.out create mode 100644 tests/general/bug-21-.xsl create mode 100644 tests/general/bug-22-.out create mode 100644 tests/general/bug-22-.xsl create mode 100644 tests/general/bug-23-.out create mode 100644 tests/general/bug-23-.xsl create mode 100644 tests/general/bug-24-.out create mode 100644 tests/general/bug-24-.xsl create mode 100644 tests/general/bug-25-.out create mode 100644 tests/general/bug-25-.xsl create mode 100644 tests/general/bug-26-.out create mode 100644 tests/general/bug-26-.xsl create mode 100644 tests/general/bug-27-.out create mode 100644 tests/general/bug-27-.xsl create mode 100644 tests/general/bug-28-.out create mode 100644 tests/general/bug-28-.xsl create mode 100644 tests/general/bug-29-.out create mode 100644 tests/general/bug-29-.xsl create mode 100644 tests/general/bug-3-.out create mode 100644 tests/general/bug-3-.xsl create mode 100644 tests/general/bug-30-.out create mode 100644 tests/general/bug-30-.xsl create mode 100644 tests/general/bug-31-.out create mode 100644 tests/general/bug-31-.xsl create mode 100644 tests/general/bug-32-.out create mode 100644 tests/general/bug-32-.xsl create mode 100644 tests/general/bug-33-.out create mode 100644 tests/general/bug-33-.xsl create mode 100644 tests/general/bug-35-.out create mode 100644 tests/general/bug-35-.xsl create mode 100644 tests/general/bug-36-.out create mode 100644 tests/general/bug-36-.xsl create mode 100644 tests/general/bug-36-inc.out create mode 100644 tests/general/bug-36-inc.xsl create mode 100644 tests/general/bug-37-.out create mode 100644 tests/general/bug-37-.xsl create mode 100644 tests/general/bug-37-inc.out create mode 100644 tests/general/bug-37-inc.xsl create mode 100644 tests/general/bug-38-.out create mode 100644 tests/general/bug-38-.xsl create mode 100644 tests/general/bug-39-.out create mode 100644 tests/general/bug-39-.xsl create mode 100644 tests/general/bug-4-.out create mode 100644 tests/general/bug-4-.xsl create mode 100644 tests/general/bug-40-.out create mode 100644 tests/general/bug-40-.xsl create mode 100644 tests/general/bug-41-.out create mode 100644 tests/general/bug-41-.xsl create mode 100644 tests/general/bug-42-.out create mode 100644 tests/general/bug-42-.xsl create mode 100644 tests/general/bug-43-.out create mode 100644 tests/general/bug-43-.xsl create mode 100644 tests/general/bug-44-.out create mode 100644 tests/general/bug-44-.xsl create mode 100644 tests/general/bug-45-.out create mode 100644 tests/general/bug-45-.xsl create mode 100644 tests/general/bug-46-.out create mode 100644 tests/general/bug-46-.xsl create mode 100644 tests/general/bug-47-.out create mode 100644 tests/general/bug-47-.xsl create mode 100644 tests/general/bug-48-.out create mode 100644 tests/general/bug-48-.xsl create mode 100644 tests/general/bug-49-.out create mode 100644 tests/general/bug-49-.xsl create mode 100644 tests/general/bug-5-.out create mode 100644 tests/general/bug-5-.xsl create mode 100644 tests/general/bug-50-.out create mode 100644 tests/general/bug-50-.xsl create mode 100644 tests/general/bug-52.out create mode 100644 tests/general/bug-52.xsl create mode 100644 tests/general/bug-53.out create mode 100644 tests/general/bug-53.xsl create mode 100644 tests/general/bug-54.out create mode 100644 tests/general/bug-54.xsl create mode 100644 tests/general/bug-55.out create mode 100644 tests/general/bug-55.xsl create mode 100644 tests/general/bug-56.out create mode 100644 tests/general/bug-56.xsl create mode 100644 tests/general/bug-57.out create mode 100644 tests/general/bug-57.xsl create mode 100644 tests/general/bug-58.xsl create mode 100644 tests/general/bug-59.out create mode 100644 tests/general/bug-59.xsl create mode 100644 tests/general/bug-6-.out create mode 100644 tests/general/bug-6-.xsl create mode 100644 tests/general/bug-60.err create mode 100644 tests/general/bug-60.out create mode 100644 tests/general/bug-60.xsl create mode 100644 tests/general/bug-61.out create mode 100644 tests/general/bug-61.xsl create mode 100644 tests/general/bug-62-inc.out create mode 100644 tests/general/bug-62-inc.xsl create mode 100644 tests/general/bug-62.out create mode 100644 tests/general/bug-62.xsl create mode 100644 tests/general/bug-63.out create mode 100644 tests/general/bug-63.xsl create mode 100644 tests/general/bug-64.out create mode 100644 tests/general/bug-64.xsl create mode 100644 tests/general/bug-65.ent create mode 100644 tests/general/bug-65.out create mode 100644 tests/general/bug-65.xsl create mode 100644 tests/general/bug-66.out create mode 100644 tests/general/bug-66.xsl create mode 100644 tests/general/bug-68.out create mode 100644 tests/general/bug-68.xsl create mode 100644 tests/general/bug-69.out create mode 100644 tests/general/bug-69.xsl create mode 100644 tests/general/bug-7-.out create mode 100644 tests/general/bug-7-.xsl create mode 100644 tests/general/bug-70.out create mode 100644 tests/general/bug-70.xsl create mode 100644 tests/general/bug-71.out create mode 100644 tests/general/bug-71.xsl create mode 100644 tests/general/bug-72.out create mode 100644 tests/general/bug-72.xsl create mode 100644 tests/general/bug-73.out create mode 100644 tests/general/bug-73.xsl create mode 100644 tests/general/bug-74.out create mode 100644 tests/general/bug-74.xsl create mode 100644 tests/general/bug-75.out create mode 100644 tests/general/bug-75.xsl create mode 100644 tests/general/bug-76.out create mode 100644 tests/general/bug-76.xsl create mode 100644 tests/general/bug-77.out create mode 100644 tests/general/bug-77.xsl create mode 100644 tests/general/bug-78.out create mode 100644 tests/general/bug-78.xsl create mode 100644 tests/general/bug-79.out create mode 100644 tests/general/bug-79.xsl create mode 100644 tests/general/bug-8-.out create mode 100644 tests/general/bug-8-.xsl create mode 100644 tests/general/bug-80.out create mode 100644 tests/general/bug-80.xsl create mode 100644 tests/general/bug-81.out create mode 100644 tests/general/bug-81.xsl create mode 100644 tests/general/bug-82.out create mode 100644 tests/general/bug-82.xsl create mode 100644 tests/general/bug-83.out create mode 100644 tests/general/bug-83.xsl create mode 100644 tests/general/bug-84.out create mode 100644 tests/general/bug-84.xsl create mode 100644 tests/general/bug-86.out create mode 100644 tests/general/bug-86.xsl create mode 100644 tests/general/bug-87.out create mode 100644 tests/general/bug-87.xsl create mode 100644 tests/general/bug-88.out create mode 100644 tests/general/bug-88.xsl create mode 100644 tests/general/bug-89.out create mode 100644 tests/general/bug-89.xsl create mode 100644 tests/general/bug-9-.out create mode 100644 tests/general/bug-9-.xsl create mode 100644 tests/general/bug-90.out create mode 100644 tests/general/bug-90.xsl create mode 100644 tests/general/bug-91.out create mode 100644 tests/general/bug-91.xsl create mode 100644 tests/general/bug-92.out create mode 100644 tests/general/bug-92.xsl create mode 100644 tests/general/bug-93-inc.out create mode 100644 tests/general/bug-93-inc.xsl create mode 100644 tests/general/bug-93.out create mode 100644 tests/general/bug-93.xsl create mode 100644 tests/general/bug-94.out create mode 100644 tests/general/bug-94.xsl create mode 100644 tests/general/bug-95.out create mode 100644 tests/general/bug-95.xsl create mode 100644 tests/general/bug-96.out create mode 100644 tests/general/bug-96.xsl create mode 100644 tests/general/bug-97.out create mode 100644 tests/general/bug-97.xsl create mode 100644 tests/general/bug-98.out create mode 100644 tests/general/bug-98.xsl create mode 100644 tests/general/bug-99.out create mode 100644 tests/general/bug-99.xsl create mode 100644 tests/general/character.out create mode 100644 tests/general/character.xsl create mode 100644 tests/general/character2.out create mode 100644 tests/general/character2.xsl create mode 100644 tests/general/date_add.out create mode 100644 tests/general/date_add.xsl create mode 100644 tests/general/inner.xsl create mode 100644 tests/general/itemschoose.out create mode 100644 tests/general/itemschoose.xsl create mode 100644 tests/keys/Makefile.am create mode 100644 tests/keys/dates.xml create mode 100644 tests/keys/month.out create mode 100644 tests/keys/month.xml create mode 100644 tests/keys/month.xsl create mode 100644 tests/multiple/Makefile.am create mode 100644 tests/multiple/dict.dtd create mode 100644 tests/multiple/dict.xml create mode 100644 tests/multiple/dict.xsl create mode 100644 tests/multiple/out/lettera.orig create mode 100644 tests/multiple/out/letterb.orig create mode 100644 tests/multiple/out/letterc.orig create mode 100644 tests/multiple/out/letterd.orig create mode 100644 tests/multiple/out/lettere.orig create mode 100644 tests/multiple/out/letterf.orig create mode 100644 tests/multiple/out/letterg.orig create mode 100644 tests/multiple/out/letterh.orig create mode 100644 tests/multiple/out/letterij.orig create mode 100644 tests/multiple/out/letterk.orig create mode 100644 tests/multiple/out/letterl.orig create mode 100644 tests/multiple/out/letterm.orig create mode 100644 tests/multiple/out/lettern.orig create mode 100644 tests/multiple/out/lettero.orig create mode 100644 tests/multiple/out/letterp.orig create mode 100644 tests/multiple/out/letterq.orig create mode 100644 tests/multiple/out/letterr.orig create mode 100644 tests/multiple/out/letters.orig create mode 100644 tests/multiple/out/lettert.orig create mode 100644 tests/multiple/out/letteruv.orig create mode 100644 tests/multiple/out/letterw.orig create mode 100644 tests/multiple/out/letterx.orig create mode 100644 tests/multiple/out/lettery.orig create mode 100644 tests/multiple/out/letterz.orig create mode 100644 tests/multiple/out/titlepage.orig create mode 100644 tests/multiple/result.xml create mode 100644 tests/namespaces/Makefile.am create mode 100644 tests/namespaces/extra.out create mode 100644 tests/namespaces/extra.xml create mode 100644 tests/namespaces/extra.xsl create mode 100644 tests/namespaces/extra2.err create mode 100644 tests/namespaces/extra2.out create mode 100644 tests/namespaces/extra2.xml create mode 100644 tests/namespaces/extra2.xsl create mode 100644 tests/namespaces/tst.out create mode 100644 tests/namespaces/tst.xml create mode 100644 tests/namespaces/tst.xsl create mode 100644 tests/namespaces/tst2.out create mode 100644 tests/namespaces/tst2.xml create mode 100644 tests/namespaces/tst2.xsl create mode 100644 tests/namespaces/tst3.out create mode 100644 tests/namespaces/tst3.xml create mode 100644 tests/namespaces/tst3.xsl create mode 100644 tests/namespaces/tst4.out create mode 100644 tests/namespaces/tst4.xml create mode 100644 tests/namespaces/tst4.xsl create mode 100644 tests/namespaces/tst5.out create mode 100644 tests/namespaces/tst5.xml create mode 100644 tests/namespaces/tst5.xsl create mode 100644 tests/namespaces/tst6.out create mode 100644 tests/namespaces/tst6.xml create mode 100644 tests/namespaces/tst6.xsl create mode 100644 tests/namespaces/tst7.out create mode 100644 tests/namespaces/tst7.xml create mode 100644 tests/namespaces/tst7.xsl create mode 100644 tests/namespaces/tst8.out create mode 100644 tests/namespaces/tst8.xml create mode 100644 tests/namespaces/tst8.xsl create mode 100644 tests/namespaces/tst9.out create mode 100644 tests/namespaces/tst9.xml create mode 100644 tests/namespaces/tst9.xsl create mode 100644 tests/numbers/Makefile.am create mode 100644 tests/numbers/format-number.out create mode 100644 tests/numbers/format-number.xml create mode 100644 tests/numbers/format-number.xsl create mode 100644 tests/plugins/Makefile.am create mode 100644 tests/plugins/plugin.out create mode 100644 tests/plugins/plugin.xml create mode 100644 tests/plugins/plugin.xsl create mode 100644 tests/plugins/testplugin.c create mode 100644 tests/reports/Makefile.am create mode 100644 tests/reports/cmdlineparams.out create mode 100644 tests/reports/cmdlineparams.xml create mode 100644 tests/reports/cmdlineparams.xsl create mode 100644 tests/reports/recglobparam.err create mode 100644 tests/reports/recglobparam.out create mode 100644 tests/reports/recglobparam.xml create mode 100644 tests/reports/recglobparam.xsl create mode 100644 tests/reports/recglobvar.err create mode 100644 tests/reports/recglobvar.out create mode 100644 tests/reports/recglobvar.xml create mode 100644 tests/reports/recglobvar.xsl create mode 100644 tests/reports/reclocparam.err create mode 100644 tests/reports/reclocparam.out create mode 100644 tests/reports/reclocparam.xml create mode 100644 tests/reports/reclocparam.xsl create mode 100644 tests/reports/reclocvar.err create mode 100644 tests/reports/reclocvar.out create mode 100644 tests/reports/reclocvar.xml create mode 100644 tests/reports/reclocvar.xsl create mode 100644 tests/reports/tst-1.err create mode 100644 tests/reports/tst-1.out create mode 100644 tests/reports/tst-1.xml create mode 100644 tests/reports/tst-1.xsl create mode 100644 tests/reports/tst-2.err create mode 100644 tests/reports/tst-2.out create mode 100644 tests/reports/tst-2.xml create mode 100644 tests/reports/tst-2.xsl create mode 100644 tests/reports/undefvar.err create mode 100644 tests/reports/undefvar.out create mode 100644 tests/reports/undefvar.xml create mode 100644 tests/reports/undefvar.xsl create mode 100644 tests/xinclude/Makefile.am create mode 100644 tests/xinclude/e.xml create mode 100644 tests/xinclude/e.xsl create mode 100644 tests/xinclude/normal.out create mode 100644 tests/xinclude/x1.xml create mode 100644 tests/xinclude/x2.xml create mode 100644 tests/xinclude/xinclude.out create mode 100644 tests/xmlspec/Makefile.am create mode 100644 tests/xmlspec/REC-xml-20001006-review.html create mode 100644 tests/xmlspec/REC-xml-20001006.html create mode 100644 tests/xmlspec/REC-xml-20001006.xml create mode 100644 tests/xmlspec/REC-xml-2e.xsl create mode 100644 tests/xmlspec/W3C-REC.css create mode 100644 tests/xmlspec/diffspec.xsl create mode 100644 tests/xmlspec/logo-REC create mode 100644 tests/xmlspec/xmlspec-v21.dtd create mode 100644 tests/xmlspec/xmlspec.xsl create mode 100644 vms/build_xslt.com create mode 100644 vms/diffs.vms create mode 100644 vms/readme.vms create mode 100644 win32/Makefile.mingw create mode 100644 win32/Makefile.msvc create mode 100644 win32/Readme.txt create mode 100644 win32/configure.js create mode 100644 win32/defgen.xsl create mode 100644 win32/libexslt.def.src create mode 100644 win32/libxslt.def.src create mode 100644 win32/libxslt/libxslt.def create mode 100644 win32/libxslt/libxslt.dsw create mode 100644 win32/libxslt/libxslt_so.dsp create mode 100644 win32/libxslt/xsltproc.dsp create mode 100644 win32/runtests.py create mode 100644 xslt-config.in create mode 100644 xsltConf.sh.in create mode 100644 xsltproc/Makefile.am create mode 100644 xsltproc/testThreads.c create mode 100644 xsltproc/xsltproc.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d48221a --- /dev/null +++ b/.gitignore @@ -0,0 +1,152 @@ +*/*.o +*/*.lo +tags +*/tags +.deps +.gitignore +.memdump +COPYING +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +broken.xsl +config.guess +config.h +config.h.in~ +config.log +config.status +config.sub +configure +depcomp +doc/Makefile +doc/Makefile.in +install-sh +libexslt.pc +libexslt/.deps +libexslt/.libs +libexslt/Makefile +libexslt/Makefile.in +libexslt/exsltconfig.h +libexslt/libexslt.la +libtool +libxslt-1.1.24.tar.gz +libxslt.pc +libxslt.spec +libxslt.spec.in.orig +libxslt/.deps +libxslt/.libs +libxslt/Makefile +libxslt/Makefile.in +libxslt/libxslt.la +libxslt/xsltconfig.h +ltmain.sh +missing +python/.deps +python/.libs +python/Makefile +python/Makefile.in +python/gen_prog +python/libxslt-export.c +python/libxslt-py.c +python/libxslt-py.h +python/libxslt.py +python/libxsltclass.py +python/libxsltmod.la +python/tests/Makefile +python/tests/Makefile.in +python/tests/foo +stamp-h1 +tests/Makefile +tests/Makefile.in +tests/REC/.memdump +tests/REC/Makefile +tests/REC/Makefile.in +tests/REC1/.memdump +tests/REC1/Makefile +tests/REC1/Makefile.in +tests/REC2/.memdump +tests/REC2/Makefile +tests/REC2/Makefile.in +tests/XSLTMark/.memdump +tests/XSLTMark/Makefile +tests/XSLTMark/Makefile.in +tests/docbook/.memdump +tests/docbook/Makefile +tests/docbook/Makefile.in +tests/docs/Makefile +tests/docs/Makefile.in +tests/documents/.memdump +tests/documents/Makefile +tests/documents/Makefile.in +tests/exslt/Makefile +tests/exslt/Makefile.in +tests/exslt/common/.memdump +tests/exslt/common/Makefile +tests/exslt/common/Makefile.in +tests/exslt/date/.memdump +tests/exslt/date/Makefile +tests/exslt/date/Makefile.in +tests/exslt/dynamic/.memdump +tests/exslt/dynamic/Makefile +tests/exslt/dynamic/Makefile.in +tests/exslt/functions/.memdump +tests/exslt/functions/Makefile +tests/exslt/functions/Makefile.in +tests/exslt/math/.memdump +tests/exslt/math/Makefile +tests/exslt/math/Makefile.in +tests/exslt/sets/.memdump +tests/exslt/sets/Makefile +tests/exslt/sets/Makefile.in +tests/exslt/strings/.memdump +tests/exslt/strings/Makefile +tests/exslt/strings/Makefile.in +tests/extensions/.memdump +tests/extensions/Makefile +tests/extensions/Makefile.in +tests/general/.memdump +tests/general/Makefile +tests/general/Makefile.in +tests/keys/.memdump +tests/keys/Makefile +tests/keys/Makefile.in +tests/multiple/.memdump +tests/multiple/Makefile +tests/multiple/Makefile.in +tests/namespaces/.memdump +tests/namespaces/Makefile +tests/namespaces/Makefile.in +tests/numbers/.memdump +tests/numbers/Makefile +tests/numbers/Makefile.in +tests/plugins/.deps/ +tests/plugins/Makefile +tests/plugins/Makefile.in +tests/plugins/xmlsoft_org_xslt_testplugin.la +tests/plugins/*.o +tests/plugins/*.lo +tests/reports/.memdump +tests/reports/Makefile +tests/reports/Makefile.in +tests/xinclude/.memdump +tests/xinclude/Makefile +tests/xinclude/Makefile.in +tests/xmlspec/.memdump +tests/xmlspec/Makefile +tests/xmlspec/Makefile.in +tests/xmlspec/debug +xslt-config +xsltConf.sh +xslt_xml_id.patch +xsltproc/.deps +xsltproc/Makefile +xsltproc/Makefile.in +xsltproc/xsltproc +tests/XSLTMark/db100.xml +tests/XSLTMark/db1000.xml +tests/XSLTMark/db10000.xml +tests/plugins/.libs +tests/plugins/plugin.res +xsltproc/testThreads +xsltproc/.libs/ diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..0379b6d --- /dev/null +++ b/AUTHORS @@ -0,0 +1,63 @@ +Daniel Veillard: + daniel@veillard.com + DV on #gnome IRC channel + http://veillard.com/ + Used to work at W3C, now Red Hat + co-chair of W3C XML Linking WG + invited expert on the W3C XML Core WG + Author of libxml2 upon which this library is based. + +Bjorn Reese: + breese@users.sourceforge.net + http://home1.stofanet.dk/breese/ + Software developer at http://www.systematic.dk/ + Member of the XML-MTF Mapping WG. + +William Brack + +Thomas Broyer + +Igor Zlatkovic for the Windows port + +Patches gently provided by a multitude of people : + +Abhishek Arya +Ben Walton +Bjorn Reese +C. M. Sperberg-McQueen +Colin Walters +Daniel Mustieles +Daniel Richard G +Darin Adler +ÉRDI Gergo +Fatih Demir +Federico Mena Quintero +Frederic Crozat +Hao Hu +Havoc Pennington +IlyaS +jacob berkman +Jason Viers +Jérôme Carretero +Joachim Breitner +Johan Dahlin +John Fleck +Jose Maria Celorio +Julio M. Merino Vidal +Kasimier T. Buchcik +Kjartan Maraas +Laurence Rowe +Malcolm Purvis +Martin +Michael Bonfils +Mike Hommey +money_seshu Dronamraju +Nick Wellnhofer +Nix +Pedro F. Giffuni +Peter Williams +Rob Richards +Roumen Petrov +Stefan Kost +Tomasz KÅ‚oczko +Chris Evans diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..7761eb3 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,7683 @@ +Fri Jul 24 10:16:24 CEST 2009 Daniel Veillard + + * libxslt/attributes.c: fix an IDness issue when building the tree + +Tue May 12 09:03:46 CEST 2009 Daniel Veillard + + * configure.in: adapt the extra version detection code to git + * libxslt.doap: adding RDF dope file + +Fri Jan 23 19:02:28 PST 2009 William Brack + + * libexslt/strings.c: Fixed indexing error reported by + Ron Burk on the mailing list. + +Fri Nov 14 15:06:55 CET 2008 Daniel Veillard + + * python/Makefile.am libxslt/Makefile.am configure.in + libexslt/Makefile.am: applied patch from Roumen Petrov for + mingw cross compilation problems raised by Rich Jones + +Tue Oct 28 11:55:27 CET 2008 Daniel Veillard + + * configure.in Makefile.am: patch from Richard Jones to build + shared libs with MinGW cross-compiler + +Tue Oct 7 18:16:08 CEST 2008 Daniel Veillard + + * libxslt/pattern.c: prevent some unchecked pointer accesses, patch + by Jake Goulding + +Wed Aug 6 20:10:08 HKT 2008 William Brack + + * Minor cleanup of "typo" and some compilation warnings: + tests/namespaces/tst7.xsl: fixed typo detected by new libxml2 code + libxslt/keys.c, libxslt/xsltlocale.c, libexslt/date.c: trivial + changes for gcc warnings. + +Fri Aug 1 10:16:48 CEST 2008 Daniel Veillard + + * libxslt/xsltconfig.h.in libxslt/xslt.c libxslt/extensions.c + libxslt/xsltlocale.c libxslt/preproc.c libxslt/xsltutils.c + libxslt/xsltlocale.h libxslt/win32config.h configure.in + config.h.in win32/configure.js: big patch from Roumen Petrov + finishing xsl:sort lang support with many portability issues + fixed and feedback from Nick Wellnhofer and Rob Richards + +Fri Aug 1 07:54:02 CEST 2008 Daniel Veillard + + * libexslt/crypto.c: fix for CVE-2008-2935 libexslt RC4 + encryption/decryption functions + +Mon Jul 28 14:46:27 CEST 2008 Daniel Veillard + + * configure.in: fix my static linking setup on x86_64 + +Sun Jul 27 13:52:10 CEST 2008 Daniel Veillard + + * libxslt/xslt.c: avoid a quadratic behaviour when hitting duplicates + exclude-result-prefixes declarations, should fix #544906 + +Sat Jul 26 12:43:18 PST 2008 William Brack + + *configure.in: fixed option --with-debugger with patch from + Arun Ragnavan #544829 + +Sat Jul 12 16:36:58 PST 2008 William Brack + + * libexslt/math.c: fixed incorrect argument popping in + exsltMathAtan2Function #541965 + +Thu Jul 10 10:04:28 PST 2008 William Brack + + * libxslt/functions.c: patch from Ron Burk to fix problem + with string check for element-available and + function-available #530891. + +Tue Jun 24 23:55:48 PST 2008 William Brack + + * libxslt/attrvt.c: added code to handle literal within an + AVT #539741. + * tests/docs/Makefile.am tests/docs/bug-168.xsl + * tests/general/Makefile.am tests/general/bug-168.* add a + test for this bug to the regression suite. + +Fri Jun 13 10:58:52 CEST 2008 Daniel Veillard + + * libxslt/libxslt.h libexslt/libexslt.h libexslt/exslt.h: patch + from Roumen Petrov fixing include path when compiling outside + source tree + +Thu Jun 12 11:23:23 CEST 2008 Daniel Veillard + + * libxslt/xsltconfig.h.in libxslt/xsltlocale.h configure.in + config.h.in win32/configure.js: patch from Nick Wellnhofer and + Roumen Petrov to fix some portability problems on the previous + xsl:sort locale patch + +Tue Jun 3 18:26:26 CEST 2008 Daniel Veillard + + * configure.in libxslt/extra.c libxslt/Makefile.am libxslt/preproc.c + libxslt/xsltInternals.h libxslt/xsltlocale.c libxslt/xsltlocale.h + libxslt/xsltutils.c win32/Makefile.mingw win32/Makefile.msvc: patch + from Nick Wellnhofer adding xsl:sort lang support using the locale + support from the C library. + +Tue Jun 3 18:14:55 CEST 2008 Daniel Veillard + + * libxslt/extensions.h: as Ralf Junker pointed out + xsltExtFunctionLookup was defined but never implemented, removing it + +Tue May 13 17:51:05 CEST 2008 Daniel Veillard + + * configure.in doc/*: release of 1.1.24 + * python/generator.py: syntactic cleanup (Martin) + +Tue May 13 16:32:22 CEST 2008 Daniel Veillard + + * libxslt/xslt.c libxslt/extensions.c libxslt/extensions.h: + fix the processing of top level elements of stylesheets which + are not in the XSLT namespace and are not an extension either + should fix #529223 + * tests/docs/Makefile.am tests/docs/bug-167.xml + tests/general/Makefile.am tests/general/bug-167.*: add the + test to the regression suite + +Fri May 9 14:30:35 CEST 2008 Daniel Veillard + + * libxslt/documents.c libxslt/keys.c libxslt/xsltInternals.h + libxslt/transform.c libxslt/pattern.c: fix the key initialization + problem introduced when tracking Josef Urban problem from 22 Dec + 2007, this should also handle the problem of recursive keys + definitions should fix #531873. + * tests/docs/bug-166.xml tests/docs/Makefile.am + tests/general/Makefile.am tests/general/bug-166.xsl + tests/general/bug-166.out: add the regression tests when a key + computation depends on another one. + +Mon Apr 21 16:16:29 CEST 2008 Daniel Veillard + + * doc/xsltproc.1 doc/xsltproc.xml: update the man page based on + Vincent Lefevre suggestion. + +Mon Apr 14 11:19:14 CEST 2008 Daniel Veillard + + * libxslt/pattern.c: fixes #527297 general patter comps fix and cleanup + * libxslt/xsltInternals.h libxslt/pattern.h: other cleanups + +Tue Apr 8 19:15:19 CEST 2008 Daniel Veillard + + * configure.in doc/*: release of 1.1.23 + +Tue Apr 8 18:52:36 CEST 2008 Daniel Veillard + + * libexslt/date.c: new version of patch from Peter Pawlowski + +Tue Apr 8 10:19:01 CEST 2008 Daniel Veillard + + * python/generator.py: fix an infinite loop bug + +Thu Apr 3 09:32:49 CEST 2008 Daniel Veillard + + * libxslt/xsltutils.c: avoid a scary realloc() loop should fix #520383 + +Thu Apr 3 07:32:36 CEST 2008 Daniel Veillard + + * libexslt/date.c: applied patch from Peter Pawlowski fixing + a timezone offset problem, fixes #521680 + * libxslt/namespaces.c: a bit of space/tabs cleanup + +Thu Apr 3 06:25:02 CEST 2008 Daniel Veillard + + * doc/xsltproc.xml doc/xsltproc.1 doc/xsltproc.html: small fix to + man page synopsis, should fix #525822 + +Sat Mar 15 11:13:18 HKT 2008 William Brack + + * libexslt/functions.c: fixed minor error reported on the mailing + list by Mark Howe, which caused a segfault if func:result was + postitioned as top-level element. + +Thu Mar 13 09:33:21 CET 2008 Daniel Veillard + + * libxslt/win32config.h: patch from Rob Richards for VS 2008 + * python/types.c: fix a problem with namespace nodes coming from + XPath nodesets. + +Mon Mar 3 09:39:31 CET 2008 Daniel Veillard + + * doc/xsltproc.xml doc/xsltproc.1: fix maxdepth default value + documentation fixes #519921. + +Sat Feb 16 01:24:58 HKT 2008 William Brack + + *libxslt/extensions.c: fixed minor error bug #516483 + *tests/exslt/common - deleted node-set.9 regression test, + because it relied upon an external web import. + +Tue Feb 5 08:53:30 CET 2008 Daniel Veillard + + * libxslt/xslt.c: applied documentation patch from Jason Viers + for xsltParseStylesheetDoc + +Tue Feb 5 08:36:53 CET 2008 Daniel Veillard + + * python/tests/pyxsltproc.py: applied a portability patch from + Stephane Bidoul + +Thu Jan 24 16:24:05 CET 2008 Daniel Veillard + + * doc/xslt.html doc/docbook.html: fix links for Cygwin DocBook + setup as suggested by Philippe Bourcier + +Sun Dec 23 16:40:38 PST 2007 William Brack + + * libxslt/keys.c, libxslt/pattern.c, libxslt/xsltInternals.h: + fixed a problem on superfluous re-generation of keys reported + on the mailing list by Josef Urban. + +Thu Nov 29 11:43:14 CET 2007 Daniel Veillard + + * configure.in: avoid a problem in configure if an old gcrypt + version is installed, patch from Brent Cowgill, fixes #500390 + +Tue Nov 13 13:08:08 PDT 2007 William Brack + + * libexslt/common.c, libexslt/dynamic.c: After discussion on + Bugzilla with Peter Pawlowski, added same code for preventing + deletion of function result during garbage collection (see + bug #495995). + +Mon Nov 12 13:53:58 PDT 2007 William Brack + + * libexslt/strings.c: Added code to mark the results of + str:tokenize and str:split as "function result" to avoid + garbage-collecting them during global variable initialisation. + Should fix bug #495995. + +Wed Oct 24 17:41:08 PDT 2007 William Brack + + * python/libxslt.c: changed iterator argument for Py_Dict_Next + from int to ssize_t (seems Python docs are incorrect) to fix + x86_64 bug #489854. + +Wed Oct 10 16:33:09 CEST 2007 Daniel Veillard + + * libexslt/date.c tests/exslt/date/datetime.1.out + tests/exslt/date/date.1.out tests/exslt/date/date.1.xml: + applied patch from Maurice van der Pot to fix EXSLT + week-in-year extenson which was not conforming to the definition. + This also changes the output of the tests a bit. Should fix #452876 + +Thu Aug 30 08:18:08 HKT 2007 William Brack + + * python/libxslt.c: applied patch from Daniel Gryniewicz to + fix a segfault caused by a parameter array not being preset + to zero. + +Thu Aug 23 17:18:03 CEST 2007 Daniel Veillard + + * configure.in doc/*: preparing release of 1.1.22 + +Thu Aug 23 15:39:18 CEST 2007 Daniel Veillard + + * libxslt/xslt.c: applied patch from Rob Richards to fix a + stylesheet compilation error handling problem #382570 + +Thu Aug 23 15:22:55 CEST 2007 Daniel Veillard + + * libxslt/security.c: applied patch from Roland Schwarz and Rob + Richards to fix the security file checks on Windows, should + close #464432 + +Thu Aug 23 21:15:28 HKT 2007 William Brack + + * tests/general/bug-165.[xsl,out,err], tests/docs/bug-165.xml, + tests/general/Makefile.am, tests/docs/Makefile.am: + added regression test for bug #469410 + +Thu Aug 23 14:13:02 CEST 2007 Daniel Veillard + + * xsltproc/xsltproc.c: patch from Drazen Kacar to add a --encoding + option fixes #443868 + * doc/xsltproc.xml doc/xsltproc.1: augment and regenerate man page. + +Thu Aug 23 11:47:20 CEST 2007 Daniel Veillard + + * libexslt/date.c: apply patch from Björn Wiberg fixing build on AIX + and closing bug #332173 + +Fri Aug 3 15:49:26 CEST 2007 Daniel Veillard + + * win32/Makefile.msvc win32/configure.js: apply patch from + Rob Richards to improve build with VS2005 + +Thu Jul 26 12:43:38 PDT 2007 William Brack + + * libxslt/xslt.c: Removed the exclude-result-prefix change of + 31 May 2007. Fixes bug #459713. + +Sat Jun 16 07:42:18 PDT 2007 William Brack + + * libxslt/transform.c: Fixed problem with RVT cleanup related + to some exslt functions (reported on the list by Marc Adkins). + +Wed Jun 13 13:27:48 PDT 2007 William Brack + + * tests/exslt/common/node-set.9.[xml,xsl,out], + tests/exslt/common/Makefile.am: added test case for bug #413451 + +Tue Jun 12 18:43:05 CEST 2007 Daniel Veillard + + * NEWS configure.in doc/*: preparing release of 1.1.21 + +Thu May 31 12:38:08 PDT 2007 William Brack + + * libxslt/xslt.c: fixed obscure namespace problem related to + exclude-result-prefix + +Mon May 7 00:14:28 HKT 2007 William Brack + + * libxslt/transform.c: fixed minor compilation warning; no change + to logic. + +Sun May 6 23:42:38 HKT 2007 William Brack + + * libexslt/math.c: fixed two memory leaks, one in exsltMathConstant + and one in exsltMathConstantFunction (bug #436324) + +Fri May 4 15:51:58 HKT 2007 William Brack + + * libxslt/transform.c: fixed xpath context housekeeping problem + on processing "choose" (bug 435479). + +Thu Apr 26 11:10:18 HKT 2007 William Brack + + * libxslt/transform.c: fixed (another) problem with cached + RVT's (from re-opened #378766). + +Tue Mar 27 16:50:52 CEST 2007 Daniel Veillard + + * libxslt/xsltutils.c: apply patch fron Shaun McCance to hook + xsl:message construct to the new per-xsltTransformCtxt error + callback if set up. + * Makefile.am: do not package svn files in releases + +Fri Mar 2 18:45:48 HKT 2007 William Brack + + * libxslt/xsltconfig.h.in: added setting of TRIO_REPLACE_STDIO + when TRIO routines are required. + * libxslt/namespaces.c, libxslt/xsltutils.c: enhanced handling + of stdio.h vs. trio.h when trio routines are required (now + use XSLT_NEED_TRIO) (bug #412787) + +Sun Feb 18 09:00:08 PST 2007 William Brack + + * python/libxsl.py: fixed tab/space inconsistency with patch + provided by Andreas Hanke (bug #409193) + +Thu Feb 15 14:03:18 PST 2007 William Brack + + * doc/xslt.html: Changed all + references to CVS to be SVN; changed corresponding links. + * doc/*html: regenerated the documentation for above + +Wed Feb 14 01:21:38 PST 2007 William Brack + + * libxslt/pattern.c: Fixed problem with namespace on compound + predicate (bug #407731) + +Wed Jan 24 11:05:28 PST 2007 William Brack + + * libxslt/pattern.c: added check for memory allocation error + (bug #400242); fixed "type-punned pointer" warnings. + * libxslt/xsltutils.c: added checks for memory allocation error + (bug #400242) + * restored NEWS, doc/EXSLT/downloads.html which mysteriously + disappeared from svn + +Wed Jan 17 14:20:18 CET 2007 Daniel Veillard + + * configure.in doc/*: preparing release of 1.1.20 + * libexslt/crypto.c: small patch for missing includes on some BSD, + fixes #397373 + * configure.in: replace == by = in test, raised by Roland Illig, + should fix #397371 + +Sun Jan 14 18:45:08 PST 2007 William Brack + + * libxslt/functions.c: fixed two problems related to checking + of fragments, related to python htmlCtxtReadFile problem + reported on mailing list by Nic Ferrier. + +Fri Jan 12 23:24:08 PST 2007 William Brack + + * libxslt/extensions.c: reverted last change, fixed some + comments. Note that in it's current state the 'plugin' + implementation will fail if called from a program + compiled as static! + +Fri Jan 12 15:40:08 PST 2007 William Brack + + * configure.in: fixed problem with DV/WMB testing env. + * regenerated docs; doc/APIchunk1[012].html added to SVN + * libxslt/extensions.c: fixed problem with plugin loading; + removed testplugin.c from SVN (current version kept as + tests/plugin/testplugin.c) + +Thu Jan 11 11:08:18 PST 2007 William Brack + + * libxslt/transform.c: enhanced to ignore empty text node + in xsltDefaultProcessOneNode (avoid calling xsltCopyText) + (bug #354900) + * xsltproc/xsltproc.c: added check for output file problem, + yielding new error code 11 (Mike Hommey). + * doc/xsltproc.html, doc/xsltproc.xml: added documentation + for above, regenerated docs (doc/xsltproc.1) + +Wed Jan 10 19:13:08 PST 2007 William Brack + + * libexslt/strings.c: added new function 'replace' from Joel + Reed. + * tests/exslt/Makefile.am, replace.1.xml, replace.1.xsl, + replace.1.out: added new test case for above. + * libxslt.spec.in: trivial change from 'Gnome' to 'GNOME' + * configure.in: trivial change for flags on my compilations + * libxslt/documents.c, libxslt/documents.h, libxslt/keys.c, + libxslt/keys.h, libxslt/variables.c, libxslt/templates.c, + libxslt/transform.c, libxslt/variables.c, libxslt/xslt.c, + libxslt/xsltutils.c: fixed some documentation/comments and + compilation warnings - no change to logic. + * re-generated the documentation. + +Wed Jan 3 16:46:05 CET 2007 Daniel Veillard + + * configure.in: adapt the extra versioning code to SVN + +Fri Dec 22 09:12:08 PST 2006 William Brack + + * python/libxslt.c: applied patch supplied by Kjartan Maraas + (bug #388567). + +Mon Dec 11 14:38:22 PST 2006 William Brack + + * libexslt/functions.c: further enhancement to the original + fix for bug #381319 (which was not correct). + * tests/exslt/functions: minor enhancement to function.9.xsl; + function.10.[xsl,xml,out] added to regression tests to check + recursive calls. + +Mon Dec 11 12:13:14 CET 2006 Daniel Veillard + + * configure python/generator.py python/libxsl.py + python/libxslt-python-api.xml python/libxslt.c + python/tests/2stage.py python/tests/loader.py: applied patch from + Nic James Ferrier to make stylesheets comparable and to add + transformContext handling + +Sat Dec 9 15:22:34 PST 2006 William Brack + + * libexslt/functions.c: changed handling of function params + to fix bug #381319 + * libxslt/transform.[ch]: exposed xsltLocalVariablePush and + xsltLocalVariablePop as global entries so that they could + be used from within libexslt/functions.c + * tests/exslt/functions/function.9.[xsl,xml,out] added to + regression tests + +Tue Dec 5 10:45:04 CET 2006 Daniel Veillard + + * libxslt/extensions.c: applied patch from Marcus Meissner removing + a strict aliasing problem should fix #317921 + +Fri Dec 1 23:02:27 HKT 2006 William Brack + + * libxslt/transform.c: fixed problem with housekeeping of + localRVTBase, bug #378766 + +Wed Nov 29 16:06:43 CET 2006 Daniel Veillard + + * NEWS configure.in doc//*: preparing release of libxslt-1.1.19 + +Sat Nov 25 11:48:28 HKT 2006 William Brack + + * libxslt/variables.c: fixed problem with cached RVT's, + bug #378766 + +Thu Nov 23 17:49:31 CET 2006 Daniel Veillard + + * libxslt/transform.c: applied patch from Mike Hommey about saving + the current in-scope namespace list when calling a template, fixes + bug #377579 + +Thu Nov 23 15:36:28 CET 2006 Daniel Veillard + + * configure.in: fix a python detection problem pointed out by + Joseph Sacco, fixes bug #376391 + +Fri Nov 17 09:53:08 HKT 2006 William Brack + + * libxslt/transform.c: fixed problem with entity handling + within xsltCopyAttrListNoOverwrite (#352907) + * tests/general/bug-164.xsl, tests/general/bug-164.out, + tests/docs/bug-164.oxml: added a regression test for this + +Thu Oct 26 15:31:01 CEST 2006 Daniel Veillard + + * NEWS configure.in doc//*: preparing release of libxslt-1.1.18, + this bumps libxml2 requirement to 1.6.27 + * libexslt/date.c libxslt/namespaces.h libxslt/xslt.c + libxslt/xsltInternals.h: cosmetic cleanups to restore the + API extraction + +Thu Oct 26 10:36:43 CEST 2006 Daniel Veillard + + * doc//*: removed all remaining references to the old Wiki + +Thu Oct 12 23:12:24 HKT 2006 William Brack + + * libexslt/date.c: fixed end-of-month problem in exsltDateCurrent + (#359246) + +Thu Oct 12 14:39:37 CEST 2006 Daniel Veillard + + * libxslt/preproc.c: applied patch from Mike Hommey fixing 2 + erroneous xmlFree() and adding a message on an unsupported feature + +Wed Oct 11 23:16:10 CEST 2006 Daniel Veillard + + * python/libxslt-python-api.xml: applied fix for accessor functions + of a stylesheet returning pointers to immutable strings, patch + from #320540 + * xsltproc/xsltproc.c: fix the xinclude on stylehseet problem + by adding a new parameter to xsltproc names --xincludestyle + +Wed Oct 11 22:27:37 CEST 2006 Daniel Veillard + + * xsltproc/xsltproc.c: apply patch from Gary Coady to compile when + libxml2 has no xinclude support #319886 + * docs/*: renamed Gnome to GNOME fixes #352159 + +Wed Oct 11 21:37:27 CEST 2006 Daniel Veillard + + * libxslt/Makefile.am: a missing DESTDIR + * python/Makefile.am: fix reference to build paths in python module + * libexslt/exsltconfig.h.in libxslt/xsltconfig.h.in: fix the header + comments on version values, the 3 are patches from Peter + Breitenlohner and should fix #340995 + +Wed Oct 11 11:16:34 CEST 2006 Daniel Veillard + + * libxslt/security.c: applied cleanup patch from Mikhail Zabaluev + which should finish fixing #337486 + +Wed Oct 11 09:55:06 CEST 2006 Daniel Veillard + + * libxslt/security.c: applied fix from Shane Corgatelli to pass + the full URL when checking security access for network URLs, + should fix bug #359366 + +Mon Aug 21 10:46:25 CEST 2006 Daniel Veillard + + * doc/xslt.html python/tests/pyxsltproc.py xsltproc/xsltproc.c: + applied patch from Daniel Leidert to fix some typo + * xsltproc.xml xsltproc.1: applied another patch from Daniel Leidert + and regenerated + +Wed Aug 16 17:39:04 CEST 2006 Daniel Veillard + + * xsltproc/xsltproc.c: --xinclude should also force XInclude + processing on the stylesheets themselves, raised by Daniel Leidert + +Thu Aug 10 15:54:02 CEST 2006 Kasimier Buchcik + + * libxslt/transform.c libxslt/variables.c + libxslt/xsltInternals.h: Fixed restoring the context doc + for XPath in xsltForEach(). Eliminated the use of @tmpDoc + of the transformation context. + +Thu Aug 10 13:40:35 CEST 2006 Kasimier Buchcik + + * libxslt/preproc.c: Added missing QName-validation of some + attributes of XSLT-elements. This fixes bug #304921, reported + by Frans Englich. + +Thu Aug 10 13:27:48 CEST 2006 Kasimier Buchcik + + * libxslt/transform.c: As suggested by Bill, I changed + xsltShallowCopyNsNode() to return an xmlNsPtr instead of + an int. The fix of bug #350085 is OK; i.e. the removal + of the call to xsltFreeRVTs() in + xsltApplyStylesheetInternal(). I think I tried to clear + the transformation context as much as possible, in case + it is reused; Daniel informed me on the list that reusing + the context is not intended, so no need anymore to try + to free the fragments immediately after the transformation. + +Wed Aug 9 13:22:13 PDT 2006 William Brack + + * libxslt/transform.c: Fixed problem with cleanup of RVT's, should + clear bug350085; cleaned up most warnings (still a problem in + xsltShallowCopyNsNode) + * trivial warning cleanup in libxslt/[extensions.c, namespaces.c, + xslt.c and xsltInternals.h] and libexslt/functions.c + +Fri Aug 4 14:50:41 CEST 2006 Daniel Veillard + + * python/generator.py: fixed the conversion of long parameters + +Wed Jul 19 15:06:39 EDT 2006 Daniel Veillard + + * python/types.c: fix float and boolean XPath conversions + * libxslt/xsltutils.c: try to fix Stephane Bidoul attempt + at setting XInclude support. + +Mon Jul 17 11:15:23 PDT 2006 William Brack + + * Updated tests affected by recent library changes - + tests/general/bug-1-.out, tests/general/bug-24-.out, + tests/keys/month.out : ( now becomes ); + tests/general/bug-41-.xsl and tests/general/bug-43.xsl : + call-template and apply-template, where the template has + no parameter but one is supplied (var should not be affected) + tests/general/bug-145.err : changed error text + +Fri Jul 14 18:16:59 CEST 2006 Kasimier Buchcik + + * libxslt/attributes.c libxslt/documents.c + libxslt/functions.c libxslt/keys.c libxslt/namespaces.c + libxslt/pattern.c libxslt/preproc.c libxslt/templates.c + libxslt/templates.h libxslt/transform.c + libxslt/variables.c libxslt/xslt.c + libxslt/xsltInternals.h libxslt/xsltutils.c + libxslt/xsltutils.h libexslt/common.c libexslt/dynamic.c + libexslt/functions.c libexslt/strings.c: + Committing again, since I forgot to switch from win to linux + linebreaks in the files. + +Fri Jul 14 17:55:42 CEST 2006 Kasimier Buchcik + + * libxslt/attributes.c libxslt/documents.c + libxslt/functions.c libxslt/keys.c libxslt/namespaces.c + libxslt/pattern.c libxslt/preproc.c libxslt/templates.c + libxslt/templates.h libxslt/transform.c libxslt/variables.c + libxslt/xslt.c libxslt/xsltInternals.h libxslt/xsltutils.c + libxslt/xsltutils.h libexslt/common.c libexslt/dynamic.c + libexslt/functions.c libexslt/strings.c: + Refactored xsltValueOf(). Changed to use xmlXPathCastToString() + directly, rather than creating an intermediate object with + xmlXPathConvertString(). This now does not add a text-node to + the result if the string is empty (this has impact on + serialization, since an empty text-node is serialized as + , and now it will be serialized as ). + Refactored other functions in transform.c: + Mostly code cleanup/restructuring. Minimized number of + function variables for instruction which eat up function stack + memory when recursing templates (xsltIf(), xsltChoose(), + xsltApplyTemplates(), xsltCallTemplate()). + Changed XSLT tests to use xmlXPathCompiledEvalToBoolean(). + Implemented redefinition checks at compilation-time and + eliminating them at transformation time in the refactored code + paths. + Introduced the field @currentTemplateRule on xsltTransformContext to + reflect the "Current Template Rule" as defined by the spec. + NOTE that ctxt->currentTemplateRule and ctxt->templ is not the + same; the former is the "Current Template Rule" as defined by the + XSLT spec, the latter is simply the template struct being + currently processed by Libxslt. + Added XML_COMMENT_NODE and XML_CDATA_SECTION_NODE to the macro + IS_XSLT_REAL_NODE. + Misc code cleanup/restructuring and everything else I already forgot. + Refactored lifetime of temporary result tree fragments. + Substituted all calls to the now deprecated xsltRegisterTmpRVT() + for the new xsltRegisterLocalRVT(). + Fragments of xsl:variable and xsl:param are freed when the + variable/pram is freed. + Fragments created when evaluating a "select" of xsl:varible and + xsl:param are also bound to the lifetime of the var/param. + EXSLT's func:function now uses the following functions to let take + care the transformation's garbage collector of returned tree + fragments: + xsltExtensionInstructionResultRegister(), + xsltExtensionInstructionResultFinalize() + Fixes: + #339222 - xsl:param at invalid position inside an xsl:template is + not catched + #346015 - Non-declared caller-parameters are accepted + #160400 - Compiles invalid XSLT; unbound variable accepted + #308441 - namespaced parameters become unregistered + #307103 - problem with proximity position in predicates of match + patterns + #328218 - problem with exsl:node-set() when converting strings + to node sets + #318088 - infinite recursion detection + #321505 - Multiple contiguous CDATA in output + #334493 - "--param" option does not have root context + #114377 - weird func:result/xsl:variable/exsl:node-set interaction + #150309 - Regression caused by fix for 142768 + +Wed Jun 21 15:13:27 CEST 2006 Kasimier Buchcik + + * tests/docs/bug-54.xml tests/general/bug-54.out + tests/general/bug-99.out tests/general/bug-136.out + tests/REC/test-7.1.3.xsl tests/REC/test-7.1.4.xsl + tests/REC/test-7.3.xsl tests/REC/test-7.4.xsl: + Fixed incorrect regression tests/results. + +Mon Jun 19 13:33:50 CEST 2006 Kasimier Buchcik + + * libxslt/attributes.c libxslt/attrvt.c libxslt/namespaces.c + libxslt/namespaces.h libxslt/preproc.c libxslt/templates.c + libxslt/transform.c libxslt/variables.c libxslt/xslt.c + libxslt/xsltInternals.h libxslt/xsltutils.c: + Merged all the namespace lookup/create/disable functions + into xsltGetSpecialNamespace(). Changed xsltGetNamespace() + and xsltGetPlainNamespace() to call xsltGetSpecialNamespace(), + but kept the ns-aliasing mechanism; the ns-aliasing needs + to be removed when we move to the refactored code, which + applies ns-alias only at compilaton time. + Refactored xsltElementComp() (preproc.c); enhanced error reports. + Fixed: if the "namespace" attribute was not given, then this + performed incorrectly only a lookup for a default namespace; + i.e., without taking any prefix on the "name" attribute into + account. + Refactored xsltElement() (transform.c); enhanced error reports. + Refactored xsltAttributeComp() (preproc.c). Added namespace + lookup as in xsltElementComp(). Enhanced error reports. + Refactored xsltAttribute() (transform.c); enhanced error reports. + xsltCopyTreeInternal(): eliminated the need to call xmlGetNsList() + for every element in the tree; this needs to be done only for + the top-most elements. For subsequent elements reconcile only + the ns-declarations. Disallowed setting of ns-declarations if + children have been already added to an element. + Removed ns-aliasing code where necessary. + xsltCopyProp(): disallowed setting of attribute nodes if + children have been already added to an element. + xsltCopy(): removed the incorrect skipping of attributes in the + XSLT namespace. Removed the incorrect ns-aliasing for attributes. + Changed to use the introduced function xsltShallowCopyAttr(). + xsltShallowCopyAttr(): Centralized all attribute-copy related + code in this function. It will now be called by + xsltCopyTreeInternal(), xsltCopyOf() and xsltCopy(). + xsltCopyAttrListNoOverwrite(): Renamed. Refactored. Optimized to + use xsltGetSpecialNamespace() and xmlNewDocProp(). + Further substitution of various scattered namespace-lookup + related code for the use of xsltGetSpecialNamespace(). + xsltAttrTemplateProcess(): Refactored. Removed the incorrect + processing of attribute-sets. Attribute sets need to be applied + before adding any normal attribute of the literal result element; + this is now done in xsltAttrListTemplateProcess(). Fixed to + ensure that the ns-prefix of the overwriting attribute is used. + xsltAttrListTemplateProcess(): Refactored. Moved semantics from + xsltAttrTemplateProcess() over to this function in order to + optimize processing of multiple attributes. This does not call + xsltAttrTemplateProcess() anymore. + Fixed: do not exclude the XSLT namespace after ns-aliasing have + beed applied. + The IFDEFed-out refactored code fixes the following issues: + - #313711: namespace collision with namespace-alias (reported + by by Oleg Paraschenko) + - #338214: Incorrect scope for exclude-result-prefixes + - #341392: Excluding namespace declarations of literal result + elements. + - #341325: Namespace aliasing and resulting namespace prefixes + Already enabled fixes: + - #344183: xsl:copy misses to copy attributes in the XSLT namespace + - #341463: Namespace-alias using #default for result-prefix with no + default namespace in scope + - #313890: namespace collision with xsl:element and xsl:attribute, + reported by Oleg Paraschenko + - #344176: xsl:copy misses to set an element's namespace-URI in + some cases + - #305739: the "name" QName of xsl:element is incorrectly always + resolved to the default namespace + +Mon Jun 12 16:34:15 CEST 2006 Daniel Veillard + + * doc/xsltproc.1 doc/xsltproc.xml: more info about --output + from Daniel Leidert c.f. #344654 + +Tue Jun 6 17:16:33 CEST 2006 Daniel Veillard + + * configure.in libxslt.spec.in doc//*: preparing release of 1.1.17 + +Tue Jun 6 11:44:34 CEST 2006 Kasimier Buchcik + + * libxslt/attributes.c: Eliminated a tiny difference wrt to + the old behaviour in the naming of newly generated ns-decls + in xsltAttributeInternal(). + +Thu Jun 1 15:06:31 CEST 2006 Daniel Veillard + + * configure.in: fix a problem in Python detection + +Thu Jun 1 13:58:19 CEST 2006 Kasimier Buchcik + + * libxslt/attributes.c libxslt/variables.c + libxslt/transform.c libxslt/xslt.c: + Next step in the refactored code: enhanced xsl:attribute; + enhanced xsltCopyProp. + Added the creation of an XPath cache in + xsltNewTransformContext(). + +Wed May 31 22:32:44 CEST 2006 Kasimier Buchcik + + * libxslt/transform.c: Fixed a difference in processing of + xsl:value-of and xsl:text wrt to merging of strings of + output-escaped text-nodes. This difference made the + optimized string-merging mechanism run out of sync, which + led to segfaults in subsequent string reallocations. See + bug #343411, reported by Grzegorz Kaczor. + * xslt.c: Added check for ctxt->internalized when we parse + xsl:text and internalize the strings. + +Mon May 22 10:32:57 CEST 2006 Kasimier Buchcik + + * libxslt/attributes.c libxslt/documents.c + libxslt/extensions.c libxslt/keys.c libxslt/pattern.c + libxslt/preproc.c libxslt/templates.c + libxslt/transform.c libxslt/variables.c + libxslt/xslt.c libxslt/xsltInternals.h: + Next tiny step of refactoring - mostly bug fixes and + cosmetic changes. + Changes outside of the refactored code: + 1) Optimized xsl:attribute if the content consists of + just 1 text node. + 2) Optimized computation of xsl:key. The keys will now be + computed for a specific document not until the first call + of a key() function; here only the keys with the specific + name used by key() are computed. This means that this + now avoids computation of all keys for all loaded + input documents (even if no key() was called on them). + One exception is the scenario where a key() is used in + a template's match pattern; in this case all keys are + computed for a document if there's a chance that + a "keyed" template could match a node (this could still + be optimized a bit). + +Mon May 15 22:32:13 CEST 2006 Kasimier Buchcik + + * libxslt/namespaces.c libxslt/attributes.c: + Fixed bug #302020, reported by Thomas Blatter. + +Fri May 12 23:23:06 CEST 2006 Kasimier Buchcik + + * libxslt/documents.c libxslt/namespaces.c + libxslt/preproc.c libxslt/transform.c + libxslt/xslt.c libxslt/xsltInternals.h libxslt/xsltutils.c: + Next step of refactoring. For more details see bug #341588. + I applied the suggestion of Jerome Pesenti to the refactored + (still IDFEDed out with XSLT_REFACTORED) code: The XPath + compilation context (accessible via the compilation context) + is now reused for compilation of expressions at + compilation-time; this should reduce compilation time to 50% + for avarage stylesheets. + +Thu May 11 22:12:22 CEST 2006 Kasimier Buchcik + + * libxslt/extensions.c: Changed a comment to indicate that a + specific bug was already fixed. + +Fri May 5 23:10:47 CEST 2006 Kasimier Buchcik + + * libxslt/xsltInternals.h libxslt/attributes.c + libxslt/documents.c libxslt/extensions.c + libxslt/extensions.h libxslt/functions.c + libxslt/imports.c libxslt/keys.c libxslt/preproc.c + libxslt/transform.c libxslt/variables.c libxslt/xslt.c + libxslt/xsltutils.c libxslt/xsltutils.h libexslt/functions.c: + Next step of refactoring (plus some bug-fixes). + For more details see #340780. + +Fri May 5 14:31:53 CEST 2006 Kasimier Buchcik + + * tests/exslt/common/node-set.5.out + tests/exslt/sets/difference.1.out + tests/exslt/functions/function.6.out: Reverting the + changes; I'll rather change the processing stylesheet + documents in a way that they will produce the same results + for broken and stricter whitespace-stripping. + +Thu May 4 22:55:26 CEST 2006 Kasimier Buchcik + + * tests/exslt/common/node-set.5.out + tests/exslt/sets/difference.1.out + tests/exslt/functions/function.6.out: Changed regression test + results (bug #340684). Those will now produce regression + errors; so we need to fix the processor. + +Mon May 1 17:39:27 EDT 2006 Daniel Veillard + + * configure.in NEWS doc//*: preparing release of 1.1.16, updated and + regenerated the docs. + +Tue Apr 25 15:02:42 CEST 2006 Daniel Veillard + + * configure.in: applied patch from Joseph Sacco changing slightly + the python detection scheme should fix bug #338527 + +Wed Apr 12 13:35:45 CEST 2006 Kasimier Buchcik + + * libxslt/attributes.c libxslt/preproc.c libxslt/transform.c + libxslt/variables.c libxslt/xslt.c libxslt/xsltInternals.h + libxslt/xsltutils.c libxslt/xsltutils.h: + Refactored the internal structures into specialized + structures and adjusted the code to work with those new + structures. I didn't yet (we should in the future) + renamed any fields of the old structures in order to avoid + changing too much code. + Introduced the internal structure xsltCompilerCtxt to be + used for storage and control of the compilation. + Optimized the way lists of in-scope namespaces are created + and stored; this will now only generate a new list if + really needed, i.e. if we encounter a ns-decl. + All this changes here are IFDEFed out with XSLT_REFACTORED. + +Thu Apr 6 10:16:59 CEST 2006 Daniel Veillard + + * doc/xsltproc.1 doc/xsltproc.xml: applied man page improvement + from Daniel Leidert + +Thu Mar 30 17:23:52 CEST 2006 Kasimier Buchcik + + * tests/general/bug-36-inc.xsl tests/general/bug-37-inc.xsl + tests/general/bug-65-inc.xsl tests/general/bug-100.xsl + tests/REC/test-15-1.xsl tests/REC/test-7.1.1-3.xsl + tests/namespaces/extra2.xsl tests/extensions/module.xsl + tests/plugins/plugin.xsl python/tests/extelem.py + python/tests/extfunc.py: Fixed regression tests wrt + usage of the attributes "exclude-result-prefixes" + and "extension-element-prefixes". test-7.1.1-3.xsl fails + now, since the code still does not exclude ns-decls + correctly. + +Thu Mar 30 17:11:53 CEST 2006 Kasimier Buchcik + + * libxslt/xslt.c libxslt/xsltutils.c libxslt/preproc.c + libxslt/namespaces.c libxslt/imports.c + libxslt/attributes.c: Eliminated usage of xsltGetNsProp() in cases + where an attribute with a specific namespace is requested. + xsltGetNsProp() uses xmlGetProp() which is not namespace aware + and thus will return the first attribute with the requested + name but of arbitrary namespace. + Changed retrieval of the attributes "exclude-result-prefixes" + and "extension-element-prefixes", which are expected to be in + no namespace on XSLT elements and in the XSLT namespace on + literal result elements or extension elements. + Additional change: for XSLT elements the attribute + "exclude-result-prefixes" is only allowed on xsl:stylesheet + and xsl:transform. This attribute was previously processed on + all XSLT elements. + +Wed Mar 29 12:16:41 CEST 2006 Daniel Veillard + + * libxslt/transform.c: Charles Hardin pointed an OOM condition where + a NULL pointer could be dereferenced, closes #336394 + +Fri Mar 10 12:49:18 CET 2006 Daniel Veillard + + * libexslt/crypto.c libexslt/date.c libexslt/saxon.c + libxslt/attributes.c libxslt/imports.c libxslt/pattern.c + libxslt/preproc.c libxslt/transform.c libxslt/variables.c + libxslt/xslt.c libxslt/xsltutils.c: various assorted small cleanups + based on the Coverity reports + +Wed Feb 22 16:09:10 CET 2006 Daniel Veillard + + * python/types.c: Nic Ferrier found debug statement left in the + XPath conversion code + +Tue Feb 21 20:21:07 CET 2006 Daniel Veillard + + * doc/xsltproc.1 doc/xsltproc.xml: new update from Daniel Leidert + +Tue Feb 21 17:59:11 CET 2006 Daniel Veillard + + * libxslt/extensions.c libxslt/xslt.c libxslt/xslt.h + libxslt/xsltInternals.h: applied patch from Christopher R. Palmer + to avoid a race condition in xsltInit() + +Sun Feb 19 22:40:58 CET 2006 Daniel Veillard + + * doc/xsltproc.1 doc/xsltproc.xml: improvement of the man page + by Daniel Leidert, c.f. #331779 + +Sat Feb 11 13:10:01 CET 2006 Daniel Veillard + + * libxslt/xsltutils.c: fix xsltSaveResultToString comment + * libxslt/transform.c: detect loops when computing variables, should + fix bug #330772 + * doc/xsltproc.xml doc/xsltproc.1: fix typo in man page + * tests/namespaces/tst7.out tests/general/bug-152.out: small output + changes due to libxml2 xhtml meta handling modification + +Mon Nov 21 12:22:21 CET 2005 Daniel Veillard + + * libexslt/date.c: Albert Chin found another signed/unsigned problem + in the date and time code raised on IRIX 6.5 + +Mon Nov 21 12:08:05 CET 2005 Daniel Veillard + + * libexslt/crypto.c: patch from Albert Chin needed for HP-UX + which doesn't have + +Mon Nov 21 12:05:41 CET 2005 Daniel Veillard + + * libexslt/date.c: Albert Chin posted a patch to fix a problem on + Solaris with dates, extended bitfield size too to match libxml2 + code from xmlschemastypes.c + +Wed Nov 16 12:47:25 CET 2005 Daniel Veillard + + * libexslt/functions.c: fix an problem raised by Ralf Junker in the + use of xmlHashScanFull() fixes bug #321582 + +Sun Nov 6 19:22:45 CET 2005 Daniel Veillard + + * libxslt/attrvt.c: added a missing parameter to a debug function + +Tue Oct 4 20:37:09 HKT 2005 William Brack + + * libexslt/date.c: applied fix to date:week-in-year posted to + the mailing list by Thomas Broyer + * tests/exslt/date/date.1.out, tests/exslt/date/datetime.1.out: + updated to reflect above fix + +Sun Oct 2 11:52:44 CEST 2005 Daniel Veillard + + * configure.in libxslt/Makefile.am libxslt/xsltconfig.h.in + libxslt.spec.in tests/plugins/Makefile.am xslt-config.in: applied + patch from Joel Reed to ease plugin integration + +Thu Sep 22 21:51:22 HKT 2005 William Brack + + * libxslt/pattern.c: fixed problem in internal XPath compilation + of patterns including variables, fixes #316861 + +Wed Sep 14 14:30:03 CEST 2005 Daniel Veillard + + * libxslt/transform.c: removed a superfluous second sorting of + the node set on xsl:copy-of, fixes #316288 + * libxslt/xsltutils.c: marked xsltDocumentSortFunction as slow, + obsolete and deprecated :-) + +Sat Sep 10 14:35:06 CEST 2005 Daniel Veillard + + * configure.in: check environment for PYTHON, fixes #315367 + +Mon Sep 5 00:44:24 CEST 2005 Daniel Veillard + + * configure.in NEWS doc/*: preparing release 1.1.15 + * libxslt/pattern.c libxslt/xsltutils.c: a bit more cleanup + +Mon Sep 5 00:07:40 CEST 2005 Daniel Veillard + + * libxslt/pattern.c: fixed #303289 variable in match are forbidden + * tests/general/bug-89.xsl: had to fix that test which was doing this + * tests/general/bug-142.out tests/general/bug-152.out + tests/namespaces/tst7.out: small output change on libxml2-2.6.21 + new way of serializing encoding meta in HTML + +Wed Aug 31 13:49:51 CEST 2005 Daniel Veillard + + * libxslt/transform.c: fixed #314936 a dictionnary issue on text + node merging, which probably fixed #311267 too. + +Thu Aug 25 13:29:20 CEST 2005 Daniel Veillard + + * libxslt/xslt.c: libxslt should deallocate directly text node content + use xmlSetNodeContent(..., NULL) + +Fri Aug 12 12:17:10 CEST 2005 Daniel Veillard + + * tests/general/bug-163.*, tests/general/Makefile.am, + tests/docs/bug-163.*, tests/docs/Makefile.am: check fix for + #310692 + +Tue Aug 9 22:13:18 CEST 2005 Daniel Veillard + + * tests/plugins/Makefile.am: try to get rid of complaints from + jhbuild newbies. + +Sun Aug 7 16:04:47 CEST 2005 Daniel Veillard + + * libxslt/xsltutils.c: fixed a bug when size of xmlXPathContext + changes, uses the libxml2 alloc and dealloc functions instead. + +Tue Jul 13 22:41:03 PDT 2005 William Brack + + * libxslt/transform.c: added check in xsltCopyText to assure + content is in dictionary before doing a straight copy of + content (bug 302821) + +Tue Jul 13 16:16:31 PDT 2005 William Brack + + * libxslt/transform.c: fixed to set current default value for + XInclude when creating new TransformContext + * libxslt/xslt.c: minor change for per-mille + +Sun Jul 10 16:17:53 CEST 2005 Daniel Veillard + + * libxslt/xsltwin32config.h*: try to avoid generating conflicts + * libexslt/dynamic.c: applied patch from Mark Vakoc to implement + dyn:map + * configure.in tests/exslt/Makefile.am tests/exslt/dynamic/*: + added test for dyn:map to the regression suite + +Sat Jul 2 02:32:24 PDT 2005 + + * libxslt/numbers.c: further fixes for bug 309209, changing + behaviour of format-number. + * libxslt/xslt.c: changed definition of per-mille character from + '?' to Unicode #2030 (UTF-8 '‰') (ref XSLT spec 12.3) + +2005-06-30 Federico Mena Quintero + + * libxslt/xsltwin32config.h: Added this file back. We'll have to + figure out a way to make jhbuild not get CVS conflicts with it. + +Thu Jun 30 14:09:55 PDT 2005 William Brack + + * libxslt/numbers.c: fixed bug in negative prefix (bug 309209) + +2005-06-17 Federico Mena Quintero + + * libxslt/xsltwin32config.h: Removed from CVS; this is a generated + file anyway and it breaks jhbuild all the time. + +Sat May 7 11:28:41 CEST 2005 Daniel Veillard + + * libexslt/libexslt.3: applied patch from Jonathan Wakely to fix + the namespace name for the EXSLT date and time functions in the man + page. + +Wed Apr 6 23:58:12 CEST 2005 Igor Zlatkovic + + * libexslt/exslt.c libexslt/libexslt.h: Windows build cleanups, + removed obsolete checks + * libxslt/libxslt.h libxslt/win32config.h libxslt/xsltutils.h: + Windows build cleanups, removed obsolete checks + * win32/configure.js: removed obsolete copy operations + * win32/Makefile.*: make install cleanup + * xsltproc/xsltproc.c: Windows build cleanup, removed obsolete + macro definitions + * .cvsignore: added Eclipse project files + +Sat Apr 2 13:34:11 CEST 2005 Daniel Veillard + + * configure.in NEWS doc/*: preparing release of 1.1.14, updated docs + and rebuilt. + +Thu Mar 31 23:50:43 CEST 2005 Daniel Veillard + + * tests/docbook/result/fo/gdp-handbook.fo tests/general/bug-105.out + tests/general/bug-142.out: updated the result of some tests + following the change to serailization in libxml2. + +Thu Mar 31 11:54:31 CEST 2005 Daniel Veillard + + * libxslt/pattern.c: fixed bug #171488 with cascading select in + patterns. + * tests/general/bug-161.*, tests/general/Makefile.am, + tests/docs/bug-161.*, tests/docs/Makefile.am: added test provided + by Ben Ko + +Thu Mar 31 00:28:38 CEST 2005 Daniel Veillard + + * tests/plugins/Makefile.am: fixed build outside of source tree + bug #172155 thanks to patch from Mike Castle + +Wed Mar 30 14:09:19 CEST 2005 Daniel Veillard + + * xsltproc/xsltproc.c: fixed the xinclude problem with document() + as in bug #171893 + * configure.in tests/Makefile.am tests/xinclude/*: added a new + xinclude directory with the test for this problem + +Wed Mar 30 11:59:06 CEST 2005 Daniel Veillard + + * libxslt/pattern.c: fixed bug 169718 with ancestors in patterns + similar to same bug fixed in libxml2 + * tests/general/bug-160.*, tests/general/Makefile.am, + tests/docs/bug-160.*, tests/docs/Makefile.am: added test provided + by Aaron Kaplan + +Tue Mar 29 22:35:14 CEST 2005 Daniel Veillard + + * tests/general/bug-159.*, tests/general/Makefile.am, + tests/docs/bug-159.*, tests/docs/Makefile.am: added test for + bug #168196 fixed in libxml2 + +Tue Mar 29 21:06:11 CEST 2005 Daniel Veillard + + * libxslt/transform.c: working around Mark Vakoc' reported bug related + to mode internaing + * xsltproc/xsltproc.c: adding a --nodict mode to check problems with + document without a dictionnary. + * tests/REC/Makefile.am tests/general/Makefile.am: testing without + dictionnary + +Tue Mar 29 15:37:13 CEST 2005 Daniel Veillard + + * libxslt/xslt.c: fix bug #165201 when calling xsltInit() multiple + times. + +Tue Mar 29 15:13:59 CEST 2005 Daniel Veillard + + * libxslt/preproc.c libxslt/xslt.c libxslt/xsltInternals.h: + added DTD like checking when compiling stylesheets, closes + bug #160402 and a long term TODO + * tests/general/bug-89.xsl: thos spotted a misconstruct of one + of the test cases where was not within + +Mon Mar 21 20:56:43 MST 2005 John Fleck (jfleck@inkstain.net) + + * doc/xsltproc.xml, xsltproc.html, xsltproc.1: + update documentation to reflect addition of --nodtdattr + command line flag. Bug #171098 + +Wed Mar 16 17:19:24 HKT 2005 William Brack (wbrack@mmm.com.hk) + + * libxslt/xslt.c: fixed problem with text node on stylesheet + document without a dictionary (bug 170533) + +Sun Mar 13 20:08:34 CET 2005 Daniel Veillard + + * NEWS configure.in doc/*: preparing 1.1.13, updated and rebuilt + the docs. + * tests/plugins/Makefile.am xsltproc/Makefile.am: trying to fix + some build problems. + * libxslt.spec.in: adding a build require and a require for + libgcrypt-devel, c.f. Red Hat bug #133211 + * libxslt/xsltInternals.h: as for libxml2, XML_CAST_FPTR was wrong. + +Wed Feb 23 19:25:13 HKT 2005 William Brack + + * libxslt/pattern.c: fixed a problem with '//' and + namespaces (bug 168208) + +Mon Feb 14 23:10:21 HKT 2005 William Brack + + * libxslt/namespaces.c: fixed a problem with + exclude-result-prefixes (bug 165560) + +Mon Feb 14 12:51:07 CET 2005 Daniel Veillard + + * libxslt/variables.c: added a cretion of ctxt->globalVars in + xsltProcessUserParamInternal if missing. + +Wed Feb 9 21:58:56 CET 2005 Daniel Veillard + + * doc/Makefile.am doc/libxslt-api.xml doc/libxslt-refs.xml + doc/EXSLT/libexslt-api.xml: applied patch for make wiki from + Joel Reed and rebuild + * tests/plugins/Makefile.am: fix from Joel Reed for make dist + +Sun Jan 30 20:01:21 CET 2005 Daniel Veillard + + * tests/plugins/testplugin.c win32/Makefile.msvc win32/configure.js: + applied plugin patch for Windows by Joel Reed + +Fri Jan 28 01:00:56 CET 2005 Daniel Veillard + + * win32/configure.js: Makefile fixes for Widows from Joel Reed + +Sat Jan 22 22:14:26 CET 2005 Daniel Veillard + + * libxslt/pattern.c libxslt/preproc.c libxslt/templates.c + libxslt/xslt.c libxslt/xsltInternals.h: chasing xmlStrEqual + calls and removed them when comparing mode and modeURI for + templates by interning those strings when compiling the + stylesheets. + +Sat Jan 22 19:17:13 CET 2005 Daniel Veillard + + * configure.in: small fix for local setup + * libxslt/transform.c libxslt/variables.c : speeding up some + variable lookup. In the process dug out something nasty about + ctxt->dict creation and key initialization order. + +Sat Jan 22 16:28:27 CET 2005 Daniel Veillard + + * libxslt/templates.c libxslt/transform.c libxslt/xslt.c + libxslt/xsltInternals.h: when copying text nodes in elements + or attributes to the output, if interning, then reuse the strings + directly without copying them in the output tree if dicts are + shared between the context and the output docs. Less allocations + smaller output document and no copying involved anymore. + +Sat Jan 22 11:24:43 CET 2005 Daniel Veillard + + * libxslt/xslt.c: internalize all text node content from + stylesheet documents with the stylesheet dictionnary + +Fri Jan 21 12:04:18 HKT 2005 William Brack + + * tests/plugins/Makefile.am: Applied patch 11 (with small + modification) from Joel + +Thu Jan 20 21:05:27 CET 2005 Daniel Veillard + + * tests/plugins/Makefile.am tests/plugins/testplugin.c: applied + patch 10 from Joel Reed + +Wed Jan 19 10:08:55 HKT 2005 William Brack + + * libxslt/xsltwin32config.h, libxslt/xsltwin32config.h.in: + fixed a small error in LIBXSLT_VERSION_EXTRA pointed out + by Michael.Hewarth on the mailing list + +Wed Jan 19 13:58:16 CET 2005 Daniel Veillard + + * configure.in: patch #9 from Joel Reed + +Wed Jan 19 10:21:37 HKT 2005 William Brack + + * transform.c: fixed problem with parserOptions not being + set before loading a new document (bug 164530) + +Mon Jan 17 16:50:02 CET 2005 Daniel Veillard + + * configure.in libxslt/Makefile.am libxslt/xsltwin32config.h + tests/Makefile.am tests/plugins/Makefile.am + tests/plugins/testplugin.c: applied another patch from Joel Reed + still failing here but looking better + +Sun Jan 16 00:09:11 CET 2005 Daniel Veillard + + * libxslt/extensions.c: applied another patch from Joel Reed + +Sat Jan 15 13:54:28 CET 2005 Daniel Veillard + + * tests/plugins/plugin.* tests/Makefile.am libxslt/extensions.c + libxslt/Makefile.am configure.in: Applied another patch from + Joel Reed, fixed a segfault and changed the configure code + a bit to work in my debug environment. + +Tue Jan 11 10:50:33 HKT 2005 William Brack + + * configure.in: added python2.4 to the list of accepted + versions (bug 163274) + +Sun Jan 9 17:04:23 CET 2005 Daniel Veillard + + * libxslt/extensions.c: oops previous patch could break build + +Sun Jan 9 16:41:59 CET 2005 Daniel Veillard + + * configure.in win32/configure.js libxslt/extensions.c + libxslt/xsltconfig.h.in libxslt/xsltwin32config.h.in: + integrated the module patch from Joel Reed with just a couple + of changes and cleanup. + +Tue Dec 27 17:50:10 HKT 2004 William Brack + + * libxslt/pattern.c: fixed a problem with the expression + "*//name" (bug 162265), also a small problem with the '|' + operator. + +Thu Dec 23 16:04:47 HKT 2004 William Brack + + * libxslt/transform.c, libxslt/templates.c: fixed a couple of + spots where out-of-memory errors were not detected in time + (bug #153660 on OSF/1) + +Thu Dec 2 21:10:31 HKT 2004 William Brack + + *doc/xslt.html, doc/downloads.html: changed the download link + on the web page for cvs snapshot + +Wed Dec 1 22:37:55 HKT 2004 William Brack + + * libxslt/extensions.c, libxslt/functions.c, libxslt/numbers.c, + libxslt/pattern.c, libxslt/transform.c, libxslt/xslt.c, + libxslt/xsltInternals.h: minor changes to get rid of gcc + warnings, especially on 64-bit system. Implemented + XML_CAST_FPTR macro to cast between function pointer <-> + object pointer while avoiding gcc warnings (a hack). + No change to the logic. + +Wed Dec 1 10:47:15 CET 2004 Daniel Veillard + + * libxslt/security.c xsltproc/xsltproc.c: applied patch from + Aleksey Gurtovoy moving some stat() definition for Windows + to the right place. + +Wed Dec 1 14:30:22 HKT 2004 William Brack + + * libxslt/xslt.c: applied patch from Mark Vakoc fixing bug with + namespace URI on template names. + * tests/namespaces/tst9*, tests/namespaces/Makefile.am: added + test case for this + +Tue Nov 30 10:53:18 HKT 2004 William Brack + + * libxslt/pattern.c: more on RVT's in XPath predicates, this + time for bug 159726. Cleaned up the logic a little, hopefully + now covers all setting of XSLT_RUNTIME_EXTRA. + * tests/general/bug-158.xsl: corrected a typo + +Thu Nov 25 22:24:03 HKT 2004 William Brack + + * libxslt/variables.c, libxslt/xsltInternals.h: backed out the + last change and re-did it the "right way" (bug 158372). + * tests/general/bug-158.*, tests/general/Makefile.am, + tests/docs/bug-158.*, tests/general/Makefile.am: added test + case for this bug + +Wed Nov 24 10:51:51 HKT 2004 William Brack + + * libxslt/variables.c, libxslt/xsltInternals.h: enhanced the + evaluation of global variables to take account of possible + changes to the current document (bug 158372). + +Mon Nov 22 08:10:18 HKT 2004 William Brack + + * libxslt/pattern.c: small change to previous fix for bug 153137, + fixes bug 158840. + * tests/general/bug-157.*, tests/general/Makefile.am, + tests/docs/bug-157.*, tests/docs/Makefile.am: added test for this + +Sun Nov 21 09:42:22 HKT 2004 William Brack + + * libxslt/transform.c: enhanced code to assure the "current + template rule" is not changed by xsl:call-template (bug 157859). + * tests/general/bug-156.*, tests/general/Makefile.am, + tests/docs/bug-156.*, tests/docs/Makefile.am: added a test case + +Mon Nov 8 11:41:32 HKT 2004 William Brack + + * libexslt/date.c: fixed problem with day-of-week-in-month + (bug 157592) with patch from Sal Paradise + * tests/exslt/date/datetime.1.out: corrected expected output + after above fix + +Mon Nov 1 15:57:24 CET 2004 Daniel Veillard + + * tests/general/bug-155.*, tests/general/Makefile.am, + tests/docs/bug-155*, tests/docs/Makefile.am: added a test case + provided by Markus Bertheau breaking on libxml2-2.6.15 + +Fri Oct 29 17:03:26 CEST 2004 Daniel Veillard + + * configure.in NEWS doc/*: preparing release of libxslt-1.1.12 + * libexslt/crypto.c: mini change to avoid breaking apibuild.py + * libxslt/templates.c: small fix, first step in adressing #153660 + +Fri Oct 29 14:18:35 CEST 2004 Daniel Veillard + + * doc/xsltproc.1 doc/xsltproc.xml: indicate - means stdin closing + #156626 + +Wed Oct 27 17:00:54 CEST 2004 Daniel Veillard + + * libxslt/transform.c: another dictionnary/string interning fix + +Wed Oct 27 00:00:07 CEST 2004 Daniel Veillard + + * libxslt/transform.c: fix to force string interning on generated + documents + +Sat Oct 23 09:36:12 PDT 2004 William Brack + + * libexslt/crypto.c, libexslt/functions.c, libxslt/keys.c, + libxslt/numbers.c, libxslt/pattern.c, libxslt/transform.c, + libxslt/variables.c: changed some variable names for warning + cleanup when -ansi flag is not present. + * libxslt/namespaces.c: fixed potential NULL pointer reference + pointed out by Dennis Dams (bug 156187) + +Mon Oct 18 17:04:27 CEST 2004 Daniel Veillard + + * libxslt.spec.in doc/Makefile.am: fix for RedHat bug #136072 + to include EXSLT doc in libxslt package. + +Thu Oct 14 22:43:22 PDT 2004 William Brack + + * configure.in, config.h.in, libexslt/date.c: changed date.c to use + gmtime_r if available (bug 129983) + * libexslt/functions.c: fixed a namespace problem concerning a + function with a namespace-qualified name (bug 155197) + +Tue Oct 12 03:54:44 CEST 2004 Daniel Veillard + + * libxslt/namespaces.c: fixed a bug in namespace lookup exhibited + by the recent namespace tests in libxml2 + +Thu Oct 7 16:15:15 CEST 2004 Daniel Veillard + + * libxslt/transform.c: fixed a problem of tree structure raised + by the new libxml2 tree checking code. + +Thu Sep 30 11:28:03 PDT 2004 William Brack + + * libexslt/date.c: fixed problem with negative periods + (bug 154021) + * tests/exslt/date/sum.2.out: changed expected output, now + agrees with comments in sum.2.xml test data file + +Thu Sep 30 08:19:28 CEST 2004 Daniel Veillard + + * libxslt/templates.c: patch from Mark Vakoc about an incorrect + attribute document pointer. + +Thu Sep 30 08:13:57 CEST 2004 Daniel Veillard + + * doc/tutorial2/libxslt_pipes.*: updated the tutorial from Panagiotis + Louridas + +Thu Sep 30 00:10:09 CEST 2004 Daniel Veillard + + * configure.in doc/*: release of 1.1.11, rebuilt the docs + +Wed Sep 29 15:42:33 CEST 2004 Daniel Veillard + + * libxslt/pattern.c: try to fix #153137 but without a test case + it's shooting in the dark. + +Tue Sep 28 16:20:48 CEST 2004 Daniel Veillard + + * doc/tutorial2/libxslt_pipes.*: New tutorial from Panagiotis Louridas + * libxslt.spec.in doc/Makefile.am: integrated the tutorial in the + distribution + +Sat Sep 25 21:38:57 CEST 2004 Daniel Veillard + + * libxslt/preproc.c libxslt/variables.c: fixed 2 leaks with + namespaced variable names. + * tests/general/bug-154.*, tests/general/Makefile.am, + tests/docs/bug-154*, tests/docs/Makefile.am: added test case + for above + +Fri Sep 24 18:13:45 CEST 2004 Daniel Veillard + + * Makefile.am: add missing variable + * libxslt/transform.c: fixed some error callback data + * tests/exslt/date/Makefile.am tests/exslt/date/sum*: added new + date:sum testing from Derek Poon + +Fri Sep 24 09:17:22 PDT 2004 William Brack + + * libexslt/date.c: fixed problem with empty sets, etc. + (see discussion on mailing list) + +Sat Sep 18 17:08:31 PDT 2004 William Brack + + * libexslt/date.c: fixed problem with timezone offset + (bug 153000) + * tests/exslt/date/add.1.out: changed regression test output, + which was apparently incorrect for above case + +Sat Sep 18 00:04:02 PDT 2004 William Brack + + * libxslt/transform.c: re-arranged sequence of setting up + namespaces within xsltCopyTree (see the list thread + http://mail.gnome.org/archives/xml/2004-September/msg00072.html) + * tests/general/bug-104.out: slight change to expected output + due to above fix + +Fri Sep 17 23:15:33 PDT 2004 William Brack + + * libexslt/date.c: enhanced validation of date-time to catch + bit-field overflow (bug 152836) + * tests/exslt/date/date.2.*, tests/exslt/time.2.*: added test + cases for above + +Tue Sep 7 18:04:55 PDT 2004 William Brack + + * libxslt/numbers.c: further refinement to UTF8 pattern + separator (bug 151975) + +Tue Sep 7 00:14:12 PDT 2004 William Brack + + * libxslt/numbers.c: fixed problem with UTF8 pattern + separator (bug 151975) + +Mon Sep 6 14:27:38 PDT 2004 William Brack + + * libxslt/imports.c, libxslt/xslt.c, libxslt/xsltInternals.h: + fixed 2 problems with xsl:include (bug #151795) + +Tue Aug 31 15:45:42 CEST 2004 Daniel Veillard + + * NEWS configure.in doc/*: Release of libxslt-1.1.10 + +Tue Aug 31 11:41:11 CEST 2004 Daniel Veillard + + * doc/xsltproc.1 doc/xsltproc.xml: added missing descriptions + for --path as well as --load-trace, fixes Red Hat bug #106545 + +Fri Aug 27 20:52:52 PDT 2004 William Brack + + * libxslt/keys.c: fixed small problem with key initialisation + disturbing the transformation context (bug 151201). + * tests/general/bug-153.*, tests/general/Makefile.am, + tests/docs/bug-153*, tests/docs/Makefile.am: added test case + for above + +Tue Aug 24 16:40:51 CEST 2004 Igor Zlatkovic + + * win32/configure.js: added support for version extra + +Mon Aug 23 16:53:02 CEST 2004 Daniel Veillard + + * libexslt/date.c libxslt/imports.c libxslt/xslt.c: fixing + compilation problems on Solaris #150844 + +Sun Aug 22 17:19:49 CEST 2004 Daniel Veillard + + * configure.in NEWS doc/*: preparing release of 1.1.9 + +Sat Aug 21 22:08:14 PDT 2004 William Brack + + * transform.c: Further enhancement for keys on exslt:node-sets. + Corrects a rather serious timing problem (bug 150741) + * tests/exslt/common/node-set.8.*: added regression test for this + +Fri Aug 20 18:53:50 CEST 2004 Daniel Veillard + + * Makefile.am configure.in: a bit of cleanup and a extra variable for + CVS dist + +Fri Aug 20 11:30:19 CEST 2004 Daniel Veillard + + * libxslt/imports.c: fix a 64bit bug reported by Andreas Schwab + +Wed Aug 18 14:27:18 PDT 2004 William Brack + + * configure.in libxslt/xsltconfig.h.in libxslt/xslt.c + libxslt/xsltwin32config.* libexslt/exsltconfig.h.in + libexslt/exslt.c: added some code to include the CVS + ChangeLog version in the version strings available for + printing (e.g. by xsltproc) + +Wed Aug 18 00:22:00 CEST 2004 Daniel Veillard + + * xsltproc/xsltproc.c: implemented --nodtdattr to avoid defaulting + DTD attributes, RFE 150311 . Also cleanup the code from all + libxml2 pre 2.6.0 specific code since we are using + LIBXML_REQUIRED_VERSION=2.6.8 in configure.in + +Tue Aug 17 01:01:22 CEST 2004 Daniel Veillard + + * libxslt/documents.c libxslt/documents.h libxslt/imports.c + libxslt/xslt.c libxslt/xsltutils.c: Implemented a hook to + provide document loading as suggested by David Hyatt for + Safari + +Mon Aug 16 12:53:55 PDT 2004 William Brack + + * libxslt/transform.c: added a call to xmlXPathOrderDocElems + in xmlNewTransformContext for the principal document (bug 133289) + +Sat Aug 14 21:49:48 PDT 2004 William Brack + + * libxslt/namespaces.[ch], transform.c, xslt.c, xsltInternals.h: + fixed handling of #default in namespace-alias for default + namespace (bug 149659) + * tests/namespaces/tst7.* tst8.*: added regression tests for above + +Fri Aug 6 11:05:31 PDT 2004 William Brack + + * libexslt/date.c: added date:sum routine supplied by Joel + Reed + +Wed Aug 4 00:04:13 CEST 2004 Daniel Veillard + + * doc/downloads.html doc/xslt.html: fixed a couple of problems + reported by Oliver Stoeneberg + +Mon Aug 2 08:48:03 PDT 2004 William Brack + + * libxslt/documents.c, libxslt/functions.c, libxslt/transform.c, + libxslt/variables.c: added code to assure keys are generated + when needed for node-sets (bug 148773) + * tests/exslt/common/node-set.7.* - added test case for above. + +Mon Jul 26 17:03:22 PDT 2004 William Brack + + * libexslt/strings.c: fixed str:tokenize for case when 2nd + argument is an empty string (should produce a token for + each char in the string). Reported on the mailing list by + Peter Pawlowski. + +Fri Jul 23 21:55:14 PDT 2004 William Brack + * libxslt/imports.c: further enhancement for template priorities + on imported stylesheets (better fix for bug 141279, fixes + bug 148246). + +Fri Jul 16 12:14:57 CEST 2004 Daniel Veillard + + * configure.in libexslt/crypto.c libexslt/exslt.[ch] + libexslt/exsltconfig.h.in win32/configure.js: apply patch from + Rob Richards to add a normal --with-crypto configure option. + +Tue Jul 13 22:57:43 HKT 2004 William Brack + + * libxslt/functions.c: added some logic to xsltKeyFunction + to set the transform context doc ptr when the xpath context + doc is different (bug 147445) + * tests/exslt/common/Makefile.am, tests/exslt/common/node-set.5* + and tests/exslt/common/node-set.6*: added regression tests + for bug 145547 (UNION and FILTER for RVT's) + +Mon Jul 12 08:28:07 HKT 2004 William Brack + + * python/libxslt-python-api.xml: fixed type for doctypeSystem + and doctypePublic (problem reported on the list by Sitsofe + Wheeler) + * doc/libxslt-api.xml: updated database. + +Sun Jul 11 22:46:31 HKT 2004 William Brack + + * transform.c: small change to key handling for RVT, needed + because of enhancement to libxml2 xpath. + +Fri Jul 9 02:51:38 PDT 2004 Daniel Veillard + + * python/libxsl.py: fixes Python on 64bits box problem. + +Tue Jul 6 18:43:37 CEST 2004 Daniel Veillard + + * libxslt.spec.in: better python dependancy Red hat bug #126364 + by Robert Scheck + +Tue Jul 6 21:35:44 HKT 2004 William Brack + + * tests/namespaces/Makefile.am: added extra2.err, tst5.xml, + tst5.xsl and tst.out to EXTRA_DIST + +Mon Jul 5 21:48:13 CEST 2004 Daniel Veillard + + * configure.in doc/*: releasing 1.1.8 + +Sun Jul 4 24:18:12 HKT 2004 William Brack + + * xsltproc/Makefile.am: changed the sequence of LD_ADDS and + LIBGCRYPT_LIBS on xsltproc_LDADD. Previously this was + causing the wrong libs to be linked when using the configure + option --with-libxml-libs-prefix, or --with-libxml-src (nasty) + +Sun Jul 4 21:42:48 HKT 2004 William Brack + + * libexslt/Makefile.am: implemented change from Joel Reed for + automake-1.4 compatibility. + * libexslt/crypto.c: reformatted source to remove an overly + generous supply of tabs. Added a #include for sys/select to + fix a compilation error caused by the gcrypt include file's + usage of 'fd_set'. Made some minor changes to fix + some warning messages (no change to the logic). + * configure.in, config.h.in: added test for presence of + sys/select.h. + Added test for libgcrypt version > 1.1.41 (bug 145245) + +Sat Jul 3 17:52:27 HKT 2004 William Brack + + * doc/xslt.html, doc/extensions.html: corrected the URI for libxslt + namespace, also a small enhancement of the surrounding text on + extension functions. (bug 145250) + +Fri Jul 2 15:51:49 CEST 2004 Daniel Veillard + + * configure.in: convenience change + * python/libxsl.py python/libxslt-python-api.xml python/libxslt.c: + try to avoid calling libxml2 cleanup function directly but go + though the python wrapper of libxml2 for memory debug accounting. + +Fri Jul 2 16:24:12 HKT 2004 William Brack + + * libxslt/keys.c: added namespace setup before calling XPath + to evaluate key (Bug 143520) + +Thu Jul 1 10:07:55 HKT 2004 William Brack + + * libxslt/transform.c: added coding to xsltCopyTree to copy + namespaces (bug 139578). + * tests/general/bug-128.out: changed to reflect above fix + * libxslt/xslt.c: minor change to an error message + +Wed Jun 30 18:41:20 CEST 2004 Daniel Veillard + + * win32/Makefile.msvc win32/Makefile.mingw libexslt/Makefile.am + libexslt/exslt.c libexslt/exslt.h config.h.in configure.in + libexslt/crypto.c: applied patch from Joel Reed to get EXSLT + crypto extensions based on libgcrypt if found at configure time. + * tests/namespaces/Makefile.am: fixed a small breakage + +Wed Jun 30 12:28:34 HKT 2004 William Brack + + * libxslt/namespaces: some enhancement for fixing bug 142768 + * tests/namespaces/Makefile.am, tests/namespaces/tst6*: + added regression test for this bug + +Tue Jun 29 09:23:03 CEST 2004 Daniel Veillard + + * Makefile.am examples/xsltICUSort.c: seems I never commited to CVS + the example from Richard Jinks + +Wed Jun 9 16:33:56 CEST 2004 Igor Zlatkovic + + * win32/configure.js win32/Makefile.* minor changes for the new + layout of the Windows binary package + +Wed May 26 10:51:22 HKT 2004 William Brack + + * doc/search.php.inc, doc/search/php: enhanced to remove + forcing module names to lower case, and to fix problem + with links between pages in libxml2 directory. + +Mon May 24 12:46:10 HKT 2004 Igor Zlatkovic + + * win32/makefile.msvc, win32/configure.js: included the cruntime + option, contributed by Oliver Stoeneberg + +Mon May 24 08:37:22 HKT 2004 William Brack + + * libxslt/xsltutils.c: fixed bug in error message printing + for undefined namespace (bug 143004) + +Mon May 17 23:08:42 CEST 2004 Daniel Veillard + + * NEWS doc/*: updated for 1.1.7 + +Mon May 17 06:14:09 CEST 2004 Daniel Veillard + + * configure.in: release of libxslt-1.1.7 + +Sun May 16 23:08:05 CEST 2004 Daniel Veillard + + * tests/general/bug-151*, tests/docs/bug-151.xml, + tests/general/Makefile.am, tests/docs/Makefile.am: added + regression test for old bug #127877 + +Sun May 16 20:48:35 CEST 2004 Daniel Veillard + + * libxslt/transform.c: fixing bug #135542 about the DOCTYPE name + being generated when the root element is namespaced + * tests/general/bug-151*, tests/docs/bug-151.xml, + tests/general/Makefile.am, tests/docs/Makefile.am: added + regression test for bug #135542 + +Sun May 16 19:39:44 CEST 2004 Daniel Veillard + + * libxslt/namespaces.c libxslt/namespaces.h libxslt/templates.c + libxslt/transform.c: fixing bug #134500 on namespace lookup for + attribute which sometimes lead to default namespace + * tests/general/bug-150*, tests/docs/bug-150.xml, + tests/general/Makefile.am, tests/docs/Makefile.am: added + regression test for bug #134500 + +Sun May 16 18:09:36 CEST 2004 Daniel Veillard + + * libexslt/date.h: fixing a small portability problem on Solaris + for the declaration of localtime_r bug #140468 + +Sun May 16 16:36:38 CEST 2004 Daniel Veillard + + * libxslt.m4: applied patch from Edward Rudd to fix the problems + raised in bug #142429 + +Sun May 16 11:01:52 CEST 2004 Daniel Veillard + + * libxslt/xslt.c: fixed a weird namespace bug #141532 + * tests/docs/Makefile.am tests/docs/bug-14[89].xml + tests/general/Makefile.am tests/docs/bug-14[89]*: added tests + to the regression for bug #141532 + +Sun May 2 23:47:43 PDT 2004 William Brack + + * libxslt/imports.c: added comments and function header, + improved logic of routine just added. + * tests/general/bug-147*, tests/docs/bug-147.xml, + tests/general/Makefile.am, tests/docs/Makefile.am: added + regression test for bug 141279 + +Sun May 2 12:47:32 PDT 2004 William Brack + + * libxslt/imports.c: enhanced normalization of comp steps + when an imported stylesheet has it's own imports + (bug 141279) + +Sat May 1 10:35:03 PDT 2004 William Brack + + * libxslt/transform.c: added code to recognize + disable-output-escaping on certain text nodes (bug 140755) + * tests/general/bug-100.out: regenerated to account for change + from next ChangeLog entry (bug 140558) + +Wed Apr 28 18:17:24 PDT 2004 William Brack + + * libxslt/xsltutils.c: suppressed any automatic linefeed after + a comment following the document root element (bug 140558) + +Thu Apr 22 08:38:35 CEST 2004 Daniel Veillard + + * libxslt/transform.c: fix a problem where we updated an + ELEMENT node psvi field as if it was a DOCUMENT one, leading + to a subtle crash later, valgrind rules. + +The Apr 20 00:22:37 HKT 2004 William Brack + + * libexslt/strings.c: fixed bug in UTF8 string tokenize + kindly reported by Vasily Tchekalkin + +Mon Apr 19 00:39:18 CEST 2004 Daniel Veillard + + * configure.in doc/*: preparing release 1.1.6 + * libxslt.spec.in: keep the ChangeLog compressed + +Mon Apr 5 15:23:53 CEST 2004 Daniel Veillard + + * libxslt/keys.c: fixed a stupid cut'npaste bug #139132 + * tests/docs/Makefile.am tests/docs/bug-146.xml + tests/general/Makefile.am tests/docs/bug-146*: added test + to the regression for bug #139132 + +2004-04-02 10:17:23 HKT 2004 William Brack + + * libxslt/keys.c: applied patch from Mark Vakoc to fix problem + with key matching attribute node. + +2004-04-01 Johan Dahlin + + * python/.cvsignore: Add generated files, to make cvs silent. + + * .cvsignore: Add missing libexslt.pc and stamp-h1 + +Tue Mar 23 13:13:56 CET 2004 Daniel Veillard + + * configure.in: prepare release of 1.1.5, made a hard dependancy + to libxml2 2.6.8 due to the dictionnary reference counting change + * doc/*: updated and rebuilt the doc. + * tests/namespaces/Makefile.am: fixed a build problem (tst5 ?) + +Mon Mar 22 20:25:41 CET 2004 Daniel Veillard + + * libxslt/xsltconfig.h.in: small fix for OpenVMS + * libxslt/documents.c: fixed a leak associated to the change + in reference counting when running the XML parser and using + the document() function. + +Wed Mar 17 18:49:55 HKT 2004 William Brack + + * xsltproc/xsltproc.c: added check for state XSLT_STATE_STOPPED + when output file is used (bug 137341) + +Tue Mar 16 08:55:18 HKT 2004 William Brack + + * libxslt/xsltutils.c: corrected my error from bug 135938 + pointed out on the mailing list by Mark Vakoc. + * libxslt/transform.c: enhanced the error message for + call-template when namespace is present. + * tests/general/bug-145.err: regenerated for new message + +Fri Mar 12 13:07:03 HKT 2004 William Brack + + * libxslt/namespaces.c: added additional check to prevent + superfluous namespace href's being generated on elements + (bug 136914) + * tests/namespaces/Makefile.am, tests/namespaces/tst5.x[ms]l: + added new test for bug 136914 + * tests/namespaces, tests/extensions/ tests/reports: fixed + error in "enhanced" Makefile.am, removed superfluous .err files + from cvs + +Wed Mar 10 19:27:39 HKT 2004 William Brack + + * doc/search.php.incl: minor addition for later version of php + requiring $HTTP_GET_VARS. + doc/*: rebuilt the docs + +Wed Mar 10 17:14:13 HKT 2004 William Brack + + * libexslt/strings.c: modified the 'tokenize' routine to work with + UTF8 chars in both string and tokens (Bug 136183) + +Tue Mar 9 23:44:31 HKT 2004 William Brack + + * libxslt/attrvt.c: added coding to allow growing the + AVT structure when a large number of segments are present + (bug 136624) + * libxslt/keys.c: fixed a compilation warning (no logic change) + +Sat Mar 6 23:42:47 HKT 2004 William Brack + + * tests/docbook/Makefile.am: small fix to typo + +Sat Mar 6 23:05:11 HKT 2004 William Brack + + * Makefile.am, tests/Makefile.am, tests/REC/Makefile.am, + tests/REC1/Makefile.am, tests/REC2/Makefile.am, + tests/XSLTMark/Makefile.am, tests/docbook/Makefile.am, + tests/exslt/common/Makefile.am, tests/exslt/date/Makefile.am, + tests/exslt/functions/Makefile.am, tests/exslt/math/Makefile.am, + tests/exslt/sets/Makefile.am, tests/exslt/strings/Makefile.am, + tests/extensions/Makefile.am, tests/general/Makefile.am, + tests/keys/Makefile.am, tests/multiple/Makefile.am, + tests/namespaces/Makefile.am, tests/numbers/Makefile.am, + tests/reports/Makefile.am, test/xmlspec/Makefile.am, + tests/general/bug-60.err, tests/docbook/result/html/gdp-handbook.err, + tests/REC/test-2.5-1.err: + Major enhancement to "make tests". All but Python tests + cleaned up to produce minimum summary output if no problems. + * tests/general/bug-145.xsl, tests/general/bug-145.err, + tests/docs/Makefile.am, tests/docs/bug-145.xml: + Added test case for bugzilla bug 135938 + +Thu Mar 4 23:02:18 HKT 2004 William Brack + + * libxslt/xsltutils.h, libxslt/xsltutils.c, libxslt/preproc.c: + fixed problem with dictionary handling (bug 135938). + * doc/EXSLT/*: fixed a few more "href_base" files. + +Wed Mar 3 21:33:33 HKT 2004 William Brack + + * doc/*, doc/html/*, doc/EXSLT/*: rebuilt the docs to fix + the "href_base" problem. + +Fri Feb 27 01:04:47 HKT 2004 William Brack + + * configure.in, config.h.in: added test for localtime_r + * libexslt/date.c: added usage of localtime_r if present on + system (bug 129983, suggested by Vasily Tchekalkin) + +Thu Feb 26 16:59:45 CET 2004 Daniel Veillard + + * libxslt/keys.c libxslt/pattern.c: removed the last use + of _private that time in the input document, use the psvi + field again, this may be interesting if XSLT2 support gets + in but since this is very unlikely ... + +Thu Feb 26 16:04:28 CET 2004 Daniel Veillard + + * libxslt/transform.c libxslt/variables.c: use the psvi field + of teh document used for RVT instead of _private. + +Thu Feb 26 15:17:52 CET 2004 Daniel Veillard + + * libxslt/attrvt.c libxslt/templates.c: use the psvi field of + the attribute instead of the _private one to compile AVT infos + +Thu Feb 26 14:53:16 CET 2004 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-144.xml + tests/general/Makefile.am tests/docs/bug-144*: added test + similar to 143 but checking for AVT in local variables. + +Thu Feb 26 13:16:33 CET 2004 Daniel Veillard + + * libxslt/attrvt.c libxslt/variables.c: fixed a regression for + AVT found in global variable content. + * tests/docs/Makefile.am tests/docs/bug-143.xml + tests/general/Makefile.am tests/docs/bug-143*: added test + to the regression suite. + +Wed Feb 25 16:35:01 CET 2004 Daniel Veillard + + * libxslt/attributes.c libxslt/keys.h libxslt/preproc.c + libxslt/transform.c libxslt/variables.c libxslt/xsltutils.c: + First step toward _private cleanup: use the psvi field to store + the precompilation informations in the stylesheet nodes. + +Wed Feb 25 14:24:34 CET 2004 Daniel Veillard + + * libxslt/variables.c: trying to use the fact that names comes + from a dictionnary when looking up for variables. + * tests/documents/Makefile.am: try to fix an error reported on + the list. + +Wed Feb 25 17:02:22 HKT 2004 William Brack + + * tests/general/Makefile.am, tests/general/bug-142.xsl, + tests/general/bug-142.out, tests/docs/Makefile.am, + tests/general/bug-142.xml: added test for language + attribute which previously triggered a memory leak + (from list report by Mike Hommey) + +Mon Feb 23 18:01:44 CET 2004 Daniel Veillard + + * NEWS configure.in doc/*: preparing release 1.1.4, updated and + regenerated the documentation + +Tue Feb 24 00:37:28 HKT 2004 William Brack + + * libxslt/xsltutils.c, libxslt/templates.c, libxslt/preproc.c: + minor changes to eliminate compilation warnings. No change + to logic. + +Sun Feb 22 23:59:12 CET 2004 Daniel Veillard + + * libexslt/exsltexports.h libxslt/xsltexports.h: patches from + Mikhail S Grushinskiy to compile on Mingw + +Sat Feb 21 16:47:04 CET 2004 Daniel Veillard + + * win32/Makefile.msvc: patch from Mark Vadoc for attrvt.c + +Wed Feb 18 13:32:55 CET 2004 Daniel Veillard + + * libxslt/extensions.c: applied patch from Steve Little to + display the extension modules. + +Wed Feb 18 11:40:23 CET 2004 Daniel Veillard + + * libxslt/transform.c: trying to fix an extension regression pointed + out on the list. + +Tue Feb 17 12:20:26 CET 2004 Daniel Veillard + + * libxslt/transform.c: try to fix the problem with yelp + and dictionnaries + +Tue Feb 17 11:29:15 CET 2004 Daniel Veillard + + * libxslt/templates.c: applied patch from #134588 provided by + Mariano Suárez-Alvarez, attribute text node without doc. + +Mon Feb 16 15:55:57 CET 2004 Daniel Veillard + + * configure.in, doc/*: updated and rebuilt the documentation + preparing release of 1.1.3 + * libxslt/attrvt.c libxslt/xsltInternals.h: cleanup + +2004-02-15 Tomasz KÅ‚oczko + + * libxslt.m4: small fix: added missing [] quotation macro name + defined in AC_DEFUN(). Fix is neccessary for aclocal from automake + 1.8.x and is backward compatible with older auto tools. + +Sun Feb 15 23:01:09 CET 2004 Daniel Veillard + + * libxslt/attrvt.c libxslt/templates.c: removed the two last + known bug with the new code, was overoptimizing a bit... + +Sun Feb 15 19:57:20 CET 2004 Daniel Veillard + + * libxslt/attrvt.c: found the memory leak shown in DocBook, + mostly an error handling some ATV coupled with doctionnaries + reference counting. + * libxslt/documents.c libxslt/transform.c libxslt/variables.c + libxslt/xslt.c: added a bit of debug to be able to trace + dictionnaries. + +Fri Feb 13 16:59:46 CET 2004 Daniel Veillard + + * libxslt/attrvt.c libxslt/Makefile.am: added new code to handle + attribute value templates + * libxslt/*.c libxslt/*.h: also a lot of work to reuse the + dictionaries at the stylesheet and transformation level. + * configure.in: this relies on a recent version of libxml2 + with the sub dictionnary catalog. + +Sun Feb 8 16:53:14 HKT 2004 William Brack + + * libxslt/transform.c: added check for "?>" in PI content + (Bug 133726) + +Sat Jan 31 02:43:45 PST 2004 William Brack + + * libxslt/namespaces.c: fixed problem with attribute + namespace (Bug 132953) + +Thu Jan 29 14:47:22 PST 2004 William Brack + + * libxslt/transform.c: added check for "--" or ending '-' + in xsl:comment (Bug 132742) + +Thu Jan 29 14:08:31 PST 2004 William Brack + + * libxslt/transform.c, libxslt/attributes.c: added + validation of QName for xsl:element and xsl:attribute + (Bug 132531) + +Fri Jan 23 18:52:22 HKT 2004 William Brack + + * libxslt/pattern.c: changed priority of template patterns + starting with '//' from 0.0 to 0.5 (Bug 131705) + +Thu Jan 22 18:42:03 CET 2004 Daniel Veillard + + * libxslt/xslt.c: applied patch from Stefan Kost to fix + behaviour on unknown element from the XSLT namespace. + * python/generator.py: applied patch from Stephane bidoul + to export enums in the bindings. + +Thu Jan 22 10:35:14 HKT 2004 William Brack + + * tests/general/Makefile.am, tests/general/bug-141.out, + tests/general/bug-141.xsl, tests/docs/Makefile.am, + tests/general/bug-141.xml: added test case for + Bug 13971 (libxml2 xpath.c bug, but tested here) + +Fri Jan 16 22:15:34 HKT 2004 William Brack + + * libxslt/xsltutils.c: added a newline for any comment before + the root element (Bug 130433) + * libxslt/xslt.c: fixed problem with cdata-section-elements when + default namespace is changed (Bug 130793) + * tests/extensions/module.out, tests/general/bug-100.out: adjusted + for newline after comment change above. + * tests/general/Makefile.am, tests/general/bug-140.xsl, + tests/general/Makefile.am, tests/docs/bug-140.xml: added test for + cdata-section-elements problem. + +Wed Jan 14 16:44:58 CET 2004 Daniel Veillard + + * python/libxsl.py: applied shared lib loading patch for OS X from + Gianni Ceccarelli + +Wed Jan 14 14:28:02 HKT 2004 William Brack + + * libexslt/math.c, libexslt/common.c: fixed problem, + reported on the list by Markus Bayerlein, concerning + math functions on nodesets generated with + exslt:node-set + * tests/exslt/math/max.3.xsl, tests/exslt/math/max.3.xml, + tests/exslt/math/max.3.out, tests/exslt/math/Makefile.am: + added test case for above. + +Tue Jan 13 00:33:50 HKT 2004 William Brack + + * libxslt/transform.c: changed to assure comment which + preceeds root node is output after DTD (Bug 130433) + * test/exslt/common/node-set.4.*: added test case for + Bug 130922 + +Mon Jan 12 12:51:45 HKT 2004 William Brack + + * doc/site.xsl: Changed logo spacing to avoid stacking + * doc/*: rebuilt web pages + +Sun Jan 11 20:10:09 MST 2004 John Fleck + + * doc/site.xsl + * doc/w3c.png + * doc/* + Test William's new site.xsl improvements by adding the + W3C logo icon, rebuild docs, and presto! It shows up + everywhere! + +Mon Jan 10 08:33:18 HKT 2004 William Brack + + * libxslt/transform.c: Refined wrapper code with large + test case submitted by Norm Walsh. (Bug 130922) + +Sun Jan 10 23:33:21 HKT 2004 William Brack + + * libxslt/transform.c: Added coding to create a xsltDocument + wrapper for an RVT, in order to produce the applicable + keys (Bug 130922) + +Sat Jan 9 17:04:38 HKT 2004 William Brack + + * doc/search.xml, doc/search.templ, doc/Makefile.am, + doc/search.php.inc: Added new facility to "autogen" + the search script. Fixed a few more problems with + the API page generation. + * doc/site.xsl, doc/api.xsl, doc/newapi.xsl: integrated + the autogeneration of the php script. Note that from + this point doc/search.php will be include in the + generic "Rebuilt docs". + * doc/*: api docs rebuilt. + +Fri Jan 8 08:32:55 HKT 2004 William Brack + + * doc/site.xsl, doc/api.xsl, doc/newapi.xsl, doc/search.php: + Further cleanup, fully implemented common routine for + "generic page" within the docs. + * doc/*: api docs rebuilt with enhanced scripts. + +Thu Jan 8 06:45:04 MST 2004 John Fleck + + * doc/xslt.html, doc/bugs.html + made link to bugzilla more useful + +Wed Jan 7 20:12:14 HKT 2004 William Brack + + * doc/api.xsl, doc/site.xsl, doc/search.php: a little + cleanup of scripts, assuring page tables are consistent. + * doc/*: api docs rebuilt with enhanced scripts. + +Tue Jan 6 23:38:47 HKT 2004 William Brack + + * configure.in: fixed Bug130593. + * doc/apibuild.py: fixed a couple of sequence problems on + references within APIxxx.html files, rebuild doc/* (and NEWS) + +Sun Jan 4 19:06:59 MST 2004 John Fleck + + * doc/newapi.xsl: change background color of function + declaration to improve readability + * doc/*: rebuild docs with new stylesheet + +Fri Jan 2 21:42:49 MST 2004 John Fleck + + * libxslt/transform.c: fix bad doc comment formatting on + xsltDebugSetDefaultTrace and xsltDebugGetDefaultTrace + * doc/*: rebuild docs + +Wed Dec 24 15:15:52 CET 2003 Daniel Veillard + + * configure.in doc/*: prepared release of libxslt-1.1.2 + * libxslt.spec.in doc/Makefile.am: some tweaking following the + new EXSLT docs. + +Mon Dec 22 20:33:08 HKT 2003 William Brack + + * libxlst/numbers.c: fixed xsl:number level="any" for Bug + 129057 + +Sun Dec 21 21:38:11 HKT 2003 William Brack + + * libxslt/numbers.c: added namespace comparison for + xsl:number count function (Bug 129057) + +Sun Dec 21 13:56:48 CET 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-139.xml + tests/general/Makefile.am tests/general/bug-139*: added + test for entities parsing (Bug #129489) + +Sun Dec 21 20:33:27 HKT 2003 William Brack + + * tests/docs/Makefile.am tests/docs/bug-138.xml + tests/general/Makefile.am tests/general/bug-138*: added + test for namespace problem (Bug #129624) + +Sun Dec 21 13:17:05 CET 2003 Daniel Veillard + + * xsltproc.c: fixed #129327 make sure parser flags get transmitted to + the transformation context + * libxslt/documents.c libxslt/transform.c libxslt/xsltInternals.h + libxslt/xsltutils.c libxslt/xsltutils.h: add a new call + xsltSetCtxtParseOptions() to update parsing options in document() + +Sun Dec 21 12:51:12 CET 2003 Daniel Veillard + + * libxslt/keys.c: fixed second problem on #122483, namespace + definitions must be propagated to keys. + * tests/docs/Makefile.am tests/docs/bug-137.xml + tests/general/Makefile.am tests/docs/bug-137*: added test + to the regression for bug #122483 + +Sun Dec 21 12:08:45 CET 2003 Daniel Veillard + + * libxslt/transform.c: added the cast needed to fix #129188 warning + +Sat Dec 20 23:37:31 HKT 2003 William Brack + + * libexslt/transform.c: fixed Bug 129624 (erroneous output + of namespaces) + +Sat Dec 20 16:22:11 HKT 2003 William Brack + + * libexslt/date.c: fixed several routines to assure empty + string returned (rather than a string object with a null + string pointer) (Bug 129561) + +Mon Dec 16 00:30:47 PST 2003 William Brack + + * doc/Makefile.am doc/site.xsl doc/api.xsl doc/newapi.xsl + doc/xslt.html doc/apibuild.py doc/EXSLT doc/EXSLT/exslt.html: + enhanced documentation to include exslt; rebuilt docs + +Mon Dec 15 20:33:52 MST 2003 John Fleck + + * libxslt/xsltutils.h + * doc/* + document XSLT_TRACE macro (sort of) and rebuild docs + +Thu Dec 11 19:50:41 CET 2003 Igor Zlatkovic + + * win32/Makefile.mingw win32/configure.js: tried to fix mingw + build, no success, it still works halfway. + +Thu Dec 11 16:33:41 CET 2003 Igor Zlatkovic + + * win32/Makefile.* win32/configure.js libxslt/xsltexports.h + libexslt/exsltexports.h libxslt/win32config.h: msvc and + mingw compilation fixes. + +Wed Dec 10 20:37:46 MST 2003 John Fleck + + * doc/xslt.html docs.html + remove reference to gtk-doc + +Wed Dec 10 17:20:27 CET 2003 Daniel Veillard + + * configure.in NEWS doc/*: updated the docs, made release 1.1.1 + +Wed Dec 10 16:13:38 CET 2003 Daniel Veillard + + * configure.in: upp'ed the dependancy to libxml2-2.6.3 + * libxslt/documents.c xsltproc/xsltproc.c: fixed #127473 + by using the new XInclude APIs provided by 2.6.3... + +Mon Dec 8 23:34:32 HKT 2003 William Brack + + * libxslt/transform.c, libxslt/xslt.c: modified to assure + XML_CDATA_SECTION_NODE's do not have xmlStringTextNoenc + set into node name. This modification arises from + bug #128520, and avoids unnecessary work in libxml2. + +Mon Dec 1 16:41:27 CET 2003 Daniel Veillard + + * libxslt/*.h *.h.in: updated the metadata informations in the headers + * doc/* doc/html/*: regenerated the docs. + +Sun Nov 30 23:25:22 HKT 2003 William Brack + + * doc/Makefile.am: small further enhancement to makefile + * doc/APIchunk[127].html, doc/libxslt-api.xml, doc/libxslt-refs.xml, + doc/html/libxslt-transform.html: updated to reflect last change + to transform.c + +Sun Nov 30 22:44:07 HKT 2003 William Brack + + * doc/newapi.xsl, doc/api.xsl, doc/apibuild.py, doc/site.xsl, + Makefile.am: adapted the libxml files for libxslt. + * doc/API*.html, doc/html/*.html, doc/libxslt-api.xml, + doc/libexslt-api.xml, doc/libxslt-refs.xml, + win32/libxslt.def.src, win32/libexslt.def.src: regenerated + the docs. + +Sun Nov 30 18:48:27 HKT 2003 William Brack + + * libxslt/transform.c: change initialisation of external functions + to take place in xsltNewTransformContext instead of in + xsltApplyStylesheetInternal. This fixes bug 122483, and should + also fix problem reported on the mailing list on today's date. + +Wed Nov 26 09:49:11 HKT 2003 William Brack + + * libxslt/imports.c, libxslt/xsltInternals.h: Changed to + detect recursion in xslt:include (bug #127687). + * tests/XSLTMark/reverser.out, + * test/docbook/result/xhtml/gdp-handbook.xhtml: results changed + because of fix of bug #127877 in libxml2 (quotes in text) + +Mon Nov 24 07:32:38 HKT 2003 William Brack + + * libxslt/xslt.c, libxslt/imports.c, libxslt/parserInternals.h: + Changed to detect recursion in xslt:import (bug #127687). + * doc/libxslt-api.xml, python/libxsltclass.txt: regenerated to + include change to xsltParseStylesheetImportedDoc parameters for + above. + +Sat Nov 22 13:04:59 CET 2003 Daniel Veillard + + * libxslt/keys.c libxslt/templates.c libxslt/transform.c + libxslt/variables.c libxslt/xsltInternals.h libxslt/xsltutils.h: + Applied patch from Mark Vadoc adding flexible trace debugging + support to the library. + +Sat Nov 22 00:53:47 HKT 2003 William Brack + + * libxslt/transform.c: fixed bug #127561 (xsl:element with a + 'computed' namespace attribute) + * tests/docs/Makefile.am tests/docs/bug-136.xml + tests/general/Makefile.am tests/docs/bug-136*: added tests + to the regression for bug #127561 + +Fri Nov 21 18:17:32 HKT 2003 William Brack + + * libxslt/keys.c: small further enhancement, bug #127450 + +Thu Nov 20 17:26:57 CET 2003 Daniel Veillard + + * libxslt/keys.c: another problem reported by Oleg Paraschenko + on the same code in #127450 + * tests/docs/Makefile.am tests/docs/bug-135.xml + tests/general/Makefile.am tests/docs/bug-135*: added tests + to the regression suite for bug #127450. + +Thu Nov 20 10:59:48 CET 2003 Daniel Veillard + + * libxslt/keys.c: fixed an error from #120684 patch raised in + #127450 + * tests/docs/Makefile.am tests/docs/bug-134.xml + tests/general/Makefile.am tests/docs/bug-134*: added tests + to the regression suite for bug #127450. + +Thu Nov 20 00:22:14 CET 2003 Daniel Veillard + + * libxslt/keys.c: fixed a bug in the keys selector parsing + #120684 when | is in a predicate or a string. + * tests/docs/Makefile.am tests/docs/bug-133.xml + tests/general/Makefile.am tests/docs/bug-133*: added tests + to the regression suite for bug #120684. + * Makefile.am: don't package cvs temp files + * doc/apibuild.py: update from libxml2 one + +Tue Nov 18 13:42:12 HKT 2003 William Brack + + * libexslt/strings.c: fixed entity problem in exslt:tokenize + uncovered by newapi.xsl + * libxslt/transform.c,libxslt/pattern.c,libxslt/keys.c: changed + to use IS_BLANK_CH for char compares (fixes warnings) + +Fri Nov 14 23:59:08 CET 2003 Daniel Veillard + + * libxslt/preproc.c: applied fix from Bjorn Reese to close + number formatting bug #126994 + +Fri Nov 14 18:44:50 CET 2003 Daniel Veillard + + * Makefile.am configure.in libexslt.pc.in libxslt.spec.in: adding + libexslt.pc support + +Thu Nov 13 11:54:36 CET 2003 Daniel Veillard + + * libxslt/attributes.c libxslt/documents.c libxslt/transform.c + libxslt/variables.c libxslt/xsltInternals.h: applied Mark Vakoc + patch to moves the control of the XSLT debugger into the transform + context. + +Tue Nov 12 18:17:24 HKT 2003 William Brack + + * libexslt/functions.c: applied patch for param visibility from + Shaun McCance. Changed variable scoping in accordance with + Shaun's suggestions. This fixed problem reported on the list + by Bernd Lang + * tests/exslt/functions/function.8.[xml,xsl,out], Makefile.am: + regression test for above + +Sat Nov 8 13:27:12 CET 2003 Daniel Veillard + + * libexslt/libexslt.3: applied improvement patch from Jonathan Wakely + describing the entry points. + +Wed Nov 6 17:27:23 CET 2003 Igor Zlatkovic + + * win32/configure.js: fixed #122146 + +Wed Nov 5 12:25:34 CET 2003 Daniel Veillard + + * tests/multiple/Makefile.am: applied last fix from #125614 + +Tue Nov 4 19:08:53 PST 2003 William Brack + + Minor enhancements to eliminate compile/test warnings + * libxslt/xsltconfig.h.in, libexstl/exsltconfig.h.in: + changed macro ATTRIBUTE_UNUSED for gcc so that, if undefined, + it's defined as __attribute__((unused)) + * python/libxslt.c: fixed ATTRIBUTE_UNUSED to appear after + variable declaration + * libxslt/preproc.c: minor change to get rid of unused var/code + +Tue Nov 4 14:21:06 CET 2003 Daniel Veillard + + * doc/* NEWS: preparing release 1.1.0 + +Tue Nov 4 14:04:58 CET 2003 Daniel Veillard + + * libxslt/preproc.c: fixing the Document element precompilation + to avoid the problem raised in #125614 + +Tue Nov 4 01:08:17 PST 2003 William Brack + + * tests/multiple/out/letter*.orig: updated to reflect change + to HTML output in libxml2 (formatting of

, bug #125093) + +Sun Nov 2 09:07:32 PST 2003 William Brack + + * libxslt/xslt.c: fixed bug #124286 - detect invalid name on + template + +Sun Nov 2 10:51:58 CET 2003 Daniel Veillard + + * Makefile.am configure.in libxslt.spec.in doc/libxslt-api.xml + libxslt/xslt.h libxslt/xsltwin32config.h: some cleanup and trial + for the upcoming 1.1.0 release + * breakpoint/*: this release removes the deprecated breakpoint library + +Sat Nov 1 17:04:27 PST 2003 William Brack + + * libxslt/transform.c, tests/general/bug-119.out: fixed + bug #125502 and corrected expected test output + * tests/general/bug-79.out: fixed broken test (bug #123328) + * libxslt/pattern.c, libexslt/functions.c: minor change to + eliminate compilation warning + +Sat Nov 1 22:36:30 CET 2003 Daniel Veillard + + * tests/REC/test-5.2-17.xsl tests/REC/test-5.2-18.xsl: fixing two + broken tests (revealed by #125502) + +Sat Nov 1 07:41:06 CET 2003 Daniel Veillard + + * libexslt/strings.c: fix bug #125265 about entities breaking + exsl:tokenize and exsl:split + * tests/exslt/strings/split.1.* tests/exslt/strings/tokenize.1.*: + augmented the reression tests with the example from the bug report. + +Fri Oct 31 20:26:04 CET 2003 Daniel Veillard + + * libxslt/preproc.c: fix bug #120828 make sure that xsl:sort is + empty. + +Fri Oct 31 15:53:45 CET 2003 Daniel Veillard + + * libxslt/documents.c libxslt/imports.c libxslt/xslt.c libxslt/xslt.h + xsltproc/xsltproc.c: switch to use xmlReadfile instead of + xmlParseFile, this avoid relying on global parser options, far + far cleaner. + * tests/XSLTMark/xslbench1.out tests/general/bug-90.out: fixes a + slightly corrected output for CDATA and STYLE element save. + +Tue Oct 28 15:30:54 CET 2003 Daniel Veillard + + * configure.in python/Makefile.am python/tests/Makefile.am: applied + patch from Roumen Petrov for bug #124539 when building outside the + source directory + * libxslt/xsltutils.c: fixed the way to grab the line number from + the document, use the predefiend libxml2 API which mate it work + with both 2.5.x and 2.6.x + +Mon Oct 27 08:57:43 HKT 2003 William Brack + + * libxslt/xslt.c: put in #undef for IS_BLANK macros to fix + problem reported on the mailing list by Justin Fletcher + +Fri Oct 24 00:49:05 CEST 2003 Daniel Veillard + + * configure.in libxslt.spec.in: doing some testing and raising + the build requirement to 2.5.10 + * libexslt/Makefile.am configure.in: applied patch from Graham Wilson + for linking the exslt lib with the lib being build instead of the + installed one + +Thu Oct 23 15:48:39 HKT 2003 William Brack + + * libxslt/pattern.c: Fixed problem with cascaded predicates + (more of bug 119946) + +Thu Oct 23 15:37:26 HKT 2003 William Brack + + * restored earliest portion of ChangeLog (was corrupted) + +Wed Oct 22 13:07:50 CEST 2003 Daniel Veillard + + * libxslt/xsltutils.[ch]: applied patch from Kasimier Buchcik + for xsltGetDebuggerStatus and xsltSetDebuggerStatus + * doc/libxslt-api.xml: regenerated the API + +Sun Oct 19 23:32:23 CEST 2003 Daniel Veillard + + * configure.in: bump the libxml2 require to 2.6.0 which + should ship for good real soon... + * doc/Makefile.am: fix installation of HTML pages + * doc/libxslt-api.xml: rebuilt + * libxslt/xsltexports.h: cleanup + * python/generator.py: ATTRIBUTE_UNUSED is after the parameter + * xsltproc/xsltproc.c: applied Crutcher Dunnavant --load-trace patch 2 + +Fri Oct 17 18:25:42 HKT 2003 William Brack + + * libxslt/attributes.c: fixed bug 123822 + +Fri Oct 17 12:40:37 HKT 2003 William Brack + + * libxslt/pattern.c: fixed bug 119946 + * configure.in: enhanced for better devel (me) testing + +Wed Oct 15 17:30:43 CEST 2003 Daniel Veillard + + * configure.in: applied a small patch from Troels Walsted Hansen + for python libxml2 detection. + +Sat Sep 27 18:42:57 PDT 2003 William Brack + + * libxslt/numbers.c, libxslt/extensions.c, libexslt/date.c, + python/libxslt.c, xsltproc/xsltproc.c: minor cleanup for + various compilation warnings (AIX as well as gcc) + +Sat Sep 27 17:29:43 CEST 2003 Daniel Veillard + + * libexslt/saxon.c: applied patch from Brett Kail to implement + saxon:line-number() + +Thu Sep 25 11:46:40 CEST 2003 Daniel Veillard + + * libxslt/extensions.h libxslt/extra.h: fix some header paths + as pointed by Steve Ball + +Wed Sep 24 23:31:45 CEST 2003 Daniel Veillard + + * libxslt/extensions.c: applied patch from Karl Eichwalder + apparently the xmlFree was introducting a memory error + on x86_64, though not reproduced. + * libxslt/transform.c: patch from Shaun McCance fixing a comment. + +Thu Sep 18 11:32:20 CEST 2003 Daniel Veillard + + * python/libxslt.c: don't output errors to stdout by default + use stderr instead. + +Thu Sep 18 11:28:43 CEST 2003 Daniel Veillard + + * libxslt/functions.c libxslt/numbers.c: small fixes w.r.t. + IS_XSLT_REAL_NODE change + * python/Makefile.am Makefile.am: some makefile "distclean" + target improvement from Graham Wilson + * xsltproc/xsltproc.c: small fix from Alexey Efimov for options + display. + +Mon Sep 15 07:41:14 PDT 2003 William Brack + + * libxslt/xsltutils.h: Added XML_PI_NODE to the macro + IS_XSLT_REAL_NODE, fixed bug 120644. + +Sat Sep 13 02:04:13 CEST 2003 Daniel Veillard + + * xsltproc/xsltproc.c doc/xsltproc.1 doc/xsltproc.xml + libxslt/xsltutils.h: removing the DocBook SGML support + +Fri Sep 12 13:52:07 CEST 2003 Daniel Veillard + + * configure.in: preparing release libxslt-1.0.33 + * doc/*: updated and rebuilt the docs + * doc/apibuild.py: small fixes for new tokens + +Wed Sep 10 23:32:42 PDT 2003 William Brack + + * transform.c: enhanced previous fix to bug #120684, using + excellent suggestion by Daniel + * attributes.c: fixed bug #119583, merging attribute sets + from imported stylesheets. + * tests/docs/Makefile.am tests/docs/bug-131.xml + tests/general/Makefile.am tests/docs/bug-131*: added tests + to the regression suite for bug #120684. + +Sat Sep 6 09:57:03 PDT 2003 William Brack + + * pattern.c pattern.h imports.c: fixed bug 119946, caused by + incorrect creation of "extra" variables when compiling + templates on imported stylesheets. + * tests/docs/Makefile.am tests/docs/bug-130.xml tests/docs/bug-130.doc + tests/general/Makefile.am test/docs/bug-130*: added tests + to the regression suite for this bug. + + +Wed Sep 3 15:33:40 CEST 2003 Daniel Veillard + + * tests/xmlspec/*.html: tyny change HTML -> html DOCTYPE due to + a libxml2 change + +Tue Sep 2 18:22:46 PDT 2003 William Brack + + * transform.c: fixing bug #120684 on crash caused by text between + apply-templates + +Tue Sep 2 16:05:37 CEST 2003 Igor Zlatkovic + + * libxslt/xsltexports.h libexslt/exsltexports.h: defined additional + macros which affect exports and added mingw section + +Mon Sep 1 23:02:12 CEST 2003 Daniel Veillard + + * libxslt/function.c: patch from Mark Vadoc to allow compiling + against libxml2 without XPointer supoort. + +Fri Aug 29 12:28:12 CEST 2003 Daniel Veillard + + * libxslt/transform.c: fixing the bug #120971 on cdata-section-elements + with namespaced names reported by Steve Hay + * tests/docs/Makefile.am tests/docs/bug-129.* + tests/general/Makefile.am tests/general/bug-129*: added the + test to the regression suite for this bug. + +Thu Aug 28 18:30:11 CEST 2003 Igor Zlatkovic + + * libxslt/xsltexports.h libexslt/exsltexports.h: fixed typos reported by + Mark Vakoc + +Wed Aug 27 12:07:13 CEST 2003 Igor Zlatkovic + + * libxslt/*.h: realigned parameters after taint + +Wed Aug 27 09:59:54 CEST 2003 Igor Zlatkovic + + * libxslt/xsltexports.h libexslt/exsltexports.h: fixed defs for + Borland compiler, as reported by Eric Zurcher + +Mon Aug 25 13:39:40 CEST 2003 Daniel Veillard + + * libxslt/Makefile.am libexslt/Makefile.am: add the new header so they + get included in the distrib + +Mon Aug 25 11:56:02 CEST 2003 Igor Zlatkovic + + * libxslt/*.h libexslt/*.h: exportability taint of the headers. + * libxslt/xsltexports.h libexslt/exsltexports.h: new files, + contain the export defs. + +Tue Aug 19 00:38:46 CEST 2003 Daniel Veillard + + * xsltproc/Makefile.am libxslt/libxslt.h libxslt/numbersInternals.h + libexslt/*.c configure.in: applied patch from Mikhail Grushinskiy + for compilation with MingW compiler on Windows. + +Mon Aug 18 14:42:12 HKT 2003 William Brack + + * keys.c: enhanced xsltInitCtxtKey to take care of multiple + instances of a key with the same namespace:name, reported + on the mailing list by Ian Young. Added regression test + (bug-128). + +Thu Aug 15 13:00:02 HKT 2003 William Brack + + * variables.c: fixed bug 119699 (missing error on shadowed + variable) + * autogen.sh: removed dependency on automake-1.4, updated + links for fetching auto* tools + * doc/Makefile.am: added check for automatic regeneration of + win32/*.def.src when api xml files are updated. + +Thu Aug 14 23:15:14 HKT 2003 William Brack + + * transform.c: fixed bug 114563 (params not passed when + default template processed) + +Thu Aug 14 22:04:37 HKT 2003 William Brack + + * xslt.c: fixed bug 119862 (missing param on ns error print) + +Sun Aug 10 00:21:48 CEST 2003 Daniel Veillard + + * News configure.in: preparing libxslt-1.0.32 release + * doc/* : updated the doc and rebuilt + +Thu Aug 7 21:02:07 HKT 2003 William Brack + + * breakpoint/Makefile.am: removed ref to libxslt.la + * numbers.c transform.c python/libxml_wrap.h python/types.c + xlstproc/xsltproc.c: Minor cleanup of warning errors + +Mon Aug 4 22:43:05 CEST 2003 Daniel Veillard + + * doc/libxslt-api.xml doc/* doc/html/*: revuilt the API and docs + +Sun Aug 3 21:34:44 EDT 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-127.* + tests/general/Makefile.am tests/general/bug-127*: added the + test from bug #118763 to the regression suite. + +Sun Aug 3 17:40:13 EDT 2003 Daniel Veillard + + * xsltproc/xsltproc.c: minor change, avoid wasting CPU cycles + +Sun Aug 3 21:05:07 HKT 2003 William Brack + + Minor cleanup of regression test general/bug-125 + +Sun Aug 3 19:46:42 HKT 2003 William Brack + + Fixed bug 116517 - handling of '{' and '}' + * templates.c: added checks for escaping and balancing of + curly brackets + * tests/general/Makefile.am tests/docs/Makefile.am: + Added test case (bug-126) to regression suite. + +Sun Aug 3 15:50:51 HKT 2003 William Brack + + Fixed bug 117552 - sort with multiple keys + * xsltutils.c: enhanced treatment of NaN when multiple sort + keys are specified. + * tests/general/Makefile.am tests/docs/Makefile.am: + Added test case (bug-125) to regression suite. + +Sat Aug 2 09:55:38 HKT 2003 William Brack + + Fixing bug 118561 (IRIX MIPSPro compiler warnings) + * transform.c, variables.c, xslt.c, xsltutils.c: + removed some unused variables + +Thu Jul 31 20:33:12 HKT 2003 William Brack + + Fixing bug 118558 (Solaris 8 compiler warnings) + * xslt.c: minor re-ordering of code + * functions.c: added an explicit cast + * number.c: added include for string.h + * security.c: added an explicit cast + +Tue Jul 29 12:43:17 HKT 2003 William Brack + + * libexslt/date.c test/exslt/data/seconds.1 : changed sign + of date:seconds as previously posted to the mailing list + * numbers.c: extensive modification to cater for UTF8 within + the various routines. + +Thu Jul 24 19:38:56 IST 2003 Daniel Veillard + + * libexslt/strings.c: applied patch from Shaun McCance to fix bug + #117616 about EXST str:tokenize. + * tests/exslt/strings/Makefile.am tests/exslt/strings/tokenize.3.*: + added the test in the regression suite. + +Wed Jul 23 21:57:39 IST 2003 Daniel Veillard + + * xsltproc/xsltproc.c: applying a patch based on #117377 + for --path option. + +Mon Jul 21 20:28:11 IST 2003 Daniel Veillard + + * libxslt/transform.c: allow strip-space to support full namespaces + using prefix:* , should fix #114287 + * tests/docs/Makefile.am tests/docs/bug-124.* + tests/general/Makefile.am tests/general/bug-124*: added a + test to the regression suite for this bug. + +Mon Jul 21 20:09:57 IST 2003 Daniel Veillard + + * libxslt/tramsform.c: make xsl:copy on attribute a copy in case + the attribute was already defined, should fix bug #113812 + * tests/docs/Makefile.am tests/docs/bug-123.* + tests/general/Makefile.am tests/general/bug-123*: added the + test to the regression suite. + +Fri Jul 18 13:13:52 CEST 2003 Daniel Veillard + + * libexslt/strings.c: applied patch from Shaun McCance to implement + exslt:split c.f. #117752 + * tests/exslt/strings/Makefile.am tests/exslt/strings/split.1.*: + added the test to the regression suite. + +Thu Jul 17 10:35:22 CEST 2003 Daniel Veillard + + * libxslt/numbers.c: quick fix for an HP-UX compilation problem, + might require more attention could be an Unicode support breakage. + +Wed Jul 16 10:46:35 CEST 2003 Daniel Veillard + + * libxslt/numbers.c libxslt/transform.c libxslt/transform.h + libxslt/xsltInternals.h: optimize text node coalescing by + caching info about the last text node generated and doing + fast alloc/copy of the text. Should fix #115273 + +Mon Jul 14 13:00:00 HKT 2003 William Brack + + * fixed bug 113520, incorrect result for date:seconds + with change to type casting in libexslt/date.c + +Sat Jul 12 20:35:28 HKT 2003 William Brack + + * fixed bug 114764: trouble with globals and RVT's + with minor changes in variables.c and transform.c + so that any global instantiated with an RVT gets + uninitialized when the RVT is destroyed. + +Thu Jul 10 15:47:33 CEST 2003 Daniel Veillard + + * libxslt/transform.c: simple cast missing Peter Breitenlohner + * breakpoint/Makefile.am: added deps to libxslt + * tests/exslt/common/Makefile.am: integrated William Brack test + in the regression suite + +Wed Jul 9 21:27:43 HKT 2003 William Brack + + * fixed bug 114812, trouble with imported exslt functions + added lookup function in libxslt/extension.c + enhanced exsltInitFunc in libexslt/functions.c to take + better care of imports + +Wed Jul 9 12:19:34 CEST 2003 Daniel Veillard + + * python/generator.py python/libxslt-python-api.xml python/libxslt.c + python/libxslt_wrap.h python/libxsltclass.txt: patch from + Sean Treadway, adding Python bindings for extension element and + some bindings cleanups. + * python/tests/Makefile.am python/tests/extelem.py: also add an + example/test. + +Tue Jul 8 12:20:11 CEST 2003 Daniel Veillard + + * python/libxml_wrap.h: applied patch from #116943 which should + fix the xsltSaveResultToFile python binding. + +Mon Jul 7 11:03:18 CEST 2003 Daniel Veillard + + * INSTALL: removed an old reference to libxml2 >= 2.2.12 + +Sun Jul 6 23:57:35 CEST 2003 Daniel Veillard + + * configure.in: releasing 1.0.31 + * doc/*: update and rebuild of the docs + +Sun Jul 6 18:31:56 CEST 2003 Daniel Veillard + + * libxslt/transform.c: fixing bug #115913 for xsl:copy with namespace + nodes. + * tests/docs/Makefile.am tests/docs/bug-122.* + tests/general/Makefile.am tests/general/bug-122*: added the + test to the regression suite. + +Sun Jul 6 18:09:13 CEST 2003 Daniel Veillard + + * libxslt/preproc.c: fix bug #115778 for attribute value template + on xsl:sort order + +Sun Jul 6 17:22:35 CEST 2003 Daniel Veillard + + * libxslt/documents.c libxslt/transform.c: applied patch from + Keith Isdale to desactivate node numbering when running under + the debugger. + +Sun Jul 6 00:00:31 CEST 2003 Daniel Veillard + + * libxslt/security.c: fix the write checking code when + the output filename does not parse as an URL bug #115402 + +Sun Jun 22 19:38:04 CEST 2003 Daniel Veillard + + * libxslt/Makefile.am: Albert Chin pointed out that trio.h and + triodef.h were missing from the distribution + +Fri Jun 13 16:53:33 CEST 2003 Daniel Veillard + + * libxslt.spec.in libexslt/Makefile.am libexslt/libexslt.3 + libxslt/Makefile.am libxslt/libxslt.3: Moved the man pages + to section 3 + * libexslt/sets.c: applied patch from Peter Breitenlohner + * doc/*: rebuilt the docs + * tests/docbook/result//* tests/xmlspec/*.html: changes in + generattion of " as " in element content. + +Sun Jun 08 22:57:13 CEST 2003 Igor Zlatkovic + + * libxslt/transform.c: changed xsltChoose to ignore whitespace + which is a sibling of xsl:when + +Sat May 31 17:18:21 CEST 2003 Igor Zlatkovic + + * libxslt/xslt.c: fixed a possible crash when the document + wasn't a proper stylesheet. + +Tue May 20 12:14:12 CEST 2003 Daniel Veillard + + * libxslt/variables.c: fixes a 64bits cleanliness issue #113318 + +Sat May 17 13:25:32 CEST 2003 Igor Zlatkovic + + * win32/defgen.xsl: new file, generates the export sources. + * win32/*.def.src: these are now autogenerated, changes to these + will not be logged anymore. + +Fri May 16 13:22:31 EDT 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-121.* + tests/general/Makefile.am tests/general/bug-121*: added the + example for bug #112904 in the regression tests, the bug fix is + actually in libxml2 + +Thu May 15 16:26:34 EDT 2003 Daniel Veillard + + * xsltproc/xsltproc.c: fixing portability bug #113002 on HP-UX + * configure.in libxslt.spec.in python/Makefile.am: cleanup + of --with-python like for libxml2 + +Thu May 15 11:45:00 HKT 2003 William Brack + + * libxslt/xsltutils.c: fixing bug #112995, a problem with + NaN within the sort element. Also added regression test. + +Tue May 13 18:22:38 EDT 2003 Daniel Veillard + + * doc/Makefile.am: fixing bug #112803 , make sure to avoid + network accesses when building + +Sat May 10 14:19:14 EDT 2003 Daniel Veillard + + * libxslt/transform.c: fixed a segfault introduced with the RVT + handling change, bug #112703 . + +Sat May 10 13:05:21 EDT 2003 Daniel Veillard + + * libxslt/xslt.c: make sure stylesheet compilation errors + forces a NULL stylesheet, fixes #112270 + +Sun May 4 17:41:23 CEST 2003 Daniel Veillard + + * NEWS configure.in : preparing release 1.0.30 + * doc/apibuild.py: backported a patch from libxml2 + * doc/*: updated and rebuilt the docs + +Wed Apr 30 22:44:49 CEST 2003 Daniel Veillard + + * libxslt/transform.c libxslt/variables.c libxslt/xsltInternals.h: + cleaning up Result Value Tree handling + * libexslt/functions.c libexslt/strings.c: fixed a pair of + implementations. + * tests/exslt/strings/Makefile.am tests/exslt/strings/tokenize.2.*: + added Mark Vakoc test combining for-each and exslt:tokenize + +Wed Apr 30 15:23:33 CEST 2003 Daniel Veillard + + * libxslt/transform.c: fixing bug #111755 when a template is + applied to an attribute + * tests/docs/Makefile.am tests/docs/bug-119.* + tests/general/Makefile.am tests/general/bug-119*: added the + example in the regression tests for that bug. + +Tue Apr 29 15:18:31 CEST 2003 Daniel Veillard + + * doc/Makefile.am doc/libxslt.xml: upgraded to the XML/XSLT toolchain + for the HTML generation fixing #111799 + * doc/html/*.html doc/html/*.png: associated update + +Sun Apr 27 18:00:12 CEST 2003 Igor Zlatkovic + + * libxslt/variables.c: removed premature call to xsltFreeStackElem + * win32/libxslty.def.src: added more exports + +Sun Apr 27 12:46:31 CEST 2003 Daniel Veillard + + * NEWS doc/*.xsl doc/*.html: updated the web site, made the + transition to XHTML1 added validity checking to the makefile rules. + +Sat Apr 26 14:00:58 CEST 2003 Daniel Veillard + + * python/generator.py: fixed a problem in the generator where + the way functions are remapped as methods on classes was + not symetric and dependant on python internal hash order, + as reported by Stéphane Bidoul + * libexslt/strings.c: attempt at fixing an object type pbm + * libxslt/triodef.h: update for OpenVMS from libxml2 + +Fri Apr 25 15:26:26 CEST 2003 Daniel Veillard + + * doc/Makefile.am doc/xsltproc.1 doc/xsltproc.xml: automated the + generation of the man page + +Wed Apr 23 23:27:44 CEST 2003 Daniel Veillard + + * libexslt/sets.c: fixed a bug introduced in the last commit + * libxslt/transform.c: tried to fix #111437 + * tests/docbook/result/xtchunk/html/*.orig + tests/multiple/out/*.orig: side effect of #111437 change. + +Wed Apr 23 22:41:08 CEST 2003 Daniel Veillard + + * libexslt/strings.c: applied last patch for #110023 from + Mark Vakoc + * libexslt/sets.c: fixed a memory leak when mixing one of the + EXSLT set functions and a Result Value Tree + * TODO: there are other bugs around in libexslt/sets.c in conjunction + with Result Value Tree + +Wed Apr 23 17:00:16 CEST 2003 Daniel Veillard + + * libxslt/extensions.c: patch from Vasily Tchekalkin fixing + bug #111420 about double initialization of extension contexts + +Wed Apr 23 14:25:46 CEST 2003 Daniel Veillard + + * libxslt/transform.c: fix bug #110577 namespace in copy-of + don't obbey the same rules as for literal reusl elements. + * tests/docs/Makefile.am tests/docs/bug-118.* + tests/general/Makefile.am tests/general/bug-118*: added the + example in the regression tests for that bug. + * libxslt/variables.c: fixed a bug introduced in fixing #110020 + * tests/docs/Makefile.am tests/docs/bug-11[67].* + tests/general/Makefile.am tests/general/bug-11[67]*: added 2 + regression tests one still exposing a mem leak (Mark Vadoc). + +Tue Apr 22 16:01:25 CEST 2003 Daniel Veillard + + * libxslt/pattern.c: fix a memory related segfault on a + pattern compilation error #110189 + +Tue Apr 22 15:45:25 CEST 2003 Daniel Veillard + + * libxslt/variables.c: fixing bug #110020 on global parameter + and variables mismatch + * tests/reports/Makefile.am tests/reports/cmdlineparams.*: added + the test to the regression suite + +Mon Apr 21 12:22:31 CEST 2003 Daniel Veillard + + * libexslt/math.c: applied patch from Charles Bozeman fixing + the math power function where args were inverted #110996 + * tests/exslt/math/Makefile.am tests/exslt/math/power.1.*: + added the test to the regraession for #110996 + * libexslt/sets.c: avoid a problem with nodesets. + +Wed Apr 14 18:10:21 CEST 2003 Igor Zlatkovic + + * libxslt/win32config.h: added HAVE_MATH_H + +Wed Apr 13 14:04:15 CEST 2003 Igor Zlatkovic + + * win32/Makefile.msvc: fixed compilation with thread-enabled + libxml + +Wed Apr 9 22:02:17 CEST 2003 Daniel Veillard + + * libexslt/strings.c: applied patch from Mark Vakoc fixing a problem + with RTF in libexslt + +Mon Apr 7 14:39:01 CEST 2003 Daniel Veillard + + * libxslt/keys.c libxslt/templates.c libxslt/transform.c + libxslt/variables.c: Fixes bug #110023 reported by Mark Vakoc and + other places where ctxt->document pointer may be used without + checking it agaisnt NULL. + * tests/docs/Makefile.am tests/docs/bug-115.* + tests/general/Makefile.am tests/general/bug-115*: added the + example in the regression tests for that bug. + * libxslt/trio.h libxslt/triodef.h: update of Trio from Bjorn Reese + +Tue Apr 1 13:39:26 CEST 2003 Daniel Veillard + + * configure.in NEWS: preparing 1.0.29 release + * libxslt/documents.c: generate the document order for document() + loaded resources. + * doc/*: updated and regenerated the docs + +Tue Apr 1 11:28:01 CEST 2003 Daniel Veillard + + * libxslt/transform.c: fixed a namespace redundancy problem + in xsl:element + * tests/docs/Makefile.am tests/docs/bug-114.* + tests/general/Makefile.am tests/general/bug-114*: added an + example in the regression tests for that bug. + +Fri Mar 28 12:19:35 CET 2003 Daniel Veillard + + * python/libxsl.py: fix bug #109395 as pointed out by Ben Phillips + and avoid some warnings when loading the python modules on non + Linux platforms. + * libxslt/transform.c: fix a bug introduced in the document lookup + and exhibited by the keys test. + +Wed Mar 26 22:41:00 CET 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-113.* + tests/general/Makefile.am tests/general/bug-113*: added an + example in the regression tests for bug #109160 fixed in libxml2 + +Wed Mar 26 21:43:30 CET 2003 Daniel Veillard + + * configure.in python/Makefile.am python/libxslt.c libxslt/xsltutils.c + libxslt/trio.h libxslt/triodef.h: portability fixes from Albert Chin + * python/libxslt.py: avoid RTLD_GLOBAL detection warning too + +Wed Mar 26 19:08:55 CET 2003 Daniel Veillard + + * libxslt/transform.c: forgot to make one change related to + Result Value Tree change, pointed out by Sebastian Rahtz + * tests/docs/Makefile.am tests/docs/bug-112.* + tests/general/Makefile.am tests/general/bug-112*: added an + example in the regression tests that bug + +Wed Mar 26 01:38:38 CET 2003 Daniel Veillard + + * libxslt/transform.c: second part of the patch fixing #108905 + performances problems, ask for computation of document order on + the document transformed and avoid inefficiencies building large + nodesets of unique nodes. + * configure.in: fix a trouble with libtool in my debug environment. + +Mon Mar 24 22:30:00 CET 2003 Daniel Veillard + + * libxslt/pattern.c libxslt/transform.c libxslt/variables.c: + Result Value Tree are now generated with a document root node + not an element, it's quite cleaner. + * configure.in libxslt.spec.in NEWS: But this requires libxml2-2.5.5 + also prepared for libxslt-1.0.28 release + * doc/*: updated and regenerated the docs + +Mon Mar 24 15:01:07 CET 2003 Daniel Veillard + + * libxslt/pattern.c libxslt/transform.c libxslt/variables.c: + Finally fixed bug #75813, processing or Result Value Tree + converted into node-sets should be a bit more sensible now. + * tests/exslt/common/node-set.2.out: the associated fix in libxml2 + fixes this regression test, there is 4 nodes, not 3 + * tests/docs/Makefile.am tests/docs/bug-111.* + tests/general/Makefile.am tests/general/bug-111*: added an + example in the regression tests for bug #75813 + +Sun Mar 23 13:09:17 CET 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-110.* + tests/general/Makefile.am tests/general/bug-110*: added an + example in the regression tests for bug #108976 which is + fixed in libxml2 + +Sat Mar 22 12:35:47 CET 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-109.xml + tests/general/Makefile.am tests/general/bug-109*: added an + example in the regression tests for the invalid bug #108716 + +Sat Mar 22 12:01:24 CET 2003 Daniel Veillard + + * libxslt/variables.c: fixed bug #108633 reported by + Jerome Pesenti about recursive global variables/param detections + * tests/reports/Makefile.am tests/reports/rec*: added regression + tests for the checking of recusion in global/local param/variables. + +Fri Mar 7 16:08:24 CET 2003 Daniel Veillard + + * libxslt/numbers.c: valgrind pointed out an uninitialized + variable use in format-number() + +Fri Mar 7 15:27:56 CET 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-108.xml + tests/general/Makefile.am tests/general/bug-108*: added an + example in the regression tests bug #107804 fixed in libxml2 + +Wed Mar 5 12:47:31 CET 2003 Daniel Veillard + + * libxslt/pattern.c: fixed bug #107591 node() in pattern + matches should catch comments and PIs + * tests/docs/Makefile.am tests/docs/bug-107.xml + tests/general/Makefile.am tests/general/bug-107*: added an + example in the regression tests for this case + +Wed Feb 26 16:49:17 CET 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-106.xml + tests/general/Makefile.am tests/general/bug-106*: added the next + example for bug #106788 from James Clark in the regression tests, + the bug fix is actually in libxml2 + +Tue Feb 25 16:19:45 CET 2003 Daniel Veillard + + * configure.in doc/Makefile.am xsltproc/Makefile.am: some cleanup + for Python checks, makefile cleanup, and convenience changes + +Mon Feb 24 23:49:01 CET 2003 Daniel Veillard + + * xsltproc/xsltproc.c: had to comment out Igor last change + since it made libxslt-1.0.27 depends on libxml2 newly + API extension which hasn't propagated yet :-( + +Mon Feb 24 22:21:09 CET 2003 Daniel Veillard + + * configure.in: preparing release 1.0.27 + * doc/*: updated and rebuilt the docs + +Mon Feb 24 19:43:15 CET 2003 Daniel Veillard + + * libxslt/namespaces.c: fixed #106554 for spurious xmlns:nsX="" + generation + +Sun Feb 23 14:52:57 CET 2003 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-105.xml + tests/general/Makefile.am tests/general/bug-105*: added the + example for bug #106788 from James Clark in the regression tests, + the bug fix is actually in libxml2 + +Sun Feb 23 14:25:13 CET 2003 Daniel Veillard + + * libxslt/namespaces.c libxslt/transform.c: fixed bug #106789 from + James Clark and a bit of cleanup + * tests/docs/Makefile.am tests/docs/bug-104.xml + tests/general/Makefile.am tests/general/bug-104*: added the + example in the regression tests for this case + +Fri Feb 21 17:07:59 CET 2003 Daniel Veillard + + * libxslt.spec.in: fixed RH#84801 wrong prereqs in the spec file + +Wed Feb 19 18:51:06 CET 2003 Igor Zlatkovic + + * libxslt/functions.c libxslt/xslt.c: fixed bug 106251 + +Wed Feb 19 15:52:33 CET 2003 Igor Zlatkovic + + * xsltproc/xsltproc.c: obsoleted xmlNormalizeWindowsPath + * win32/configure.js: included handling of the trio option + +Mon Feb 10 17:34:32 CET 2003 Daniel Veillard + + * configure.in doc/*: preparing release 1.0.26 + +Fri Feb 7 15:47:20 CET 2003 Daniel Veillard + + * libxslt/functions.c: fixing another bug in document(), bug #105450 + * tests/documents/test_bad.result: Slight change to the output + +Fri Feb 7 15:34:24 CET 2003 Daniel Veillard + + * libxslt/functions.c: fixing a segfault in document(), bug #105418 + * tests/documents/Makefile.am tests/documents/test_bad: add the + specific test as suggested by Jean T Anderson + +Fri Feb 7 14:18:40 CET 2003 Daniel Veillard + + * libxslt/extensions.c libxslt/keys.c libxslt/pattern.c + libxslt/preproc.c libxslt/transform.c libxslt/variables.c + libxslt/xslt.c: tried to fix 105387 and all similar cases + in the library sources. + +Wed Feb 5 16:04:10 CET 2003 Daniel Veillard + + * doc/* configure.in: preparing for release of 1.0.25 + +Wed Feb 5 00:07:43 CET 2003 Daniel Veillard + + * xsltproc/xsltproc.c: fixed bug #99623 + +Tue Feb 4 22:10:17 CET 2003 Daniel Veillard + + * libxslt/transform.c: fixing bug #105116 sometimes one need + to generate a default namespace reset xmlns="" in the output + * tests/docs/Makefile.am tests/docs/bug-103.xml + tests/general/Makefile.am tests/general/bug-103*: added the + example in the regression tests for this case + +Tue Feb 4 18:39:35 CET 2003 Daniel Veillard + + * libxslt/pattern.c libxslt/transform.c: changed the way the + root element of value tree are handled to fix bug #104123 + +Tue Feb 4 18:15:01 CET 2003 Daniel Veillard + + * README: change of policy w.r.t. mails + * configure.in: small cleanup + * libxslt/transform.c libxslt/xslt.c libxslt/variables.c: fixed + a couple of bugs raised by Eric van der Vlist in #104114 + * tests/exslt/*/*.out: slight change to the tests + +Tue Feb 4 17:18:54 CET 2003 Daniel Veillard + + * doc/xsltproc.1 doc/xsltproc.xml: fixing bug #104096, put + emphasis on the fact that --docbook should not be used + for XML. + +Wed Jan 22 16:43:49 CET 2003 Daniel Veillard + + * python/libxslt.c: fixed a couple of return error #104150 + reported by Peter O'Shea + +Fri Jan 17 17:43:43 CET 2003 Daniel Veillard + + * xsltproc/xsltproc.c: fixed a double free of stylesheet + when applied to a standalone stylesheet + +Tue Jan 14 16:22:48 CET 2003 Daniel Veillard + + * configure.in: preparing release 2.0.24 + * libxslt.spec.in: small update + * doc/*: updated the news, rebuilt the APIs descriptions + +Tue Jan 14 14:23:47 CET 2003 Daniel Veillard + + * libxslt/functions.c: fixed #101502 by applying and cleaning up + the associated patch from Daniel Stodden. + * tests/documents/Makefile.am tests/documents/fragment*: added a + specific test. + +Mon Jan 13 23:25:59 CET 2003 Daniel Veillard + + * libxslt/extensions.c libxslt/transform.c: fixing bug #101602 + for extension modules init and shutdown callbacks, check that + they are now called when needed. + * python/libxsl.py python/libxslt-python-api.xml python/libxslt.c: + started adding the extension module support at the Python level. + Still a strange bug to hunt down left. + +Sun Jan 12 23:56:18 CET 2003 Daniel Veillard + + * libxslt/attributes.c libxslt/xsltInternals.h libxslt/imports.c + libxslt/xslt.c: fixed bug #101003 on attribute-sets value + computation in the presence of imports + * tests/docs/Makefile.am tests/docs/bug-102.xml + tests/general/Makefile.am tests/general/bug-102*: added an + example in the regression tests for this case + +Fri Jan 10 10:34:23 CET 2003 Daniel Veillard + + * xsltproc/xsltproc.c: final touch to #102800 fix + +Thu Jan 9 18:17:40 CET 2003 Daniel Veillard + + * xsltproc/xsltproc.c: tried to fix #102800 for good. Reenabled + memory debug checking which got deactivated at some point ?!? + * libexslt/date.c libxslt/attributes.c: fixing some memory leaks + * libxslt/xsltutils.c: very small change on HTML indentation handling + +Thu Jan 9 14:28:19 CET 2003 Daniel Veillard + + * tests/REC/test-8-1.xsl tests/REC/test-9.1-2.xsl + tests/general/bug-83.xsl tests/multiple/dict.xsl: added some + exclude-result-prefixes to avoid extra namespace declaration being + dumped following the fix for #102920 in libxml2 + +Wed Jan 8 12:33:47 CET 2003 Daniel Veillard + + * libxslt/transform.c: fixed a problem related to directory + checking and creation raised by Craig Goss + +Thu Jan 2 23:23:30 CET 2003 Daniel Veillard + + * libexslt/strings.c: applied patch from Jörg Walter to provide + URI escaping and unescaping functions. + +Thu Dec 26 15:43:31 CET 2002 Daniel Veillard + + * libexslt/strings.c: Alexey Efimov found a typo bug in + exsltStrPaddingFunction() + +Mon Dec 23 15:43:59 CET 2002 Daniel Veillard + + * python/libxslt.c: patch from Stéphane Bidoul for Python 2.1 + +Sun Dec 22 22:54:04 CET 2002 Daniel Veillard + + * vms/build_xslt.com libxslt/xsltconfig.h.in libxslt/xsltutils.c: + applied patch from Craig A. Berry for the VMS port. + +Wed Dec 18 15:41:21 CET 2002 Daniel Veillard + + * libxslt/xsltInternals.h: increase the max number of cascaded + sort operations. + * AUTHORS doc/* win32/*: updated Igor's mail and the Web page for + the Windows binaries. + +Mon Dec 16 19:31:16 CET 2002 Igor Zlatkovic + + * win32/libxslt.def.src: added more exports for Stephane Bidoul + +Fri Dec 13 14:50:12 CET 2002 Daniel Veillard + + * doc/apibuild.py doc/libexslt-api.xml doc/libxslt-api.xml: updated + the apibuilder script, regenerated the APIs + +Fri Dec 13 11:59:07 CET 2002 Daniel Veillard + + * libxslt/numbers.c: numbering should not traverse XInclude + nodes left in the tree. Closes bug #101114 raised by + Bernd Kuemmerlen + +Thu Dec 12 01:17:09 CET 2002 Daniel Veillard + + * doc/apibuild.py: fixed a bug in merging public info from + C modules. + * win32/Makefile.msvc win32/configure.js: patch from Mark Vakoc + the iconv option to configure.js didn't work, and + added zlib option needed when linking xsltproc statically + +Wed Dec 11 19:18:45 CET 2002 Daniel Veillard + + * doc/Makefile.am doc/apibuild.py doc/libexslt-api.xml: added + the generation of libexslt-api.xml + * libexslt/exslt.h: small cleanup. + +Wed Dec 11 18:45:09 CET 2002 Daniel Veillard + + * doc/Makefile.am doc/apibuild.py doc/libxslt-api.xml: + copied over the apibuild.py from libxml2, adapted a bit and + regenerated the API description in XML. Todo: libexslt-api.xml + * libxslt/attributes.c libxslt/documents.c libxslt/extensions.c + libxslt/imports.c libxslt/numbers.c libxslt/numbersInternals.h + libxslt/pattern.c libxslt/preproc.c libxslt/security.c + libxslt/templates.c libxslt/transform.c libxslt/transform.h + libxslt/variables.c libxslt/xslt.c libxslt/xsltInternals.h + libxslt/xsltutils.c libxslt/xsltutils.h: cleanup based on the + report from the scripts. + * libxslt.spec.in: make sure libxslt-api.xml ends up in the devel + package + +Thu Dec 5 18:05:44 CET 2002 Daniel Veillard + + * libxslt/transform.c: xsl:element generated superfluous xmlns + declarations, closes bug #99905 + * tests/docs/Makefile.am tests/docs/bug-101.xml + tests/general/Makefile.am tests/general/bug-101.*: added the + example in the regression tests for this case + +Wed Dec 4 18:12:24 CET 2002 Daniel Veillard + + * libxslt/xslt.c: Matt Sergeant reported a bug when having comments + within an + +Mon Dec 2 17:19:38 CET 2002 Daniel Veillard + + * libxslt/extensions.c: applied patch from Josh Parsons fixing bug + #100056 + * tests/docs/Makefile.am tests/docs/bug-100.xml + tests/general/Makefile.am tests/general/bug-100.*: added the + example in the regression tests for this case + * tests/docs/Makefile.am tests/docs/bug-99.xml + tests/general/Makefile.am tests/general/bug-99.*: this test + covers an xsl:attribute namespace bug that Norm pointed out. + +Thu Nov 28 17:52:21 CET 2002 Daniel Veillard + + * libxslt/xsltInternals.h libxslt/xsltutils.c libxslt/xsltutils.h + win32/libxslt.def.src: applied another patch from Richard Jinks + for the export of teh sorting routine and allowing per context + sort. + +Wed Nov 27 13:33:26 CET 2002 Daniel Veillard + + * libxslt/preproc.c libxslt/xsltInternals.h libxslt/xsltutils.c + libxslt/xsltutils.h: Applied patch from Richard Jinks to allow + redefining the sorting routine, plus a bit of tweaking of the + interfaces. + +Tue Nov 26 16:02:38 CET 2002 Daniel Veillard + + * doc/Makefile.am doc/parsedecl.py: fixed the API generation + scripts. + * doc/libxslt-api.xml doc/libxslt-refs.xml: regenerated + * doc/html/*.html: updated too + * python/libxsltclass.txt: updated too + +Tue Nov 26 15:17:13 CET 2002 Daniel Veillard + + * libxslt/xsltutils.c libxslt/xsltutils.h: added the function + xsltGetProfileInformation() to retrieve profiling informations + from an XSLT transformation context. It returns it as an XML + tree. Provided by Michael Rothwell this closes RFE #99527 + +Tue Nov 26 14:40:45 CET 2002 Daniel Veillard + + * libxslt/imports.c: apply patch from Daniel Stodden, a bug + in xsltFindElemSpaceHandling() missing imported informations + * tests/REC/stand-2.7-1.stand.out: this change slightly the result + of this test. + +Mon Nov 25 17:33:48 CET 2002 Daniel Veillard + + * libxslt/namespaces.c: fix for namespace generation on + attributes created with xsl:attribute + +Mon Nov 25 17:30:02 CET 2002 Daniel Veillard + + * libxslt.spec.in configure.in: add a line in %changelog for releases + +Mon Nov 25 14:57:53 CET 2002 Daniel Veillard + + * libxslt/transform.h: Kir Kolyshkin pointed out it lacked + xsltInternals.h reference. + +Sun Nov 24 15:49:58 CET 2002 Daniel Veillard + + * python/tests/*.py: enable libxml2 memory debug before + loading libxslt since libxslt initialization now includes + EXSLT registration which initialize the libxml2 library and + allocate memory + +Sun Nov 24 13:58:48 CET 2002 Daniel Veillard + + * python/libxsl.py: updated with new version from Stéphane Bidoul + +Sat Nov 23 22:49:08 CET 2002 Igor Zlatkovic + + * win32/libxslt.def.src: exported new functions + +Sat Nov 23 14:46:06 CET 2002 Daniel Veillard + + * libexslt/date.c: patch from Charles Bozeman fixing a memory + leak in exsltDateDurationFunction pointed out by Bernard Brinkhus + * python/tests/exslt.py: trouble with mem debug in that specific + test... + +Sat Nov 23 12:33:58 CET 2002 Daniel Veillard + + * libxslt/xsltInternals.h: Alexey Efimov reported a portability + problem when compiling on HP-UX + +Sat Nov 23 12:23:32 CET 2002 Daniel Veillard + + * python/generator.py python/libxslt.c: fixes for compiling + without config.h + +Thu Nov 21 18:51:29 CET 2002 Daniel Veillard + + * libxslt/transform.c: fixed bug #99168 select evaluating to + a node list check + +Thu Nov 21 15:12:33 CET 2002 Daniel Veillard + + * tests/documents/result.xhtml: the XHTML1 serialization change + to libxml2 modifies slightly the result of that test. + +Mon Nov 18 11:38:46 CET 2002 Daniel Veillard + + * configure.in: the python bindings requires libxml2 >= 2.4.25 + for the regexp stuff. + +Mon Nov 18 10:09:06 CET 2002 Daniel Veillard + + * configure.in: similar patch to #98825 for --with-python + +Sun Nov 17 22:06:59 CET 2002 Daniel Veillard + + * libxslt/variables.c: fix bug #98793 on clash of imported global + variables. + * tests/reports/tst-1.err: this changes the output of that test + +Sun Nov 17 18:12:20 CET 2002 Daniel Veillard + + * configure.in: preparing 1.0.23 + * doc/*: rebuilding the docs + +Sat Nov 16 23:23:41 CET 2002 Daniel Veillard + + * python/libxslt.c: make sure to register EXSLT for the bindings + * python/tests/Makefile.am python/tests/exslt.py: add a specific test + * xsltproc/xsltproc.c: minor cleanup + +Fri Nov 15 12:35:57 CET 2002 Daniel Veillard + + * python/Makefile.am python/tests/Makefile.am: trying to fix #98518 + when building outside of the source tree + +Thu Nov 14 21:39:37 CET 2002 Daniel Veillard + + * python/generator.py: xpathObjectRet() pertains to the libxml2 + module, add the namespace. + +Thu Nov 14 18:48:00 CEST 2002 Igor Zlatkovic + + * libxslt/win32config.h: cleanup + * win32/Makefile.mingw: new file, integrated mingw in JScript configure + * win32/Makefile.msvc: modified to allow mingw coexistence + * win32/configure.js: integrated mingw + * win32/Readme.txt: cleanup + * xsltproc/xsltproc.c: allowed stdarg for mingw + +Thu Nov 14 07:22:23 MST 2002 John Fleck + + * doc/xsltproc.1 + * doc/xsltproc.html - ran stylesheets to update man page + and html with Daniel's fix to #95510 + +Thu Nov 14 15:10:13 CET 2002 Daniel Veillard + + * libxslt/transform.c: applied patch from Brian McCauley fixing #95493 + * doc/xsltproc.xml: fixing #95510 missing description of --writesubtree + * README: fix the bug page URL + +Thu Nov 14 10:03:12 CET 2002 Daniel Veillard + + * libxslt/functions.c: make sure the fixup for key() reported + by John Escott actually works. + * tests/docs/Makefile.am tests/docs/bug-98.xml + tests/general/Makefile.am tests/general/bug-98.*: added the + example in the regression tests for this case + +Wed Nov 13 10:35:46 CET 2002 Daniel Veillard + + * libxslt/pattern.c: fixes bug #97969 for @*[...] patterns + * tests/docs/Makefile.am tests/docs/bug-97.xml + tests/general/Makefile.am tests/general/bug-97.*: added the + example in the regression tests for this case + +Tue Nov 12 22:35:47 CET 2002 Daniel Veillard + + * libxslt/transform.c: fixes bug #97950 for cdata-section-elements + checks in recursive copies. + * tests/docs/Makefile.am tests/docs/bug-96.xml + tests/general/Makefile.am tests/general/bug-96.*: added the + example in the regression tests for this case + +Tue Nov 12 19:31:49 CET 2002 Daniel Veillard + + * libxslt/functions.c: autoconvert key() first arg to string, + reported by John Escott + +Tue Nov 12 13:40:47 CET 2002 Daniel Veillard + + * libxslt/transform.c: corner case handling of copying a CDATA node. + +Fri Nov 8 18:12:46 CEST 2002 Igor Zlatkovic + + * libxslt/win32config.h: retired xmlwin32version.h + +Fri Nov 8 17:09:14 CET 2002 Daniel Veillard + + * Makefile.am libxslt.m4 libxslt.spec.in: integrated libxslt.m4 + written by Thomas Schraitle (RFE #96485) + +Thu Nov 7 11:18:42 MST 2002 John Fleck + + * doc/xsltproc.xml + * doc/xsltproc.1 + clarifying --catalog option and xsltproc's use of + XML_CATALOG_FILES and /etc/xml/catalog. fixes + http://bugzilla.gnome.org/show_bug.cgi?id=97891 + +Mon Nov 4 06:55:36 CET 2002 Daniel Veillard + + * xsltproc/xsltproc.c: remove the use of snprintf, and use + libxml2 string API instead. + * configure.in libxslt/xsltconfig.h.in libxslt/xsltutils.c: + try to cope with architecture lacking some of the string functions, + reuse the trio ones compiled in libxml2 , should close #97113 + +Wed Oct 23 17:06:24 CEST 2002 Daniel Veillard + + * Makefile.am libxslt.spec.in doc/Makefile.am: cleaned up + the spec file and associated changes in the Makefiles. + +Tue Oct 22 21:02:37 CEST 2002 Daniel Veillard + + * libxslt/pattern.c: Forgot to check a pointer, fixes bug #96495 + +Tue Oct 22 20:53:10 CEST 2002 Daniel Veillard + + * libxslt/keys.h: fixed include c.f. bug #96487 + * config.h.in: Red Hat 8.0 induced change + +Mon Oct 21 20:56:31 CEST 2002 Daniel Veillard + + * libxslt/numbers.c libxslt/numbersInternals.h libxslt/xsltutils.[ch]: + fixed bug #78501 when using a non ascii character for the + number formatting grouping separator. + * tests/docs/Makefile.am tests/docs/bug-95.xml + tests/general/Makefile.am tests/general/bug-95.*: added the + example in the regression tests for this case + * libxslt/attributes.c: cleaning up a problem introduced in last + patch + +Mon Oct 21 09:31:55 CEST 2002 Igor Zlatkovic + + * libxslt/attributes.c: fixed minor typo in a call to + xmlHasNsProp + +Sun Oct 20 23:20:37 CEST 2002 Daniel Veillard + + * python/types.c: fixed bugs when passing result value tree + to Python functions. + +Sun Oct 20 15:23:28 CEST 2002 Igor Zlatkovic + + * libxslt/win32config.h: mapped vsnprintf to _vsnprintf for the + MS runtime + * xsltproc/xsltproc.c: mapped snprintf to _snprintf for the MS + runtime + +Fri Oct 18 13:40:12 CEST 2002 Daniel Veillard + + * configure.in: preparing 1.0.22 + * doc/*: upated and rebuilt the docs + +Thu Oct 17 16:32:44 CEST 2002 Daniel Veillard + + * libxslt/variables.c: fixed bug #86421 + * tests/docs/Makefile.am tests/docs/bug-94.xml + tests/general/Makefile.am tests/general/bug-94.*: added the + example in the regression tests for this case + +Thu Oct 17 15:50:04 CEST 2002 Daniel Veillard + + * xsltproc: added and tested the --path option to close #79638 + +Thu Oct 17 15:25:46 CEST 2002 Daniel Veillard + + * libxslt/attributes.c: fixing bug #95826 the attribute was reset + with the inherited stylesheet value. + * tests/docs/Makefile.am tests/docs/bug-93.xml + tests/general/Makefile.am tests/general/bug-93-inc.* + tests/general/bug-93.*: added the example in the regression + tests for this case + +Tue Oct 15 18:02:37 CEST 2002 Daniel Veillard + + * libxslt/xsltInternals.h libxslt/xsltutils.[ch]: added the + possibility to register a transformation context specific + error handler, with xsltSetTransformErrorFunc() and provided + a new routine xsltTransformError() to handle contextual errors, + this should fix #94435 + * libxslt/*.c: modified all the code to use the context specific + error handling, as a result xsltPrintErrorContext() is not called + anymore except internally from xsltTransformError() + +Tue Oct 15 14:52:23 CEST 2002 Daniel Veillard + + * libxslt/transform.c: closing #94933, any error will make + the transformation abort with no result. + * tests/reports/tst-1.err tests/reports/tst-1.out + tests/reports/undefvar.err: this changed the regression tests + output. + * tests/exslt/date/difference.1.out tests/exslt/date/seconds.1.out: + updated the result accordingly to the fixes done last month. + * libxslt/namespaces.c: make sure to avoid duplicate namespace + declarations in the result trees. May fix #93692 but it's unclear. + +Tue Oct 15 12:45:42 CEST 2002 Daniel Veillard + + * xsltproc/xsltproc.c: added a --path option to provide the + enhancement requested by #79638, first cut at it, untested + yet. + +Tue Oct 15 13:02:40 CEST 2002 Daniel Veillard + + * libxslt/xslt.c: seems the media-type attribute wasn't + always correctly handled + +Mon Oct 14 09:27:01 CEST 2002 Daniel Veillard + + * libxslt/transform.c: added URI escaping in case the resource + target computation of exslt:element failed. Should fix #81837 + +Tue Oct 15 12:42:25 CEST 2002 Daniel Veillard + + * README: updated the contact informations + +Tue Oct 15 11:40:19 CEST 2002 Daniel Veillard + + * libxslt/pattern.c: fixed the behaviour of node() patter which + didn't patch the one defined in XPath :-( . Closes bug #95793 + * tests/docs/Makefile.am tests/docs/bug-92.xml + tests/general/Makefile.am tests/general/bug-92.*: added the + example in the regression tests for this case + +Mon Oct 14 12:29:53 CEST 2002 Igor Zlatkovic + + * libxslt/win32config.h: remapped mkdir to _mkdir for MS runtime + * win32/Makefile.msvc: added security.c to the build + * win32/libxslt.def.src: exported functions from security.c + +Thu Oct 10 18:41:56 CEST 2002 Daniel Veillard + + * xsltproc/xsltproc.c: added another option --writesubtree to allow + documents to be written only to a given subtree. + +Thu Oct 10 17:16:52 CEST 2002 Daniel Veillard + + * libxslt/security.[ch] libxslt/Makefile.am: new module with + runtime security checks, it will also check and do directory + creation when allowed + * libxslt/documents.c libxslt/imports.c libxslt/transform.c + libxslt/xslt.c libxslt/xsltInternals.h: plug-in the new + security infrastructure probes at file reading or file creation + * xsltproc/xsltproc.c: plugged the security module there too, + added the new options --nowrite and --nomkdir + * doc/*: updated the man page and regenerated. + +Wed Oct 9 18:37:56 CEST 2002 Daniel Veillard + + * doc/*: updated the doc XSLT to add the search, added the search + page, fixed a link problem raised by Yves Pratter, regenerated + +Wed Oct 9 14:27:17 CEST 2002 Daniel Veillard + + * doc/index.py: the indexer version of the XSLT part of the + xmlsoft site + archives + +Sun Sep 29 20:02:25 CEST 2002 Igor Zlatkovic + + * win32/Makefile.msvc: introduced double-run compilation. + * win32/configure.js: introduced double-run compilation. + +Thu Sep 26 20:08:50 CEST 2002 Daniel Veillard + + * configure.in: preparing 1.0.21 + * doc/* : updated and regenerated the docs and web pages + +Wed Sep 25 11:16:06 CEST 2002 Daniel Veillard + + * libxslt/transform.c: fixed a disable output escaping bug for + HTML output introduced in 1.0.20 and raised by Mario Weilguni + * tests/docs/Makefile.am tests/docs/bug-91.xml + tests/general/Makefile.am tests/general/bug-91.*: added the + example in the regression tests for this case + +Tue Sep 24 20:33:08 MDT 2002 John Fleck + + * doc/xlst.html: changing link on ftp.gnome.org + +Mon Sep 23 10:14:38 CEST 2002 Daniel Veillard + + * Makefile.am: set-up DIST_SUBDIRS to avoid the same problem Jacob + reported for libxml2 + +Fri Sep 20 14:06:45 CEST 2002 Daniel Veillard + + * Makefile.am configure.in: trying to fix the same problem as + #88412 by bypassing all the python subdir if python ain't detected + +Fri Sep 20 10:55:03 CEST 2002 Daniel Veillard + + * libxslt/templates.c: fixed a problem reported by Mark Vakoc + +Wed Sep 18 15:46:50 CEST 2002 Igor Zlatkovic + + * libexslt/date.c: fixed the embedded '-' in the duration format + function + * tests/.../difference.1.xml: added test cases which illustrated + the above bug + +Tue Sep 17 18:01:22 CEST 2002 Igor Zlatkovic + + * libexslt/date.c: fixed date:difference() bugs, removed all + type conversion warnings. + * libxslt/xsltutils.c: removed unused local variable. + +Sat Sep 14 16:17:51 MDT 2002 John Fleck + + * doc/xsltproc.html: + oops, forgot to update the html version of the man page + +Sat Sep 14 16:10:21 MDT 2002 John Fleck + + * doc/xsltproc.xml + * doc/xsltproc.1 + * doc/xsltproc2.html + Fixing erroneous mention of old --warnnet option (thanks to Jean + T. Anderson for pointing this out) + +Tue Sep 10 21:05:28 CEST 2002 Igor Zlatkovic + + * win32/configure.js: added more readme info for the binary + package. + +Mon Sep 9 14:07:06 CEST 2002 Daniel Veillard + + * libxslt/pattern.c: fixed a bug in match="node()" reported by + Ben Ko + +Mon Sep 9 14:06:25 CEST 2002 Daniel Veillard + + * libxslt.spec.in: fixes libary path for x86_64 AMD + +Thu Sep 5 10:07:13 CEST 2002 Daniel Veillard + + * python/Makefile.am: applied patch from Christophe Merlet to + reestablish DESTDIR + +Thu Aug 29 21:26:30 CEST 2002 Daniel Veillard + + * libxslt/transform.c: re-applied the patch from Nathan Myers about + a possible memory leak in case of error + +Wed Aug 28 13:44:54 CEST 2002 Daniel Veillard + + * doc/Libxslt-Logo-180x168.gif doc/Libxslt-Logo-90x34.gif: + nice logos generated by Marc Liyanage + * doc/site.xsl *.html: changed the stylesheet to show the new + logo and regenerated the pages + +Sun Aug 25 17:01:40 CEST 2002 Daniel Veillard + + * python/libxslt-python-api.xml python/libxslt.c + python/libxsltclass.txt python/tests/basic.py: applied a patch + from Ralf Mattes providing style.saveResultToString() + +Fri Aug 23 13:53:50 CEST 2002 Daniel Veillard + + * configure.in: preparing release 1.0.20 + * doc/*: updated and regenerated the docs + +Wed Aug 21 21:27:29 CEST 2002 Daniel Veillard + + * libxslt/templates.c: fixed a bug w.r.t. namespace context when + doing the evaluation of attribute value templates + * libxslt.spec.in python/Makefile.am: fixed some troubles + with "make rpm" + +Wed Aug 21 18:59:28 CEST 2002 Daniel Veillard + + * python/libxslt.c: fixed the parameter order when calling + Python based extensions. + +Wed Aug 21 13:48:07 CEST 2002 Daniel Veillard + + * libxslt/transform.c libxslt/xslt.c: fixed bug #89258 and a bit of + cleanup. + * tests/docs/Makefile.am tests/docs/bug-90.xml + tests/general/Makefile.am tests/general/bug-90.*: added the + example in the regression tests for this case + +Tue Aug 20 16:40:48 CEST 2002 Igor Zlatkovic + + * win32/Makefile.msvc: added the prefix location to the include + and lib search path. + +Mon Aug 19 15:03:11 CEST 2002 Daniel Veillard + + * libxslt/transform.c: found and fixed the small + bug which was giving troubles to DocBook users (the test expression + of was evaluated in the namespace context of !) + +2002-08-18 Havoc Pennington + + * autogen.sh: hardcode aclocal-1.4/automake-1.4 so that users with + both automake 1.6 and 1.4 installed get the right automake. Means + compilation from CVS will now require the latest automake 1.4 + release, or manually creating symlinks called "automake-1.4" and + "aclocal-1.4" + +Wed Aug 14 18:54:19 CEST 2002 Daniel Veillard + + * configure.in python/Makefile.am: AMD x86-64 induced changes from + Frederic Crozat + +Wed Aug 14 13:35:04 CEST 2002 Daniel Veillard + + * libxslt/functions.c: recovering to the old (somewhat) broken + implementation of document('') when there is no base for the + source document or it can't be realoaded (e.g. when the sytlesheet + was loaded from a memory string). Matt Sergeant insisted on this + one :-) + +Tue Aug 13 11:21:44 CEST 2002 Daniel Veillard + + * libxslt/transform.c: applied another patch from Nathan Myers about + a possible memory leak in case of error + +Mon Aug 12 23:12:59 CEST 2002 Daniel Veillard + + * libxslt/transform.c: applied a patch from Nathan Myers about + an erroneous free in case of error + +Thu Aug 1 14:29:11 CEST 2002 Daniel Veillard + + * configure.in: upon suggestion of Marc-Andre Lemburg, make + the misdetection of libxml2 python bindings a warning only + +Sun Jul 21 19:10:00 HKT 2002 William Brack + + * xsltInternals.h/xslt.c/transform.c and pattern.c: fixed + a bug reported by Gero Meissner (87230) + * fixed a problem compiling python directory when multiple + 'make' jobs were executed (python/Makefile.am) + +Wed Jul 17 19:58:36 CEST 2002 Daniel Veillard + + * libxslt/attributes.c: fixed a bug reported by Keith Isdale + at the xsltdbg interface when encountering an empty attribute + set. + +Wed Jul 17 19:51:47 CEST 2002 Daniel Veillard + + * tests/* : the change in HTML meta encoding tag serialization + affected some of the results + +Thu Jul 11 22:04:30 CEST 2002 Daniel Veillard + + * doc/Makefile.am: adding doc/xsltproc.xml to the tarball + to fix Red Hat bug #68614 + +Wed Jul 10 21:28:11 CEST 2002 Igor Zlatkovic + + * win32/Makefile.msvc: Made the copy *.pdb in install succeed even + if there is no *.pdb + +Sat Jul 6 22:00:08 CEST 2002 Daniel Veillard + + * configure.in: preparing 1.0.19 + * doc/* : rebuilt the docs + +Sat Jul 6 17:51:14 CEST 2002 Daniel Veillard + + * libxslt/transform.c: fixed bug #83749 about namespace generated + being invalid when they are inherited from the context. + +Fri Jul 5 22:27:47 CEST 2002 Daniel Veillard + + * libxslt/transform.c: fixed bug #86753 on multiple identical + attributes being generated, oops ... + * tests/docs/Makefile.am tests/docs/bug-89.xml + tests/general/Makefile.am tests/general/bug-89.*: added an + example in the regression tests for this case + +Fri Jul 5 18:28:08 CEST 2002 Daniel Veillard + + * libxslt/preproc.c libxslt/transform.c: fixed bug #87279 + * tests/docs/Makefile.am tests/docs/bug-88.xml + tests/general/Makefile.am tests/general/bug-88.*: added an + example in the regression tests for this case + +Fri Jul 5 16:30:02 CEST 2002 Daniel Veillard + + * libxslt/preproc.c libxslt/xsltutils.c: applied a patch from + Ken Neighbors to implement/fix sorting orders + * tests/docbook/result/*/gdp-handbook.* + tests/docbook/result/xtchunk/html/*.orig + tests/general/bug-12-.out tests/general/bug-63.out: + cleaned up the result of "make tests" following some changes + in namespace axis order and serialization rules in libxml2 + +Thu Jul 4 16:53:00 HKT 2002 William Brack + + * transform.c further enhancement for bug 84902 (another + path), also cleaned up code slightly + +Wed Jul 3 00:50:00 HKT 2002 William Brack + + * transform.c: fixed bug 84902 - message with terminate=yes + caused segfault + +Tue Jul 2 00:02:53 CEST 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-87.xml + tests/general/Makefile.am tests/general/bug-87.*: added a + example in the regression tests for a case where the XML + default namespace was missing from the namespace axis + * xsltproc/xsltproc.c: added the informations that parameter + strings are expected to be UTF8 + * libxslt/attributes.c: fixes on attribute group implementation + +Sat Jun 29 21:12:14 MDT 2002 John Fleck + + * doc/xsltproc.xml, doc/xsltproc.html/, doc/xsltproc.1 + updating docs to add reference to UTF-8 requirement for + stringparam command line option + +Wed Jun 19 13:43:00 CEST 2002 Daniel Veillard + + * libxslt/documents.c libxslt/functions.c libxslt/xsltInternals.h: + fixed document('') as pointed by Eric van der Vlist + * tests/docs/Makefile.am tests/docs/bug-86.xml + tests/general/Makefile.am tests/general/bug-86.*: added the + specific example in the regression tests + +Sat Jun 15 15:44:58 CEST 2002 Daniel Veillard + + * libxslt/numbers.c libxslt/numbersInternals.h: applied a + patch from Ken Neighbors fixing some format-number inconsistencies + * tests/numbers/format-number.out tests/numbers/format-number.xml + tests/numbers/format-number.xsl: the patch also included + updates to the regression tests + +Mon Jun 10 14:55:31 CEST 2002 Daniel Veillard + + * libxslt/numbers.c: patch from Richard Jinks t correct a bug in + xsl:number level="multiple" + * tests/docs/Makefile.am tests/docs/bug-84.xml + tests/general/Makefile.am tests/general/bug-84.*: added a + specific example in the regression tests + +Fri May 31 09:33:09 CEST 2002 Daniel Veillard + + * libexslt/dynamic.c: turned a function static + * libxslt/win32config.h: applied patch from Mark Vadoc + +Thu May 30 23:35:47 CEST 2002 Daniel Veillard + + * win32/Makefile.msvc libexslt/Makefile.am libexslt/date.c + libexslt/dynamic.c libexslt/exslt.c libexslt/exslt.h: applied + a patch from Mark Vakoc to implement the EXSLT + object dyn:evaluate(string) extension function, and a small fix + to date.c + +Mon May 27 23:24:57 CEST 2002 Daniel Veillard + + * configure.in: preparing 1.0.18 + * doc/*: recompiled the API and web site + +Mon May 27 19:14:46 CEST 2002 Daniel Veillard + + * libxslt/namespaces.c libxslt/transform.c: fix bug #81099 about + duplicated namespace declarations, this might not be as generic as + it should but works well for DocBook stylesheets + +Sat May 25 12:07:45 CEST 2002 Daniel Veillard + + * libxslt.pc.in: fix bug #82970 + +Fri May 24 15:02:50 CEST 2002 Daniel Veillard + + * python/libxslt-python-api.xml python/libxslt.c + python/libxsltclass.txt : tried to fix #79105 by providing a + specific error registering routine. + +Thu May 23 17:28:35 CEST 2002 Daniel Veillard + + * libxslt/xsltutils.[ch] : applied patch from Morus Walter + adding xsltSaveResultToString() + * doc/APIfiles.html doc/APIfunctions.html doc/libxslt-api.xml + doc/libxslt-decl.txt doc/libxslt-refs.xml: this increased the + API with the new function. + +Wed May 22 11:50:36 CEST 2002 Daniel Veillard + + * libxslt/function.c: applied a patch from Richard Jinks + to avoid a crash in element-available() + +Tue May 21 19:38:20 CEST 2002 Daniel Veillard + + * libxslt.spec.in: applied patch from Geert Kloosterman to + not miss gif and .png files in the RPM documentation + +Tue May 21 08:43:11 CEST 2002 Daniel Veillard + + * libexslt/libexslt.4: Applied patch for the EXSLT man page + from Charles Bozeman + +Sat May 18 10:01:38 CEST 2002 Daniel Veillard + + * libexslt/libexslt.4 libxslt/libxslt.4 libxslt/keys.c + libxslt/xsltconfig.h.in: applied a man page patch from + Christian Cornelssen and fixed a couple of issues he raised. + +Thu May 16 19:38:24 CEST 2002 Daniel Veillard + + * xsltproc/xsltproc.c: moved the extension dump out of the loop + +Thu May 16 19:31:35 CEST 2002 Daniel Veillard + + * libxslt/extensions.[ch] xsltproc/xsltproc.c win32/libxslt.def.src: + Applied Mark Vakoc patch to show registered extensions in xsltproc + * doc/*: rebuilt the API, docs and website + * python/libxsltclass.txt: this added an entry point + +Wed May 15 00:20:10 CEST 2002 Igor Zlatkovic + + * libxslt/xslt.c: xsl:include crash fix + * libxslt/imports.c: xsl:include crash fix + * libxslt/imports.h: xsl:include crash fix + +Wed May 9 01:39:14 CEST 2002 Igor Zlatkovic + + * libexslt/exslt.h: fixed a typo _cplusplus -> __cplusplus + +Thu May 2 11:08:22 CEST 2002 Daniel Veillard + + * xsltproc/xsltproc.c libxslt/xsltutils.c doc/xsltproc.xml: + fixed some return code problems raised by Thomas Mauch + +Tue Apr 30 18:06:14 CEST 2002 Daniel Veillard + + * libxslt/transform.c: don't allow adding an attribute to + a document node + +Mon Apr 29 19:00:22 CEST 2002 Daniel Veillard + + * configure.in libxslt/xsltwin32config.h: preparing 1.0.17 + * doc/*: rebuilt the docs. + +Mon Apr 29 17:22:08 CEST 2002 Daniel Veillard + + * libxslt/variables.c: better attempt to fix the problem in + xsltProcessUserParamInternal reported by Babak Vahedipour-Kunze + +Sun Apr 28 17:53:23 CEST 2002 Igor Zlatkovic + + * win32/dsp/*.dsp: Removed obsolete macros + * win32/dsp/*.def: Updated export definitions + +Sun Apr 28 17:47:17 CEST 2002 Daniel Veillard + + * libxslt/variables.c: tried to fix a problem in + xsltProcessUserParamInternal reported by Babak Vahedipour-Kunze + +Fri Apr 26 08:15:30 CEST 2002 Daniel Veillard + + * libexslt/date.c: applied another patch from Charles Bozeman to + enhance date/duration support + * tests/exslt/date: added the associated set of regression tests + +Thu Apr 25 08:18:57 CEST 2002 Daniel Veillard + + * libexslt/date.c: applied a patch from Charles Bozeman to add + duration routines to the date exslt extensions. + +Thu Apr 18 22:56:06 CEST 2002 Daniel Veillard + + * libexslt/exslt.h: extern "C" { missing by Mark Vakoc + +Tue Apr 17 23:16:54 CEST 2002 Igor Zlatkovic + + * libexslt/date.c: fixed type inconsistencies, double->int + and unsigned/signed mismatch warnings eliminated + +Tue Apr 16 19:40:21 CEST 2002 Igor Zlatkovic + + * win32/Makefile.msvc: XSLT debugger support fix + * win32/configure.js: XSLT debugger support fix + * libxslt/xsltconfig.h.in: XSLT debugger support fix + +Mon Apr 15 19:27:31 CEST 2002 Daniel Veillard + + * configure.in: preparing 1.0.16 + * doc/*: updated and rebuilt the docs + +Mon Apr 15 17:27:51 CEST 2002 Daniel Veillard + + * libxslt/attributes.c: removed a warning + * libxslt/transform.c libxslt/transform.h win32/libxslt.def.src: + added xsltRunStylesheetUser() API needed to fix #78546 + * xsltproc/xsltproc.c: second part of the fix #78546 + +Mon Apr 15 15:57:28 CEST 2002 Daniel Veillard + + * python/Makefile.am: fixing the equivalent of #75779 + +Mon Apr 15 14:00:12 CEST 2002 Daniel Veillard + + * libxslt/keys.c: fixed bug #78735 + * configure.in tests/Makefile.am tests/keys/*: + added the tests in a separate directory + +Mon Apr 15 00:01:07 CEST 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-83.xml + tests/general/Makefile.am tests/general/bug-83.*: added a + specific example for bug #78662 in the regression tests + * tests/docbook/: this also changed a couple of DocBook results + +Sun Apr 14 15:32:23 CEST 2002 Daniel Veillard + + * configure.in: trying to kill #77827 IEEE conformance on alphas + * libxslt/imports.c libxslt/transform.c libxslt/xslt.c: fixing + bug #78211 + * tests/docs/Makefile.am tests/docs/bug-82.xml + tests/general/Makefile.am tests/general/bug-82.*: added a + specific example for bug #78211 in the regression tests + +Wed Apr 10 20:35:54 CEST 2002 Daniel Veillard + + * libxslt/pattern.c: applied patch from Mark Vakoc + +Fri Mar 29 18:28:23 CET 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-81.xml + tests/general/Makefile.am tests/general/bug-81.*: added a + specific example for bug #76927 in the regression tests + +Wed Mar 27 10:03:11 CET 2002 Daniel Veillard + + * AUTHORS HACKING: Added Igor Zlatkovic as official maintainer + * python/Makefile.am python/tests/Makefile.am: Albert Chin pointed + that $(datadir) should be used for docs + +Mon Mar 25 17:56:44 CET 2002 Daniel Veillard + + * configure.in: preparing 1.0.15 + * doc/*: updated and rebuilt + +Mon Mar 25 17:11:42 CET 2002 Daniel Veillard + + * libxslt/attributes.c libxslt/attributes.h libxslt/pattern.c + libxslt/xslt.c: Fix bug #76043 about cascading attribute sets + * tests/docs/Makefile.am tests/docs/bug-80.xml + tests/general/Makefile.am tests/general/bug-80.*: added a + specific example for bug #76043 in the regression tests + +Fri Mar 22 19:26:47 CET 2002 Daniel Veillard + + * libxslt/pattern.c: Fixing bug #75902 error with @foo[..] + steps which were not compiled + * tests/docs/Makefile.am tests/docs/bug-79.xml + tests/general/Makefile.am tests/general/bug-79.*: added a + specific example for bug #75902 in the regression tests + +Fri Mar 22 16:13:22 CET 2002 Daniel Veillard + + * libxslt/pattern.c: Fixing bug #75777 error with namespaced + attribute match rules evaluation + * tests/docs/Makefile.am tests/docs/bug-78.xml + tests/general/Makefile.am tests/general/bug-78.*: added a + specific example for bug #75777 in the regression tests + +Thu Mar 21 17:19:56 CET 2002 Daniel Veillard + + * libxslt/transform.c: found another stupid bug by step by + step processing of the code + * libxslt/pattern.c: idem, except that once stupid mistake + ELEM vs NODE forced the templates to be stored in a list + instead of a hash table, fixing this stupidity should + again lead to a substantive improvement of processing speed. + Like divide by 2 processing time for DocBook stylesheets. + +Thu Mar 21 00:25:12 CET 2002 Daniel Veillard + + * libxslt/transform.c: fixing bug #75603 + * tests/docs/Makefile.am tests/docs/bug-77.xml + tests/general/Makefile.am tests/general/bug-77.*: added a + specific example for bug #75603 in the regression tests + +Wed Mar 20 17:49:43 CET 2002 Daniel Veillard + + * python/Makefile.am: Art Haas pointed a stupid error + +Tue Mar 19 19:42:01 CET 2002 Daniel Veillard + + * Makefile.am tests/Makefile.am tests/*/Makefile.am + tests/*/*/Makefile.am : added "make valgrind" targets + to run the test suite under the debugger control + * transform.c: valgrind spotted 2 bugs, one related to + the ordering of the deallocation of the data associated to + a transofrmation, the second in xsltCopyTree when the new + node may have been coalesced with an adjacent text node. + The regression tests now pass cleanly under testgrind. + +Mon Mar 18 21:33:38 CET 2002 Daniel Veillard + + * python/Makefile.am: fixed a stupid bug + +Mon Mar 18 20:45:27 CET 2002 Daniel Veillard + + * configure.in: preparing 1.0.14 + * doc/*: updated rebuilt + * libxslt/*.c libexslt/*.c libxslt/libxslt.h libexslt/libexslt.h: + implemented the IN_LIBXSLT and IN_LIBEXSLT mechanism discussed + with the Windows maintainers + +Mon Mar 18 16:22:46 CET 2002 Daniel Veillard + + * python/Makefile.am python/generator.py python/libxslt.c + python/types.c python/tests/Makefile.am: applied the same kind of + fixes to the Python Makefiels than to libxml2 ones. Updates + and cleanups too. + +Sat Mar 16 23:48:21 CET 2002 Daniel Veillard + + * libexslt/common.c libxslt/pattern.c libxslt/transform.c + libxslt/variables.c: chaing result tree values which may + be deallocated and must not be kept in the template + pattern lookup cache. Thanks to Valgrin to allow finding + the real problem in bug #74857 + +Wed Mar 13 15:17:51 CET 2002 Daniel Veillard + + * libxslt/*.h doc/* python/*: applied another cleanup comment + diff from Heiko W. Rupp, regenerated the API and python + +Wed Mar 13 13:41:19 CET 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-76.xml + tests/general/Makefile.am tests/general/bug-76.*: added a + home brewed test for path computation elmininating duplicate + in result sets. + +Sat Mar 9 11:53:39 CET 2002 Daniel Veillard + + * doc/Makefile.am: fixed a build problem in some environements + +2002-03-08 jacob berkman + + * python/Makefile.am (libxsltmodule_la_SOURCES): remove $(srcdir) + as make will automatically look there for these files + +Fri Mar 8 17:44:31 CET 2002 Daniel Veillard + + * configure.in libxslt/xsltwin32config.h: preparing release + 1.0.13 + * doc/*: updated and rebuilt the docs + * python/libxslt.c: fixed a possible reentrancy problem + +Fri Mar 8 14:51:59 CET 2002 Daniel Veillard + + * libxslt/pattern.c: Fixes the problems exposed by #73880 + those ought to be computed at stylesheet compile time, not + at run-time, and the computation was wrong. + * libxslt/transform.c: get rid of fake nodes coming from node-set + transformations. At least if they are still produced they will + become easy to spot as resulting document won't be well-formed. + +Thu Mar 7 17:01:21 CET 2002 Daniel Veillard + + * libxslt/extensions.c: fixed bug #73791 related to extension + function declared in included stylesheets + * tests/exslt/functions/function.7.*: added specific test + +Thu Mar 7 15:20:32 CET 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-75.xml + tests/general/Makefile.am tests/general/bug-75.*: added a + specific example for bug #72150 in the regression tests + +Thu Mar 7 15:17:21 CET 2002 Daniel Veillard + + * configure.in xsltproc/xsltproc.c: fixed bug #71488 in a + similar way as #71457 + +Thu Mar 7 09:41:59 CET 2002 Daniel Veillard + + * tests/xmlspec/REC-xml-20001006*.html tests/XSLTMark/xslbench1.out: + some HTML meta encoding fixups resulting from fix in libxml2 + +Mon Mar 4 18:09:48 CET 2002 Daniel Veillard + + * libxslt/namespaces.c tests/general/bug-63.out: small fixups + related to the XPath changes in fixing #61290 + +Mon Mar 4 12:57:21 CET 2002 Daniel Veillard + + * libxslt/pattern.c: fixed bug #73363, bad tokenization of + pattern + +Mon Mar 4 12:01:34 CET 2002 Daniel Veillard + + * libexslt/date.c: patch from Charles Bozeman for the exslt date + extension + * configure.in tests/exslt/Makefile.am tests/exslt/date/*: added + the associated regression test provided by Charles + +Fri Mar 1 10:17:26 CET 2002 Daniel Veillard + + * libxslt/preproc.c: Fixed #73088 with the associated patch + +Fri Mar 1 10:14:07 CET 2002 Daniel Veillard + + * xsltproc/xsltproc.c: similar to #72663 and #72658, don't memdump + unless compiled explicitely with memory debugging switched on + * TODO: refreshed a bit + +Fri Feb 22 23:44:57 CET 2002 Daniel Veillard + + * python/generator.py python/libxslt.c: changes for the 'usual' + setup.py to allow building a libxml2-python + module based on the same code. The initialization is however + different the 2 .so files fo libxml2 and libxslt are identical and + they entry point initialize both libraries. this is done to avoid + some possible nasty problem since the Python don't merge the maps + of all shared modules. + * python/libxsl.py: attempt to cope with the shared library loading + problem when both modules are not merged. + +Thu Feb 21 12:59:59 CET 2002 Daniel Veillard + + * doc/site.xml doc/xslt.html doc/python.html doc/*.html: added + documentation for the wrappers and python modules. + +Wed Feb 13 14:22:22 CET 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-74.xml + tests/general/Makefile.am tests/general/bug-74.*: added a + specific example for bug #71342 in the regression tests + * tests/docbook/result/xhtml/gdp-handbook.xhtml: fixing + #71342 changed one attribute serialization. + +Tue Feb 12 15:08:38 CET 2002 Daniel Veillard + + * python/Makefile.am: trying to fix #71270 + +Mon Feb 11 19:40:34 CET 2002 Daniel Veillard + + * python/*.py: removed tab used spaces + * configure.in libxslt/xsltwin32config.h: preparing 1.0.12 + * doc/news.html doc/xslt.html: rebuild/updated + +Mon Feb 11 16:34:37 CET 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-73.xml + tests/general/Makefile.am tests/general/bug-73.*: added a + specific example for bug #71181 in the regression tests + +Mon Feb 11 16:22:36 CET 2002 Daniel Veillard + + * libxslt/pattern.c: fixed bug #71181 p/text() would not + work. A bit of cleanup. + +Mon Feb 11 15:01:42 CET 2002 Daniel Veillard + + * xslt-config: fixing Red Hat bug #59508 + +Mon Feb 11 14:27:25 CET 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-72.xml + tests/general/Makefile.am tests/general/bug-72.*: added a + specific example for bug #58444 in the regression tests + +Mon Feb 11 14:13:07 CET 2002 Daniel Veillard + + * libxslt/transform.c: fixed bug #58444, was quite simpler + than expected. + +Mon Feb 11 13:27:42 CET 2002 Daniel Veillard + + * libxslt/xsltInternals.h libxslt/pattern.c: expected to have + closed bug #70131, still wondering about the position() when + the node is selected. + +Mon Feb 11 10:45:27 CET 2002 Daniel Veillard + + * tests/docs/Makefile.am tests/docs/bug-71.xml + tests/general/Makefile.am tests/general/bug-71.*: added a + specific example for Norm's bug in the regression tests + +Sun Feb 10 22:08:51 CET 2002 Daniel Veillard + + * libxslt/attributes.c: fixed a bug reported by Norm + +Sun Feb 10 20:25:28 CET 2002 Daniel Veillard + + * python/libxml.c : fixed a small warning. + * doc/libxslt-api.xml doc/libxslt-decl.txt doc/libxslt-refs.xml + python/libxsltclass.txt: rebuilt the APIs + +Sun Feb 10 20:16:15 CET 2002 Daniel Veillard + + * libxslt/imports.c libxslt/numbers.c libxslt/pattern.c + libxslt/pattern.h libxslt/transform.c libxslt/xslt.c + libxslt/xsltInternals.h: adding extra run-time informations + to make the stylesheet really read-only at run-time. + +Sun Feb 10 16:21:09 CET 2002 Daniel Veillard + + * libxslt/transform.c: fixing bug #70281 + +Sun Feb 10 15:10:56 CET 2002 Daniel Veillard + + * libxslt/numbers.c: trying to fix #68759 + +Sat Feb 9 23:17:53 CET 2002 Daniel Veillard + + * python/Makefile.am: seems some version of automake didn't + generate the dependancies right as Jacob found out. Add + an extra dependancy rule. + +Sat Feb 9 19:04:01 CET 2002 Daniel Veillard + + * configure.in libxslt.spec.in python/Makefile.am python/generator.py + python/libxsl.py python/libxslt.c python/tests/Makefile.am: + Fixed the python Makefiles, corrected a bug showing up on ia64, + changed the name of the python internal module too + +Fri Feb 8 17:01:10 CET 2002 Daniel Veillard + + * Copyright Makefile.am configure.in libxslt.spec.in: change the + Licence to MIT Licence and release of 1.0.11 + * doc/FAQ.html doc/intro.html doc/libxslt-decl.txt doc/news.html + doc/xslt.html: updates of the docs accordingly + * libxslt/xsltwin32config.h: numbering + * python/generator.py python/libxml_wrap.h python/libxsltclass.txt + python/libxslt-python-api.xml: cleanup the dependancies with + libxml2 + * python/tests/extfunc.py: updated examples. + +Thu Feb 7 23:21:18 CET 2002 Daniel Veillard + + * doc/libxslt-api.xml doc/libxslt-decl.txt doc/libxslt-refs.xml + doc/parsedecl.py: fixup the script and rebuid the API + * libxslt/extensions.h: cleanup + * python/generator.py python/libxslt-python-api.xml python/libxslt.c + python/libxsltclass.txt: provided accessors for a lot of the + tructures involved in the transformation. Stylesheet and + transformation python object don't free automatically the + encapsulated object when deallocated. + * python/tests/Makefile.am python/tests/basic.py + python/tests/extfunc.py python/tests/pyxsltproc.py: + updated the examples + +Thu Feb 7 17:59:27 CET 2002 Daniel Veillard + + * xsltproc/xsltproc.c: small fix + * Makefile.am: cleanup + * python/tests/Makefile.am: avoid a problem with $(TESTS) + * python/generator.py python/libxml_wrap.h python/libxsl.py + python/libxslt.c python/libxsltclass.txt: augmented the + wrappers + * python/tests/pyxsltproc.py: rewrote xsltproc on top of the + libxslt-python API to get an estimate of what is missing + +Wed Feb 6 23:34:10 CET 2002 Daniel Veillard + + * python/libxsl.py python/libxslt-python-api.xml python/libxslt.c + python/libxsltclass.txt: added libxslt_xsltCleanup() added parameters + to libxslt_xsltApplyStylesheet() removed the memleaks left and + fixed an import order. + * python/tests/basic.py python/tests/extfunc.py: updated the tests + +Wed Feb 6 19:46:09 CET 2002 Daniel Veillard + + * python/libxlst.c python/libxslt-python-api.xml + python/libxsltclass.txt: plugged the extension of the engine + with python defined functions + * python/tests/Makefile.am python/tests/extfunc.py: added a + basic test, still a memleak, cleanup function needed. + +Wed Feb 6 13:49:55 CET 2002 Daniel Veillard + + * libxslt.spec.in python/Makefile.am python/libxsl.py: the + spec file will now build libxslt-python, fought with shared + and other crazyness, seems to work now :-) + * doc/libxslt-api.xml: regenerated + +Wed Feb 6 11:29:31 CET 2002 Daniel Veillard + + * Makefile.am configure.in tests/Makefile.am tests/*/Makefile.am + tests/*/*/Makefile.am: refactored make tests, make all now don't + run the test suite + * python/Makefile.am: added tests + * python/tests/basic.py python/tests/Makefile.am: added the first + basic test, memory debug included + +Wed Feb 6 00:20:57 CET 2002 Daniel Veillard + + * configure.in python/Makefile.am: attempst to tweak to get + full memory debug... + * python/generator.py python/libxsl.py python/libxslt-python-api.xml + python/libxslt.c python/libxslt_wrap.h python/libxsltclass.txt: + the basic API starts to work + * python/tests/test.*: first basic test + * libxslt/xsltutils.c: fixed a comment + +Tue Feb 5 17:35:00 CET 2002 Daniel Veillard + + * configure.in doc/Makefile.am: do not install outside of prefix, + make sure the API get shipped. + +Mon Feb 4 19:47:32 CET 2002 Daniel Veillard + + * libxslt/pattern.[ch] doc/libxslt-api.xml doc/libxslt-refs.xml: + reactivated xsltMatchPattern() since this is really something + one may want to have access to in an extension function. + * Makefile.am configure.in python/Makefile.am python/generator.py + python/libxml_wrap.h python/libxsl.py python/libxslt-python-api.xml + python/libxslt.c python/libxslt_wrap.h python/libxsltclass.txt + python/types.c: started working on the python bindings, borrowed + most of the work done for libxml2, most of the generator code + is similar. Commit at the point where this compiles cleanly and + "import libxslt" doesn't yield any missing entry point. + +Wed Jan 30 12:46:41 CET 2002 Daniel Veillard + + * libxslt/pattern.c: patch from Charles Bozeman to support + child::* patterns. + +Wed Jan 30 12:35:28 CET 2002 Daniel Veillard + + * libxslt/keys.c: Bob Stayton pointed out a problem when + using unions in key match patterns. + * tests/docs/Makefile.am tests/docs/bug-70.xml + tests/general/Makefile.am tests/general/bug-70.*: added a + specific example in the regression tests + +Sun Jan 27 13:54:10 CET 2002 Daniel Veillard + + * libxslt/transform.c: avoid a problem with Sun's Workshop CC, + closes bug #69809 submitted by Michael Kroell + +Fri Jan 25 15:31:23 CET 2002 Daniel Veillard + + * xsltproc/xsltproc.c: added links to the Web site from usage() + +Wed Jan 23 23:13:37 CET 2002 Daniel Veillard + + * doc/API*.html doc/parsedecl.py doc/*.xsl parsedecl.py: generated + an index based on comments content similar to libxml2 one + The code need more specific comments. + * doc/*: rebuilt the web site with the new references + +Mon Jan 21 09:53:45 CET 2002 Daniel Veillard + + * libxslt/functions.h: roll back the change after more analysis + proper fix is to restore the definition of xmlXPathFuncLookupFunc + int libxml2 + +Mon Jan 21 09:41:10 CET 2002 Daniel Veillard + + * libxslt/functions.h: fixed a proble after some cleanup of libxml2 + includes. + +Sun Jan 20 14:33:33 CET 2002 Daniel Veillard + + * xsltproc/xsltproc.c: Fixed RH bug #58124 due to an off-by-one + error when parsing -o arguments. + +Sun Jan 20 14:15:55 CET 2002 Daniel Veillard + + * doc/xsltproc.xml libxslt/xsltutils.c xsltproc/xsltproc.c: + Fixed RH bug #57496, xsltproc was not returning error + code on internal runtime errors. Should return 9 now. + +Fri Jan 18 09:43:16 CET 2002 Daniel Veillard + + * libexslt/math.c: Charlie Bozeman provided the implementation + for the EXSLT math other functions + +Thu Jan 17 23:41:53 CET 2002 Daniel Veillard + + * libexslt/Makefile.am: jacob berkman pointed out that the + Cygwin patch forgot to add libexslt.h to the tarball + +Thu Jan 17 23:39:00 CET 2002 Daniel Veillard + + * libxslt/pattern.c: fixed I18N problemes in the template parser + pointed out by Xavier Cazin + * tests/docs/Makefile.am tests/docs/bug-69.xml + tests/general/Makefile.am tests/general/bug-69.*: added a + specific example in the regression tests + +Thu Jan 17 10:40:03 CET 2002 Daniel Veillard + + * Makefile.am libexslt/common.c libexslt/date.c libexslt/exslt.c + libexslt/exslt.h libexslt/exsltconfig.h.in libexslt/functions.c + libexslt/libexslt.h libexslt/math.c libexslt/saxon.c + libexslt/sets.c libexslt/strings.c libxslt/libxslt.h + libxslt/xslt.h libxslt/xsltconfig.h.in libxslt/xsltutils.c + xsltproc/xsltproc.c: applied Robert Collins patch for + Cygwin support + +Thu Jan 17 10:34:39 CET 2002 Daniel Veillard + + * xsltproc/Makefile.am configure.in: ugly way to keep + the memory debugging active on my devel workstation + by bypassing libtool completely + +Tue Jan 15 12:00:18 CET 2002 Daniel Veillard + + * libxslt/templates.c: fixed bug #68751 + * tests/docs/Makefile.am tests/docs/bug-68.xml + tests/general/Makefile.am tests/general/bug-68.*: added a + specific example in the regression tests + +Tue Jan 15 10:40:41 CET 2002 Daniel Veillard + + * libxslt/transform.c xsltproc/xsltproc.c: fixed a couple of + small problems raised by Justin Fletcher + +Mon Jan 14 18:35:18 CET 2002 Daniel Veillard + + * configure.in: releasing 1.0.10 + * doc/*: updating the docs for the release. + * libxslt/namespaces.c libxslt/pattern.c libxslt/transform.c: + seems I inadvertantly commited previously stuff from a failed + attempt at fixing namespace nodes parents. + +Mon Jan 14 12:20:33 CET 2002 Daniel Veillard + + * libxslt/numbers.c: the xsl:number implementation incorrectly + cached the format string in some case. Fixes bug #65391 + +Mon Jan 14 10:35:27 CET 2002 Daniel Veillard + + * configure.in: fixed a couple of cut and paste errors in the + math functions detection + * libxslt.spec.in: added missing file entry for libxslt.pc + +Tue Jan 8 21:04:17 MST 2002 John Fleck + + * doc/xsltproc.xml, doc/xsltproc.1, doc/xsltproc.html + update xsltproc man page to add --stringparam option + +Tue Jan 8 17:21:02 CET 2002 Daniel Veillard + + * xsltproc/xsltproc.c: added the --stringparam option + * xsltproc/xsltproc.c: applied John Fleck's patch to correct + the --novalid behaviour. + +Tue Jan 8 13:51:08 CET 2002 Daniel Veillard + + * doc/site.xsl doc/*.html: added a DocBook section docbook.html + +Tue Jan 8 12:51:15 CET 2002 Daniel Veillard + + * doc/*.html: updated gdome2 homepage + +Sat Jan 5 19:32:17 CET 2002 Daniel Veillard + + * win32/dsp: Windows/MSVC project files update from Igor Zlatkovic + +Fri Jan 4 22:13:40 MST 2002 John Fleck + + * doc/xsltproc.xml, xsltproc.1 - updating man page to reflect + increased number of parameteres, changed license, cleaned up some + places where it looked junky because of stylesheet issues + +Fri Jan 4 15:50:25 CET 2002 Daniel Veillard + + * xsltproc/xsltproc.c: increased the max number of parameters + +Thu Dec 20 14:54:27 CET 2001 Daniel Veillard + + * libxslt.pc.in configure.in: added pkg-config file from Rodrigo Moya + +Thu Dec 20 14:49:39 CET 2001 Daniel Veillard + + * configure.in: applied albert portability patch + * libxslt/libxslt.h libxslt/xslt.h libxslt/xsltconfig.h.in + libxslt/xsltutils.c libxslt/xsltwin32config.h.in win32/dsp/libxslt.def: + applied Igor patch for Windows + +Tue Dec 11 15:27:15 CET 2001 Daniel Veillard + + * libxslt/xsltutils.c: fixed a problem with the debuuger interface. + +Fri Dec 7 15:48:48 CET 2001 Daniel Veillard + + * configure.in: preparing 1.0.9 + * doc/*: updated and rebuild the doc + +Thu Dec 6 14:57:56 CET 2001 Daniel Veillard + + * configure.in libexslt/Makefile.am: trying to fix the problem + related to prelinking and libtools crazyness + +Wed Dec 5 18:49:53 CET 2001 Daniel Veillard + + * libxslt/transform.c libxslt/variables.c: applied Keith Isdale + patch for the debugger glue. + +Wed Dec 5 18:43:45 CET 2001 Daniel Veillard + + * breakpoint/Makefile.am breakpoint/deprecated.c: replaced + the whole module with just the entry points. + +Fri Nov 30 18:59:50 CET 2001 Daniel Veillard + + * libxslt/transform.c: Nik Clayton found a bug introduced in + 1.0.8 when using doctypes for HTML output + +Fri Nov 30 12:59:05 CET 2001 Daniel Veillard + + * libxslt/attributes.c libxslt/transform.c libxslt/xsltutils.c + libxslt/xsltutils.h: revamped the mechanism to hook a debuger + to use a callback setup function, deprecating libxsltbreakpoint + * xsltproc/Makefile.am configure.in breakpoint/Makefile.am: removing + dependancies on libxsltbreakpoint + +Thu Nov 29 09:52:38 CET 2001 Daniel Veillard + + Build patch from Peter Williams + * breakpoint/Makefile.am (INCLUDES): meed $(top_builddir)/libxslt. + * doc/Makefile.am ($(PAGES)): xslt.html and site.xsl live in + $(srcdir), not the build directory. + +Wed Nov 28 11:17:04 CET 2001 Daniel Veillard + + * doc/FAQ.html doc/site.xsl doc/*.html doc/Makefile.am: added an FAQ + +Tue Nov 27 21:15:43 MST 2001 John Fleck + + * doc/xsltproc.xml, xsltproc.1, xsltproc.html - documenting new + xsltproc return codes, per + https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=56649 + +Tue Nov 27 22:16:50 CET 2001 Daniel Veillard + + * libxslt/pattern.c: Marc Tardif provided a patch to use as + much as 40 steps. A dynamic alloc would still be better + +Mon Nov 26 21:45:07 CET 2001 Daniel Veillard + + * xsltproc/xsltproc.c: return useful code signaling error conditions + closing #56649 (RH) + +Mon Nov 26 13:14:14 CET 2001 Daniel Veillard + + * configure.in libxslt/xsltwin32config.h: preparing release of 1.0.8 + +Mon Nov 26 11:21:27 CET 2001 Daniel Veillard + + * libxslt/pattern.c: fixing bug #64044 reported by Gero Meißner, + template matches compilation was failing to skip blanks bewteen + consecutive predicates + +Mon Nov 26 10:27:30 CET 2001 Daniel Veillard + + * Makefile.am configure.in breakpoint/Makefile.am libexslt/Makefile.am: + updating Makefiles to fix the prelinking. + +Sun Nov 25 15:52:38 CET 2001 Daniel Veillard + +* libxslt/transform.c: fixed a bug in the document extension + element where the doctype infos were not taken into account. + +Thu Nov 22 19:08:23 CET 2001 Daniel Veillard + + * libxslt/extra.c: fixed xsltDebug() to output with the normal + error routines + * tests/namespaces/*: updated the tests to separate stdout and + stderr + * libxslt/transform.c: increasing xsltMaxDepth to 5000 + +Thu Nov 22 12:09:56 CET 2001 Daniel Veillard + + * configure.in libexslt/Makefile.am: more Makefile fixups + +Wed Nov 21 16:29:04 CET 2001 Daniel Veillard + + * configure.in libexslt/Makefile.am: trying to fix more Makefiles + crapola + * libxslt/transform.c: small fix. + +Tue Nov 13 16:16:41 CET 2001 Daniel Veillard + + * vms/* Makefile.am: included OpenVMS port instructions from + John A Fotheringham, integrated in the tar file. + +Mon Nov 12 22:46:26 CET 2001 Daniel Veillard + + * win32/dsp/* xsltproc/xsltproc.c libxslt/transform.c: Patches + from Igor for Windows + * libxslt/xslt.h: try to fix the LIBXSLT_PUBLIC mess + +Sun Nov 11 21:15:05 CET 2001 Daniel Veillard + + * libxslt/transform.c: fixing bug #64298 reported by T. V. Raman + +Sat Nov 10 14:01:44 CET 2001 Daniel Veillard + + * configure.in: preparing 1.0.7 + * libxslt.spec.in: cleanup similar to libxml2 one + * breakpoint/*.[hc]: finished cleaning up contributed code + * doc/*: updated and rebuilt the documentation + * xsltproc/xsltproc.c: cleanup of the timing code + * xsltproc/Makefile.am: auto* sucks + * libxslt/transform.c: added a missing include + +Mon Nov 5 14:29:26 CET 2001 Daniel Veillard + + * Makefile.am acconfig.h config.h.in configure.in + xsltproc/Makefile.am breakpoint/* libxslt/transform.[ch] + libxslt/xsltconfig.h.in: Applied Keith Isdale patch for + the debugger support, make it the default, added the + WITH_XSLT_DEBUGGER define to xsltconfig.h.in, small cleanups + +Fri Nov 2 11:19:49 CET 2001 Daniel Veillard + + * libxslt/libxslt.h: make sure LIBXSLT_PUBLIC is defined + +Thu Nov 1 15:15:39 CET 2001 Daniel Veillard + + * libxslt/xsltutils.c: handle indent=no when using an HTML + output + * tests/docbook/result/* tests/xmlspec/REC-xml-*.html: this + modified the output of those test suites + +Wed Oct 31 18:53:26 CET 2001 Daniel Veillard + + * xsltproc/xsltproc.c: cleanup, moved xsllNoNetExternalEntityLoader() + to libxml and removed the --warnnet option + +Tue Oct 30 19:32:08 CET 2001 Daniel Veillard + + * configure.in: applied patches from David Härdeman closing + bug #62891 + +Tue Oct 30 15:25:19 CET 2001 Daniel Veillard + + * configure.in libxslt/xsltwin32config.h: preparing 1.0.6 + * libexslt/date.c: applied patch from Bruce Miller + * doc/*: updated and rebuilt the docs + +Fri Oct 26 14:12:14 CEST 2001 Daniel Veillard + + * win32/dsp/libexslt_a.dsp win32/dsp/libexslt_so.dsp + win32/dsp/libxslt.def: updated with latest ZIP from Igor, + made sure the .def is handled as binary + +Fri Oct 26 11:37:01 CEST 2001 Daniel Veillard + + * win32/dsp/libxslt.def libxslt/xslt.h: applied Igor patches + for Win32 + * doc/*.html doc/site.xsl: changed the site stylesheet a bit + +Thu Oct 25 23:05:14 CEST 2001 Thomas Broyer + + * libxslt/numbers.c: take NaN and infinity attributes of + xsl:decimal-format into account. Closes #62577 + +Wed Oct 24 13:02:15 CEST 2001 Daniel Veillard + + * doc/*.html doc/site.xsl doc/Makefile.am: the web site + is now extracted from the xslt.html flat file using + the site stylesheet ... eat your own dogfood ! + * libxslt/transform.c libxslt/xsltutils.c: fixed the + HTML output to not generate a DOCTYPE if it should not + i.e. no identifier nor version specified in the xsl:output + * tests/multiple/out/*.orig tests/general/bug-11-.out + tests/general/bug-33-.out tests/general/bug-52.out + tests/docbook/result/xtchunk/html/*.orig + tests/docbook/result/html/gdp-handbook.html + tests/XSLTMark/*.out: fixing xsl:output with method=html + resulted in a number of small changes in the regression tests + output + +Fri Oct 19 16:46:06 CEST 2001 Daniel Veillard + + * libexslt/*.c libexslt/exsltconfig.h.in: moved the + config.h include out of exsltconfig.h since this header is + exported and config.h is not. + +Wed Oct 17 21:20:55 CEST 2001 Daniel Veillard + + * libxslt/attributes.c libxslt/extensions.c libxslt/preproc.c + libxslt/transform.c libxslt/xsltutils.h: cleanup TODO into + XSLT_TODO + +Wed Oct 17 02:46:55 CEST 2001 Thomas Broyer + + * libxslt/numbers.c: reworked internal representation of + tokenized number format and parsing/tokenization. This fixes + many bugs regarding separator and default tokens. + * tests/REC/test-7.7-3.out: the fix changes the output of this + test. It now complies to the XSLT spec (wow! ;o) + +Tue Oct 16 11:25:15 CEST 2001 Daniel Veillard + + * xsltproc/Makefile.am configure.in config.h.in: trying to + bypass libtool crazyness when compiling in my debug environment + * libxslt/templates.c: fix a compilation problem due to recent + libxml changes + +Sun Oct 14 17:17:03 CEST 2001 Thomas Broyer + + * libxslt/numbers.c tests/REC/test-7.7-4.out: implement initial + non-alphanumeric token handling in number formatting. + +Wed Oct 10 11:58:41 CEST 2001 Daniel Veillard + + * configure.in: releasing 1.0.5 + * doc/xslt.html doc/html/*: updated and rebuilt the docs + +Wed Oct 10 00:10:01 CEST 2001 Thomas Broyer + + * tests/REC/test-7.7-4.out: fixed a typo + +Tue Oct 9 22:59:00 CEST 2001 Thomas Broyer + + * libexslt/saxon.c: fixed a typo and improved handling of + non-XPath-expression arguments. + * libexslt/strings.c: fixed a bug in tokenize: function was using + tctxt->output instead of tctxt->document->doc. + * libxslt/transform.c: fixed a bug in xsltDefaultProcessOneNode + which was using variable "node" instead of "cur" + +Tue Oct 9 19:51:48 CEST 2001 Thomas Broyer + + * libxslt/extra.[ch]: removed older SAXON extensions + implementations from Darren Graves. + * libexslt/date.c: applied patch from Charlie Bozeman to fix + a bug with time zone offset on Linux. + +Tue Oct 9 13:02:46 CEST 2001 Daniel Veillard + + * libxslt/documents.c libxslt/extra.c libxslt/transform.[ch]: + strip-space should also be applied to document imported + at run-time. + +Tue Oct 9 12:36:53 CEST 2001 Daniel Veillard + + * libxslt/imports.[ch] libxslt/transform.c libxslt/xslt.c: + rewrote the way strip-space gets applied. Closes bugs #61962 + * tests/docs/Makefile.am tests/docs/bug-66.xml + tests/general/Makefile.am tests/general/bug-66.*: added a + specific example in the regression tests + +Mon Oct 8 11:27:52 CEST 2001 Daniel Veillard + + * libxslt/xslt.c: Fixing bug #61913 + * libxslt/transform.c: removing a small memleak when running with + the profiler. + +Sun Oct 7 18:53:34 CEST 2001 Thomas Broyer + + * libexslt/saxon.c libexslt/Makefile.am libexslt/exslt.[ch]: + added implementation of SAXON expression(), eval() and + evaluate() functions. + See http://saxon.sourceforge.net/saxon6.4.4/extensions.html + * tests/extension/evaluate.xsl tests/extension/list.{xsl,out}: + modified to use SAXON namespace (functions are not registered + in the LibXSLT namespace) + * tests/exslt/common/object-type.1.out: modified to take account + of the new saxon:expression function + +Sun Oct 7 13:15:33 CEST 2001 Daniel Veillard + + * libxslt/numbers.c: fixed bug #61070, number ANY formatting + should be faster too. + * tests/docbook/result/xtchunk/html/* tests/xmlspec/REC-xml-20001006*.html: + updated the result of the tests. A subtle bug unnnoticed yet + in the XML Rec formatting got fixed. + +Sat Oct 6 19:45:07 CEST 2001 Daniel Veillard + + * libxslt/numbers.c: trying to fix bug #61070, seems there + is still a couple of problem left. And optimizations are + certainly needed. + +Sat Oct 6 15:10:16 CEST 2001 Daniel Veillard + + * libxslt/variables.c: fixing bug #61673 part II + * tests/docs/Makefile.am tests/docs/bug-65.xml + tests/general/Makefile.am tests/general/bug-65.*: added a + specific example in the regression tests + +Sat Oct 6 12:41:37 CEST 2001 Daniel Veillard + + * libxslt/pattern.c: fixed bug #61627 + * tests/docs/Makefile.am tests/docs/bug-64.xml + tests/general/Makefile.am tests/general/bug-64.*: added a + specific example in the regression tests + * tests/docs/Makefile.am tests/docs/bug-63.xml + tests/general/Makefile.am tests/general/bug-63.*: added a + specific example in the regression tests for bug #61291 + (fixed in libxml2 module) + * tests/reports/Makefile.am tests/reports/undefvar.*: added + a test for handling undefined variables + +Thu Oct 4 15:49:57 CEST 2001 Daniel Veillard + + * configure.in xslt-config.in: trying to fix bug #60890 + +Thu Oct 4 15:28:25 CEST 2001 Daniel Veillard + + * configure.in: applied patch to close bug #60724 + +Tue Oct 2 21:38:23 CEST 2001 Thomas Broyer + + * libexslt/date.c: applied patch from Charlie Bozeman that fixes + a bug in DAY_IN_WEEK and implements the date:week-in-month function + +Tue Oct 2 17:11:15 CEST 2001 Daniel Veillard + + * libxslt/extra.[ch] tests/extensions/list.* + tests/extensions/evaluate.*: applied patch from Darren Graves + adding support for Saxon's evaluate & expression extension functions + http://users.iclway.co.uk/mhkay/saxon/saxon6.3/extensions.html + +Mon Oct 1 17:18:32 CEST 2001 Daniel Veillard + + * libxslt/xsltwin32config.h.in win32/dsp/libexslt_*.dsp: applied + patches from Igor for Windows. + +Tue Sep 18 11:48:20 CEST 2001 Daniel Veillard + + * libxslt/xslt.c: fixed bug #60624 + * libxslt/xsltutils.c: improver the error context reporting + * tests/reports/Makefile.am tests/reports/tst-2.*: added a + specific regression test + * xsltproc/xsltproc: free the stylesheet if it contained an error. + +Mon Sep 17 14:45:48 CEST 2001 Daniel Veillard + + * libxslt/variables.c: fixed a problem with global var override + being reported as an error. + * tests/docs/Makefile.am tests/docs/bug-61.xml + tests/general/Makefile.am tests/general/bug-61.*: added a + specific example in the regression tests + * configure.in tests/Makefile.am tests/reports/*: adding a test + to make sure redefinition of global variables in the same stylesheet + are still reported + +Sat Sep 15 17:32:16 CEST 2001 Daniel Veillard + + * libxslt/extra.c: okay the code from Norm is really non + portable and break everywhere except on Sun and Linux + platform. Compile it only on those targets. + +Sat Sep 15 06:25:02 CEST 2001 Thomas Broyer + + * libexslt/date.c: fixed some bugs (reported by Charles Bozeman + and Justin Fletcher) + +Fri Sep 14 15:22:30 CEST 2001 Daniel Veillard + + * libxslt/numbers.c: Fixing bug #60415 + * tests/docs/Makefile.am tests/docs/bug-61.xml + tests/general/Makefile.am tests/general/bug-61.*: added a + specific example in the regression tests + +Fri Sep 14 12:42:22 CEST 2001 Daniel Veillard + + * tests/docbook/result/*: the change in libxml to output + decimal charrefs instead of hexadecimal changed a lot of + docbook results + +Thu Sep 13 15:30:01 CEST 2001 Daniel Veillard + + * libxslt.spec.in doc/Makefile.am: install xsltproc man page + +Wed Sep 12 21:09:53 CEST 2001 Daniel Veillard + + * configure.in: preparing for 1.0.4 + * doc/xslt.html doc/html/*: updated and regenerated docs + +Wed Sep 12 18:10:33 CEST 2001 Thomas Broyer + + * libexslt/date.c: fixed some compile warnings and disabled + debugging by default. + +Wed Sep 12 17:00:53 CEST 2001 Daniel Veillard + + * win32/dsp/libxslt.def libxslt/variables.[ch]: trying to + incorporate comments from bug #59220 + +Wed Sep 12 05:51:32 CEST 2001 Thomas Broyer + + * configure.in libexslt/date.c libexslt/Makefile.am + libexslt/exslt.[ch] libexslt/.cvsignore: added implementation + of the EXSLT - Dates and Times core functions. + The exsltDateFormat* functions need to be reworked but it + works like this, even if it's quite messy. + * tests/exslt/strings/.cvsignore: added + +Tue Sep 11 14:48:43 CEST 2001 Daniel Veillard + + * xsltproc/xsltproc.c: tell in usage that parameter strings + need to be quoted + +Tue Sep 11 13:42:49 CEST 2001 Daniel Veillard + + * libxslt/Makefile.am libxslt/transform.c: trying to close + bug #60304 on xsl:fallback usage + * tests/docs/Makefile.am tests/docs/bug-60.xml + tests/general/Makefile.am tests/general/bug-60.*: added a + specific example in the regression tests + +Tue Sep 11 13:02:34 CEST 2001 Daniel Veillard + + * tests/documents/Makefile.am tests/documents/*: changed the + test to use doc%5Ffile instead of doc%20file, this is + sufficient to preserve the test capacities while closing + bug #60090 + +Tue Sep 11 12:33:03 CEST 2001 Daniel Veillard + + * libxslt/extra.c : close #59570 by simply not providing + Norm's extension on FreeBSD. + * tests/general tests/docs: added a couple of new entries + in the testsuite + * libexslt/strings.c: NULL initialized a local variable + which was tested later on. + +Mon Sep 10 22:52:44 CEST 2001 Daniel Veillard + + * libxslt/pattern.c tests/docbook/result/fo/*: applied fix from + #60143 and rebuilt the FO test outputs + +Mon Sep 10 19:38:54 CEST 2001 Daniel Veillard + + * libxslt/attributes.c libxslt/transform.c: fixed bug #59757 + on inheritance of attributes from multiple attributes-sets + +Mon Sep 3 02:14:58 CEST 2001 Thomas Broyer + + * libexslt/Makefile.am libexslt/exslt.[ch] libexslt/strings.c: + added implementation of EXSLT - Strings. + Currently implemented functins are str:tokenize, str:align + str:concat and str:padding. + * configure.in tests/exslt/Makefile.am + tests/exslt/strings/Makefile.am + tests/exslt/strings/tokenize.1.*: added a test for the + str:tokenize function. + +Fri Aug 31 13:51:53 CEST 2001 Daniel Veillard + + * libxslt/libxslt.4 libexslt/libexslt.4 libxslt/Makefile.am + libexslt/Makefile.am: added man pages provided by Heiko Rupp + +Wed Aug 29 21:23:54 MDT 2001 John Fleck + + * doc/tutorial/libxslttutorial.xml, libxslttutorial.html - update + tutorial text to add references to global variables cleanups + +Wed Aug 29 21:05:43 MDT 2001 John Fleck + + * doc/xsltproc.1 - added xsltproc man page (note: this has not + been added into the build yet) + +Wed Aug 29 22:58:58 CEST 2001 Daniel Veillard + + * doc/tutorial/libxslt_tutorial.c doc/tutorial/libxslttutorial.html + doc/tutorial/libxslttutorial.xml: added global variables cleanups + to the example. + * tests/documents/Makefile.am: mjcox pointed to some missing files + +Wed Aug 29 15:32:52 CEST 2001 Thomas Broyer + + * libexslt/common.c: fixed a bug in exsltNodeSetFunction + +Wed Aug 29 15:18:28 CEST 2001 Thomas Broyer + + * libexslt/common.c: implemented version 3 of the exslt:node-set() + function. + * tests/exslt/common/Makefile.am + tests/exslt/common/node-set.3.{xml,xsl,out}: added a test + +Mon Aug 27 08:27:21 MDT 2001 John Fleck + + * adding doc/xsltproc.html - html generated from xsltproc.xml, + update doc/xslt.html with link to xsltproc.html + +Mon Aug 27 08:21:47 MDT 2001 John Fleck + + * adding doc/xsltproc.xml - user manual for xsltproc + +Sun Aug 26 20:52:02 CEST 2001 Daniel Veillard + + * libxslt/numbers.c libxslt/xslt.c: removed a couple of + warning raised by the Windows compiler (Chris Poblete) + +Fri Aug 24 01:15:24 CEST 2001 Daniel Veillard + + * libxslt/functions.h libxslt/preproc.c libxslt/transform.c: + closed bugs #59212 and #59220 + +Thu Aug 23 23:18:44 CEST 2001 Daniel Veillard + + * config.h.in configure.in xsltproc/xsltproc.c: complete test + of a DocBook XSLt transform with --nonet, need stat(), added + checking in configure. + +Thu Aug 23 17:37:40 CEST 2001 Daniel Veillard + + * xsltproc/xsltproc.c: catalog integration, cleanup with + the --nonet option closing #59427 + * libxslt/xslt.c: removed a small memleak when using a + stylesheet PI + +Tue Aug 21 13:17:19 CEST 2001 Daniel Veillard + + * //Makefile.am : fixed an error I propagated to nearly all + Makefiles.am on Saturday + +Tue Aug 21 13:10:03 CEST 2001 Daniel Veillard + + * libexslt/math.c libxslt/numbers.c: use xmlXPathIsNaN() and + xmlXPathIsInf() + * libxslt/pattern.c: tag a potential threading problem. + +Tue Aug 21 11:18:45 CEST 2001 Bjorn Reese + + * libxslt/numbers.c libexslt/math.c: Re-worked NaN and Inf + support. + +Sat Aug 18 15:57:46 CEST 2001 Daniel Veillard + + * //Makefile.am : fixed a number of small problems with + Makefiles spotted by Albert Chin + +Thu Aug 16 14:37:55 CEST 2001 Daniel Veillard + + * win32/dsp/libxslt.def: minimal changes to compile 1.0.2 on + Windows/MSC + +Thu Aug 16 12:58:11 CEST 2001 Daniel Veillard + + * libxslt/extensions.c: fixed a permutation of args to + xsltPrintErrorContext() + +Wed Aug 15 15:19:14 CEST 2001 Daniel Veillard + + * Makefile.am config.h.in configure.in libxslt/xsltwin32config.h: + release of 1.0.2 + * tests/docs/Makefile.am libexslt/Makefile.am + tests/documents/Makefile.am tests/general/Makefile.am + xsltproc/Makefile.am: cleaning of Makefiles pointed out + by make distcheck + +Wed Aug 15 13:54:41 CEST 2001 Daniel Veillard + + * libxslt/functions.h libxslt/transform.c: a bit of cleanup + +Wed Aug 15 12:06:43 CEST 2001 Daniel Veillard + + * libexslt/common.c libexslt/math.c libxslt/Makefile.am + libxslt/libxslt.h libxslt/xsltconfig.h.in: cleanup of includes + export xsltconfig.h at make install stage + +Tue Aug 14 20:51:09 MDT 2001 John Fleck + + * doc/xslt.html updated xsltproc description with the many new + command line options Daniel has added, cleaned up some spelling + +Tue Aug 14 18:41:02 CEST 2001 Daniel Veillard + + * libxslt/extra.c libxslt/keys.c libxslt/templates.c + libxslt/transform.c libxslt/variables.c libxslt/xsltutils.c: + serious changes on Result Value Trees and NodeSets + w.r.t. deallocation and collect operations. Probably not + 100% clean (merge of allocated trees smells like a problem). + Seems sufficient to close #58943 . Also check if XPath evaluations + failed, and in this case stops the processing and avoid + going further, goal is to not segfault on broken XSLT. + +Tue Aug 14 15:32:08 CEST 2001 Daniel Veillard + + * libxslt/pattern.c libxslt/transform.c: trying to kill bug #58878, + some associated serious cleanup in the pattern code. + * tests/docbook/result/*: regenerated all the results for the + docbook testsuite. Seems killing #58878 also changes the + fo results seriously. + * tests/docs/Makefile.am tests/docs/bug-5[56].xml + tests/general/Makefile.am tests/general/bug-5[56].*: added + 2 more tests + +Tue Aug 14 05:01:30 CEST 2001 Thomas Broyer + + * libxslt/xslt.c libxslt/xsltInternals.h libxslt/transform.c + libxslt/extra.[ch] libxslt/extensions.c libxslt/preproc.[ch]: + fixed compilation warnings due to recent changes to the extension + framework. + * libxslt/preproc.[ch] libexslt/common.c + fixed the precomputation of *:document elements + * libxslt/functions.h: fixed a compilation warning + +Mon Aug 13 11:41:02 CEST 2001 Daniel Veillard + + * libxslt/xsltutils.c: applied fix suggested by Tom Moog + for xsltTimeStamp() in bug report #58012 + +Sun Aug 12 21:53:13 CEST 2001 Daniel Veillard + + * libxslt/functions.c libxslt/keys.c libxslt/transform.c + libxslt/xsltutils.h: cleaned up the code w.r.t. handling + of 'non-standard' libxml element like namespace nodes. + * tests/docs/Makefile.am tests/docs/bug-54.xml + tests/general/Makefile.am tests/general/bug-54.*: added a + specific example in the regression tests + +Wed Aug 8 22:57:05 CEST 2001 Daniel Veillard + + * HACKING: added John Fleck right to commit in the doc subdir + +Tue Aug 7 03:11:31 CEST 2001 Daniel Veillard + + * xsltproc/xsltproc.c: for heriting defaulted atts from the DTD + * tests/docs/Makefile.am tests/docs/bug-52.xml tests/docs/bug-53.xml + tests/general/Makefile.am tests/general/bug-52.* + tests/general/bug-53.*: Added a few new tests for recently fixed + stuff in libxml + * tests/xmlspec/REC-xml-20001006-review.html + tests/xmlspec/REC-xml-20001006.html: inheriting default attrs from + DTD changed the result by adding extra attributes to the HTML output + +2001-08-06 Peter Williams + + * libexslt/Makefile.am, xsltproc/Makefile.am: Fixes for compiling + when srcdir != builddir. + +Sun Aug 5 09:37:14 CEST 2001 Thomas Broyer + + * libxslt/extensions.[ch] libxslt/preproc.[ch] libxslt/transform.c + libxslt/xslt.c libxslt/xsltInternals.h: modified extension framework + to easify extension element precomputation. + * libexslt/functions.c: uses the new framework and precomputes + func:result elements. + +Sat Aug 4 20:42:32 CEST 2001 Daniel Veillard + + * libxslt/transform.c: bug fix on output="text" from Nicolas Marsgui + +Fri Aug 3 14:23:25 CEST 2001 Daniel Veillard + + * tests/general/bug-21-.out tests/general/bug-31-.out: + this got fixed by libxml patches + * win32/readme.msvc win32/dsp/* xsltproc/xsltproc.c + Makefile.am libexslt/exslt.[ch] libexslt/exsltconfig.h.in + libexslt/functions.c libexslt/math.c libxslt/win32config.h + libxslt/xsltconfig.h.in libxslt/xsltutils.h + libxslt/xsltwin32config.h libxslt/xsltwin32config.h.in: + Applied Igor Zlatkovic Win32 Facelift No.2 patch, and fixed + a few things related to those changes. + +Wed Aug 1 13:58:21 CEST 2001 Daniel Veillard + + * libxslt/xsltutils.c: well one need one \n after DOCTYPE + * test//*/*.out: the output of some tests changed, looks better + actually + +Wed Aug 1 13:21:18 CEST 2001 Daniel Veillard + + * libxslt/xsltutils.c: avoid extra \n when serializing top + text nodes. + +Wed Aug 1 10:37:50 CEST 2001 Daniel Veillard + + * libxslt/extra.c: one more revision on Norm's localTime() function + +Wed Aug 1 01:37:41 CEST 2001 Thomas Broyer + + * libexslt/sets.c: fixed bugs in exsltTrailingFunction and + exsltLeadingFunction when passing an empty node-set as the + second argument + * libxslt/functions.[ch]: gave priority to context-level functions + over extension module functions. This allows a function declared + with a func:function element to override an extension module + function for example. This is a bit hackish... + * tests/exslt/sets/{lead,trail}ing.1.out: fixed errors. The result + values didn't conform to the expected values. This is a bug in + the EXSLT official use cases. + +Tue Jul 31 23:53:55 CEST 2001 Daniel Veillard + + * config.h.in configure.in libxslt/extra.c: tried to integrate + Norm's implemntation of localTime() + +Tue Jul 31 03:47:10 EDT 2001 Daniel Veillard + + * libxslt/extra.c: fixed a serious proble is node-set was called + on a nodeset + * tests//*/Makefile.am: fixed the rule to rebuild xsltproc + +Lun Jul 30 05:47:43 CEST 2001 Thomas Broyer + + * libexslt/functions.c: fixed memory leaks + +Sun Jul 29 08:37:59 EDT 2001 Daniel Veillard + + * libexslt/functions.c libxslt/extensions.[ch] libxslt/extensions.h + libxslt/xslt.[hc] libxslt/xsltInternals.h xsltproc/xsltproc.c: + more cleanup of the problems introduced with EXSLT, also closes + bug #58180 + +Sat Jul 28 08:25:05 MDT 2001 John Fleck + + * doc/internals.html - general cleanup + +Fri Jul 27 04:00:38 CEST 2001 Thomas Broyer + + * configure.in tests/Makefile.am tests/exslt/*: added some tests + to check EXSLT conformance + * libexslt/sets.c: fixed a typo when registering has-same-node + +Fri Jul 27 12:33:52 EDT 2001 Daniel Veillard + + * libxslt/extensions.c xsltproc/xsltproc.c: quick cleanup + of memory allocations, raise a bug in the test suite, also + need to be centralized as a single cleanup function. + +Fri Jul 27 10:50:39 EDT 2001 Daniel Veillard + + * libxslt/transform.[ch]: applied changes from Tom Moog #58002 + * libexslt/functions.c libxslt/documents.c libxslt/extensions.c: + Some cleanup, there is still a memory leak left and some warnings + in libexslt. + +Thu Jul 26 19:05:48 CEST 2001 Thomas Broyer + + * libxslt/extensions.[ch] libxslt/functions.[ch] libxslt/preproc.c + libxslt/transform.[ch] libxslt/variables.c libxslt/xslt.c + libxslt/xsltInternals.h: new extension framework. + Added stylesheet module data, top-level and extension elements + precomputing, global registration of top-level elements and + extension elements and functions. + Extensions are no longer initialized from extension-element-prefixes + declarations but when modules need the data. + init/shutdown functions registered with xsltRegisterExtModule{,Full} + only allocate and free module data, they shouldn't register the + elements and functions any more. + * libxslt/xsltutils.c: fixed a bug in xsltPrintErrorContext when + @node wasn't NULL. + * libxslt/xslt.c: fixed xsltPrecomputeStylesheetTop which allowed + non-XSLT top-level elements before any xsl:import element. + * libexslt/common.c libexslt/functions.c libexslt/math.c + libexslt/sets.c: adapted to use the new extension framework. + * libxslt/functions.c libxslt/extensions[ch] xsltproc/xsltproc.c: + moved the test module from functions.c to extensions.[ch], + modified it to use the new extension framework. Updated xsltproc + to register the test module. + +Thu Jul 26 10:20:19 EDT 2001 Daniel Veillard + + * libxslt/pattern.c: fixed an ugly problem with namespaces + in templates compilation + * tests/namespaces/tst4.*: added a specific testcase + * libxslt/transform.c: reenabled debug + +Tue Jul 24 17:45:22 CEST 2001 Daniel Veillard + + * configure.in libxslt.spec.in libxslt/xsltwin32config.h: + releasing 1.0.1 + * doc/html/*.html: updated the docs. + * xsltproc/xsltproc.c: activate line numbering unfortunately + this works only with CVS, libxml2-2.4.1 is broken in this respect + +Mon Jul 23 23:35:00 HKT 2001 William M. Brack + + * libxslt/documents.c enhancement to xsltFindDocument to + cater for the Matt Sergeant patch + +Mon Jul 23 09:32:27 MDT 2001 John Fleck + + * updating libxslt tutorial to include param support + +Mon Jul 23 20:12:38 CEST 2001 Daniel Veillard + + * libexslt/math.c: small cleanup + * libxslt/functions.c: patch to document('') from Matt Sergeant + * libxslt/xsltInternals.h libxslt/xsltutils.[ch]: profiler on Windows + c.f. bug #57464 from Tom Moog + +2001-07-19 Darin Adler + + * configure.in: Add HTML_DIR definition. + * xsltproc/.cvsignore: Ignore some generated files. + +2001-07-18 Peter Williams + + * xsltproc/Makefile.am (INCLUDES): Fix compiling when + srcdir != builddir. + +2001-07-17 Thomas Broyer + + * libexslt/.cvsignore libexslt/Makefile.am libexslt/utils.[ch] + libexslt/common.c libexslt/functions.c libexslt/math.c + libexslt/sets.c: removed utils.[ch] as their content is + integrated in libxml + * libexslt/sets.c: uses the new libxml functions + * libxslt/extra.[ch]: removed exsl:document + * AUTHORS: added /me + +2001-07-16 Thomas Broyer + + * libexslt/.cvsignore: some more generated files to ignore + * libexslt/Makefile.am: utils.h not installed anymore + * libexslt/common.c libexslt/exslt.[ch] libexslt/functions.c + libexslt/math.c libexslt/sets.c: + changed function prefix from exsl* to exslt* + {common.c,exslt.c} moved exsltLib{rary,exslt,xslt,xml}Version + from common.c to exslt.c + {common.c} removed exslNodeSetFunction, uses xsltFunctionNodeSet + instead + * libxslt/extra.c: fixed xsltFunctionNodeSet to accept + XPATH_NODESET arguments in addition to XPATH_XSLT_TREE + * xsltproc/xsltproc.c: updated to use the new function prefix + +2001-07-15 Darin Adler + + * libxslt/.cvsignore: + * tests/XSLTMark/.cvsignore: + * tests/extensions/.cvsignore: + * tests/xmlspec/.cvsignore: + Some more generated files to ignore. + +Mon Jul 16 14:26:48 CEST 2001 Daniel Veillard + + * Makefile.am configure.in libexslt/Makefile.am: + Integration of libexslt in the build system + * libxslt/Makefile.am libxslt/xsltproc.c libxslt/xsltutils.c + xsltproc/Makefile.am xsltproc/xsltproc.c: + Moved xsltproc to a separate directory, linked it to libexslt, + and added exslt version reports to -V + * tests/*/Makefile.am: updated the path to xsltproc + * libexslt/common.c libexslt/exslt.h libexslt/exsltconfig.h.in + libexslt/functions.c libexslt/math.c libexslt/sets.c: added + versionning informations, some cleanup, and added documentation + to a couple of exported functions + +Sun Jul 15 15:27:47 CEST 2001 Thomas Broyer + + * libexslt/Makefile.am: account for new source files + * libexslt/.cvsignore: added + +Sun Jul 15 05:02:50 CEST 2001 Thomas Broyer + + * libexslt/exslt.[hc] libexslt/common.[hc] libexslt/functions.[hc] + libexslt/math.[hc] libexslt/sets.[hc] libexslt/utils.[hc]: + start implementing EXSLT + +Sun Jul 15 16:01:55 CEST 2001 Daniel Veillard + + * libxslt/numbers.c libxslt/numbersInternals.h libxslt/preproc.c: + trying to accept AVT for "format" in xsl:number + +Fri Jul 13 16:57:08 CEST 2001 Daniel Veillard + + * win32/libxslt/libxslt.defs: trying to close #57460 by adding + xsltProfileStylesheet + +Thu Jul 12 21:31:06 CEST 2001 Daniel Veillard + + * libxslt/documents.c libxslt/extensions.c libxslt/extra.c + libxslt/functions.c libxslt/imports.c libxslt/keys.c + libxslt/namespaces.c libxslt/numbers.c libxslt/pattern.c + libxslt/preproc.c libxslt/templates.c libxslt/transform.c + libxslt/variables.c libxslt/xslt.c: provide context for + error messages. Requires libxml head changes. + * libxslt/xsltutils.c libxslt/xsltutils.h: fixed a --profile + problem + +Wed Jul 11 00:32:21 CEST 2001 Daniel Veillard + + * libexslt/Makefile.am: initial EXSLT framework + +Tue Jul 10 18:03:36 CEST 2001 Daniel Veillard + + * configure.in libxslt/xsltwin32config.h: releaseing 1.0.0 + * win32/libxslt/libxslt.def: added another entry point + * libxslt/transform.c: fixed a comment block + * doc/xslt.html doc/html/*: updated and regenerated the docs + +Tue Jul 10 17:25:59 CEST 2001 Daniel Veillard + + * win32/libxslt/libxslt.def: added missing functions + +Tue Jul 10 16:48:43 CEST 2001 Daniel Veillard + + * FEATURES libxslt/xsltproc.c libxslt/transform.c + libxslt/xsltInternals.h: added Embedding Stylesheets + * tests/REC/Makefile.am tests/REC/stand-2.7-1.*: added the test + from the REC about it + * libxslt/transform.c libxslt/extra.[ch] libxslt/preproc.c: + tried to accomodate the various (and changing) proprietary + ways of implementing chunking. + * tests/docbook/result/xtchunk/html: now output is generated in + ISO-8859-1 + +Mon Jul 9 23:23:50 CEST 2001 Daniel Veillard + + * libxslt/xsltproc.c: small cleanup + * libxslt/transform.c libxslt/xslt.c : patch from Michal Sajdak + for cdata/text handling + +Mon Jul 9 22:02:40 CEST 2001 Daniel Veillard + + * libxslt/xsltutils.c: small fix for xsl:message by Stephane GUIBOU + * tests/documents/Makefile.am tests/documents/message.*: added + a specific regression test + * libxslt/transform.c: fixed an infinite loop + * configure.in doc/Makefile.am: attempt to add --with-html-dir, + this may work + +Mon Jul 9 15:55:14 CEST 2001 Daniel Veillard + + * libxslt/transform.c libxslt/xslt.c libxslt/xsltInternals.h: + fixed exclude-result-prefixes handling and how namespaces + propagate from the stylesheet to the result in general, this + is a serious cleanup. + * tests/general/bug-3[67]-inc.xsl tests/general/bug-6-.xsl + tests/general/itemschoose.out tests/namespaces/extra.xsl + tests/REC/test-10-1.xsl tests/REC/test-10-2.xsl + tests/REC/test-11.2-1.xsl tests/REC/test-11.2-2.xsl + tests/REC/test-11.2-6.xsl tests/REC/test-15-1.xsl + tests/REC/test-16.1-1.xsl tests/REC/test-16.1-2.xsl + tests/REC/test-5.4-1.out tests/REC/test-5.4-2.out + tests/REC/test-5.4-3.out tests/REC/test-5.4-4.out + tests/REC/test-7.1.1-2.out tests/REC/test-7.1.1-2.xsl + tests/REC/test-7.1.1-3.out tests/REC/test-7.1.1-3.xsl + tests/REC/test-7.1.1.out tests/REC/test-7.1.3.xsl + tests/REC/test-7.3.xsl tests/REC/test-7.4.xsl + tests/REC/test-7.6.1-1.xsl tests/REC/test-7.6.1-2.xsl + tests/REC/test-7.6.1-3.xsl tests/REC/test-7.6.2-1.xsl: + fixed and rechecked all the tests where the namespace + propagation was wrong either taht the rules were not applied + correctly or that superfluous namespaces were declared in the + stylesheets + +Sun Jul 8 22:12:02 CEST 2001 Daniel Veillard + + * libxslt/extra.c libxslt/functions.c libxslt/transform.[ch] + libxslt/variables.h: Norm pointed out that element-available() + didn't work, implemented it + * tests/extensions/Makefile.am tests/extensions/list.*: added + a test for all registered xslt element, function and default + extensions. + +Sun Jul 8 20:44:25 CEST 2001 Daniel Veillard + + * tests/documents/Makefile.am 'tests/documents/doc file.xml' + tests/documents/docfile.xml tests/documents/test.result + tests/documents/test.xml tests/documents/test.xsl: + added a test for URI-escaping on document() input + +Sun Jul 8 16:34:07 CEST 2001 Daniel Veillard + + * tests/docs/Makefile.am tests/general/Makefile.am + tests/general/bug-49-* tests/docs/bug-49-* + tests/general/bug-50-* tests/docs/bug-50-*: added a + couple of regression tests for bugs posted on the list + +Sun Jul 8 15:40:44 CEST 2001 Daniel Veillard + + * libxslt/xsltproc.c: avoid generating CDATA node in document + tree when parsed, force generation of text nodes instead. + +Sun Jul 8 14:39:27 CEST 2001 Daniel Veillard + + * doc/extensions.html: fixed a number of typo found by Dan York + * libxslt/xsltutils.c: improved the profiling ouput, added the + average value too. + +Sun Jul 8 00:01:21 CEST 2001 Daniel Veillard + + * libxslt/variables.c: tryingt to fix a problem raised by Norm + +Sat Jul 7 23:19:09 CEST 2001 Daniel Veillard + + * config.h.in configure.in: added gettimeofday() check + * libxslt/transform.c libxslt/xsltInternals.h libxslt/xsltutils.[ch]: + profiling works option --profile (or --norman ;) + +Sat Jul 7 18:58:56 CEST 2001 Daniel Veillard + + * libxslt/templates.c libxslt/transform.c libxslt/transform.h + libxslt/variables.c: big cleanup on the way templates or + template fragments are processed, cleanup of stack building + * tests/docs/Makefile.am tests/general/Makefile.am + tests/general/bug-4[1-8]-* tests/docs/bug-4[1-8]-*: added a + series of regression test for the variable/params lookups + * libxslt/transform.c libxslt/xsltutils.[ch] libxslt/xsltproc.c: + started working on profiling code, there is just invocation counting + yet but the framework is in place. + +Sat Jul 7 11:20:59 CEST 2001 Daniel Veillard + + * tests/docs/Makefile.am tests/general/Makefile.am + tests/general/bug-40-* tests/docs/bug-40-*: added a specific + regression test for the variable scope within templates problem + +Sat Jul 7 17:05:00 HKT 2001 Wiliam Brack + + * xsltInternals.h variables.c transform.c: + fixed problem with variable scope within templates + +Fri Jul 6 17:42:06 CEST 2001 Daniel Veillard + + * doc/extensions.html doc/internals.html doc/xslt.html: + added a documentation on writing libxslt extensions, and + added links to the main page + * libxslt/functions.c libxslt/xsltInternals.h + +Fri Jul 6 14:30:00 HKT 2001 William Brack + + * cleaned up many comments and error messages + +Fri Jul 6 01:43:51 CEST 2001 Daniel Veillard + + * configure.in libxslt/xsltwin32config.h: released 0.14.0 + * doc/xslt.html: added 0.14.0 release + +Fri Jul 6 01:00:55 CEST 2001 Daniel Veillard + + * doc/html/*: rebuilt docs before release + * libxslt/extensions.c: fixed a function doc header + +Fri Jul 6 00:40:55 CEST 2001 Daniel Veillard + + * FEATURES: updated + * libxslt/xslt.c libxslt/xsltInternals.h: added exclude-result-prefix + support + * tests/REC/Makefile.am tests/REC/test-7.1.1-[23]*: added a couple + of specific tests + * tests/xmlspec/REC-xml-20001006-review.html: seems this changed + something there, not visually perceptible + +Thu Jul 5 22:49:57 CEST 2001 Daniel Veillard + + * tests/docbook/result/: the change in libxml affected the + output of the Docbook tests (of course it was detected on + a DocBook example) + +Thu Jul 5 15:11:58 CEST 2001 Daniel Veillard + + * FEATURES: updated + * libxslt/transform.c: added cdata-section-elements + * tests/REC/Makefile.am tests/REC/test-16.1-*: added 2 tests from + the REC + +Thu Jul 5 10:44:47 CEST 2001 Daniel Veillard + + * FEATURES: updated + * libxslt/xsltutils.c: do not dump document for which there have + been no generated content + * tests/multiple/result.xml tests/namespaces/extra2.out: fixed + test output accordingly + * libxslt/transform.c libxslt/preproc.c: added xsl:fallback support + * tests/REC/Makefile.am tests/REC/test-15-1.*: xsl:fallback test + * tests/xmlspec/Makefile.am tests/docbook/Makefile.am: cleanups + +Wed Jul 4 15:15:50 CEST 2001 Daniel Veillard + + * libxslt/extension.[ch] libxslt/extra.[ch] libxslt/xsltInternals.h + libxslt/transform.c libxslt/functions.c: Added the extension API + suggested by Thomas Broyer, this should allow implementation of + EXSLT for example. + * libxslt/extra.[ch]: added a fake xsltFunctionLocalTime() in Norm's + CVS extension namespace to avoid complaints, some cleanup + * configure.in tests/Makefile.am tests/extensions/*: added a test + for new modules testing both elements and functions registration + +Fri Jun 29 23:32:37 CEST 2001 Daniel Veillard + + * libxslt/pattern.c libxslt/preproc.c libxslt/transform.c + libxslt/xslt.c libxslt/xsltutils.[ch]: added xsltGetQNameURI() + and cleaned up the way URI for QNames were computed through + the code, serious cleanup. + * libxslt/xsltInternals.h libxslt/xslt.c: moved cdata-sections + in their own hash table, implementation not yet finished. + +Thu Jun 28 23:01:14 CEST 2001 Daniel Veillard + + * libxslt/keys.c libxslt/templates.c libxslt/transform.c + libxslt/variables.c libxslt/xsltutils.c: hum seems I forgot + to save/restore some XPath context, bug raised by + Steve Cheng + +Thu Jun 28 15:48:06 CEST 2001 Daniel Veillard + + * libxslt/xsltwin32config.h[.in]: added configuration/version + informations for Windows/MSC + * libxslt/libxslt.h libxslt/*.c: internal header to centralize + includes switches + * libxslt/Makefile.am: added libxslt.h and xsltwin32config.h[.in] + * libxslt/*.[ch] libxslt/*.in: quite a bit of cleanup, especially + the email addresses + * AUTHORS: added William + +Tue Jun 26 18:45:38 CEST 2001 Daniel Veillard + + * configure.in doc/xslt.html: releasing 0.13.0 + * doc/Makefile.am: don't index the win32 include + * doc/html/*: rebuilt the docs + +Mon Jun 25 15:30:30 CEST 2001 Daniel Veillard + + * libxslt/xsltproc.c: John Fleck found a typo in usage() + * libxslt/xslt.c: avoid warning if version="1.1" is used + * libxslt/transform.c: forgot to initialize cur->outputFile + * libxslt/functions.c: DOCBOOK_XSL_HACK some versions of DocBook XSL + use the vendor string to detect supporting chunking, this + is a workaround to be considered in the list of decent XSLT + processors + +Mon Jun 25 12:41:30 CEST 2001 Daniel Veillard + + * libxslt/transform.[ch] libxslt/xslt.c libxslt/xsltInternals.h: + added a new interface xsltRunStylesheet() for a more flexible + handling of the output and trying to adhere to xsl:document + filename generation semantic if one knows the URL of the output, + also add IObuf capacity and SAX for output but is currently not + implemented. + * libxslt/xsltproc.c: added a -o or --output filename argument + to test xsltRunStylesheet() or provide a base when generating + multiple outputs + * tests/docbook/Makefile.am tests/docbook/result/xtchunk/html/*: + updated tests to add DocBook xt:document based chunking + * tests/multiple/Makefile.am: cleaned up the makefile a bit + * tests/multiple/out/*.html: the new xt:document now generate + the DOCTYPE if available as is the case for HTML + +Mon Jun 25 08:45:00 HKT 2001 William Brack + + * Removed some redundant code in xsltDefaultProcessOneNode + and revised the default processing of an attribute node + +Sun Jun 24 14:40:00 HKT 2001 William Brack + + * Enhanced ApplyTemplates and ForEach to allow multiple + documents within a nodelist. + * Repaired small bug in xsltDocument function which caused + a crash if invalid second argument was provided. + +Sat Jun 23 15:44:00 MDT 2001 John Fleck + + * doc/tutorial/libxslttutorial.xml, libxslttutorial.html + updating tutorial with explanation of xsltSave vs. xmlSave + functions + +Sat Jun 23 19:04:27 CEST 2001 Daniel Veillard + + * test/docbook: updated to docbook-xsl-1.4, regenerated results + +Sat Jun 23 15:32:25 CEST 2001 Daniel Veillard + + * Makefile.am libxslt/Makefile.am libxslt/numbers.c + libxslt/win32config.h libxslt/xsltconfig.h.in libxslt/xsltproc.c: + Patches for Windows mostly contributed by Yon Derek + * win32/libxslt/libxslt.def win32/libxslt/libxslt.dsw + win32/libxslt/libxslt_so.dsp win32/libxslt/xsltproc.dsp: + Project file for Mircrosoft C provided by Yon Derek + +Sat Jun 23 14:20:01 CEST 2001 Daniel Veillard + + * libxslt/pattern.c: closing bug #56517, fixed a number of + problems in the patterns compilations, priorities and debug + * libxslt/transform.c: improved the template debug message + * tests/docs/Makefile.am tests/general/Makefile.am + tests/general/bug-39-* tests/docs/bug-39-*: added a specific + regression test for #56517 + +Fri Jun 22 16:17:23 CEST 2001 Daniel Veillard + + * libxslt/xslt.c: avoid a stupid bug when compiling with + libxml < 2.3.11 and without LIBXML_DEBUG_ENABLED + +Fri Jun 22 00:11:18 CEST 2001 Daniel Veillard + + * libxslt/numbers.c: fix of a small bug + * libxslt/transform.c libxslt/variables.c libxslt/xslt.c: cleanups + while bug-hunting + +Tue Jun 19 16:13:49 CEST 2001 Daniel Veillard + + * tests/docbook/Makefile.am: added XHTML and XSL FO to the + regression tests + * tests/docbook/xhtml/*: added XHTML stylesheets + * tests/docbook/fo/*: added XSL FO stylesheets + * tests/docbook/result/xhtml/*: added XHTML results + * tests/docbook/result/fo/*: added XSL FO results + +Tue Jun 19 00:20:32 CEST 2001 Daniel Veillard + + * HACKING: fixed, added William + +Mon Jun 18 18:36:36 CEST 2001 Daniel Veillard + + * libxslt/xsltutils.c: forgot to flush in xsltSaveTo() in html and + xml cases, and fixed text output to be recursive in text nodes + lookups + +Mon Jun 18 15:44:51 CEST 2001 Daniel Veillard + + * configure.in: patch from Tony Graham to cleanup libxml2 detection + +Sun Jun 17 17:42:33 CEST 2001 Daniel Veillard + + * libxslt/xsltutils.[ch]: fixed xsltGetNsProp, i always forget + 'namespace' is a reserved C++ identifier + +Sun Jun 17 17:08:30 CEST 2001 Daniel Veillard + + * doc/xslt.html: adding 0.12.0 release + +Sun Jun 17 13:15:48 CEST 2001 Daniel Veillard + + * configure.in: preparing 0.12.0 release + * libxslt/transform.c: a bit of cleanup on the XInclude defaults + * libxslt/xsltconfig.h.in: added doc inline comment + * libxslt/xslt.[ch] libxslt/xsltproc.c: added more version informations + and enriched xsltproc --version to show them + * doc/html/*.html: rebuilt the docs + * doc/Makefile.am libxslt.spec.in: try to make sure John Fleck + tutorial ends up in the tars and RPMs + +Sat Jun 16 23:58:57 CEST 2001 Daniel Veillard + + * libxslt.spec.in: updated the descriptions + +Sat Jun 16 23:26:46 CEST 2001 Daniel Veillard + + * libxslt/namespaces.[ch]: added a single namespace def copy + operation xsltCopyNamespace(). cleaned up xsltCopyNamespaceList() + * libxslt/transform.c: cleaned up xsltCopyNode to cope with + any kind of input nodes. + * libxslt/variables.c: checked and closed the last TODO about + namespace propagation + * tests/docs/Makefile.am tests/general/Makefile.am + tests/general/bug-38-* tests/docs/bug-38-*: added a specific + regression test for #56115 + +Sat Jun 16 09:27:27 MDT 2001 John Fleck + + * updating tutorial: adding discussion of freeing memory, image + files for callouts, link to xsltproc.c code + +Sat Jun 16 15:23:43 CEST 2001 Daniel Veillard + + * libxslt/variables.c: bug #56267 was still not fixed, forgot + to remove the old code + * tests/general/bug-37-.xsl: wrong reference to 36 fixed, this does + the test for good + +Sat Jun 16 00:32:39 CEST 2001 Daniel Veillard + + * libxslt/variables.c: fixed bug #56267, namespaces must + be propagated when evaluating local variables. + * tests/docs/Makefile.am tests/general/Makefile.am + tests/general/bug-37-* tests/docs/bug-37-*: added a specific + regression test for #56267 + +Fri Jun 15 18:29:29 CEST 2001 Daniel Veillard + + * libxslt/keys.c: avoid a possibility of an uninitialized variable + * libxslt/documents.c libxslt/transform.[ch] libxslt/transform.h + libxslt/xsltInternals.h libxslt/xsltproc.c: Implement Raphael Hertzog + request to have xinclude processing done on document() if requested + +Thu Jun 14 20:52:13 CEST 2001 Daniel Veillard + + * libxslt/Makefile.am: applied patch from Sander Vesik for -j2 + +Thu Jun 14 10:07:59 CEST 2001 Daniel Veillard + + * libxslt/preproc.c: removed a warning on xsl:transform + * tests/docs/Makefile.am tests/docs/array.xml tests/general/Makefile.am + tests/general/array.out tests/general/array.xsl: added a new + test fround in xsl-dev + +Wed Jun 13 23:12:57 CEST 2001 Daniel Veillard + + * tests/docbook/result/html/*.html tests/XSLTMark/xslbench[12].out + tests/xmlspec/REC-xml-20001006*.html: the changes to the HTML + serializer of libxml impacted the result of some tests. Checked + that the XML REC renders identically. + +Mon Jun 11 07:19:06 MDT 2001 John Fleck + + * fixing embarassing typos in doc/tutorial/libxslttutorial.xml and + generated html + +Tue Jun 12 07:42:35 CEST 2001 Daniel Veillard + + * libxslt/variables.c: fixed bug #55670, namespaces must + be propagated when evaluating global variables. + * tests/docs/Makefile.am tests/general/Makefile.am + tests/general/bug-36-* tests/docs/bug-36-*: added a specific + regression test for #55670 + +Mon Jun 11 09:35:53 CEST 2001 Daniel Veillard + + * doc/xslt.html: linked to the tutorial + +Sun Jun 10 19:36:31 MDT 2001 John Fleck + + * doc/tutorial/libxslt_tutorial.c, libxslttutorial.html, + libxslttutorial.xml + adding tutorial + +Sun Jun 10 21:52:35 CEST 2001 Daniel Veillard + + * libxslt/transform.c: closed bug #55723, problem was due to + a limitation of xsltGetNamespace() when the insertion point + is the document. + * tests/docs/Makefile.am tests/general/Makefile.am + tests/general/bug-35-* tests/docs/bug-35-*: added a specific + regression test for #55723 + +Sun Jun 10 13:37:33 HKT 2001 William Brack + + * libxslt/transform.c: fixed problems with document() in + xsltApplyTemplates and xsltForEach. Cleaned up several + error messages. + * libxslt/keys.c: saved and restored ctxt->document within + xsltInitKey to fix problem with keys when doc changed + * libxslt/documents.[ch]: added new procedure xsltFindDocument + needed when document() causes a change of doc within + xsltApplyTemplates and xsltForEach + +Thu Jun 7 21:31:46 CEST 2001 Daniel Veillard + + * libxslt/xsltutils.[ch]: closing bug #55683 required to add + xsltGetNsProp() + * libxslt/attributes.c libxslt/imports.c libxslt/namespaces.c + libxslt/preproc.c libxslt/templates.c libxslt/xslt.c: + Updated to use the new function + * tests/XSLTMark/prettyprint.out tests/docbook/result/html/*.html: + the fixes in the serialization of

 in HTML in libxml
+	  led to a number of changes in the output
+
+Thu Jun  7 04:23:38 CEST 2001 Daniel Veillard 
+
+	* tests/docs/Makefile.am tests/general/Makefile.am
+	  tests/general/bug-32-* tests/docs/bug-32-*: added a specific
+	  regression test for #55722 
+
+Wed Jun  6 09:48:53 CEST 2001 Daniel Veillard 
+
+	* doc/xslt.html: updated to ask to not send mail directly
+	* tests/docs/Makefile.am tests/general/Makefile.am
+	  tests/general/bug-33-* tests/docs/bug-33-*: added a specific
+	  regression test for #55722 
+
+Wed Jun  6 11:07:50 CEST 2001 Daniel Veillard 
+
+	* libxslt/pattern.c : trying to fix #55670
+	* tests/XSLTMark/reverser.out : result of test changed when
+	  William fixed XPath
+
+Sat Jun  2 06:52:12 CEST 2001 Daniel Veillard 
+
+	* doc/xslt.html: updated with 0.11.0
+
+Fri Jun  1 11:30:49 CEST 2001 Daniel Veillard 
+
+	* configure.in libxslt.spec.in: released 0.11.0
+
+Mon May 28 12:54:45 CEST 2001 Daniel Veillard 
+
+	* libxslt/transform.c: William M. Brack found a small bug
+	  when call-template didn't find the template.
+
+Sat May 26 17:08:19 CEST 2001 Daniel Veillard 
+
+	* libxslt/transform.c: fixed handling of PI and comments
+	  (bug raised by Brent M Hendricks).
+	* tests/docs/Makefile.am tests/general/Makefile.am
+	  tests/general/bug-31-* tests/docs/bug-31-*: added a specific
+	  regression test
+
+Wed May 23 13:25:37 CEST 2001 Daniel Veillard 
+
+	* libxslt/xsltproc.c: added --xinclude in the option list,
+	  patch from Raphael Hertzog
+	* test/docbook/Makefile.am: force at least the gdp-handbook.xml
+	  test in the normal testsuite
+
+Wed May 23 00:05:19 CEST 2001 Daniel Veillard 
+
+	* libxslt/variables.c: Mark Vakoc found a bug in variable eval
+	  at the top template level 
+	* tests/docs/Makefile.am tests/general/Makefile.am
+	  tests/general/bug-30-* tests/docs/bug-30-*: added a specific
+	  regression test
+
+Tue May 22 18:52:30 CEST 2001 Daniel Veillard 
+
+	* libxslt/functions.c: fixed the document() bug reported by
+	  Stephane GUIBOUD-RIBAUD
+	* tests/docs/Makefile.am tests/general/Makefile.am
+	  tests/general/bug-29-* tests/docs/bug-29-*: added a specific
+	  regression test
+
+Tue May 22 15:09:02 CEST 2001 Daniel Veillard 
+
+	* configure.in libxslt/Makefile.am: fixed bug #54953
+	* libxslt/attributes.c: cleanup pointed by Joe Orton
+	* libxslt/xsltproc.c: added --catalogs to load catalogs from
+	  $SGML_CATALOG_FILES
+	* libxslt/functions.c: cleanup unreached code
+	* configure.in config.h.in libxslt/xsltproc.c: guarded the
+	  include with preprocessor definitions
+
+Sun May 20 20:55:00 CEST 2001 Daniel Veillard 
+
+	* tests/documents/Makefile.am tests/general/Makefile.am
+	  tests/multiple/Makefile.am tests/namespaces/Makefile.am
+	  tests/numbers/Makefile.am tests/xmlspec/Makefile.am
+	  tests/REC/Makefile.am tests/REC1/Makefile.am tests/REC2/Makefile.am
+	  tests/XSLTMark/Makefile.am tests/docbook/Makefile.am
+	  configure.in: Makefiles cleanup from Joe Orton
+
+Sun May 20 15:20:49 CEST 2001 Daniel Veillard 
+
+	* tests/docbook/result/html/external.html 
+	  tests/docbook/result/html/graphics.html
+	  tests/docbook/result/html/gtest.html
+	  tests/docbook/test/external.xml tests/docbook/test/subdoc.ent:
+	  Added a test from coolo for IDs in external parsed entities
+	  and fixed 2 outputs
+
+Sat May 19 22:28:05 CEST 2001 Daniel Veillard 
+
+	* libxslt/xslt.[ch] libxslt/xsltconfig.h.in libxslt/xsltproc.c:
+	  added --version info to xsltproc closing #54952
+
+Sat May 19 17:41:23 CEST 2001 Daniel Veillard 
+
+	* tests/documents/Makefile.am tests/general/Makefile.am 
+	  tests/multiple/Makefile.am tests/namespaces/Makefile.am 
+	  tests/numbers/Makefile.am tests/xmlspec/Makefile.am:
+	  Seems some of the changes I made for 0.9.0 Makefiles were
+	  not commited ...
+
+Sat May 19 17:23:54 CEST 2001 Daniel Veillard 
+
+	* configure.in: preparing 0.10.0 release
+	* doc/xslt.html: updated
+	* doc/html/* : rebuilt the docs
+
+Fri May 18 16:48:13 CEST 2001 Daniel Veillard 
+
+	* libxslt/xslt.c libxslt/variables.c libxslt/templates.c
+	  libxslt/keys.[ch] libxslt/functions.c: cleanups for ctxt->inst
+	  avoiding modifying stylesheet informations, and fixing
+	  document() when called from a global variable init
+
+Thu May 17 17:24:35 CEST 2001 Daniel Veillard 
+
+	* libxslt/functions.c libxslt/transform.c libxslt/xsltInternals.h:
+	  add ctxt->inst to allow stylesheet element lookup (needed
+	  for document() fix)
+	* libxslt/*.[ch]: generate docs for the structures and
+	  macros, general cleanup for docs
+	* doc/html/*.html: regenerated all docs
+
+Wed May 16 23:00:53 CEST 2001 Daniel Veillard 
+
+	* libxslt/extra.c libxslt/transform.c libxslt/variables.[ch]
+	  libxslt/xsltInternals.h: optimizations, cleanup of global
+	  variables handling
+
+Wed May 16 12:29:17 CEST 2001 Daniel Veillard 
+
+	* libxslt/extensions.c libxslt/preproc.c libxslt/transform.c
+	  libxslt/variables.c: force the precompilation of XPath expressions
+	  at stylesheet compilation time
+
+Tue May 15 14:34:23 CEST 2001 Daniel Veillard 
+
+	* libxslt/keys.c libxslt/transform.c: avoid some possibilities
+	  of crashes on debug
+	* tests/REC/Makefile.am: be less verbose if things really go wrong
+	* tests/docs/Makefile.am tests/general/Makefile.am
+	  tests/docs/bug-28-.xml tests/general/bug-28-.*: added bug-28 in
+	  the regression tests
+
+Sat May 12 12:39:54 CEST 2001 Daniel Veillard 
+
+	* libxslt/transform.c libxslt/xsltutils.c: fixed the default
+	  detection method to generate HTML documents 
+	* tests/REC/test-2.5-1.out tests/REC/test-8-1.out
+	  tests/REC/test-9.1-2.out tests/REC2/html.xml tests/XSLTMark/game.out
+	  tests/XSLTMark/html.out tests/XSLTMark/products.out
+	  tests/XSLTMark/xslbench1.out tests/XSLTMark/xslbench2.out
+	  tests/XSLTMark/xslbench3.out tests/general/bug-15-.out
+	  tests/general/bug-5-.out: updated a number of tests output
+	  accordingly
+
+Sat May 12 09:43:10 CEST 2001 Daniel Veillard 
+
+	* libxslt/xsltproc.c: use LIBXML_DOCB_ENABLED, William M. Brack
+
+Fri May 11 19:12:26 CEST 2001 Daniel Veillard 
+
+	* libxslt/templates.c libxslt/transform.c: fixed bug #54446
+	  about attribute being generated twice. Fixed a number of related
+	  bugs on attributes handling.
+	* tests/REC/test-7.1.4.out: this changed an attribute generation
+	  order
+	* tests/docs/bug-27-.xml tests/general/bug-27-.*: added test
+
+Fri May 11 17:08:14 CEST 2001 Daniel Veillard 
+
+	* libxslt/templates.c: fixed bug #54451 on escaped curly brackets
+	* tests/docs/bug-26-.xml tests/general/bug-26-.*: added test
+
+Fri May 11 16:20:40 CEST 2001 Daniel Veillard 
+
+	* configure.in tests/XSLTMark/Makefile.am: try to handle gracefully
+	  the cases where perl is not in the path (nor in /usr/bin)
+	* tests/docbook/result/html/gdp-handbook.html
+	  tests/docbook/result/html/kwrite.html
+	  tests/docbook/test/gdp-handbook.xml
+	  tests/docbook/test/kwrite.xml: commited a few more DocBook tests
+
+Wed May  9 12:29:47 CEST 2001 Daniel Veillard 
+
+	* libxslt/xsltproc.c: added --nonet and --warnnet to catch
+	  cases where a network access is needed to load a DTD or entity
+	* tests/docbook/Makefile.am: added --nonet
+	* tests/docbook/test/classsynop.xml tests/docbook/test/docbook40.xml:
+	  fixed 2 tests as a result
+
+Wed May  9 10:43:53 CEST 2001 Daniel Veillard 
+
+	* configure.in tests/docbook/Makefile.am tests/docbook/**/Makefile.am:
+	  try to remove the unneeded docbook Makefile stuff 
+
+Tue May  8 16:18:19 CEST 2001 Daniel Veillard 
+
+	* doc/xslt.html: fixed a link error
+	* libxslt/transform.c libxslt/xsltutils.c: fixed DOCTYPE generation
+	* libxslt/xsltproc.c: cleaned up the --repeat loop
+	* tests/documents/result.xhtml tests/xmlspec/REC-xml-20001006*.html:
+	  fixed the DOCTYPE in tests output
+	* tests/docs/bug-25-.xml tests/doc/Makefile.am 
+	  tests/general/bug-25-.* tests/general/Makefile.am : added a new
+	  test case and fixed the EXTRA_DIST
+
+Mon May  7 22:27:03 CEST 2001 Daniel Veillard 
+
+	* libxslt/extra.c: add more debug to xsltDebug
+	* libxslt/transform.c: spent a few hours tracking down an ugly
+	  race like bug in xsltCopyTreeList() arghhh
+	* libxslt/xsltproc.c: call xmlInitMemory() explictely
+
+Mon May  7 11:38:54 CEST 2001 Daniel Veillard 
+
+	* doc/internals.html: more work done on the doc, mostly complete
+	  except the section on the XSLT stack and the extensions API
+	  since both still need more work.
+
+Sun May  6 15:03:59 CEST 2001 Daniel Veillard 
+
+	* doc/internals.html doc/contexts.* doc/object.*: more work done
+	  on the doc
+
+Sun May  6 00:18:39 CEST 2001 Daniel Veillard 
+
+	* doc/internals.html: more work done on the doc
+
+Sat May  5 18:58:13 CEST 2001 Bjorn Reese 
+
+	* libxslt/transform.c tests/XSLTMark/xslbench1.out: Another fix
+	  for the CDATA output
+
+Sat May  5 18:09:15 CEST 2001 Daniel Veillard 
+
+	* libxslt/xslt.c: do not escape content of CDATA nodes on output
+
+Sat May  5 17:52:52 CEST 2001 Daniel Veillard 
+
+	* doc/internals.html doc/node.fig doc/node.gif doc/processing.fig
+	  doc/processing.gif doc/stylesheet.fig doc/stylesheet.gif
+	  doc/templates.fig doc/templates.gif: started writing tye doc
+	  on how libxslt works.
+
+Sat May  5 17:13:16 CEST 2001 Bjorn Reese 
+
+	* libxslt/numbersInternals.h libxslt/numbers.c
+	  tests/numbers/format-number.out tests/XSLTMark/number.out:
+	  Patch from William Brack to bring format-number() more in alignment
+	  with the Java implementations.
+
+	* libxslt/xslt.c tests/XSLTMark/xslbench1.out: Do not remove CDATA
+	  from stylesheet
+
+Fri May  4 20:10:45 CEST 2001 Daniel Veillard 
+
+	* tests/docbook/result/html/* tests/general/bug-11-.out 
+	  tests/multiple/result.xml tests/XSLTMark/*.out 
+	  libxslt/transform.c: all the PUBLIC and SYSTEM IDs
+	  were swapped
+
+Fri May  4 19:09:45 CEST 2001 Daniel Veillard 
+
+	* libxslt/xsltproc.c: add a --docbook option if your libxml2
+	  has the SGML DocBook support compiled in.
+
+Fri May  4 17:06:01 CEST 2001 Daniel Veillard 
+
+	* tests/general/bug-2[0-4].* tests/docs/bug-2[0-4].*: added more
+	  tests especially on sorting
+	* test/xsltutils.c: oops multiple sorts was actually broken !!!
+	  this should fix it
+
+Thu May  3 19:02:21 CEST 2001 Daniel Veillard 
+
+	* TODO configure.in libxslt.spec.in: getting ready for 0.9.0
+	  release
+	* doc/html/* doc/xslt.html: updated and regenerated the docs
+
+Thu May  3 17:56:55 CEST 2001 Daniel Veillard 
+
+	* xsltutils.[ch] transform.c: implemented multiple levels of
+	  sorting
+	* test/REC/test-10-2.*: added a really small test for it
+
+Wed May  2 14:04:34 CEST 2001 Daniel Veillard 
+
+	* libxslt/transform.c libxslt/xslt.c: fixed xsl:text processing
+	  there can be multiple text and CDATA child
+
+Wed May  2 10:55:56 CEST 2001 Daniel Veillard 
+
+	* tests/multiple/makefile.am: fixing #54015
+	* tests/XSLTMark/makefile.am tests/docbook/makefile.am: fixing #54014
+	  and a similar problem for the docbook tests
+
+Mon Apr 30 22:31:59 CEST 2001 Daniel Veillard 
+
+	* tests/general/bug-8-.out: fixed in libxml xpath
+	* libxslt/templates.[ch] libxslt/pattern.c: fixed an namespace
+	  problem in predicates within a pattern. Spotted another
+	  potential namespace problem
+
+Mon Apr 30 19:29:34 CEST 2001 Daniel Veillard 
+
+	* libxslt/preproc.c libxslt/xslt.c libxslt/xsltInternals.h
+	  libxslt/xsltproc.c: counting errors and warnings at compilation
+	  time. Stop processing in case of error.
+	* tests/docs/bug-1[89]* tests/general/-1[89]* tests/general/inner.xsl:
+	  added more namespace related bug checks
+
+Mon Apr 30 13:47:11 CEST 2001 Daniel Veillard 
+
+	* libxslt/preproc.c libxslt/variables.c: found the source of a
+	  memory leak with DocBook introduced this w.e.. bit of cleanup.
+	* tests/docbook/result/html/*.html : regenerated the DocBook tests
+	  results.
+
+Sun Apr 29 18:54:03 CEST 2001 Daniel Veillard 
+
+	* libxslt/variables.c: fixing bug #53769
+	* tests/general tests/docs: added new examples from the
+	  bug reports to the regression tests, updated the Makefiles
+
+Sun Apr 29 11:47:58 CEST 2001 Daniel Veillard 
+
+	* preproc.[ch] templates.[ch] variables.[ch] xslt.c xsltInternals.h
+	  attributes.c extensions.[ch]: moved all stylesheet precomputation
+	  at stylesheet loading time (stylesheet transform should be thread
+	  safe now), improved params and variables evaluations (but optim
+	  is not complete yet).
+	* TODO: updated
+
+Sat Apr 28 16:28:45 CEST 2001 Daniel Veillard 
+
+	* libxslt/xsltproc.c : changed the way --repeat works when
+	  used twice
+
+Sat Apr 28 16:19:06 CEST 2001 Bjorn Reese 
+
+	* libxslt/numbers.c libxslt/preproc.c tests/REC/test-7.7-3.out:
+	  fixed default formatting
+
+Sat Apr 28 14:20:29 CEST 2001 Daniel Veillard 
+
+	* libxslt/preproc.c : fixed  bug reported by Ankh
+	* libxslt/xsltproc.c : added an option to process HTML input
+
+Thu Apr 26 21:13:59 CEST 2001 Daniel Veillard 
+
+	* libxslt/transform.c: Tony Gorski found a bug pointed by
+	  a compiler on Tandem
+	* tests/documents/result.xhtml: this results in a small
+	  change in the output of this test
+
+Thu Apr 26 16:33:36 CEST 2001 Daniel Veillard 
+
+	* test/general/bug-14*.* test/docs/bug-14*.xml: added testcase from
+	  bug #53689
+
+Wed Apr 25 16:58:11 CEST 2001 Daniel Veillard 
+
+	* transform.c: fixed text and cdata handling in xsl:copy
+	* xslt.c : avoid crashing on invalid xslt input
+	* test/general/bug-*.* test/docs/bug-*.xml : added a number of
+	  bugs submitted to the regression tests
+
+Wed Apr 25 12:42:48 CEST 2001 Daniel Veillard 
+
+	* libxslt/xsltproc.c : Renaud Chaillat provided a fix for #53535
+
+Sun Apr 22 22:47:44 CEST 2001 Daniel Veillard 
+
+	* configure.in: updated to 0.8.0
+
+Sun Apr 22 22:46:03 CEST 2001 Daniel Veillard 
+
+	* transform.c: fixed a bug introduced on handling #53401
+
+Sun Apr 22 22:27:09 CEST 2001 Daniel Veillard 
+
+	* transform.c: fixed #53401
+	* configure.in libxslt/*.c: allowed to suppress debug reporting
+	  functionalities but it brings not noticeable improvements
+	* doc/xslt.html doc/html/*: updated and regenerated docs
+
+Wed Apr 18 15:24:50 CEST 2001 Daniel Veillard 
+
+	* tests/general/bug-5-.out tests/multiple/out/*.orig
+	  tests/xmlspec/REC-xml-20001006*.html: fixed the test output
+	  following the libxml changes
+
+Wed Apr 18 12:05:04 CEST 2001 Daniel Veillard 
+
+	* libxslt/functions.c: applied TOM's patch to key()
+	* tests/XSLTMark/chart.out tests/XSLTMark/dbonerow.out
+	  tests/XSLTMark/prettyprint.out tests/multiple/out/*.html:
+	  small HTML output change 
+
+Mon Apr 16 16:14:02 CEST 2001 Daniel Veillard 
+
+	* libxslt/functions.c libxslt/transform.c libxslt/xsltInternals.h:
+	  fixed current()
+
+Tue Apr 17 10:10:56 CEST 2001 Daniel Veillard 
+
+	* libxslt/keys.c libxslt/preproc.c libxslt/templates.c
+	  libxslt/transform.c libxslt/variables.c libxslt/xsltInternals.h:
+	  fixed for the most part the namespace handling problem in XPath
+	  expression computations.
+	* test/doc/ tests/general: added bug 5 and 6
+
+Thu Apr 12 14:40:22 CEST 2001 Daniel Veillard 
+
+	* libxslt/xslt.c: applied William M. Brack patch fixing the
+	  template lack of support for priority
+	* test/XSLTMark/*.out : this fixed anumber of problems in the
+	  XSLTMark output
+
+Thu Apr 12 14:29:48 CEST 2001 Daniel Veillard 
+
+	* libxslt/functions.c: removed warning in unparsed-entity-uri()
+	  fixed a bug in generate-id()
+	* libxslt/transform.c: fixed null list result errors
+	* libxslt/transform.c libxslt/xsltutils.c: applied William M. Brack
+	  fixes for sorting semantic
+
+Wed Apr 11 14:25:23 CEST 2001 Daniel Veillard 
+
+	* config.h.in configure.in libxslt/xsltconfig.h.in: added
+	  ansidecl.h test
+	* libxslt/xsltproc.c : added --xinclude option
+	* tests/XSLTMark/union.out : fixed the output
+
+Tue Apr 10 20:05:00 CEST 2001 Fatih Demir 
+
+	* .cvsignore & doc/.cvsignore: Added CVS ignore files.
+
+Tue Apr 10 12:10:25 CEST 2001 Daniel Veillard 
+
+	* configure.in: released 0.7.0
+	* tests/XSLTMark/Makefile.am: trying to solve some make distcheck
+	  problems
+
+Sun Apr  8 11:42:03 CEST 2001 Daniel Veillard 
+
+	* libxslt/functions.c libxslt/keys.c libxslt/transform.c:
+	  some checking against NULL pointers
+
+Mon Apr  2 17:00:39 CEST 2001 Daniel Veillard 
+
+	* configure.in tests/Makefile.am tests/XSLTMark/* tests/multiple:
+	  added the XSLTMark in the regression tests as well as multiple
+	  output test from Ankh
+	* libxslt/functions.c libxslt/keys.c libxslt/transform.c
+	  libxslt/variables.c libxslt/xsltutils.c: applied William M. Brack
+	  patches and fixed a memory leak
+	* tests/docbook/result/html/*.html : updated the results after
+	  William's patch
+	* tests/xmlspec/REC-xml-20001006-review.html 
+	  tests/xmlspec/REC-xml-20001006.html: libxml now don't invent
+	  an HTML doctype when serializing HTML result, but adds the
+	  encoding in ALT
+
+Thu Mar 29 10:24:42 CEST 2001 Daniel Veillard 
+
+	* libxslt/transform.c: applied fix to xsltApplyTemplates from
+	  William M. Brack
+	* test/docbook/result/html/*.html: this change the output
+	* tests/xmlspec/REC-xml-20001006-review.html 
+	  tests/xmlspec/REC-xml-20001006.html: this also fixed some of
+	  the reference anchors generated for the XML spec
+
+Mon Mar 26 18:57:58 CEST 2001 Daniel Veillard 
+
+	* libxslt/attributes.c libxslt/extra.c libxslt/keys.c libxslt/numbers.c
+	  libxslt/templates.c libxslt/transform.c libxslt/xsltconfig.h.in
+	  libxslt/xsltutils.c: of course the way I defined
+	  UNUSED breaks on old gcc version. Try to be smart and
+	  also define it directly in xsltconfig.h
+	* tests/xmlspec/Makefile.am: fixed the timing arg test
+
+Sun Mar 25 22:07:34 CEST 2001 Daniel Veillard 
+
+	* libxslt/transform.[ch] libxslt/variables.[ch] libxslt/xsltproc.c:
+	  implemented command line parameter passing
+	* tests/xmlspec/Makefile.am tests/xmlspec/REC-xml-20001006-review.html:
+	  tested it by passing show.diff.markup=1 to build the review version too
+
+Sat Mar 24 19:35:42 CET 2001 Daniel Veillard 
+
+        Huge cleanup, I switched to compile with
+	-Wall -g -O -ansi -pedantic -W -Wunused -Wimplicit
+	-Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat
+	-Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow
+	-Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return
+	-Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline
+	* libxslt/attributes.c libxslt/extensions.c libxslt/extra.c
+	  libxslt/functions.c libxslt/keys.c libxslt/numbers.c
+	  libxslt/pattern.c libxslt/preproc.c libxslt/templates.c
+	  libxslt/transform.c libxslt/variables.c libxslt/xslt.c
+	  libxslt/xsltutils.c: basically made static unexported functions
+	  avoided name clashes and flagged unused parameters.
+
+Thu Mar 22 22:52:48 CET 2001 Daniel Veillard 
+
+	* configure.in: 0.6.0 yet another release
+	* doc/xslt.html doc/html/*: updated the docs
+
+Wed Mar 21 23:19:11 CET 2001 Daniel Veillard 
+
+	* libxslt/xsltInternals.h libxslt/xslt.c libxslt/transform.c
+	  libxslt/templates.[ch] libxslt/preproc.c libxslt/extensions.[ch]
+	  extended xsltEvalStaticAttrValueTemplate and 
+	  xsltEvalAttrValueTemplate to support foreign namespaces,
+	  and fixed document()
+
+Mon Mar 19 18:40:40 CET 2001 Daniel Veillard 
+
+	* xsltutils.h: cleanup some garbage added last night
+	* xsltInternals.h variables.c transform.c templates.[ch]
+	  preproc.c pattern.c keys.c: switched the whole XSLt processing
+	  to use XPath precompiled expressions and reusing them.
+	* functions.c: some cleanup, seems people don't use 
+	  unparsed-entity-uri() the way it's supposed to be used
+
+Mon Mar 19 01:08:05 CET 2001 Daniel Veillard 
+
+	* libxslt/keys.c libxslt/templates.c libxslt/transform.c
+	  libxslt/variables.c libxslt/xsltutils.h: Changed to work
+	  with the new way XPath is interpreted. This doesn't yet
+	  take advantage of the separate parsing/evaluation phases
+
+Wed Mar 14 15:51:36 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c: robert@xsl.00008.org pointed out a
+	  problem in xsl:copy-of in case of attributes
+	* tests/docs/Makefile.am tests/docs/bug-3-.xml
+	  tests/general/Makefile.am tests/general/bug-3-.*:
+	  added the test to the general regression suite
+
+Wed Mar 14 14:21:45 CET 2001 Daniel Veillard 
+
+	* libxslt/functions.c: applied and fixed ptittom@free.fr patch
+	  fixing some of the missing functionnalities in the XSLT
+	  functions implementations.
+	  
+Tue Mar 13 14:38:48 CET 2001 Daniel Veillard 
+
+	* libxslt/Makefile.am: nick@debian.org forwarded a fix
+
+Tue Mar 13 10:29:45 CET 2001 Daniel Veillard 
+
+	* README.cvs-commits: added, pointing to HACKING
+	* HACKING: added defines commit rules.
+
+Mon Mar 12 14:43:20 CET 2001 Daniel Veillard 
+
+	* libxslt/extra.c libxslt/variables.c: fixing compilation
+	  when libxml was compiled without debug support
+
+Sat Mar 10 13:50:16 CET 2001 Daniel Veillard 
+
+	* configure.in: time for 0.5.0
+	* tests/docs/Makefile.am tests/general/Makefile.am: make sure the
+	  new test files are included in the distribution
+	* doc/xslt.html : updated
+	* doc/html/*.html: regenerated the docs
+
+Thu Mar  8 02:34:52 CET 2001 Daniel Veillard 
+
+	* tests/docbook/result/html/*.html: regenerated the HTML
+	  now that value-of an result tree don't include the fake root
+
+Thu Mar  8 02:26:56 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c libxslt/variables.c: removed a couple
+	  of possibly uninitialized var probs
+	* tests/xmlspec/Makefile.am: run the processing without verbose
+	  avoid raising generated id differences.
+
+Wed Mar  7 23:22:09 CET 2001 Daniel Veillard 
+
+	* libxslt/preproc.c libxslt/xsltInternals.h: fixed a stylesheet
+	  reuse problem.
+	* libxslt/transform.c: fixed a bug which exaplined why no
+	  optimization were resulting from preproc stuff
+
+Wed Mar  7 21:51:52 CET 2001 Daniel Veillard 
+
+	* libxslt/preproc.c libxslt/transform.c: a couple of nastyness
+	  w.r.t. value of tree result (and attributes within it) fixed.
+	* tests/xmlspec/Makefile.am tests/xmlspec/REC-xml-20001006.html:
+	  Integrated the xmlspec to the test (i.e. diffed output for
+	  changes).
+
+Wed Mar  7 18:01:07 CET 2001 Daniel Veillard 
+
+	* imports.c transform.c xslt.c xsltInternals.h: fixed a
+	  strip-spaces problem
+	* tests/docs/*.xml tests/general/*.[xsl,out]: added reported
+	  bugs to testsuite
+
+Wed Mar  7 13:34:13 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.[ch]: finished integrating the current
+	  state of the preproc optimizations.
+	* tests/xmlspec/diffspec.xsl: switched off diff printing
+
+Wed Mar  7 12:46:09 CET 2001 Daniel Veillard 
+
+	* libxslt/preproc.c libxslt/transform.c: started rolling in
+	  some of the optimizations.
+
+Tue Mar  6 19:39:25 CET 2001 Daniel Veillard 
+
+	* attributes.[ch] extra.[ch] preproc.c xsltInternals.h
+	  transform.[ch]: previous commit broke a lot of stuff, fixing
+	  and preparing for next step
+
+Tue Mar  6 19:03:21 CET 2001 Daniel Veillard 
+
+	* libxslt/preproc.[ch] Makefile.am templates.[ch] transform.[ch]
+	  xsltInternals.h: started working on optimizing stylesheet
+	  element parsing. Just builds the extra informations so far.
+	* xsltutils.h: added a missing XPath decl
+
+Tue Mar  6 09:52:13 CET 2001 Daniel Veillard 
+
+	* libxslt/variables.c: William M. Brack found a serious bug
+	  with imports and global variables ...
+
+Mon Mar  5 21:51:54 CET 2001 Daniel Veillard 
+
+	* libxslt/pattern.[ch] libxslt/transform.c: added 
+	  xsltCleanupTemplates() to clean up state left after processing.
+
+Sun Mar  4 19:03:27 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c: applied patch from William M. Brack
+	  to support with-param in xsltApplyTemplates().
+
+Sun Mar  4 17:53:13 CET 2001 Bjorn Reese 
+
+	* libxslt/pattern.c: fixed the compilation of patterns which
+	  contains XPath NodeTypes. Handling of nested predicates.
+
+Sat Mar  3 20:56:47 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c: save ctxt->node after for-each
+
+Thu Mar  1 18:16:58 CET 2001 Daniel Veillard 
+
+	* configure.in libxslt.spec.in: updated to 0.4.0 and 2.3.3
+	* doc/xslt.html: updated
+
+Wed Feb 28 19:24:51 CET 2001 Daniel Veillard 
+
+	* libxslt/extra.[ch] libxslt/transform.[ch] libxslt/xsltInternals.h:
+	  added xsltDocumentElem implementing multiple file output,
+	  including 1.1 xsl:document but yet untested.
+
+Wed Feb 28 00:03:44 CET 2001 Daniel Veillard 
+
+	* libxslt/extensions.c: fixed stoopid bug
+	* libxslt/Makefile.am libxslt/extra.[ch]: added a new module
+	  carrying extensions to the specification. Added node-set()
+	  for existing saxon and xt namespaces and debug() in libxslt
+	  namespace (http://xmlsoft.org/XSLT/namespace)
+	* libxslt/xsltutils.[ch] transform.c: moved xsltDebug to extra.c
+	  plus cleanup.
+	* configure.in tests/Makefile.am tests/namespaces: added some
+	  namespaces tests, including a test calling the extra debugging
+	  function in libxslt namespace, worked first time !!!
+
+Tue Feb 27 16:15:47 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.c: extension prefix support for the full stylesheet
+	* libxslt/transform.c libxslt/extensions.[ch]: more work should
+	  start working
+
+Mon Feb 26 22:59:44 CET 2001 Daniel Veillard 
+
+	* doc/xslt.html : cleaned up, added a bit more description on
+	  the API section.
+
+Mon Feb 26 09:41:04 CET 2001 Daniel Veillard 
+
+	* libxslt/Makefile.am libxslt/extensions.[ch]: started working
+	  on functions and element extensions. First on list will be
+	  a document element.
+
+Sun Feb 25 06:52:14 CET 2001 Daniel Veillard 
+
+	* configure.in libxslt.spec.in: releasing 0.3.0
+	* doc/xslt.html: updated
+	
+Sun Feb 25 05:28:30 CET 2001 Daniel Veillard 
+
+	* configure.in tests/docbook/html : oops forgot to add
+	  the stylesheets themselves :-\
+
+Sun Feb 25 04:51:33 CET 2001 Daniel Veillard 
+
+	* configure.in tests/Makefile.am tests/docbook tree:
+	  added docbook XSL based test suite
+
+Sat Feb 24 14:02:05 CET 2001 Daniel Veillard 
+
+	* libxslt/xsltutils.c: reformat of messages
+	* libxslt/xsltproc.c: removed memleak on --noout
+	* libxslt/xsltInternals.h libxslt/variables.[ch] libxslt/transform.c:
+	  changed again the way parameter are evaluated before a
+	  call-template, seems to fix a few nasty bugs, memory alloc debug too
+	
+Wed Feb 21 09:10:13 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c libxslt/variables.c libxslt/xsltInternals.h:
+	  fixed the param evaluation problem in apply-template
+	* libxslt/pattern.c: speed up seriously some context computation
+	* libxslt/xsltInternals.h: preparing for extension support
+	  
+Mon Feb 19 19:34:59 CET 2001 Daniel Veillard 
+
+	* libxslt/Makefile.am: small cleanup
+	* libxslt/functions.c libxslt/transform.c libxslt/xsltInternals.h:
+	  fixed current() I hope
+
+Mon Feb 19 18:05:47 CET 2001 Daniel Veillard 
+
+	* libxslt/numbers.c libxslt/numbersInternals.h libxslt/xslt.c
+	  libxslt/pattern.[ch] libxslt/xsltInternals.h:  more work on
+	  support of namespaces, both in templates and in XPath subexpressions
+
+Sun Feb 18 19:11:26 CET 2001 Bjorn Reese 
+
+	* libxslt/xsltutils.c: xsltSortFunction uses Shell's sort
+
+Sun Feb 18 17:13:00 CET 2001 Daniel Veillard 
+
+	* libxslt/pattern.c: when precompiled pattern is ALL, predicate
+	  contextual info must be recomputed
+
+Sun Feb 18 16:39:17 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.h libxslt/transform.c: defined and exported xsltMaxDepth
+	* libxslt/xsltproc.c : added --maxdepth
+
+Sun Feb 18 15:44:33 CET 2001 Daniel Veillard 
+
+
+	* libxslt/xsltproc.c: added --novalid and --noout as well
+	  as options printing when no args
+	* libxslt/variables.c libxslt/transform.c: trying to get rid
+	  if some variable/params addressing errors.
+
+Sat Feb 17 14:27:47 CET 2001 Daniel Veillard 
+
+	* FEATURES libxslt/attributes.c: fixed use-attribute-sets
+	* libxslt/xsltutils.c: add carriage return to xsl:message when
+	  needed
+
+Sat Feb 17 02:25:45 CET 2001 Daniel Veillard 
+
+	* libxslt/functions.c: fixed a bug with generate-id()
+
+Sat Feb 17 00:51:53 CET 2001 Daniel Veillard 
+
+	* libxslt/xsltutils.c: started doing more useful stuff in
+	  xsltDebug
+	* libxslt/transform.[ch] libxslt/variables.[ch] libxslt/templates.c
+	  libxslt/xsltInternals.h: changed the way variables/params
+	  are stored
+	* libxslt/xsltproc.c: removed a pedantic warning
+	* libxslt/variables.[ch]: found an ugly evaluation bug
+
+Thu Feb 15 18:14:48 CET 2001 Daniel Veillard 
+
+	* tests/REC/Makefile.am: updated
+
+Thu Feb 15 17:40:28 CET 2001 Daniel Veillard 
+
+	* libxlst/functions.c: fixed ID generation
+	* doc/xslt.html doc/html/*.html: updated/regenerated the doc
+
+Thu Feb 15 13:34:42 CET 2001 Daniel Veillard 
+
+	* libxslt/numbers.c: removed a couple of memleaks
+
+Thu Feb 15 12:41:44 CET 2001 Daniel Veillard 
+
+	* libxslt/pattern.[ch]: exported pattern matching interfaces
+	  for numbers.c and future debug module
+	* libxslt/numbers.c: updated to new interface, should avoid
+	  unnecessary recompilation of patterns.
+	* libxslt/xsltutils.[ch]: cleanup
+	* tests/REC/gmon.out: removed :-)
+
+Wed Feb 14 19:13:33 CET 2001 Bjorn Reese 
+
+	* libxslt/numbers.c: implemented level=any
+	* libxslt/transform.c: corrected some default values
+	* tests/REC/test-7.7-*.*: added
+
+Wed Feb 14 18:07:25 CET 2001 Daniel Veillard 
+
+	* libxslt/pattern.c: priorities were horribly broken, hope it's
+	  fixed
+
+Wed Feb 14 15:39:06 CET 2001 Daniel Veillard 
+
+	* FEATURES libxslt/imports.h libxslt/pattern.[ch]
+	  libxslt/xsltInternals.h libxslt/transform.[ch]
+	  libxslt/templates.c libxslt/xslt.c:
+	  Added apply-imports, keep a stack of running templates
+	* libxslt/xsltutils.c: bugfixes, gather the output informations
+	  down the cascade
+	* tests/xmlspec/Makefile.am tests/xmlspec/REC-xml-2e.xsl
+	  tests/xmlspec/diffspec.xsl tests/xmlspec/xmlspec.xsl: running
+	  the real set of transformation on XML-1.0 2e generages a near
+	  perfect HTML. Needs just more number fixes and implementation
+	  and an obscure problem in 3.3.3
+
+Tue Feb 13 20:31:03 CET 2001 Bjorn Reese 
+
+	* libxslt/pattern.c: added xsltMatchPattern()
+	* libxslt/numbers.c: implemented "level=multiple" for xsl:number
+
+Tue Feb 13 18:07:12 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c libxslt/xsltproc.c: cleanup and debug
+	* libxslt/xsltutils.[ch] : added a small debugging hook
+
+Mon Feb 12 18:30:26 CET 2001 Daniel Veillard 
+
+	* libxslt/FEATURES libxslt/transform.c: added support for
+	  disable-output-escaping in xsl:copy-of
+	* xmlspec/Makefile.am libxslt/variables.c libxslt/transform.c:
+	  give more debugging info
+
+Sun Feb 11 21:08:35 CET 2001 Daniel Veillard 
+
+	* libxslt/documents.[ch] libxslt/functions.c libxslt/imports.c
+	  libxslt/xslt.c libxslt/xsltInternals.h: changed teh way to store
+	  Includes, more document changes
+	* libxslt/xsltutils.c: fix the output of doctype and what is or
+	  is not HTML
+	* tests/REC/*.out tests/REC2/html.xml : changed output accordingly
+	* tests/Makefile.am tests/documents/* : added a new test from Stric
+	  exercising document() among other things
+
+Sun Feb 11 17:24:03 CET 2001 Bjorn Reese 
+
+	* FEATURES libxslt/transform.c libxslt/numbers.c: partial support
+	  for the level attribute for xsl:number
+	* libxslt/numbers.c: internal restructuring
+
+Fri Feb  9 15:49:19 CET 2001 Daniel Veillard 
+
+	* libxslt/Makefile.am libxslt/documents.[ch]: added a new module
+	  to deal with documents
+	* libxslt/functions.c: fixed document() to return the same set
+	  for teh same URL
+	* libxslt/keys.[ch] libxslt/templates.c libxslt/transform.c
+	  libxslt/variables.c libxslt/xsltInternals.h: keys are really
+	  associated to loaded documents, not to the transformation
+	  context, made the change, this impacted a number of modules
+
+Thu Feb  8 12:51:00 CET 2001 Daniel Veillard 
+
+	* doc/libxslt.sgml doc/html/*.html: updated and rebuilt the doc list
+
+Thu Feb  8 12:36:23 CET 2001 Daniel Veillard 
+
+	* README configure.in libxslt.spec.in: bumped to 0.1.0, getting
+	  ready for the release
+	* libxslt/keys.c libxslt/xslt.c: cleanup of uninitialized vars
+	* tests/REC1/Makefile.am tests/REC/Makefile.am: the EXTRA list
+	  was not up to date
+
+Thu Feb  8 12:09:58 CET 2001 Daniel Veillard 
+
+	* FEATURES libxslt/xsltInternals.h libxslt/pattern.c libxslt/keys.c:
+	  added support for keys in patterns
+	* tests/REC/test-12.2-2.*: added a specific testcase
+
+Wed Feb  7 21:16:47 CET 2001 Daniel Veillard 
+
+	* libxslt/functions.c FEATURES: started adding support for key()
+	* tests/REC/test-12.2-1.*: first key test
+
+Wed Feb  7 19:46:07 CET 2001 Daniel Veillard 
+
+	* FEATURES: updated
+	* libxslt/Makefile.am libxslt/keys.[ch] libxslt/xslt.c
+	  libxslt/transform.c libxslt/xsltInternals.h: started adding key
+	  support
+	* libxslt/xsltutils.c: warning cleanup
+	* libxslt/pattern.h: fixed soopid cut'n paste prob
+
+Tue Feb  6 10:56:38 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c libxslt/xslt.c: chased some reported
+	  unitinitialized variables.
+
+Tue Feb  6 10:55:26 CET 2001 Daniel Veillard 
+
+	* tests/numbers/Makefile.am: fixed the EXTRA stuff
+
+Mon Feb  5 22:02:24 CET 2001 Daniel Veillard 
+
+	* Copyright IPR Makefile.am: added some wording and a rewrite
+	  of the W3C IPR but without giving Copyright rights to W3C,
+	  should suit everybody
+
+Mon Feb  5 18:58:17 CET 2001 Daniel Veillard 
+
+	* FEATURES: updated, added mode support for templates
+	* pattern.[ch] transform.c xslt.c xsltInternals.h: added mode
+	  support for templates
+	* templates.c variables.c: simple fixes
+	* xslt.c: added a separate DEBUG_BLANKS debug class disabled
+	* xsltproc.c: added option -timing
+	* xsltutils.c: seem I forgot to add encoding support in output...
+	* configure.in tests/Makefile.am tests/xmlspec/*: added a test
+	  consisting of reformatting the XML REC with the xmlspec XSLT,
+	  heavy !
+
+Mon Feb  5 18:43:37 CET 2001 Bjorn Reese 
+
+	* FEATURES: updated
+	* numbers.c: handles actual number formatting for both xsl:number
+	  and the format-number extension function.
+	* function.c: formatting moved to numbers.c
+	* transform.c: added xsl:number
+	* xslt.c: minor memory leak removed
+	* Makefile.am: added numbers.c and numbersInternals.h
+
+Sat Feb  3 21:49:36 CET 2001 Daniel Veillard 
+
+	* TODO: updated
+	* doc/html/*.html updated
+	* doc/libxslt.sgml: added new modules
+	* libxslt/pattern.c: fix loop on hash clashes.
+
+Sat Feb  3 16:13:35 CET 2001 Daniel Veillard 
+
+	* FEATURES: updated
+	* imports.c: bugfix
+	* pattern.c: lots of changes to make most patterns work
+	* templates.[ch]: added xsltEvalXPathPredicate() for predicate testing
+	* transform.c: cleanup and attribute patterns testing
+	* xslt.c: added xsltFreeStylesheetList() and now cleanup
+	  the imports
+	* tests/REC/test-2.3* tests/REC/test-2.6.2*: more tests
+	* tests/REC/test-5.2-*: 18 pattern tests from the spec, all should
+	  work now.
+
+Fri Feb  2 11:15:24 CET 2001 Daniel Veillard 
+
+	* FEATURES: updated
+	* transform.c: added xsl:element support
+	* namespaces.[ch]: added xsltGetSpecialNamespace()
+	* attributes.c: added xsl:attribute namespace support.
+
+Thu Feb  1 20:58:54 CET 2001 Daniel Veillard 
+
+	* libxslt/Makefile.am libxslt/imports.[ch]: new module to
+	  implement import cascade lookups and traversal
+	* libxslt/attributes.c libxslt/namespaces.c libxslt/pattern.[ch]
+	  libxslt/transform.c libxslt/xslt.c libxslt/xsltInternals.h:
+	  started coding the import cascade lookup in the places needed,
+	  probably incomplete.
+
+Thu Feb  1 18:04:39 CET 2001 Daniel Veillard 
+
+	* libxslt/xsltInternals.h libxslt/xslt.h: started implementing
+	  xsl:include and xsl:import, untested
+
+Thu Feb  1 14:54:39 CET 2001 Daniel Veillard 
+
+	* 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 
+
+	* tests/REC/test-11*: added more tests
+	* libxslt/transform.c libxslt/variables.c: fixing bugs raised by
+	  said tests
+
+Wed Jan 31 21:42:43 CET 2001 Daniel Veillard 
+
+	* tests/REC/test-[9-10]*: added more tests
+	* tests/REC2/html.xml libxslt/xsltutils.c libxslt/transform.c:
+	  fixed sorting
+
+Wed Jan 31 19:25:38 CET 2001 Daniel Veillard 
+
+	* tests/REC/test-[7-9]*: added more tests
+	* libxslt/templates.c libxslt/transform.c libxslt/variables.c:
+	  fixing bugs raised by said tests, cleaned up the way ctxt->xpathctxt
+	  is allocated, overall cleanup.
+
+Wed Jan 31 14:25:25 CET 2001 Daniel Veillard 
+
+	* tests/REC/test-7.*: added more tests
+	* libxslt/pattern.c libxslt/templates.c libxslt/transform.c:
+	  fixing bugs raised by said tests
+
+Tue Jan 30 18:55:49 CET 2001 Daniel Veillard 
+
+	* tests/REC/test-7.*: added more tests
+	* libxslt/namespaces.[ch] libxslt/pattern.c libxslt/attributes.c
+	  libxslt/templates.c libxslt/transform.c libxslt/xslt.c: fixing bugs
+	  raised by said tests
+
+Tue Jan 30 15:16:56 CET 2001 Daniel Veillard 
+
+	* TODO: updated
+	* configure.in tests/Makefile.am tests/REC/*: started adding
+	  some regression tests based from fragments of spec examples
+	* libxslt/transform.c: fixed a problem on namespace generation
+
+Mon Jan 29 18:40:23 CET 2001 Daniel Veillard 
+
+	* FEATURES: updated
+	* tests/numbers/Makefile.am tests/numbers/format-number.*
+	  tests/Makefile.am configure.in: added number formattting
+	  test from Bjorn
+	* libxslt/attributes.[ch]: separated attribute support, started
+	  add support for attribute-sets
+	* libxslt/functions.[ch]: update for number and formatting
+	  from Bjorn
+	* libxslt/transform.c libxslt/xslt.c libxslt/xsltInternals.h:
+	  cleanups updates, etc ...
+
+Mon Jan 29 00:53:25 CET 2001 Daniel Veillard 
+
+	* FEATURES: updated
+	* libxslt/transform.c: added copy-of support
+	* libxslt/xsltutils.[ch]: added xsltDocumentSortFunction()
+
+Sun Jan 28 21:45:23 CET 2001 Daniel Veillard 
+
+	* FEATURES TODO: updates
+	* libxslt/xsltutils.[ch] libxslt/xsltInternals.h libxslt/xsltutils.h:
+	  added xsl:message
+
+Sun Jan 28 17:25:35 CET 2001 Daniel Veillard 
+
+	* FEATURES TODO: updates
+	* libxslt/namespaces.[ch] libxslt/templates.c libxslt/transform.c
+	  libxslt/xslt.c libxslt/xsltInternals.h: added support for
+	  namespace aliases and cleaned up the overall namespace related
+	  code. This materialize as a new module.
+
+Sun Jan 28 08:41:10 CET 2001 Daniel Veillard 
+
+	* configure.in libxslt.spec.in: changes needed for libxml2-devel
+	  changes
+
+Sat Jan 27 11:00:20 CET 2001 Daniel Veillard 
+
+	* libxslt.spec.in doc/xslt.html: updating doc and trying to add
+	  it to the RPM.
+
+Fri Jan 26 22:29:34 CET 2001 Daniel Veillard 
+
+	* Makefile.am configure.in doc/Makefile.am: added a doc subdir
+	  and the rules to generates the makefiles.
+	* doc/libxslt.sgml doc/xslt.html: very first version of the manual
+	* doc/html/*.html : autogenerated documentation
+	* libxslt/xsltInternals.h: fixed a typedef wich was breaking gtk-doc
+
+Fri Jan 26 21:48:25 CET 2001 Daniel Veillard 
+
+	* libxslt/functions.c: xsltGenerateIdFunction() small patch
+
+Thu Jan 25 19:36:45 CET 2001 Daniel Veillard 
+
+	* FEATURES TODO README INSTALL: updated
+	* libxslt/xslt.h: added URL and version/vendor :-)
+	* libxslt/transform.c: fixed a problem in xsl:attribute, removed
+	  attempt to support older libxml2 version.
+	* libxslt/variables.h libxslt/xsltInternals.h: update to structures
+	  and macros to add/register new document created by document()
+	* libxslt/functions.c: implemented current(), unparsed-entity-uri()
+	  system-property(), element-available() and function-available().
+	  A crippled version of document() has been added too.
+
+Thu Jan 25 12:13:04 CET 2001 Daniel Veillard 
+
+	* functions.[ch]: Bjorn Reese  provided
+	  number formatting !!!
+	* acconfig.h config.h.in configure.in libxslt/Makefile.am
+	  tests/Makefile.am; added testing for mathematical functions,
+	  fixed make test(s)
+	* FEATURES: updated
+
+Wed Jan 24 16:59:05 CET 2001 Daniel Veillard 
+
+	* libxslt/xsltInternals.h libxslt/pattern.c: fixed problems
+	  with non-named rules (*, ...) added accelerators
+	* libxslt/templates.[ch]: added xsltEvalTemplateString()
+	  and xsltEvalAttrValueTemplate() high level functions
+	* libxslt/transform.c: fixed the part where attributes
+	  had to be looked at as templates, added comment and
+	  PI generation
+	* TODO FEATURES: updated to reflect the new state
+
+Wed Jan 24 05:33:54 CET 2001 Daniel Veillard 
+
+	* libxslt/functions.[ch] Makefile.am: added new module functions
+	  with templates for the XSLT functions.
+	* libxslt/variables.h templates.c: added registrations of new
+	  functions when an XPath context is created
+
+Tue Jan 23 17:24:26 CET 2001 Daniel Veillard 
+
+	* tests/Makefile.am: cleanup
+	* libxslt/pattern.c: should support most of the patterns now
+	  except ID/Key and maybe some namespace checks when having
+	  a default namespace
+	* TODO: updated
+
+Tue Jan 23 14:58:32 CET 2001 Daniel Veillard 
+
+	* Makefile.am libxslt.spec.in tests/REC1/Makefile.am
+	  tests/REC2/Makefile.am: updated the makefiles and spec files to
+	  add tests, and the FEATURES file to the RPM
+
+Mon Jan 22 23:35:57 CET 2001 Daniel Veillard 
+
+	* Makefile.am libxslt.spec.in libxslt/Makefile.am tests/Makefile.am:
+	  prepared the Makefiles and spec files for a first release.
+	* COPYING.LIB: added LGPL Licence
+
+Mon Jan 22 22:36:43 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c: applied cleanup patch from Bjorn Reese
+	  
+
+Mon Jan 22 20:24:36 CET 2001 Daniel Veillard 
+
+	* configure.in libxslt.spec.in: first try to get a spec file
+
+Mon Jan 22 19:37:00 CET 2001 Daniel Veillard 
+
+	* libxslt/xsltproc.c: avoid segfault when stylesheet is inproper
+	* libxslt/transform.c: add support for "*" to strip and preserve
+	  space.
+
+Mon Jan 22 15:30:19 CET 2001 Daniel Veillard 
+
+	* TODO: updated
+	* FEATURES: added with alist of what's in and what's not
+	* libxslt/xslt.c: fixed top level Param and Variable stuff
+
+Mon Jan 22 11:46:44 CET 2001 Daniel Veillard 
+
+	* xsltproc.c: removed bug
+	* tests/REC2/html.xml: added newline after doctype
+	* libxslt/variables.[ch] libxslt/xsltInternals.h: added param
+	  support, result tree fragment support (requires just commited
+	  extensions to libxml2 XPath !!!)
+	* transform.c: added call-template, with-param support
+	* libxslt/pattern.[ch]: xsltFindTemplate() needed for call-template
+	* TODO: updated, added a DONE section and started migrating stuff :-)
+
+Sun Jan 21 12:03:16 CET 2001 Daniel Veillard 
+
+	* Makefile.am tests/Makefile.am tests/REC1/Makefile.am
+	  tests/REC2/Makefile.am tests/REC2/html.xml: added tests target
+	  too, added the HTML output test
+	* libxmls/xsltutils.c: added HTML output
+	* libxslt/xslt.c: check version on literal result used as templates
+	* libxslt/transform.c: fixed an error in VERSION number
+	* libxslt/templates.c: make sure generated nodes have doc and
+	  parent properly set
+
+Sat Jan 20 23:35:07 CET 2001 Daniel Veillard 
+
+	* libxslt/Makefile.am libxslt/template.[ch]: added a template
+	  specific module. Added attribute value template, at least in
+	  one spot.
+	* tests/REC2/Makefile.am tests/REC2/svg.xml: the SVG test from
+	  the spec now works too.
+	* libxslt/variables.c: fixed the debug
+	* libxslt/xslt.c: fixed an ugly uninitialized variable
+	* libxslt/transform.c: now using attr template processing
+
+Sat Jan 20 17:59:20 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c libxslt/variables.[ch] libxslt/xslt.c
+	  libxslt/xsltInternals.h libxslt/xsltutils.h: changed a few
+	  structure to add an execution stack with variables. Tree
+	  valued variables still missing.
+	* TODO: updated
+
+Fri Jan 19 13:16:57 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.c: check version on stylesheets
+	* libxslt/xslt.c libxslt/xsltInternals.h libxslt/variables[.ch]:
+	  started adding variables interfaces and modules.
+
+Thu Jan 18 16:08:38 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.c: added support for disable-output-escaping
+	  will need libxml version > 20211
+	* libxslt/transform.c: cleanup
+	* libxslt/xsltutils.[ch]: added output functions
+	* libxslt/xsltproc.c: reuse the output function
+	* tests/REC2/Makefile.am tests/REC2/vrml.xml: added VRML output
+	  test
+
+Wed Jan 17 21:03:01 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c libxslt/xslt.c: avoiding some problems
+	  with blank node stripping when not allowed.
+
+Wed Jan 17 20:15:40 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.c: modified apply-templates processing
+	  added select and sort support support.
+
+Wed Jan 17 17:45:20 CET 2001 Daniel Veillard 
+
+	* TODO: guess what, it's growing :-(
+	* configure.in: setup hacking values when compiling in my
+	  own environment.
+	* libxslt/transform.c libxslt/xsltutils.[hc]: added a first
+	  very rudimentary version of xsl:sort
+
+Wed Jan 17 14:25:25 CET 2001 Daniel Veillard 
+
+	* TODO: more stuff
+	* libxslt/transform.c: context position and size in for-each
+	* libxslt/xsltutils[ch] libxslt/makefile.am: added the util module
+	  and put Error and Debug routines
+	* libxslt/xslt.c libxslt/transform.c libxslt/pattern.c: switched
+	  to use the Debug calls, cleanup
+	* libxslt/xsltproc.c: added -v to enable debug printing
+
+Tue Jan 16 17:17:17 CET 2001 Daniel Veillard 
+
+	* TODO: started filling it :-(
+	* libxslt/pattern.c: should now at least compile the full
+	  set of patterns authorized. Default priorities added.
+	* libxslt/transform.c: a bit more work and cleanup.
+
+Mon Jan 15 15:34:17 CET 2001 Daniel Veillard 
+
+	* TODO: started adding in there :-(
+
+Mon Jan 15 15:31:41 CET 2001 Daniel Veillard 
+
+	* transform.c, xslt.c, xsltproc.c: lots of fixes, added
+	  support of xslt:if and xslt:attribute, need libxml2 interfaces
+	  present only in CVS.
+
+Sat Jan 13 23:26:21 CET 2001 Daniel Veillard 
+
+	* test/Makefile.am test/REC*/Makefile.am: added first test
+	* libxslt/pattern.c libxslt/transform.c libxslt/xslt.c:
+	  cleanup of nodes at reading of stylesheet, added support
+	  for xsl:for-each and fixed a few recursion bugs
+
+Fri Jan 12 22:33:07 CET 2001 Daniel Veillard 
+
+	* pattern.c, xslt.c: removed debug
+	* transform.c: added value-of, seems to handle the first
+	  REC example correctly
+
+Fri Jan 12 18:34:01 CET 2001 Daniel Veillard 
+
+	* transform.c, xsltproc.c: small fight with spaces and formatting
+	  may need a revisit later but looks pretty good right now.
+
+Fri Jan 12 13:43:30 CET 2001 Daniel Veillard 
+
+	* transform.c: basic processing in place
+	* xsltInternals.h: exported one xslt.c function
+
+Thu Jan 11 21:10:59 CET 2001 Daniel Veillard 
+
+	* libxslt/transform.[ch] Makefile.am: started adding the
+	  transformation module
+	* pattern.[ch] xslt.c: more work...
+
+Thu Jan 11 14:02:03 CET 2001 Daniel Veillard 
+
+	* libxslt/pattern.c: started adding xsltTestCompMatch()
+
+Wed Jan 10 20:44:30 CET 2001 Daniel Veillard 
+
+	* libxslt/pattern.c: more work on parsing selectors
+
+Wed Jan 10 16:29:41 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt*: completeted the structures
+	* libxslt/pattern.[ch]: started adding code to precompile patterns
+	  and do the lookup
+	* libxslt/makefile.am: added the new files
+
+Mon Jan  8 19:55:18 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.c : small cleanup
+	* configure.in libxslt/xsltconfig.h.in: add memory debug and
+	  mechanism for compile-time options
+
+Sun Jan  7 22:53:12 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.[ch]: started parsing templates
+
+Sun Jan  7 19:50:02 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.[ch]: started parsing stylesheet xsl:stylesheet
+
+Sun Jan  7 16:11:42 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.[ch] libxslt/xsltInternals.h libxslt/xsltproc.c:
+	  very early coding
+
+Sun Jan  7 15:10:54 CET 2001 Daniel Veillard 
+
+	* configure.in Makefile.am AUTHORS NEWS autogen.sh config.h.in
+	  libxslt/Makefile.am tests/Makefile.am:
+	  Created the library framework, imported it into the GNOME CVS base
+	* INSTALL: added a small instruction file.
+
+Sun Jan  7 13:51:30 CET 2001 Daniel Veillard 
+
+	* libxslt/xslt.[ch] libxslt/xsltInternals.h libxslt/xsltproc.c:
+	  first steps toward building the framework
+
+Sun Jan  7 12:22:13 CET 2001 Daniel Veillard 
+
+	* NOTES: added notes taken while reading the spec.
+
+Fri Jan  5 11:34:12 CET 2001 Daniel Veillard 
+
+	* test/REC1 test/REC2: added examples from the XSLT REC
+
+Fri Jan  5 11:14:29 CET 2001 Daniel Veillard 
+
+	* README: basic informations
+	* Changelog: created
diff --git a/Copyright b/Copyright
new file mode 100644
index 0000000..627eeff
--- /dev/null
+++ b/Copyright
@@ -0,0 +1,53 @@
+Licence for libxslt except libexslt
+----------------------------------------------------------------------
+ Copyright (C) 2001-2002 Daniel Veillard.  All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is fur-
+nished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
+NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of Daniel Veillard shall not
+be used in advertising or otherwise to promote the sale, use or other deal-
+ings in this Software without prior written authorization from him.
+
+----------------------------------------------------------------------
+
+Licence for libexslt
+----------------------------------------------------------------------
+ Copyright (C) 2001-2002 Thomas Broyer, Charlie Bozeman and Daniel Veillard.
+ All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is fur-
+nished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
+NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the authors shall not
+be used in advertising or otherwise to promote the sale, use or other deal-
+ings in this Software without prior written authorization from him.
+----------------------------------------------------------------------
diff --git a/FEATURES b/FEATURES
new file mode 100644
index 0000000..7003d46
--- /dev/null
+++ b/FEATURES
@@ -0,0 +1,244 @@
+       Status of implementation of the XSLT 1.0 Features:
+       ==================================================
+
+      $Id$
+
+Stylesheet Constructs:
+======================
+
+YES			    xsl:stylesheet
+?				id = id 
+YES				extension-element-prefixes = tokens 
+YES				exclude-result-prefixes = tokens 
+YES				version = number
+
+YES			    xsl:transform
+?				id = id 
+YES				extension-element-prefixes = tokens 
+YES				exclude-result-prefixes = tokens 
+YES				version = number
+
+
+YES			    Literal Result Element as Stylesheet
+
+YES			    Embedding Stylesheets
+
+NO                          mediaType
+
+Top Level Elements:
+===================
+
+YES			    xsl:include
+YES				href = uri-reference
+
+YES			    xsl:import
+YES				href = uri-reference
+
+YES			    xsl:strip-space
+YES				elements = tokens
+
+YES			    xsl:preserve-space
+YES				elements = tokens
+
+YES			    xsl:template
+YES				match = pattern 
+YES				name = qname 
+YES				priority = number 
+YES				mode = qname
+
+YES			    xsl:namespace-alias
+YES				stylesheet-prefix = prefix | "#default"
+YES				result-prefix = prefix | "#default"
+
+YES			    xsl:attribute-set
+YES				name = qname 
+YES				use-attribute-sets = qnames
+
+YES			    xsl:variable
+YES				name = qname 
+YES				select = expression
+YES				Content: template
+
+YES			    xsl:param
+YES				name = qname 
+YES				select = expression
+YES				Content: template
+
+YES			    xsl:key
+YES				name = qname 
+YES				match = pattern 
+YES				use = expression
+
+YES			    xsl:output
+YES				method = "xml" | "html" | "text" | qname-but-not-ncname 
+YES				version = nmtoken 
+YES				encoding = string 
+YES				omit-xml-declaration = "yes" | "no"
+YES				standalone = "yes" | "no"
+YES				doctype-public = string 
+YES				doctype-system = string 
+YES				cdata-section-elements = qnames 
+YES				indent = "yes" | "no"
+YES				media-type = string
+
+Instructions:
+=============
+
+YES			    xsl:apply-templates
+YES				select = node-set-expression 
+YES				mode = qname
+
+YES			    xsl:apply-imports
+
+YES			    xsl:call-template
+YES				name = qname
+
+YES			    xsl:element
+YES				name = { qname }
+YES				namespace = { uri-reference }
+YES				use-attribute-sets = qnames
+
+YES			    xsl:attribute
+YES				name = { qname }
+YES				namespace = { uri-reference }
+
+YES			    xsl:text
+YES				disable-output-escaping = "yes" | "no"
+
+YES			    xsl:processing-instruction
+YES				name = { ncname }
+
+YES			    xsl:comment
+
+YES			    xsl:copy
+YES				use-attribute-sets = qnames
+
+YES			    xsl:value-of
+YES				select = string-expression 
+YES				disable-output-escaping = "yes" | "no"
+
+YES			    xsl:number
+YES				level = "single" | "multiple" | "any"
+YES				count = pattern 
+YES				from = pattern 
+YES				value = number-expression 
+YES				format = { string }
+NO				lang = { nmtoken }
+NO				letter-value = { "alphabetic" | "traditional" }
+YES				grouping-separator = { char }
+YES				grouping-size = { number }
+
+YES			    xsl:for-each
+YES				select = node-set-expression
+
+YES			    xsl:if
+YES				test = boolean-expression
+
+YES			    xsl:choose
+
+YES			    xsl:when
+YES				test = boolean-expression
+
+YES			    xsl:otherwise
+
+YES			    xsl:sort
+YES				select = string-expression 
+NO				lang = { nmtoken }
+YES				data-type = { "text" | "number" | qname-but-not-ncname }
+YES				order = { "ascending" | "descending" }
+NO				case-order = { "upper-first" | "lower-first" }
+
+YES			    xsl:variable
+YES				name = qname 
+YES				select = expression
+YES				Content: template
+
+YES			    xsl:param
+YES				name = qname 
+YES				select = expression
+YES				Content: template
+
+YES			    xsl:copy-of
+YES				select = expression
+
+YES			    xsl:with-param
+YES				name = qname 
+YES				select = expression
+
+YES			    xsl:decimal-format
+YES				name = qname 
+YES				decimal-separator = char 
+YES				grouping-separator = char 
+YES				infinity = string 
+YES				minus-sign = char 
+YES				NaN = string 
+YES				percent = char 
+YES				per-mille = char 
+YES				zero-digit = char 
+YES				digit = char 
+YES				pattern-separator = char
+
+YES			    xsl:message
+YES				terminate = "yes" | "no"
+
+YES			    xsl:fallback
+
+General:
+========
+
+YES			    Conflict Resolution for Template Rules
+
+YES			    Whitespace Stripping
+
+YES			    Built-in Template Rules
+YES			        match="*|/"
+YES				match="text()|@*"
+YES				match="processing-instruction()|comment()"
+YES				Namespace
+YES				Mode
+
+YES			    Extension Elements
+
+YES			    Extension Functions
+
+YES			    Attribute Value Templates
+
+YES			    Result Tree Fragments
+
+Functions:
+==========
+
+YES			    node-set document(object, node-set?)
+YES			    node-set key(string, object)
+YES			    string format-number(number, string, string?)
+YES			    node-set current() 
+YES			    string unparsed-entity-uri(string)
+YES			    string generate-id(node-set?)
+YES			    object system-property(string)
+YES			    boolean element-available(string)
+YES			    boolean function-available(string)
+
+Patterns:
+=========
+
+YES			    para
+YES			    *
+YES			    chapter|appendix
+YES			    olist/item
+YES			    appendix//para
+YES			    /
+YES			    text()
+YES			    processing-instruction()
+YES			    node()
+YES			    id("W11")
+YES			    para[1]
+YES			    *[position()=1 and self::para]
+YES			    para[last()=1]
+YES			    items/item[position()>1]
+YES			    item[position() mod 2 = 1]
+YES			    div[@class="appendix"]//p
+YES			    @class
+YES			    @*
+YES   except ns for key	    key('a','b')
+
+daniel@veillard.com
diff --git a/HACKING b/HACKING
new file mode 100644
index 0000000..bf1624f
--- /dev/null
+++ b/HACKING
@@ -0,0 +1,22 @@
+         Rules for commits on the libxslt module
+         =======================================
+
+If what you are fixing is a compilation issue either at compile
+time or linking time on one of the main Linux platforms, then feel free
+to patch first and send mail afterward, as long as it's a 'small fix'.
+
+Otherwise, only Bjorn Reese (breese@users.sourceforge.net), 
+"William M. Brack" , Igor Zlatkovic
+ and me (veillard@redhat.com)
+should commit there. John Fleck also have commit rights for the doc
+subdir. Send a mail and if it's a bug issue, provide a test case and
+register it at bugzilla.gnome.org in the libxslt module.
+I check both my mail and the bug database on a very regular basis.
+if you don't get an answer within a week (which is highly unprobable)
+then commit your changes. This simply mean that I am on holliday or
+on the road and the other maintainers are busy too.
+
+  thanks in advance for following the rule,
+
+Daniel
+
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..5fd3ecf
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,49 @@
+         How to install the XSLT library:
+
+Requirements:
+=============
+
+this library requires a recent version of libxml2 which you can grab from
+either the GNOME FTP or the xmlsoft.org server:
+
+  ftp://xmlsoft.org/
+
+When installing from a distribution package like a tar.gz:
+==========================================================
+
+expand the package
+
+run ./configure possibly indicating the desired installation prefix: 
+
+    ./configure --prefix=/usr
+
+then run
+
+    make
+
+to build the project and
+
+    make install 
+
+(possibly after having gained root access) to install the library
+and associated include and scripts.
+
+When installing from a checkout of the GNOME CVS base:
+======================================================
+
+
+run ./autogen.sh possibly indicating the desired installation prefix: 
+
+    ./autogen.sh --prefix=/usr
+
+then run
+
+    make
+
+to build the project and
+
+    make install 
+
+(possibly after having gained root access) to instal the library
+and associated include and scripts.
+
diff --git a/MAINTAINERS b/MAINTAINERS
new file mode 100644
index 0000000..c11c553
--- /dev/null
+++ b/MAINTAINERS
@@ -0,0 +1,9 @@
+See first http://xmlsoft.org/XSLT/bugs.html and use the list please.
+
+Daniel Veillard
+E-mail: veillard@redhat.com
+Userid: veillard
+
+Co-maintainer: William Brack 
+Windows port: Igor Zlatkovic 
+              Rob Richards 
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..50af9b5
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,77 @@
+SUBDIRS = \
+	libxslt \
+	libexslt \
+	xsltproc \
+	doc \
+	$(PYTHON_SUBDIR) \
+	tests
+
+DIST_SUBDIRS = libxslt libexslt xsltproc python doc tests
+
+confexecdir=$(libdir)
+confexec_DATA = xsltConf.sh
+
+bin_SCRIPTS = xslt-config
+
+dist-hook: cleanup libxslt.spec
+	touch $(distdir)/doc/*.xml
+	touch $(distdir)/doc/EXSLT/*.xml
+	touch $(distdir)/libxslt/*.syms
+	(cd $(srcdir) ; tar -cf - --exclude CVS --exclude .svn win32 vms examples) | (cd $(distdir); tar xf -)
+
+CVS_EXTRA_DIST =
+
+EXTRA_DIST = xsltConf.sh.in xslt-config.in libxslt.spec libxslt.spec.in \
+             FEATURES TODO Copyright libxslt.m4 \
+	     win32/libxslt/libxslt.def win32/libxslt/libxslt.dsw \
+	     win32/libxslt/libxslt_so.dsp win32/libxslt/xsltproc.dsp \
+	     $(CVS_EXTRA_DIST)
+
+## We create xsltConf.sh here and not from configure because we want
+## to get the paths expanded correctly.  Macros like srcdir are given
+## the value NONE in configure if the user doesn't specify them (this
+## is an autoconf feature, not a bug).
+
+xsltConf.sh: xsltConf.sh.in Makefile
+## Use sed and then mv to avoid problems if the user interrupts.
+	sed -e 's?\@XSLT_LIBDIR\@?$(XSLT_LIBDIR)?g' \
+	    -e 's?\@XSLT_INCLUDEDIR\@?$(XSLT_INCLUDEDIR)?g' \
+	    -e 's?\@VERSION\@?$(VERSION)?g' \
+	    -e 's?\@XSLT_LIBS\@?$(XSLT_LIBS) $(EXTRA_LIBS)?g' \
+	       < $(srcdir)/xsltConf.sh.in > xsltConf.tmp \
+	&& mv xsltConf.tmp xsltConf.sh
+
+CLEANFILES = xsltConf.sh
+
+check-local: tests
+
+dummy:
+
+tests: dummy
+	@echo '## Running the regression test suite'
+	@(cd tests ; $(MAKE) tests)
+	@(cd xsltproc ; $(MAKE) tests)
+	@(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; $(MAKE) tests ; fi)
+
+valgrind:
+	@echo '## Running the regression tests under Valgrind'
+	@echo '## Go get a cup of coffee it is gonna take a while ...'
+	@(cd tests ; $(MAKE) CHECKER='libtool --mode=execute valgrind -q --leak-check=full' tests)
+	@(cd xsltproc ; $(MAKE) CHECKER='libtool --mode=execute valgrind -q --leak-check=full' tests)
+
+cleanup:
+	-@(find . -name .\#\* -exec rm {} \;)
+
+cleantar:
+	@(rm -f libxslt*.tar.gz)
+
+rpm: cleantar
+	@(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz)
+
+
+pkgconfigdir=$(libdir)/pkgconfig
+pkgconfig_DATA = libxslt.pc libexslt.pc
+
+m4datadir = $(datadir)/aclocal
+m4data_DATA = libxslt.m4
+
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..f3b0596
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,1072 @@
+
+        NEWS file for libxslt
+
+  Note that this is automatically generated from the news webpage at:
+       http://xmlsoft.org/XSLT/news.html
+
+See the git page at 
+http://git.gnome.org/browse/libxslt/
+
+to get a description of the recent commits.Those are the public releases made:
+1.1.29: May 24 2016:
+   - Security:
+  CVE-2015-7995 Fix for type confusion in preprocessing attributes (Daniel Veillard)
+  
+   - Documentation:
+  
+   - Portability:
+  Fix a portibility problem with previous commit (Eduard Sanou),
+  Fix MingW build (Nick Wellnhofer),
+  Correctly emulate snprintf on older MSVC versions (Nick Wellnhofer),
+  Add Python script to run some tests on Windows (Nick Wellnhofer),
+  Remove /OPT:NOWIN98 option (Nick Wellnhofer),
+  Visual Studio 14 CTP defines snprintf() (Daniel Veillard),
+  Use AC_PATH_TOOL to find libgcrypt-config and xml2-config (Micha¿ Górny),
+  Use $libdir for LIBXSLT_DEFAULT_PLUGINS_PATH (larryhaja),
+  Use mkdir macro also in case if mingw32. (Lars Kanis),
+  Add math library to executable link flags (Nick Wellnhofer),
+  Fix quoting of xlocale test program in configure.in (Nick Wellnhofer)
+  
+   - Bug Fixes:
+  Fix OOB heap read in xsltExtModuleRegisterDynamic (Nick Wellnhofer),
+  Remove CDATA markup from libxslt_tutorial.c (Nick Wellnhofer),
+  Remove generated headers from dist tarball (Nick Wellnhofer),
+  Mark XML file argument as repeatable (Nick Wellnhofer),
+  Keep timezone in date:add (Nick Wellnhofer),
+  Fix buffer overflow in exsltDateFormat (Nick Wellnhofer),
+  Fix saxon:line-number with namespace nodes (Nick Wellnhofer),
+  Fix dyn:map with namespace nodes (Nick Wellnhofer),
+  Fix error handling in Saxon extension functions (Nick Wellnhofer),
+  Fix double free in libexslt hash functions (Nick Wellnhofer),
+  Fix libxslt format warnings (David Kilzer),
+  Fix xsltNumberFormatGetMultipleLevel (Nick Wellnhofer),
+  Fix use-after-free in xsltDocumentFunctionLoadDocument (Nick Wellnhofer),
+  Always initialize EXSLT month and day to 1 (Nick Wellnhofer),
+  Fix possible NULL pointer deref in transform.c (mahendra.n),
+  Fix possible NULL pointer deref in xsltCopyTextString (Nick Wellnhofer),
+  Fix possible NULL pointer deref in libexslt/functions.c (Nick Wellnhofer),
+  Fix possible NULL pointer deref in xsltproc.c (mahendra.n),
+  Fix possible NULL pointer deref in preproc.c (mahendra.n),
+  Fix LIBXSLT_DEFAULT_PLUGINS_PATH in xsltconfig.h (Nick Wellnhofer),
+  Fix memory leak in xsltNumberFormat (Albert Astals Cid),
+  Error in doc/Makefile.am (Brice De Bruyne),
+  Detect attribute sets recursions in more cases (Daniel Veillard),
+  Check name vales for attribute-set elements (Daniel Veillard),
+  Fix hang with namespace-alias, fixes #700689 (Shaun McCance),
+  Fix str:align with UTF-8 strings (Nick Wellnhofer),
+  Fix for compiled XPath helpers (Nick Wellnhofer),
+  Check return value of exsltFuncNewFunctionData (Nick Wellnhofer),
+  Fix return value of xsltRegisterExtModuleElement (Nick Wellnhofer),
+  Call xmlNodeGetSpacePreserve with element node (Nick Wellnhofer),
+  Set namespaces before evaluating xsl:number (Nick Wellnhofer),
+  Make --maxvars option work (Per Hedeland),
+  Set correct context node when initializing xsl:keys (Nick Wellnhofer),
+  Fix for bug 436589 (Imran Azeezullah),
+  Memory leak in xsltCompileIdKeyPattern error path (Nick Wellnhofer),
+  Fix handling of UTF-8 strings in EXSLT crypto module (Nick Wellnhofer),
+  Fix certain patterns with predicates (Nick Wellnhofer),
+  Fix direct pattern matching (Nick Wellnhofer),
+  Fix str:padding to work with UTF-8 strings (Nick Wellnhofer),
+  EXSLT function str:replace() is broken as-is (Nick Wellnhofer),
+  Fix a couple of places where (f)printf parameters were broken (Daniel Veillard)
+  
+   - Improvements:
+  Add support timestamps from environment (Daniel Veillard),
+  Add missing tests to dist tarball (Nick Wellnhofer),
+  Improve error message in xsltAddTemplate and fix test (Nick Wellnhofer),
+  Allow REC tests with empty stdout (Nick Wellnhofer),
+  Fix GPL license in HTML files as well (Nick Wellnhofer),
+  Fix status message in EXSLT dynamic tests (Nick Wellnhofer),
+  Add public function macros to xsltlocale.h (Nick Wellnhofer),
+  Make valgrind tests work with libtool (Nick Wellnhofer),
+  Add a couple of xsl:number tests (Nick Wellnhofer),
+  Lower and upper bound for format token "i" (Nick Wellnhofer),
+  Lower bound for format token "a" (Nick Wellnhofer),
+  Handle negative xsl:number values (Nick Wellnhofer),
+  Round xsl:number values to nearest integer (Nick Wellnhofer),
+  Allow {URI}NCName syntax for user parameters (Nick Wellnhofer),
+  Fix endTimer parameter type (Nick Wellnhofer),
+  Fix error messages for unsupported methods (Nick Wellnhofer),
+  Replace sprintf with snprintf (David Kilzer),
+  Enforce two digit exponent under MSVC (Nick Wellnhofer),
+  Rework xsltNumberFormat to fix warning (Nick Wellnhofer),
+  Fix a couple of GPL licences found in the documentation (Daniel Veillard),
+  Use hash table to lookup named templates (Christian Ceelen),
+  Fix to reg tests post 737840 fix (Daniel Veillard),
+  Don't fail build the man page if xsltproc is not present (Daniel Veillard),
+  Re-adding xsltproc.1 (Daniel Veillard),
+  Fix time type in xsltSaveProfiling (Nick Wellnhofer),
+  Remove unused parameters (Nick Wellnhofer),
+  Suppress unused variable warning. (Nick Wellnhofer),
+  Remove unused variable in xsltGenerateIdFunction (Nick Wellnhofer),
+  Add test case for XPath function args in error case (Nick Wellnhofer),
+  Add comment about known-to-fail test (Nick Wellnhofer),
+  Adjust expected test output (Nick Wellnhofer),
+  Helper functions to evaluate compiled XPath expressions (Nick Wellnhofer),
+  Add tests for crypto:rc4 (Nick Wellnhofer),
+  Add first test case for EXSLT crypto module (Nick Wellnhofer),
+  Separate function for predicate matching in patterns (Nick Wellnhofer),
+  Initialize pseudo random number generator with current time or optional command line parameter (Nils Werner),
+  Adding doc update related to 1.1.28 (Daniel Veillard)
+  
+   - Cleanups:
+  Remove bogus test file (Nick Wellnhofer),
+  Add warning message to expected test output (Nick Wellnhofer)
+  
+
+
+1.1.28: Nov 21 2012:
+   -  Portability:
+    Fix python build by using libxsltmod_la_CPPFLAGS instead of AM_CPPFLAGS (Alexandre Rostovtsev),
+    configure should be more careful with linker script (Igor Pashev),
+    add gcrypt library in LIBADD, not LDFLAGS, as recommended (Roumen Petrov)
+  
+   -  Bug fixes:
+    Fix generate-id() to avoid generating the same ID (Stewart Brodie),
+    Fix crash with empty xsl:key/@match attribute (Nick Wellnhofer),
+    Crash when passing an uninitialized variable to document() (Nick Wellnhofer),
+    Add missing test docs to EXTRA_DIST (Nick Wellnhofer),
+    Fix regression: Default namespace not correctly used (Nick Wellnhofer)
+  
+   -  Cleanups:
+    Remove xsltTransStorageAdd and xsltTransStorageRemove from symbols.xml (Daniel Veillard),
+    autogen.sh cleanup (Daniel Richard),
+    consistent use of xslt processor (Roumen Petrov),
+    Add object files in tests/plugins to .gitignore (Nick Wellnhofer),
+    Fix error on bug-165 regression test (Daniel Veillard),
+    Remove xsltTransStorageAdd and xsltTransStorageRemove (Daniel Veillard),
+  
+
+
+1.1.27: Sep 12 2012:
+   -  Portability:
+    xincludestyle wasn't protected with LIBXML_XINCLUDE_ENABLED (Michael Bonfils),
+    Portability fix for testThreads.c (IlyaS),
+    FreeBSD portability fixes (Pedro F. Giffuni),
+    check for gmtime - on mingw* hosts will enable date-time function (Roumen Petrov),
+    use only native crypto-API for mingw* hosts (Roumen Petrov),
+    autogen: Only check for libtoolize (Colin Walters),
+    minimal mingw support (Roumen Petrov),
+    configure: acconfig.h is deprecated since autoconf-2.50 (Stefan Kost),
+    Fix a small out of tree compilation issue (Hao Hu),
+    Fix python generator to not use deprecated xmllib (Daniel Veillard),
+    link python module with python library (Frederic Crozat)
+  
+   -  Documentation:
+    Tiny doc improvement (Daniel Veillard),
+    Various documentation fixes for docs on internals (C. M. Sperberg-McQueen)
+  
+   -  Bug fixes:
+    Report errors on variable use in key (Daniel Veillard),
+    The XSLT namespace string is a constant one (Daniel Veillard),
+    Fix handling of names in xsl:attribute (Nick Wellnhofer),
+    Reserved namespaces in xsl:element and xsl:attribute (Nick Wellnhofer),
+    Null-terminate result string of cry:rc4_decrypt (Nick Wellnhofer),
+    EXSLT date normalization fix (James Muscat),
+    Exit after compilation of invalid func:result (Nick Wellnhofer),
+    Fix for EXSLT func:function (Nick Wellnhofer),
+    Rewrite EXSLT string:replace to be conformant (Nick Wellnhofer),
+    Avoid a heap use after free error (Chris Evans),
+    Fix a dictionary string usage (Chris Evans),
+    Output should not include extraneous newlines when indent is off (Laurence Rowe),
+    document('') fails to return stylesheets parsed from memory (Jason Viers),
+    xsltproc should return an error code if xinclude fails (Malcolm Purvis),
+    Forwards-compatible processing of unknown top level elements (Nick Wellnhofer),
+    Fix system-property with unknown namespace (Nick Wellnhofer),
+    Hardening of code checking node types in EXSLT (Daniel Veillard),
+    Hardening of code checking node types in various entry point (Daniel Veillard),
+    Cleanup of the pattern compilation code (Daniel Veillard),
+    Fix default template processing on namespace nodes (Daniel Veillard),
+    Fix a bug in selecting XSLT elements (Daniel Veillard),
+    Fixed bug #616839 (Daniel Mustieles),
+    Fix some case of pattern parsing errors (Abhishek Arya),
+    preproc: fix the build (Stefan Kost),
+    Fix a memory leak with xsl:number (Daniel Veillard),
+    Fix a problem with ESXLT date:add() with January (money_seshu Dronamraju),
+    Fix a memory leak if compiled with Windows locale support (Daniel Veillard),
+    Fix generate-id() to not expose object addresses (Daniel Veillard),
+    Fix curlies support in literals for non-compiled AVTs (Nick Wellnhofer),
+    Allow whitespace in xsl:variable with select (Nick Wellnhofer),
+    Small fixes to locale code (Nick Wellnhofer),
+    Fix bug 602515 (Nick Wellnhofer),
+    Fix popping of vars in xsltCompilerNodePop (Nick Wellnhofer),
+    Fix direct pattern matching bug (Nick Wellnhofer)
+  
+   -  Improvements:
+    Add the saxon:systemId extension (Mike Hommey),
+    Add an append mode to document output (Daniel Veillard),
+    Add new tests to EXTRA_DIST (Nick Wellnhofer),
+    Test for bug #680920 (Nick Wellnhofer),
+    fix regresson in Various "make distcheck" and other fixes (Roumen Petrov),
+    Various "make distcheck" and other fixes (Daniel Richard G),
+    Fix portability to upcoming libxml2-2.9.0 (Daniel Veillard),
+    Adding --system flag support to autogen.sh (Daniel Veillard),
+    Allow per-context override of xsltMaxDepth, introduce xsltMaxVars (Jérôme Carretero),
+    autogen.sh: Honor NOCONFIGURE environment variable (Colin Walters),
+    configure: support silent automake rules if possible (Stefan Kost),
+    Precompile patterns in xsl:number (Nick Wellnhofer),
+    Fix some warnings in the refactored code (Nick Wellnhofer),
+    Adding new generated files (Daniel Veillard),
+    profiling: add callgraph report (Stefan Kost)
+  
+   -  Cleanups:
+    Big space and tabs cleanup (Daniel Veillard),
+    Fix authors list (Daniel Veillard),
+    Cleanups some of the test makefiles (Daniel Richard),
+    Remove .cvsignore files which are not needed anymore (Daniel Veillard),
+    Cleanup some misplaced spaces and tabs (Daniel Veillard),
+    Augment list of ignored files (Daniel Veillard),
+    configure: remove checks for isinf and isnan as those are not used anyway (Stefan Kost),
+    Point to GIT for source code and a bit of cleanup (Daniel Veillard),
+    Get rid of specific build setup and STATIC_BINARIES (Daniel Veillard)
+  
+
+
+1.1.26: Sep 24 2009:
+   -  Improvement:
+    Add xsltProcessOneNode to exported symbols for lxml (Daniel Veillard)
+  
+   -  Bug fixes:
+    Fix an idness generation problem (Daniel Veillard),
+    595612 Try to fix some locking problems (Daniel Veillard),
+    Fix a crash on misformed imported stylesheets (Daniel Veillard)
+  
+
+
+1.1.25: Sep 17 2009:
+   -  Features:
+      Add API versioning and various cleanups (Daniel Veillard),
+      xsl:sort lang support using the locale (Nick Wellnhofer and Roumen Petrov)
+  
+   -  Documentation:
+      Fix the download links for Solaris (Daniel Veillard),
+      Fix makefile and spec file to include doc in rpm (Daniel Veillard)
+  
+   -  Portability:
+      Make sure testThreads is linked with pthreads (Daniel Veillard),
+      Fix potential crash on debug of extensions Solaris (Ben Walton),
+      applied patch from Roumen Petrov for mingw cross compilation problems (Roumen Petrov),
+      patch from Richard Jones to build shared libs with MinGW cross-compiler (Richard Jones),
+      fix include path when compiling with MinGW (Roumen Petrov),
+      portability fixes ( Nick Wellnhofer and Roumen Petrov)
+  
+   -  Bug fixes:
+      Big fixes of pattern compilations (Nick Wellnhofer),
+      Fix uses of xmlAddChild for error handling (Daniel Veillard),
+      Detect deep recusion on function calls (Daniel Veillard),
+      Avoid an error in namespace generation (Martin),
+      Fix importing of encoding from included stylesheets (Nick Wellnhofer),
+      Fix problems with embedded stylesheets and namespaces (Martin),
+      QName parsing fix for patterns (Martin),
+      Crash compiling stylesheet with DTD (Martin),
+      Fix xsl:strip-space with namespace and wildcard (Nick Wellnhofer),
+      Fix a mutex deadlock on unregistered extensions (Nix),
+      567192 xsltproc --output option ignore --xinclude (Joachim Breitner),
+      Fix redundant headers in list (Daniel Veillard),
+      134754 Configure's --with-html-dir related fixes (Julio M. Merino Vidal),
+      305913 a serious problem in extensions reentrancy (Daniel Veillard),
+      Fix an idness issue when building the tree (Daniel Veillard),
+      Fixed indexing error reported by Ron Burk on the mailing list. (William M. Brack),
+      prevent some unchecked pointer accesses (Jake Goulding),
+      fix for CVE-2008-2935 libexslt RC4 encryption/decryption functions Daniel (Daniel Veillard),
+      avoid a quadratic behaviour when hitting duplicates (Daniel Veillard),
+      544829 fixed option --with-debugger (Arun Ragnavan),
+      541965 fixed incorrect argument popping in exsltMathAtan2Function (William M. Brack),
+      fix problem with string check for element-available (Ron Burk),
+      539741 added code to handle literal within an AVT (William M. Brack)
+  
+   -  Improvements:
+      Allow use of EXSLT outside XSLT (Martin),
+      Support Esperanto locale (Nick Wellnhofer),
+      Change how attributes are copied for id and speed (Daniel Veillard),
+      Add API versioning and various cleanups (Daniel Veillard),
+      Adding a test program to check thread reentrancy (Daniel Veillard),
+      big patch from  finishing xsl:sort lang support (Roumen Petrov),
+      add xsl:sort lang support using the locale (Nick Wellnhofer)
+  
+   -  Cleanups:
+      Label xsltProcessOneNode as static (Daniel Veillard),
+      git setup (Daniel Veillard),
+      fixed typo detected by new libxml2 code (William M. Brack),
+      xsltExtFunctionLookup was defined but never implemented (Ralf Junker)
+  
+
+
+1.1.24: May 13 2008:
+   - Documentation: man page fix (Vincent Lefevre).
+   - Bug fixes: pattern bug fix, key initialization problems, exclusion of
+      unknown namespaced element on top of stylesheets, python generator
+      syntactic cleanup (Martin)
+
+
+1.1.23: Apr  8 2008:
+   - Documentation: fix links for Cygwin DocBook setup (Philippe Bourcier),
+      xsltParseStylesheetDoc doc fix (Jason Viers), fix manpage default
+      maxdepth value 
+   - Bug fixes: python segfault (Daniel Gryniewicz), week-in-year bug fix
+      (Maurice van der Pot), fix python iterator problem (William Brack),
+      avoid garbage collection problems on str:tokenize and str:split
+      and function results (William Brack and Peter Pawlowski) 
+      superfluous re-generation of keys (William Brack), remove superfluous
+      code in xsltExtInitTest (Tony Graham), func:result segfault fix
+      (William Brack), timezone offset problem (Peter Pawlowski),
+   - Portability fixes: old gcrypt support fix (Brent Cowgill), Python
+      portability patch (Stephane Bidoul), VS 2008 fix (Rob Richard) 
+
+
+1.1.22: Aug 23 2007:
+   - Bug fixes: RVT cleanup problems (William Brack), exclude-result-prefix
+      bug (William Brack), stylesheet compilation error handling (Rob Richards).
+      
+   - Portability fixes: improve build with VS2005 (Rob Richards), 
+      fixing build on AIX (Bjorn Wiberg), fix the security file checks on
+      Windows (Roland Schwarz and Rob Richards). 
+   - Improvement: add an --encoding option to xsltproc (Drazen Kacar). 
+
+
+1.1.21: Jun 12 2007:
+   - Bug fixes: out of memory allocation errors (William Brack), 
+      namespace problem on compound predicates (William Brack),
+      python space/tab inconsistencies (Andreas Hanke), hook xsl:message
+      to per transformation error callbacks (Shaun McCance),
+      cached RVT problem (William Brack), XPath context maintainance
+      on choose (William Brack), memory leaks in the math module (William
+      Brack), exclude-result-prefix induced namespace problem (William
+      Brack)
+   - Build: configure setup for TRIO_REPLACE_STDIO (William Brack)
+  
+   - Documentation: updated after change from CVs to SVN (William Brack)
+
+
+1.1.20: Jan 17 2007:
+   - Portability fixes: strict aliasing fix (Marcus Meissner), BSD portability
+      patches (Roland Illig)
+   - Bug fixes: Result Value Tree handling fix (William Brack), function
+      parameters fix (William), uninitialized variable (Kjartan Maraas),
+      empty text node handling (William), plugin support and test fixes (William),
+      fragment support fixes (William)
+   - Improvements: python stylesheet compare and transform context
+      access (Nic Ferrier), EXSLT string replace support (Joel Reed),
+      xsltproc better low level error handling (Mike Hommey and William)
+
+
+1.1.19: Nov 29 2006:
+   - Bug fixes: entities within attributes (William Brack), Python detection
+      problem (Joseph Sacco), in-scope namespace bug (Mike Hommey), Result
+      value tree caching bug (William Brack)
+
+
+1.1.18: Oct 26 2006:
+   - portability and build fixes: DESTDIR problem, build paths in python
+      shared lib, compile when libxml2 doesn't support XInclude (Gary Coady).
+   - bug fixes: a number of namespace related bugs (Kasimier Buchcik), 
+      parameters bugs (Kasimier Buchcik), proximity position in predicates
+      of match patterns (Kasimier), exslt-node-set troubles with strings
+      (Kasimier), CDATA serialization, Python floats and booleans XPath
+      conversions, XInclude support fixes, RVT cleanup problem (William Brack
+      and Kasimier), attribute checking in stylesheets (Kasimier), xsltForEach
+      context problem (Kasimier), security check should pass full URLs (Shane
+      Corgatelli), security cleanup patch (Mikhail Zabaluev), some python
+      accessor for stylesheet were broken, memory errors when compiling 
+      stylesheets (Mike Hommey), EXSLT current date end-of-month problem
+      (William Brack).
+   - improvements: refactoring of namespace handling, value-of impleemntation
+      and template internal processing (Kasimier Buchcik), new xsltproc
+      flag to apply Xinclude to stylesheets.
+   - documentation: xsltproc man pages (Daniel Leidert), tests updates
+      (William Brack), various typo fixes (Daniel Leidert), comments on
+      versions macros (Peter Breitenlohner).
+
+
+1.1.17: Jun 6 2006:
+   - portability fixes: python detection
+   - bug fixes: some regression tests, attribute/namespaces output (Kasimier
+    Buchcik), problem in mixed xsl:value-of and xsl:text uses (Kasimier)
+   - improvements: internal refactoring (Kasimier Buchcik), use of the XPath
+    object cache in libxml2-2.6.25 (Kasimier)
+
+
+1.1.16: May 01 2006:
+   - portability fixes: EXSLT date/time on Solaris and IRIX (Albert Chin),
+      HP-UX  build (Albert Chin), 
+  
+   - build fixes: Python detection(Joseph Sacco), plugin configurei
+      (Joel Reed)
+   - bug fixes: pattern compilation fix(William Brack), EXSLT date/time
+      fix (Thomas Broyer), EXSLT function bug, potential loop on variable
+      eval, startup race (Christopher Palmer), debug statement left in python
+      (Nic Ferrier), various cleanup based on Coverity reports), error on
+      Out of memory condition (Charles Hardin), various namespace prefixes
+      fixes (Kasimier Buchcik), 
+   - improvement: speed up sortingi, start of internals refactoring (Kasimier
+      Buchcik)
+   - documentation: man page fixes and updates (Daniel Leidert)
+
+
+
+1.1.15: Sep 04 2005:
+   - build fixes: Windows build cleanups and updates (Igor Zlatkovic),
+    remove jhbuild warnings
+   - bug fixes: negative number formatting (William Brack), number
+    formatting per mille definition (William Brack), XInclude default values
+    (William), text copy bugs (William), bug related to xmlXPathContext size,
+    reuse libxml2 memory management for text nodes, dictionary text bug,
+    forbid variables in match (needs libxml2-2.6.21)
+   - improvements: EXSLT dyn:map (Mark Vakoc),
+   - documentation: EXSLT date and time functions namespace in man (Jonathan
+    Wakely)
+
+
+1.1.14: Apr 02 2005:
+   - bug fixes: text node on stylesheet document without a dictionary
+    (William Brack), more checking of XSLT syntax, calling xsltInit()
+    multiple times, mode values interning raised by Mark Vakoc, bug in
+    pattern matching with ancestors, bug in patterna matching with cascading
+    select, xinclude and document() problem, build outside of source tree
+    (Mike Castle)
+   - improvement: added a --nodict mode to xsltproc to check problems for
+    docuemtns without dictionaries
+
+
+1.1.13: Mar 13 2005:
+   - build fixes: 64bits cleanup (William Brack), python 2.4 test (William),
+    LIBXSLT_VERSION_EXTRA on Windows (William), Windows makefiles fixes (Joel
+    Reed), libgcrypt-devel requires for RPM spec.
+   - bug fixes: exslt day-of-week-in-month (Sal Paradise), xsl:call-template
+    should not change the current template rule (William Brack), evaluation
+    of global variables (William Brack), RVT's in XPath predicates (William),
+    namespace URI on template names (Mark Vakoc), stat() for Windows patch
+    (Aleksey Gurtovoy), pattern expression fixes (William Brack), out of
+    memory detection misses (William), parserOptions propagation (William),
+    exclude-result-prefixes fix (William), // patten fix (William).
+   - extensions: module support (Joel Reed), dictionary based speedups
+    trying to get rid of xmlStrEqual as much as possible.
+   - documentation: added Wiki (Joel Reed)
+
+
+1.1.12: Oct 29 2004:
+   - build fixes: warnings removal (William).
+   - bug fixes: attribute document pointer fix (Mark Vakoc), exslt date
+    negative periods (William Brack), generated tree structure fixes,
+    namespace lookup fix, use reentrant gmtime_r (William Brack),
+    exslt:funtion namespace fix (William), potential NULL pointer reference
+    (Dennis Dams, William), force string interning on generated
+  documents.
+   - documentation: update of the second tutorial (Panagiotis Louridas), add
+    exslt doc in rpm packages, fix the xsltproc man page.
+
+
+1.1.11: Sep 29 2004:
+   - bug fixes: xsl:include problems (William Brack), UTF8 number pattern
+    (William), date-time validation (William), namespace fix (William),
+    various Exslt date fixes (William), error callback fixes, leak with
+    namespaced global variable, attempt to fix a weird problem #153137
+   - improvements: exslt:date-sum tests (Derek Poon)
+   - documentation: second tutorial by Panagiotis Lourida
+
+
+1.1.10: Aug 31 2004:
+   - build fix: NUL in c file blocking compilation on Solaris, Windows build
+    (Igor Zlatkovic)
+   - fix: key initialization problem (William Brack)
+   - documentation: fixed missing man page description for --path
+
+
+1.1.9: Aug 22 2004:
+   - build fixes: missing tests (William Brack), Python dependancies, Python
+    on 64bits boxes, --with-crypto flag (Rob Richards),
+   - fixes: RVT key handling (William), Python binding (William and Sitsofe
+    Wheeler), key and XPath troubles (William), template priority on imports
+    (William), str:tokenize with empty strings (William), #default namespace
+    alias behaviour (William), doc ordering missing for main document
+    (William), 64bit bug (Andreas Schwab)
+   - improvements: EXSLT date:sum added (Joel Reed), hook for document
+    loading for David Hyatt, xsltproc --nodtdattr to avoid defaulting DTD
+    attributes, extend xsltproc --version with CVS stamp (William).
+   - Documentation: web page problem reported by Oliver Stoeneberg
+
+
+1.1.8: July 5 2004:
+   - build fixes: Windows runtime options (Oliver Stoeneberg), Windows
+    binary package layout (Igor Zlatkovic), libgcrypt version test and link
+    (William)
+   - documentation: fix libxslt namespace name in doc (William)
+   - bug fixes: undefined namespace message (William Brack), search engine
+    (William), multiple namespace fixups (William), namespace fix for key
+    evaluation (William), Python memory debug bindings,
+   - improvements: crypto extensions for exslt (Joel Reed, William)
+
+
+1.1.7: May 17 2004:
+   - build fix: warning about localtime_r on Solaris
+   - bug fix: UTF8 string tokenize (William Brack), subtle memory
+    corruption, linefeed after comment at document level (William),
+    disable-output-escaping problem (William), pattern compilation in deep
+    imported stylesheets (William), namespace extension prefix bug,
+    libxslt.m4 bug (Edward Rudd), namespace lookup for attribute, namespaced
+    DOCTYPE name
+
+
+1.1.6: Apr 18 2004:
+   - 2 bug fixes about keys fixed one by Mark Vakoc
+
+
+1.1.5: Mar 23 2004:
+   - performance: use dictionary lookup for variables
+   - remove use of _private from source documents
+   - cleanup of "make tests" output
+   - bugfixes: AVT in local variables, use localtime_r to avoid thread
+    troubles (William), dictionary handling bug (William), limited number of
+    stubstitutions in AVT (William), tokenize fix for UTF-8 (William),
+    superfluous namespace (William), xsltproc error code on
+     halt, OpenVMS fix, dictionary reference counting
+    change.
+
+
+1.1.4: Feb 23 2004:
+   - bugfixes: attributes without doc (Mariano Suárez-Alvarez), problem with
+    Yelp, extension problem
+   - display extension modules (Steve Little)
+   - Windows compilation patch (Mark Vadoc), Mingw (Mikhail Grushinskiy)
+
+
+1.1.3: Feb 16 2004:
+   - Rewrote the Attribute Value Template code, new XPath compilation
+    interfaces, dictionary reuses for XSLT with potential for serious
+    performance improvements.
+   - bug fixes: portability (William Brack), key() in node-set() results
+    (William), comment before doctype (William), math and node-set() problems
+    (William), cdata element and default namespace (William), behaviour on
+    unknown XSLT elements (Stefan Kost), priority of "//foo" patterns
+    (William), xsl:element and xsl:attribute QName check (William), comments
+    with -- (William), attribute namespace (William), check for ?> in PI
+    (William)
+   - Documentations: cleanup (John Fleck and William)
+   - Python: patch for OS-X (Gianni Ceccarelli), enums export (Stephane
+    bidoul)
+
+
+1.1.2: Dec 24 2003:
+   - Documentation fixes (John Fleck, William Brack), EXSLT documentation
+    (William Brack)
+   - Windows compilation fixes for MSVC and Mingw (Igor Zlatkovic)
+   - Bug fixes: exslt:date returning NULL strings (William Brack),
+    namespaces output (William Brack),  key and namespace definition problem,
+    passing options down to the document() parser, xsl:number fixes (William
+    Brack)
+
+
+1.1.1: Dec 10 2003:
+   - code cleanup (William Brack)
+   - Windows: Makefile improvements (Igor Zlatkovic)
+   - documentation improvements: William Brack, libexslt man page (Jonathan
+    Wakely)
+   - param in EXSLT functions (Shaun McCance)
+   - XSLT debugging improvements (Mark Vakoc)
+   - bug fixes: number formatting (Bjorn Reese), exslt:tokenize (William
+    Brack), key selector parsing with | reported by Oleg Paraschenko,
+    xsl:element with computed namespaces (William Brack), xslt:import/include
+    recursion detection (William Brack), exslt:function used in keys (William
+    Brack), bug when CDATA_SECTION are foun in the tree (William Brack),
+    entities handling when using XInclude.
+
+
+1.1.0: Nov 4 2003:
+   - Removed DocBook SGML broken support
+   - fix xsl:key to work with PIs
+   - Makefile and build improvement (Graham Wilson), build cleanup (William
+    Brack), macro fix (Justin Fletcher), build outside of source tree (Roumen
+    Petrov)
+   - xsltproc option display fix (Alexey Efimov), --load-trace (Crutcher
+    Dunnavant)
+   - Python: never use stdout for error
+   - extension memory error fix (Karl Eichwalder)
+   - header path fixes (Steve Ball)
+   - added saxon:line-number() to libexslt (Brett Kail)
+   - Fix some tortuous template problems when using predicates (William
+    Brack)
+   - Debugger status patch (Kasimier Buchcik)
+   - Use new libxml2-2.6.x APIs for faster processing
+   - Make sure xsl:sort is empty
+   - Fixed a bug in default processing of attributes
+   - Removes the deprecated breakpoint library
+   - detect invalid names on templates (William Brack)
+   - fix exslt:document (and similar) base handling problem
+
+
+1.0.33: Sep 12 2003:
+This is a bugfix only release   - error message missing argument (William Brack)
+   - mode not cascaded in template fallbacks (William Brack)
+   - catch redefinition of parameter/variables  (William Brack)
+   - multiple keys with same namespace name (William Brack)
+   - patch for compilation using MingW on Windows (Mikhail Grushinskiy)
+   - header export macros for Windows (Igor Zlatkovic)
+   - cdata-section-elements handling of namespaced names
+   - compilation without libxml2 XPointer support (Mark Vadoc)
+   - apply-templates crash (William Brack)
+   - bug with imported templates (William Brack)
+   - imported attribute-sets merging bug (DocBook) (William Brack)
+
+
+1.0.32: Aug 9 2003:
+   - bugfixes: xsltSaveResultToFile() python binding (Chris Jaeger), EXSLT
+    function (William Brack), RVT for globals (William Brack), EXSLT date
+    (William Brack),
+    speed of large text output, xsl:copy with attributes, strip-space and
+    namespaces prefix, fix for --path xsltproc option, EXST:tokenize (Shaun
+    McCance), EXSLT:seconds (William Brack), sort with multiple keys (William
+    Brack), checking of { and } for attribute value templates (William
+    Brack)
+  
+   - Python bindings for extension elements (Sean Treadway)
+   - EXSLT:split added (Shaun McCance)
+   - portability fixes for HP-UX/Solaris/IRIX (William Brack)
+   - doc cleanup
+
+
+1.0.31: Jul 6 2003:
+   - bugfixes: xsl:copy on namespace nodes, AVT for xsl:sort order, fix for
+    the debugger (Keith Isdale), output filename limitation, trio.h and
+    triodef.h added (Albert Chin), EXSLT node-set (Peter Breitenlohner),
+    xsltChoose and whitespace (Igor Zlatkovic),
+    stylesheet compilation (Igor Zlatkovic), NaN and sort (William Brack),
+    RVT bug introduced in 1.0.30
+  
+   - avoid generating " (fix in libxml2-2.5.8)
+   - fix 64bit cleaness problem and compilation troubles introduced in
+  1.0.30
+   - Windows makefile generation (Igor Zlatkovic)
+   - HP-UX portability fix
+
+
+1.0.30: May 4 2003:
+   - Fixes and new APIs to handle Result Value Trees and avoid leaks
+   - Fixes for: EXSLT math pow() function (Charles Bozeman), global
+    parameter and global variables mismatch, a segfault on pattern
+    compilation errors, namespace copy in xsl:copy-of, python generator
+    problem, OpenVMS trio update, premature call to xsltFreeStackElem (Igor),
+    current node when templates applies to attributes
+
+
+1.0.29: Apr 1 2003:
+   - performance improvements especially for large flat documents
+   - bug fixes: Result Value Tree handling, XML IDs, keys(), extra namespace
+    declarations with xsl:elements.
+   - portability: python and trio fixes (Albert Chin), python on Solaris
+    (Ben Phillips)
+
+
+1.0.28: Mar 24 2003:
+   - fixed node() in patterns semantic.
+   - fixed a memory access problem in format-number()
+   - fixed stack overflow in recursive global variable or params
+   - cleaned up Result Value Tree handling, and fixed a couple of old bugs
+    in the process
+
+
+1.0.27: Feb 24 2003:
+   - bug fixes: spurious xmlns:nsX="" generation, serialization bug (in
+    libxml2), a namespace copy problem, errors in the RPM spec prereqs
+   - Windows path canonicalization and document cache fix (Igor)
+
+
+1.0.26: Feb 10 2003:
+   - Fixed 3 serious bugs in document() and stylesheet compilation which
+    could lead to a crash
+
+
+1.0.25: Feb 5 2003:
+   - Bug fix: double-free for standalone stylesheets introduced in 1.0.24, C
+    syntax pbm, 3 bugs reported by Eric van der Vlist
+   - Some XPath and XInclude related problems were actually fixed in
+    libxml2-2.5.2
+   - Documentation: emphasize taht --docbook is not for XML docs.
+
+
+1.0.24: Jan 14 2003:
+   - bug fixes: imported global varables, python bindings (Stéphane Bidoul),
+    EXSLT memory leak (Charles Bozeman), namespace generation on
+    xsl:attribute, space handling with imports (Daniel Stodden),
+    extension-element-prefixes (Josh Parsons), comments within xsl:text (Matt
+    Sergeant), superfluous xmlns generation, XInclude related bug for
+    numbering, EXSLT strings (Alexey Efimov), attribute-sets computation on
+    imports, extension module init and shutdown callbacks not called
+   - HP-UX portability (Alexey Efimov), Windows makefiles (Igor and Stephane
+    Bidoul), VMS makefile updates (Craig A. Berry)
+   - adds xsltGetProfileInformation() (Michael Rothwell)
+   - fix the API generation scripts
+   - API to provide the sorting routines (Richard Jinks)
+   - added XML description of the EXSLT API
+   - added ESXLT URI (un)escaping (Jörg Walter)
+   - Some memory leaks have been found and fixed
+   - document() now support fragment identifiers in URIs
+
+
+1.0.23: Nov 17 2002:
+   - Windows build cleanup (Igor)
+   - Unix build and RPM packaging cleanup
+   - Improvement of the python bindings: extension functions and activating
+    EXSLT
+   - various bug fixes: number formatting, portability for bounded string
+    functions, CData nodes, key(), @*[...] patterns
+   - Documentation improvements (John Fleck)
+   - added libxslt.m4 (Thomas Schraitle)
+
+
+1.0.22: Oct 18 2002:
+   - Updates on the Windows Makefiles
+   - Added a security module, and a related set of new options to
+  xsltproc
+   - Allowed per transformation error handler.
+   - Fixed a few bugs: node() semantic, URI escaping, media-type, attribute
+    lists
+
+
+1.0.21: Sep 26 2002:
+   - Bug fixes: match="node()", date:difference() (Igor and Charlie
+    Bozeman), disable-output-escaping
+   - Python bindings: style.saveResultToString() from Ralf Mattes
+   - Logos from Marc Liyanage
+   - Mem leak fix from Nathan Myers
+   - Makefile: DESTDIR fix from Christophe Merlet, AMD x86_64 (Mandrake),
+    Windows (Igor), Python detection
+   - Documentation improvements: John Fleck
+
+
+1.0.20: Aug 23 2002:
+   - Windows makefile updates (Igor) and x86-64 (Frederic Crozat)
+   - fixed HTML meta tag saving for Mac/IE users
+   - possible leak patches from Nathan Myers
+   - try to handle document('') as best as possible depending in the
+  cases
+   - Fixed the DocBook stylesheets handling problem
+   - Fixed a few XSLT reported errors
+
+
+1.0.19:  July 6 2002:
+   - EXSLT: dynamic functions and date support bug fixes (Mark Vakoc)
+   - xsl:number fix: Richard Jinks
+   - xsl:format-numbers fix: Ken Neighbors
+   - document('') fix: bug pointed by Eric van der Vlist
+   - xsl:message with terminate="yes" fixes: William Brack
+   - xsl:sort order support added: Ken Neighbors
+   - a few other bug fixes, some of them requiring the latest version of
+    libxml2
+
+
+1.0.18: May 27 2002:
+   - a number of bug fixes: attributes, extra namespace declarations
+    (DocBook), xsl:include crash (Igor), documentation (Christian Cornelssen,
+    Charles Bozeman and Geert Kloosterman),  element-available (Richard
+  Jinks)
+   - xsltproc can now list teh registered extensions thanks to Mark
+  Vakoc
+   - there is a new API to save directly to a string
+    xsltSaveResultToString() by Morus Walter
+   - specific error registration function for the python API
+
+
+1.0.17: April 29 2002:
+   - cleanup in code, XSLT debugger support and Makefiles for Windows by
+  Igor
+   - a C++ portability fix by Mark Vakoc
+   - EXSLT date improvement and regression tests by Charles Bozeman
+   - attempt to fix a bug in xsltProcessUserParamInternal
+
+
+1.0.16: April 15 2002:
+   - Bug fixes: strip-space, URL in HTML output, error when xsltproc can't
+    save
+   - portability fixes: OSF/1, IEEE on alphas, Windows, Python bindings
+
+
+1.0.15: Mar 25 2002:
+   - Bugfixes: XPath, python Makefile, recursive attribute sets, @foo[..]
+    templates
+   - Debug of memory alocation with valgind
+   - serious profiling leading to significant improvement for DocBook
+    processing
+   - revamp of the Windows build
+
+
+1.0.14: Mar 18 2002:
+   - Improvement in the XPath engine (libxml2-2.4.18)
+   - Nasty bug fix related to exslt:node-set
+   - Fixed the python Makefiles, cleanup of doc comments, Windows
+    portability fixes
+
+
+1.0.13: Mar 8 2002:
+   - a number of bug fixes including "namespace node have no parents"
+   - Improvement of the Python bindings
+   - Charles Bozeman provided fixes and regression tests for exslt date
+    functions.
+
+
+1.0.12: Feb 11 2002:
+   - Fixed the makefiles especially the python module ones
+   - half a dozen bugs fixes including 2 old ones
+
+
+1.0.11: Feb 8 2002:
+   - Change of Licence to the MIT
+  Licence
+   - Added a beta version of the Python bindings, including support to
+    extend the engine with functions written in Python
+   - A number of bug fixes
+   - Charlie Bozeman provided more EXSLT functions
+   - Portability fixes
+
+
+1.0.10: Jan 14 2002:
+   - Windows fixes for Win32 from Igor
+   - Fixed the Solaris compilation trouble (Albert)
+   - Documentation changes and updates: John Fleck
+   - Added a stringparam option to avoid escaping hell at the shell
+  level
+   - A few bug fixes
+
+
+1.0.9: Dec 7 2001:
+   - Makefile patches from Peter Williams
+   - attempt to fix the compilation problem associated to prelinking
+   - obsoleted libxsltbreakpoint now deprecated and frozen to 1.0.8 API
+   - xsltproc return codes are now significant, John Fleck updated the
+    documentation
+   - patch to allow as much as 40 steps in patterns (Marc Tardif), should be
+    made dynamic really
+   - fixed a bug raised by Nik Clayton when using doctypes with HTML
+  output
+   - patches from Keith Isdale to interface with xsltdebugger
+
+
+1.0.8: Nov 26 2001:
+   - fixed an annoying header problem, removed a few bugs and some code
+    cleanup
+   - patches for Windows and update of Windows Makefiles by Igor
+   - OpenVMS port instructions from John A Fotheringham
+   - fixed some Makefiles annoyance and libraries prelinking
+  information
+
+
+1.0.7: Nov 10 2001:
+   - remove a compilation problem with LIBXSLT_PUBLIC
+   - Finishing the integration steps for Keith Isdale debugger
+   - fixes the handling of indent="no" on HTML output
+   - fixes on the configure script and RPM spec file
+
+
+1.0.6: Oct 30 2001:
+   - bug fixes on number formatting (Thomas), date/time functions (Bruce
+    Miller)
+   - update of the Windows Makefiles (Igor)
+   - fixed DOCTYPE generation rules for HTML output (me)
+
+
+1.0.5: Oct 10 2001:
+   - some portability fixes, including Windows makefile updates from
+  Igor
+   - fixed a dozen bugs on XSLT and EXSLT (me and Thomas Broyer)
+   - support for Saxon's evaluate and expressions extensions added (initial
+    contribution from Darren Graves)
+   - better handling of XPath evaluation errors
+
+
+1.0.4: Sep 12 2001:
+   - Documentation updates from John fleck
+   - bug fixes (DocBook  FO generation should be fixed)  and portability
+    improvements
+   - Thomas Broyer improved the existing EXSLT support and added String,
+    Time and Date core functions support
+
+
+1.0.3:  Aug 23 2001:
+   - XML Catalog support see the doc
+   - New NaN/Infinity floating point code
+   - A few bug fixes
+
+
+1.0.2:  Aug 15 2001:
+   - lot of bug fixes, increased the testsuite
+   - a large chunk of EXSLT is implemented
+   - improvements on the extension framework
+   - documentation improvements
+   - Windows MSC projects files should be up-to-date
+   - handle attributes inherited from the DTD by default
+
+
+1.0.1:  July 24 2001:
+   - initial EXSLT framework
+   - better error reporting
+   - fixed the profiler on Windows
+   - bug fixes
+
+
+1.0.0: July 10 2001:
+   - a lot of cleanup, a lot of regression tests added or fixed
+   - added a documentation for writing
+    extensions
+   - fixed some variable evaluation problems (with William)
+   - added profiling of stylesheet execution accessible as the xsltproc
+    --profile option
+   - fixed element-available() and the implementation of the various
+    chunking methods present, Norm Walsh provided a lot of feedback
+   - exclude-result-prefixes and namespaces output should now work as
+    expected
+   - added support of embedded stylesheet as described in section 2.7 of the
+    spec
+
+
+0.14.0: July 5 2001:
+   - lot of bug fixes, and code cleanup
+   - completion of the little XSLT-1.0 features left unimplemented
+   - Added and implemented the extension API suggested by Thomas Broyer
+   - the Windows MSC environment should be complete
+   - tested and optimized with a really large document (DocBook Definitive
+    Guide) libxml/libxslt should really be faster on serious workloads
+
+
+0.13.0: June 26 2001:
+   - lots of cleanups
+   - fixed a C++ compilation problem
+   - couple of fixes to xsltSaveTo()
+   - try to fix Docbook-xslt-1.4 and chunking, updated the regression test
+    with them
+   - fixed pattern compilation and priorities problems
+   - Patches for Windows and MSC project mostly contributed by Yon Derek
+   - update to the Tutorial by John Fleck
+   - William fixed bugs in templates and for-each functions
+   - added a new interface xsltRunStylesheet() for a more flexible output
+    (incomplete), added -o option to xsltproc
+
+
+0.12.0: June 18 2001:
+   - fixed a dozen of bugs reported
+   - HTML generation should be quite better (requires libxml-2.3.11 upgrade
+    too)
+   - William fixed some problems with document()
+   - Fix namespace nodes selection and copy (requires libxml-2.3.11 upgrade
+    too)
+   - John Fleck added a
+  tutorial
+   - Fixes for namespace handling when evaluating variables
+   - XInclude global flag added to process XInclude on document() if
+    requested
+   - made xsltproc --version more detailed
+
+
+0.11.0: June 1 2001:
+Mostly a bug fix release.   - integration of catalogs from xsltproc
+   - added --version to xsltproc for bug reporting
+   - fixed errors when handling ID in external parsed entities
+   - document() should hopefully work correctly but ...
+   - fixed bug with PI and comments processing
+   - William fixed the XPath string functions when using unicode
+
+
+0.10.0: May 19 2001:
+   - cleanups to make stylesheet read-only (not 100% complete)
+   - fixed URI resolution in document()
+   - force all XPath expression to be compiled at stylesheet parsing time,
+    even if unused ...
+   - Fixed HTML default output detection
+   - Fixed double attribute generation #54446
+   - Fixed {{ handling in attributes #54451
+   - More tests and speedups for DocBook document transformations
+   - Fixed a really bad race like bug in xsltCopyTreeList()
+   - added a documentation on the libxslt internals
+   - William Brack and Bjorn Reese improved format-number()
+   - Fixed multiple sort, it should really work now
+   - added a --docbook option for SGML DocBook input (hackish)
+   - a number of other bug fixes and regression test added as people were
+    submitting them
+
+
+0.9.0: May 3 2001:
+   - lot of various bugfixes, extended the regression suite
+   - xsltproc should work with multiple params
+   - added an option to use xsltproc with HTML input
+   - improved the stylesheet compilation, processing of complex stylesheets
+    should be faster
+   - using the same stylesheet for concurrent processing on multithreaded
+    programs should work now
+   - fixed another batch of namespace handling problems
+   - Implemented multiple level of sorting
+
+
+0.8.0: Apr 22 2001:
+   - fixed ansidecl.h problem
+   - fixed unparsed-entity-uri() and generate-id()
+   - sort semantic fixes and priority prob from William M. Brack
+   - fixed namespace handling problems in XPath expression computations
+    (requires libxml-2.3.7)
+   - fixes to current() and key()
+   - other, smaller fixes, lots of testing with N Walsh DocBook HTML
+    stylesheets
+
+
+0.7.0: Apr 10 2001:
+   - cleanup using stricter compiler flags
+   - command line parameter passing
+   - fix to xsltApplyTemplates from William M. Brack
+   - added the XSLTMark in the regression tests as well as document()
+
+
+0.6.0: Mar 22 2001:
+   - another beta
+   - requires 2.3.5, which provide XPath expression compilation support
+   - document() extension should function properly
+   - fixed a number or reported bugs
+
+
+0.5.0: Mar 10 2001:
+   - fifth beta
+   - some optimization work, for the moment 2 XSLT transform cannot use the
+    same stylesheet at the same time (to be fixed)
+   - fixed problems with handling of tree results
+   - fixed a reported strip-spaces problem
+   - added more reported/fixed bugs to the test suite
+   - incorporated William M. Brack fix for imports and global variables as
+    well as patch for with-param support in apply-templates
+   - a bug fix on for-each
+
+
+0.4.0: Mar 1 2001:
+   - fourth beta test, released at the same time of libxml2-2.3.3
+   - bug fixes
+   - some optimization
+   - started implement extension support, not finished
+   - implemented but not tested multiple file output
+
+
+0.3.0: Feb 24 2001:
+   - third beta test, released at the same time of libxml2-2.3.2
+   - lot of bug fixes
+   - some optimization
+   - added DocBook XSL based testsuite
+
+
+0.2.0: Feb 15 2001:
+   - second beta version, released at the same time as libxml2-2.3.1
+   - getting close to feature completion, lot of bug fixes, some in the HTML
+    and XPath support of libxml
+   - start becoming usable for real work. This version can now regenerate
+    the XML 2e HTML from the original XML sources and the associated
+    stylesheets (in section I of the XML
+    REC)
+   - Still misses extension element/function/prefixes support. Support of
+    key() and document() is not complete
+
+
+0.1.0: Feb 8 2001:
+   - first beta version, released at the same time as libxml2-2.3.0
+   - lots of bug fixes, first "testing" version, but incomplete
+
+
+0.0.1: Jan 25 2001:
+   - first alpha version released at the same time as libxml2-2.2.12
+   - Framework in place, should work on simple examples, but far from being
+    feature complete
+
+Daniel Veillard at 
+bugs.html
diff --git a/NOTES b/NOTES
new file mode 100644
index 0000000..1314b8d
--- /dev/null
+++ b/NOTES
@@ -0,0 +1,253 @@
+
+        NOTES relative to the implementation
+	====================================
+
+xsl:stylesheet:
+
+  all children except xsl:import can be in any order, so this
+can be stored as one big structure.
+
+xsl:include:
+  
+  this is really similar to XInclude, can be implemented as a
+nearly separate processing just after the XML stylesheet has been
+parsed.
+  Detect loops using a limited stack ...
+
+xsl:import:
+
+  seems this should be really implemented as having a stylesheet
+sublist being itself an import list
+
+  add the list at the end
+  when doing a resolution explore child before siblings in the list
+
+3 Data Model, we should operate on parsed trees
+
+3.1 No problem
+
+3.2 use the XML Base call, XSLT-1.1 references it
+
+3.4 Whitespace Stripping
+
+  Seems one may have to do a bit of preprocessing on both the
+stylesheet trees and the source trees.
+
+4 Expressions
+
+  looks okay, wondering about variable bindings though...
+  default namespace not in scope
+
+5.1 Processing Model
+
+  look in Michael Kay's book about how to efficiently find the
+template applying to a node. Might influence the in-memory stylesheet
+representation
+
+5.2 Patterns
+
+  the end of that section suggest that the expression could be computed in
+a simpler way. Maybe templates needs to be evaluated differently than
+through the normal XPath processing. This can be implemented separately
+or build an expression tree in the XPath module and use a different 
+evaluation mechanism. Not sure this is best.
+
+5.4 Applying Template Rules
+
+  xsl:apply-templates is the recurstion mechanism, note the select
+mechanism.
+
+  detection of loop: once the applied nodeset has been computed,
+check that none of the elements is part of the existing set in use, this
+may be costly and should be triggered only at a certain depth.
+
+5.5 Conflict Resolution for Template Rules
+
+  Sounds again that evaluation of a pattern rule should provide one
+more information not provided by the standard XPath evaluation
+
+5.6 Overriding Template Rules
+
+  another recursion mechanism, confirm that it is needed to separate
+the imported stylesheets.
+
+5.7 Modes
+
+  Confusing ??? need an example.
+
+6 Named Templates
+
+  No big deal it seems
+
+7.1.1 Literal Result Elements
+
+  cleanup of the namespace template should be done initially at stylesheet
+parsing.
+
+7.1.2 Creating Elements with xsl:element
+
+   okay, I bet it's usually used with { } expression computations
+
+7.1.3 Creating Attributes with xsl:attribute
+
+   need some running code to better understand all the subtilties
+
+7.1.4 Named Attribute Sets
+
+   Okay just a way to mimick param entities use fo attrib groups in Dtd's
+
+7.2 Creating Text
+
+   adjacent text nodes are merged ... okay
+   output escapeing might need a libxml API extension
+
+7.3 Creating Processing Instructions
+7.4 Creating Comments
+
+   RAS, one just need to make a couple of trivial checks
+
+7.5 Copying
+
+   Okay will need some testing
+
+7.6.1 Generating Text with xsl:value-of
+
+   will be a good test for XPath string() function
+   note in the example that the text nodes are coalesced
+
+7.6.2 Attribute Value Templates
+
+   hum, this is 
+    - contextual
+    - uses XPath
+
+  best seems to parse, generate an evaluation tree then evaluate
+when accessed. Note that multipe expressions can be associated to 
+a single attribute. Sounds like i will have to introduce a new
+element type inserted in the attribute nodelist. dohh ...
+
+7.7 Numbering
+
+  sounds interesting for users but might be costly, we will see ...
+
+7.7.1 Number to String Conversion Attributes
+
+   format="..." :-( it's gonna be painful ...
+
+8 Repetition
+9 Conditional Processing
+
+  doesn't sounds hard to implement since we are at an interpreter
+level but really useful in practice. Will be simple once the overall
+framework is set-up.
+
+10 Sorting
+
+  Okay applied to the node list of an xsl:apply-templates or xsl:for-each
+
+  The NOTEs are a bit scary ...
+
+11 Variables and Parameters
+
+   Variables can only be afttected at the top level, so it
+seems they act only as global variables ...
+   But this is by regions .... so some of the statements within
+a stylesheet my use a different set than others ... in practice
+it turns to be nearly like loacal variables ....
+  Need more thinking on this to handle it properly.
+  Might explain on of TOM's requests w.r.t. variable resolution
+
+11.1 Result Tree Fragments
+
+  Dohhh a new type ...
+  actually it's just a node set restricted type
+
+11.2 Values of Variables and Parameters
+
+  okay, real problem is scoping ...
+
+11.3 Using Values of Variables and Parameters with xsl:copy-of 
+
+  No surprize
+
+11.4 Top-level Variables and Parameters
+
+   It is an error if a stylesheet contains more than one binding
+   of a top-level variable with the same name and same import precedence
+
+   => ah ah, so it seems one can associate the variable bindings
+to a stylesheet and if needed recurse down the import list if not
+found, would simplify things a lot !
+
+   If the template or expression specifying the value of a global variable
+x references a global variable y, then the value for y must be computed
+before the value of x.
+
+   => Values can probably be computed dynamically at reference
+time, if this generate a loop, then it's an error. Lazy computations
+are great ...
+
+11.5 Variables and Parameters within Templates
+
+   
+   xsl:variable is allowed anywhere within a template that an instruction
+is allowed. In this case, the binding is visible for all following siblings
+and their descendants.
+   It is an error if a binding established by an xsl:variable or xsl:param
+element within a template shadows another binding established by an
+xsl:variable or xsl:param element also within the template.
+
+  => the example seems to imply that we can simply keep a list of
+     local variable binding to a template ... sounds fine.
+
+11.6 Passing Parameters to Templates
+
+  => Okay the parameter overrides the local binding
+
+12.1 Multiple Source Documents
+12.2 Keys
+
+  skipped for now
+
+12.3 Number Formatting
+
+  reimplementing Java formatting in C is gonna be a pain !
+
+12.4 Miscellaneous Additional Functions
+
+  current() => trivial
+
+  unparsed-entity-uri() => support in uri.c should do
+
+  generate-id() => use the in-memory address of the node ???
+
+  system-property() => sounds simple
+
+13 Messages
+
+  trivial I/Os
+
+14 Extensions
+15 Fallback
+
+   skipped for now
+
+16 Output
+
+16.1 XML Output Method
+
+  sounds that calling directly libxml output on the result tree
+should do it with a few caveats, for example one need to be
+able to parametrize the output
+
+16.2 HTML Output Method
+
+  sounds that calling libxml HTML output should do it too
+
+16.3 Text Output Method
+
+  doesn't sounds too hard ...
+
+16.4 Disabling Output Escaping
+
+  hum ... might be a bit painful to implement with the current framework.
diff --git a/README b/README
new file mode 100644
index 0000000..85bf80e
--- /dev/null
+++ b/README
@@ -0,0 +1,24 @@
+
+     XSLT support for libxml2 (XML toolkit from the GNOME project)
+
+Full documentation is available on-line at
+    http://xmlsoft.org/XSLT/
+
+This code is released under the MIT Licence see the Copyright file.
+ 
+To report bugs, follow the instructions at:
+  http://xmlsoft.org/XSLT/bugs.html
+
+A mailing-list xslt@gnome.org is available, to subscribe:
+    http://mail.gnome.org/mailman/listinfo/xslt
+
+The list archive is at:
+    http://mail.gnome.org/archives/xslt/
+
+All technical answers asked privately will be automatically answered on
+the list and archived for public access unless pricacy is explicitely
+required and justified.
+
+Daniel Veillard
+
+$Id$
diff --git a/README.cvs-commits b/README.cvs-commits
new file mode 100644
index 0000000..a4bd841
--- /dev/null
+++ b/README.cvs-commits
@@ -0,0 +1,5 @@
+ Please read the HACKING file for instructions
+
+Daniel
+
+$Id$
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..2c671fa
--- /dev/null
+++ b/TODO
@@ -0,0 +1,124 @@
+                  ********
+                 *        *
+                 *  TODO  *
+                 *        *
+                  ********
+
+Lifetime of result Value Tree, make sure we keep pointers. Exslt
+handling of node set values is especially nasty in this respect,
+lots of potential mem leaks...
+
+Pattern tester:
+  -> try to optimize for ID scan and tests.
+
+Pattern scanner:
+  -> add error checks on all returns
+
+Sorting:
+  -> add lang and case-order
+  -> add foreign sorting functions (interfaces ?).
+
+                  ********
+                 *        *
+                 *  DONE  *
+                 *        *
+                  ********
+
+Design:
+  - should transforms for a given stylesheet be thread clean,
+    -> the precompilation now occur only at stylesheet processing
+       time (except the binding for named templates and extension
+       functions which need to be computed once at run-time).
+       Multiple threads should be able to reuse the same stylesheet
+       now.
+
+Embedding Stylesheets:
+  - example in 2.7 would force to validate, we do it by default now
+
+ID and Key support:
+  -> Done
+
+Extra functions:
+  -> document() should not be a problem since Result Tree Fragments are
+     implemented
+  => Done
+
+Templates:
+  -> check the built-in template rule for attributes
+  -> make sure @xxx matches are applied
+
+Contextual error reporting:
+  -> provide a couple of functions providing context analysis, not urgent
+
+Validity:
+  -> should we add validation by default ? Make this an option
+  -> redirrect validity errors
+  => done added a special parsing mode
+
+Import:
+  -> parse them
+  -> provide functions to circulate in the import tree of stylesheets
+  -> make sure we use the cascade wherever it's needed
+
+Extra functions:
+  -> make a separate module.
+  => done functions.[ch]
+
+Support Attribute value templates:
+  -> starts to be urgent. Design it in flexible ways but try to optimize
+     to handle most of it at the stylesheet parse time ...
+  => Done for the most part need to check all attributes in XSLT constructs
+     using them and use the dedicated readin function.
+  -> optimization by checking their existence at stylesheet parse time.
+  => done when building the preproc function
+
+Sorting:
+  -> add support for imbricated sorts
+  => done but not well tested.
+
+Separate util module:
+  -> macros, config, verbosity ?
+  => xsltutils.[ch]
+
+Support for disable-output-escaping="yes":
+  -> looks problematic, libxml has no support for anything like this,
+     and unless adding a new node type :-( or tweaking text node and
+     output routines this is gonna be messy ... must be handled at libxml
+     level.
+  => Done with a trick, text node name is different, requires > 2.2.11
+
+Pattern scanner:
+  -> compute priority
+  -> handle unions
+  -> support for mode
+  => done
+
+Pattern tester:
+  -> also put fast lookup for "text()", "comment()", "node()"
+     based patterns lists.
+  => done
+
+Support Attribute value templates:
+  -> namespace support for attribute value templates is not done, need
+     a small API redesign
+
+Doc:
+  - put a page at http://xmlsoft.org/XSLT/
+  - generate/transform the DocBook to HTML
+  - add HTML to package
+  - manpage and doc for xsltproc
+
+
+Error handling:
+  -> check the version stuff, design a separate module for error interfacing
+     and default handling, parsing vs. runtime, fatal / compat / warning,
+     and lack of optionnal features.
+  -> reports context
+
+ID and Key support:
+  -> done but namespace support in keys is not defined
+  -> make sure keys are recomputed on new document input
+
+Profiler:
+  -> added looks good enough
+  -> autocorrection of initial calibration loop
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..0eeadd3
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,83 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=. 
+
+THEDIR=`pwd`
+cd $srcdir
+DIE=0
+
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+	echo
+	echo "You must have autoconf installed to compile libxslt."
+	echo "Download the appropriate package for your distribution,"
+	echo "or see http://www.gnu.org/software/autoconf"
+	DIE=1
+}
+
+(libtoolize --version) < /dev/null > /dev/null 2>&1 || {
+	echo
+	echo "You must have libtool installed to compile libxslt."
+	echo "Download the appropriate package for your distribution,"
+	echo "or see http://www.gnu.org/software/libtool"
+	DIE=1
+}
+
+(automake --version) < /dev/null > /dev/null 2>&1 || {
+	echo
+	DIE=1
+	echo "You must have automake installed to compile libxslt."
+	echo "Download the appropriate package for your distribution,"
+	echo "or see http://www.gnu.org/software/automake"
+}
+
+if test "$DIE" -eq 1; then
+	exit 1
+fi
+
+test -f libxslt/xslt.h  || {
+	echo "You must run this script in the top-level libxslt directory"
+	exit 1
+}
+
+if test -z "$NOCONFIGURE" -a -z "$*"; then
+	echo "I am going to run $srcdir/configure with no arguments - if you wish "
+	echo "to pass any to it, please specify them on the $0 command line."
+fi
+
+echo "Running libtoolize..."
+libtoolize --copy --force
+echo "Running aclocal..."
+aclocal $ACLOCAL_FLAGS
+echo "Running automake..."
+automake --add-missing --warnings=all
+echo "Running autoconf..."
+autoconf --warnings=all
+
+cd $THEDIR
+
+if test x$OBJ_DIR != x; then
+    mkdir -p "$OBJ_DIR"
+    cd "$OBJ_DIR"
+fi
+
+EXTRA_ARGS=
+if test "x$1" = "x--system"; then
+    shift
+    prefix=/usr
+    libdir=$prefix/lib
+    sysconfdir=/etc
+    localstatedir=/var
+    if [ -d /usr/lib64 ]; then
+      libdir=$prefix/lib64
+    fi
+    EXTRA_ARGS="--prefix=$prefix --sysconfdir=$sysconfdir --localstatedir=$localstatedir --libdir=$libdir"
+fi
+
+if test -z "$NOCONFIGURE"; then
+    echo "Running configure $EXTRA_ARGS $*" ...
+    $srcdir/configure $EXTRA_ARGS "$@"
+    echo 
+    echo "Now type 'make' to compile libxslt."
+fi
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..8f7d8c0
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,225 @@
+/* config.h.in.  Generated from configure.in by autoheader.  */
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_ANSIDECL_H
+
+/* Define to 1 if you have the `asctime' function. */
+#undef HAVE_ASCTIME
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#undef HAVE_CLOCK_GETTIME
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_ERRNO_H
+
+/* Define if fabs is there */
+#undef HAVE_FABS
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_FLOAT_H
+
+/* Define if floor is there */
+#undef HAVE_FLOOR
+
+/* Define to 1 if you have the `fprintf' function. */
+#undef HAVE_FPRINTF
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_FP_CLASS_H
+
+/* Define to 1 if you have the `ftime' function. */
+#undef HAVE_FTIME
+
+/* Define if gcrypt library is available. */
+#undef HAVE_GCRYPT
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define to 1 if you have the `gmtime' function. */
+#undef HAVE_GMTIME
+
+/* Define to 1 if you have the `gmtime_r' function. */
+#undef HAVE_GMTIME_R
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_IEEEFP_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define if pthread library is there (-lpthread) */
+#undef HAVE_LIBPTHREAD
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_LOCALE_H
+
+/* Define to 1 if you have the `localtime' function. */
+#undef HAVE_LOCALTIME
+
+/* Define to 1 if you have the `localtime_r' function. */
+#undef HAVE_LOCALTIME_R
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_MATH_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `mktime' function. */
+#undef HAVE_MKTIME
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_NAN_H
+
+/* Define if pow is there */
+#undef HAVE_POW
+
+/* Define to 1 if you have the `printf' function. */
+#undef HAVE_PRINTF
+
+/* Define if  is there */
+#undef HAVE_PTHREAD_H
+
+/* Define to 1 if you have the `snprintf' function. */
+#undef HAVE_SNPRINTF
+
+/* Define to 1 if you have the `sprintf' function. */
+#undef HAVE_SPRINTF
+
+/* Define to 1 if you have the `sscanf' function. */
+#undef HAVE_SSCANF
+
+/* Define to 1 if you have the `stat' function. */
+#undef HAVE_STAT
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_STDARG_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_SYS_TIMEB_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the `time' function. */
+#undef HAVE_TIME
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_TIME_H
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vfprintf' function. */
+#undef HAVE_VFPRINTF
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#undef HAVE_VSNPRINTF
+
+/* Define to 1 if you have the `vsprintf' function. */
+#undef HAVE_VSPRINTF
+
+/* Define to 1 if you have the  header file. */
+#undef HAVE_XLOCALE_H
+
+/* Define to 1 if you have the `_stat' function. */
+#undef HAVE__STAT
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#undef LT_OBJDIR
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
+/* Version number of package */
+#undef VERSION
+
+/* Define if debugging support is enabled */
+#undef WITH_DEBUGGER
+
+/* Define to 1 if on MINIX. */
+#undef _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE
+
+/* Using the Win32 Socket implementation */
+#undef _WINSOCKAPI_
+
+/* Win32 Std C name mangling work-around */
+#undef snprintf
+
+/* Win32 Std C name mangling work-around */
+#undef vsnprintf
diff --git a/configure.in b/configure.in
new file mode 100644
index 0000000..8bdf45a
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,732 @@
+dnl Process this file with autoconf to produce a configuration script.
+AC_PREREQ(2.59)
+AC_INIT(libxslt/xslt.c)
+AC_CONFIG_HEADERS(config.h)
+AC_CANONICAL_HOST
+AC_USE_SYSTEM_EXTENSIONS
+
+dnl
+dnl libxslt is the main part of the package
+dnl libexslt is an extension
+dnl
+LIBXSLT_MAJOR_VERSION=1
+LIBXSLT_MINOR_VERSION=1
+LIBXSLT_MICRO_VERSION=29
+PACKAGE=libxslt
+LIBEXSLT_MAJOR_VERSION=0
+LIBEXSLT_MINOR_VERSION=8
+LIBEXSLT_MICRO_VERSION=17
+LIBXML_REQUIRED_VERSION=2.6.27
+
+
+LIBXSLT_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION.$LIBXSLT_MICRO_VERSION
+LIBXSLT_VERSION_INFO=`expr $LIBXSLT_MAJOR_VERSION + $LIBXSLT_MINOR_VERSION`:$LIBXSLT_MICRO_VERSION:$LIBXSLT_MINOR_VERSION
+
+LIBXSLT_VERSION_NUMBER=`expr $LIBXSLT_MAJOR_VERSION \* 10000 + $LIBXSLT_MINOR_VERSION \* 100 + $LIBXSLT_MICRO_VERSION`
+LIBXSLT_MAJOR_MINOR_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION
+
+if test -f CVS/Entries; then
+  extra=`grep ChangeLog CVS/Entries | grep -v LIBXSLT | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
+  echo extra=$extra
+  if test "$extra" != ""
+  then
+      LIBXSLT_VERSION_EXTRA="-CVS$extra"
+  fi
+else if test -d .svn ; then
+  extra=`svn info | grep Revision | sed 's+Revision: ++'`
+  echo extra=$extra
+  if test "$extra" != ""
+  then
+      LIBXSLT_VERSION_EXTRA="-SVN$extra"
+  fi
+else if test -d .git ; then
+  extra=`git describe | sed 's+LIBXSLT[[0-9.]]*-++'`
+  echo extra=$extra
+  if test "$extra" != ""
+  then
+      LIBXSLT_VERSION_EXTRA="-GIT$extra"
+  fi
+fi
+fi
+fi
+
+AC_SUBST(LIBXSLT_MAJOR_VERSION)
+AC_SUBST(LIBXSLT_MINOR_VERSION)
+AC_SUBST(LIBXSLT_MICRO_VERSION)
+AC_SUBST(LIBXSLT_VERSION)
+AC_SUBST(LIBXSLT_VERSION_INFO)
+AC_SUBST(LIBXSLT_VERSION_NUMBER)
+AC_SUBST(LIBXSLT_VERSION_EXTRA)
+AC_SUBST(LIBXSLT_MAJOR_MINOR_VERSION)
+
+dnl
+dnl libexslt is an extension library
+dnl
+
+LIBEXSLT_VERSION=$LIBEXSLT_MAJOR_VERSION.$LIBEXSLT_MINOR_VERSION.$LIBEXSLT_MICRO_VERSION
+LIBEXSLT_VERSION_INFO=`expr $LIBEXSLT_MAJOR_VERSION + $LIBEXSLT_MINOR_VERSION`:$LIBEXSLT_MICRO_VERSION:$LIBEXSLT_MINOR_VERSION
+
+LIBEXSLT_VERSION_NUMBER=`expr $LIBEXSLT_MAJOR_VERSION \* 10000 + $LIBEXSLT_MINOR_VERSION \* 100 + $LIBEXSLT_MICRO_VERSION`
+
+if test -f CVS/Entries; then
+  LIBEXSLT_VERSION_EXTRA=-CVS`grep ChangeLog CVS/Entries | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
+fi
+
+AC_SUBST(LIBEXSLT_MAJOR_VERSION)
+AC_SUBST(LIBEXSLT_MINOR_VERSION)
+AC_SUBST(LIBEXSLT_MICRO_VERSION)
+AC_SUBST(LIBEXSLT_VERSION)
+AC_SUBST(LIBEXSLT_VERSION_INFO)
+AC_SUBST(LIBEXSLT_VERSION_NUMBER)
+AC_SUBST(LIBEXSLT_VERSION_EXTRA)
+
+VERSION=${LIBXSLT_VERSION}
+
+AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
+
+# AM_MAINTAINER_MODE
+
+# Support silent build rules, requires at least automake-1.11. Disable
+# by either passing --disable-silent-rules to configure or passing V=1
+# to make
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
+dnl
+dnl Specific dir for HTML output ?
+dnl
+
+AC_ARG_WITH(html-dir, AS_HELP_STRING([--with-html-dir=path],
+            [path to base html directory, default $datadir/doc/html]),
+            [HTML_DIR=$withval], [HTML_DIR='$(datadir)/doc'])
+
+AC_ARG_WITH(html-subdir, AS_HELP_STRING([--with-html-subdir=path],
+            [directory used under html-dir, default $PACKAGE-$VERSION/html]),
+            [test "x$withval" != "x" && HTML_DIR="$HTML_DIR/$withval"],
+            [HTML_DIR="$HTML_DIR/\$(PACKAGE)-\$(VERSION)/html"])
+
+AC_SUBST(HTML_DIR)
+
+dnl
+dnl Check the environment
+dnl
+
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_CPP
+AC_PATH_PROG(RM, rm, /bin/rm)
+AC_PATH_PROG(MV, mv, /bin/mv)
+AC_PATH_PROG(TAR, tar, /bin/tar)
+AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
+AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
+
+AC_HEADER_STDC
+
+LT_INIT(win32-dll)
+
+
+AC_CHECK_HEADERS(sys/types.h sys/time.h stdlib.h unistd.h string.h)
+
+dnl
+dnl if the system support linker version scripts for symbol versioning
+dnl then add it
+dnl
+AC_MSG_CHECKING([how to pass version script to the linker ($LD)])
+VERSION_SCRIPT_FLAGS=none
+if $LD --help 2>&1 | grep "version-script" >/dev/null 2>/dev/null; then
+    VERSION_SCRIPT_FLAGS=-Wl,--version-script=
+elif $LD --help 2>&1 | grep "M mapfile" >/dev/null 2>/dev/null; then
+    VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,"
+fi
+AC_MSG_RESULT([$VERSION_SCRIPT_FLAGS])
+AC_SUBST(VERSION_SCRIPT_FLAGS)
+AM_CONDITIONAL([USE_VERSION_SCRIPT], [test "$VERSION_SCRIPT_FLAGS" != none])
+
+dnl Look for pthread.h, needed for testThreads
+case $host in
+  *-mingw*) ;;
+  *)
+THREAD_LIBS=""
+AC_CHECK_HEADER(pthread.h,
+    AC_CHECK_LIB(pthread, pthread_join,[
+       AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)])
+       AC_DEFINE([HAVE_PTHREAD_H], [], [Define if  is there])
+       THREAD_LIBS="-lpthread"]))
+  ;;
+esac
+
+AC_SUBST(THREAD_LIBS)
+
+dnl
+dnl Detect supported locale
+dnl
+
+XSLT_LOCALE_XLOCALE=0
+XSLT_LOCALE_WINAPI=0
+
+AC_CHECK_HEADERS([locale.h xlocale.h])
+if test $ac_cv_header_xlocale_h = yes; then
+dnl
+dnl Check for generic locale_t declaration
+dnl
+AC_MSG_CHECKING([if xlocale program link])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#ifdef HAVE_LOCALE_H
+#include 
+#endif
+#ifdef HAVE_XLOCALE_H
+#include 
+#endif
+#ifdef HAVE_STRING_H
+#include 
+#endif
+#ifdef HAVE_STDLIB_H
+#include 
+#endif
+
+#ifdef __GLIBC__
+typedef __locale_t xsltLocale;
+#else
+typedef locale_t xsltLocale;
+#endif
+#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ <= 2
+#define newlocale __newlocale
+#define freelocale __freelocale
+#define strxfrm_l __strxfrm_l
+#define LC_COLLATE_MASK (1 << LC_COLLATE)
+#endif
+]],[[
+    xsltLocale locale;
+    const char *src[2] = { "\xc3\x84rger", "Zeppelin" };
+    char *dst[2];
+    size_t len, r;
+    int i;
+
+    locale = newlocale(LC_COLLATE_MASK, "en_US.utf8", NULL);
+    if (locale == NULL) exit(1);
+    for (i=0; i<2; ++i) {
+        len = strxfrm_l(NULL, src[i], 0, locale) + 1;
+        dst[i] = malloc(len);
+        if(dst[i] == NULL) exit(1);
+        r = strxfrm_l(dst[i], src[i], len, locale);
+        if(r >= len) exit(1);
+    }
+    if (strcmp(dst[0], dst[1]) >= 0) exit(1);
+
+    exit(0);
+    return(0);
+]])],
+  [AC_MSG_RESULT(yes); XSLT_LOCALE_XLOCALE=1],
+  [AC_MSG_RESULT(no)]
+)
+else
+  case "$host" in
+    *-*-mingw*)
+      AC_MSG_NOTICE([using winapi locale])
+      XSLT_LOCALE_WINAPI=1;;
+  esac
+fi
+
+AC_SUBST(XSLT_LOCALE_XLOCALE)
+AC_SUBST(XSLT_LOCALE_WINAPI)
+
+dnl
+dnl Math detection
+dnl
+
+AC_CHECK_HEADERS(ieeefp.h nan.h math.h fp_class.h float.h ansidecl.h)
+AC_CHECK_HEADERS(sys/timeb.h time.h sys/stat.h sys/select.h stdarg.h)
+AC_CHECK_HEADERS(errno.h)
+AC_CHECK_FUNCS(stat _stat)
+AC_CHECK_FUNC(pow, , AC_CHECK_LIB(m, pow,
+  [M_LIBS="-lm"; AC_DEFINE([HAVE_POW],[], [Define if pow is there])]))
+
+AC_CHECK_FUNC(floor, , AC_CHECK_LIB(m, floor,
+  [M_LIBS="-lm"; AC_DEFINE([HAVE_FLOOR],[], [Define if floor is there])]))
+
+AC_CHECK_FUNC(fabs, , AC_CHECK_LIB(m, fabs,
+  [M_LIBS="-lm"; AC_DEFINE([HAVE_FABS],[], [Define if fabs is there])]))
+
+
+AC_CHECK_FUNCS(gettimeofday)
+AC_CHECK_FUNCS(mktime localtime localtime_r asctime time gmtime gmtime_r ftime)
+
+dnl Checking the standard string functions availability
+AC_CHECK_FUNCS(printf sprintf fprintf snprintf vfprintf vsprintf vsnprintf sscanf,,
+               NEED_TRIO=1)
+
+dnl Checking for POSIX timers
+AC_CHECK_FUNCS(clock_gettime, [], [
+  AC_CHECK_LIB(rt, clock_gettime, [
+    AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
+    EXTRA_LIBS="$EXTRA_LIBS -lrt"
+  ])
+])
+
+dnl
+dnl Check for trio string functions
+dnl
+
+if test "${NEED_TRIO}" = "1" ; then
+    echo Reusing trio library for string functions
+    WITH_TRIO=1
+else    
+    WITH_TRIO=0
+fi
+AC_SUBST(WITH_TRIO)
+
+dnl
+dnl Some packages need to be checked against version numbers so we
+dnl define a function here for later use
+dnl
+AC_DEFUN([VERSION_TO_NUMBER],
+[`$1 | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
+
+dnl
+dnl Perl is just needed for generating some data for XSLtmark
+dnl
+
+AC_CHECK_PROG(PERL, perl, perl, false)
+AM_CONDITIONAL(WITH_PERL, test "$PERL" != "false")
+
+dnl
+dnl check for python
+dnl
+
+PYTHON_VERSION=
+PYTHON_INCLUDES=
+PYTHON_SITE_PACKAGES=
+pythondir=
+AC_ARG_WITH(python, [  --with-python[=DIR]    Build Python bindings if found])
+if test "$with_python" != "no" ; then
+    if test -x "$with_python/bin/python"
+    then
+        echo Found python in $with_python/bin/python
+        PYTHON="$with_python/bin/python"
+    else
+	if test -x "$with_python"
+	then
+	    echo Found python in $with_python
+	    PYTHON="$with_python"
+	else
+            if test -x "$PYTHON"
+            then
+                echo Found python in environment PYTHON=$PYTHON
+                with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
+	    else
+	        AC_PATH_PROG(PYTHON, python python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
+	    fi
+	fi
+    fi
+    if test "$PYTHON" != ""
+    then
+        echo "PYTHON is pointing at $PYTHON"
+        PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
+	echo Found Python version $PYTHON_VERSION
+	LIBXML2_PYTHON=`$PYTHON -c "try : import libxml2 ; print 1
+except: print 0"`
+	if test "$LIBXML2_PYTHON" = "1"
+	then
+	    echo Found libxml2-python module
+	else
+	    echo Warning: Missing libxml2-python
+	fi
+    fi
+    if test "$PYTHON_VERSION" != ""
+    then
+	if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
+	   -d $with_python/lib/python$PYTHON_VERSION/site-packages
+	then
+	    PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
+	    PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+	else
+	    if test -r $prefix/include/python$PYTHON_VERSION/Python.h
+	    then
+	        PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
+		PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+	    else
+		if test -r /usr/include/python$PYTHON_VERSION/Python.h
+		then
+		    PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
+		    PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+		else
+		    echo could not find python$PYTHON_VERSION/Python.h
+		fi
+	    fi
+	    if test ! -d "$PYTHON_SITE_PACKAGES"
+	    then
+		    PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
+	    fi
+	fi
+        PYTHON_LIBS=`python$PYTHON_VERSION-config --libs`
+    fi
+    if test "$with_python" != ""
+    then
+        pythondir='$(PYTHON_SITE_PACKAGES)'
+    else
+        pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+    fi
+fi
+AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
+if test "$PYTHON_INCLUDES" != ""
+then
+    PYTHON_SUBDIR=python
+else
+    PYTHON_SUBDIR=
+fi
+AC_SUBST(pythondir)
+AC_SUBST(PYTHON_SUBDIR)
+AC_SUBST(PYTHON_LIBS)
+
+AC_ARG_WITH(crypto, [  --with-crypto           Add crypto support to exslt (on)])
+WITH_CRYPTO=0
+CRYPTO_TESTDIR=
+if test "$with_crypto" = "no" ; then
+    echo Disabling crypto support
+    LIBGCRYPT_CFLAGS=""
+    LIBGCRYPT_LIBS=""
+else
+case $host in
+  *-mingw*)
+    dnl Use only native crypto-API for mingw* hosts
+    dnl TODO: to implement --with-crypto=foo to allow switch between
+    dnl crypto libraries
+    WITH_CRYPTO=1
+    CRYPTO_TESTDIR=crypto
+    ;;
+  *)
+    AC_PATH_TOOL(LIBGCRYPT_CONFIG, libgcrypt-config, no)
+    if test "$LIBGCRYPT_CONFIG" != "no" ; then
+      LIBGCRYPT_VERSION=`$LIBGCRYPT_CONFIG --version`
+      if test VERSION_TO_NUMBER(echo $LIBGCRYPT_VERSION) -lt VERSION_TO_NUMBER(echo "1.1.42")
+      then
+        LIBGCRYPT_CFLAGS=""
+        LIBGCRYPT_LIBS=""
+        echo 'gcrypt library version < 1.1.42 - Crypto extensions will not be available.'
+      else
+        LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --cflags`
+        LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --libs`
+        AC_DEFINE(HAVE_GCRYPT, 1, [Define if gcrypt library is available.])
+        echo 'Crypto extensions will be available.'
+        WITH_CRYPTO=1
+        CRYPTO_TESTDIR=crypto
+      fi
+    else
+      LIBGCRYPT_CFLAGS=""
+      LIBGCRYPT_LIBS=""
+      echo 'Crypto extensions will not be available. Install libgcrypt and reconfigure to make available.'
+    fi
+esac
+fi
+AC_SUBST(WITH_CRYPTO)
+AC_SUBST(CRYPTO_TESTDIR)
+AC_SUBST(LIBGCRYPT_CFLAGS)
+AC_SUBST(LIBGCRYPT_LIBS)
+
+dnl
+dnl Debug for DV (-Wunreachable-code)
+dnl
+if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ]] || \
+   [[ "${LOGNAME}" = "bill" -a "`pwd`" = "/home/bill/gnomesvn/libxslt" ]]
+   then
+    if test "${with_mem_debug}" = "" ;
+    then
+	with_mem_debug="yes"
+    fi
+    CFLAGS="-Wall -g -O -ansi -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat=2 -Wmissing-format-attribute -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline "
+fi
+
+AC_ARG_WITH(debug, [  --with-debug            Add the debugging code (on)])
+if test "$with_debug" = "no" ; then
+    echo Disabling debug support
+    WITH_XSLT_DEBUG=0
+else    
+    WITH_XSLT_DEBUG=1
+fi
+AC_SUBST(WITH_XSLT_DEBUG)
+
+AC_ARG_WITH(mem_debug, [  --with-mem-debug        Add the memory debugging module (off)])
+if test "$with_mem_debug" = "yes" ; then
+    echo Enabling memory debug support
+    WITH_MEM_DEBUG=1
+else    
+    WITH_MEM_DEBUG=0
+fi
+AC_SUBST(WITH_MEM_DEBUG)
+
+dnl 
+dnl Is debugger support requested
+dnl
+AC_ARG_WITH(debugger, [  --with-debugger        Add the debugging support (on)])
+if test "$with_debugger" = "no" ; then
+    echo Disabling debugger
+    WITH_DEBUGGER=0
+else
+    echo Enabling debugger
+    WITH_DEBUGGER=1
+    AC_DEFINE([WITH_DEBUGGER],[], [Define if debugging support is enabled])
+fi
+AC_SUBST(WITH_DEBUGGER)
+
+dnl
+dnl The following new parameters were added to offer
+dnl the ability to specify the location of the libxml
+dnl library during linking and compilation.
+dnl
+dnl original work - Mathieu Lacage 30/03/2000
+dnl some tweaking - David Härdeman 30/10/2001
+dnl
+
+LIBXML_CONFIG_PREFIX=""
+LIBXML_SRC=""
+
+AC_ARG_WITH(libxml-prefix,
+        [  --with-libxml-prefix=[PFX]		Specify location of libxml config],
+	LIBXML_CONFIG_PREFIX=$withval
+)
+        
+AC_ARG_WITH(libxml-include-prefix,
+        [  --with-libxml-include-prefix=[PFX]	Specify location of libxml headers],
+        LIBXML_CFLAGS="-I$withval"
+)
+
+AC_ARG_WITH(libxml-libs-prefix,
+        [  --with-libxml-libs-prefix=[PFX]	Specify location of libxml libs],
+        LIBXML_LIBS="-L$withval"
+)
+
+AC_ARG_WITH(libxml-src,
+	[  --with-libxml-src=[DIR]              For libxml thats not installed yet (sets all three above)],
+	LIBXML_SRC="$withval"
+)
+AC_SUBST(LIBXML_SRC)
+
+dnl
+dnl where is xml2-config
+dnl
+
+AC_SUBST(LIBXML_REQUIRED_VERSION)
+AC_MSG_CHECKING(for libxml libraries >= $LIBXML_REQUIRED_VERSION) 
+if test "x$LIBXML_CONFIG_PREFIX" != "x"
+then
+	AC_PATH_TOOL([XML_CONFIG], [xml2-config], [false], [${LIBXML_CONFIG_PREFIX}/bin])
+else
+	AC_PATH_TOOL([XML_CONFIG], [xml2-config], [false])
+fi
+
+dnl
+dnl imported from libxml2, c.f. #77827 
+dnl
+if test "${GCC}" != "yes" ; then
+    case "${host}" in
+          *-*-hpux* )
+	       CFLAGS="${CFLAGS} -Wp,-H30000"
+	       ;;
+          *-dec-osf* )
+               CFLAGS="${CFLAGS} -ieee"
+               ;;
+    esac
+else
+    CFLAGS="${CFLAGS} -Wall -Wformat=2 -Wmissing-format-attribute"
+    case "${host}" in
+          alpha*-*-linux* )
+	       CFLAGS="${CFLAGS} -mieee"
+	       ;;
+	  alpha*-*-osf* )
+	       CFLAGS="${CFLAGS} -mieee"
+	       ;;
+    esac
+fi
+
+dnl
+dnl Override other variables if LIBXML_SRC is set
+dnl
+
+if test "x$LIBXML_SRC" != "x"
+then
+	CWD=`pwd`
+	if cd $LIBXML_SRC
+	then
+		SRC_DIR=`pwd`
+		XML_CONFIG=${SRC_DIR}/xml2-config
+		LIBXML_CFLAGS="-I${SRC_DIR}/include"
+		LIBXML_LIBS="-L${SRC_DIR}"
+		cd $CWD
+	else
+		AC_MSG_ERROR([libxml source dir not found (${LIBXML_SRC}), typo?])
+	fi
+fi
+
+dnl
+dnl make sure xml2-config is executable,
+dnl test version and init our variables
+dnl
+
+if ${XML_CONFIG} --libs print > /dev/null 2>&1
+then
+	XMLVERS=`$XML_CONFIG --version`
+	if test VERSION_TO_NUMBER(echo $XMLVERS) -ge VERSION_TO_NUMBER(echo $LIBXML_REQUIRED_VERSION)
+	then
+		AC_MSG_RESULT($XMLVERS found)
+	else
+		AC_MSG_ERROR(Version $XMLVERS found. You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of libxslt)
+	fi
+	LIBXML_LIBS="$LIBXML_LIBS `$XML_CONFIG --libs`"
+	if test "x$LIBXML_SRC" = "x"; then
+		LIBXML_CFLAGS="$LIBXML_CFLAGS `$XML_CONFIG --cflags`"
+	fi
+else
+	AC_MSG_ERROR([Could not find libxml2 anywhere, check ftp://xmlsoft.org/.])
+fi
+
+
+AC_SUBST(CFLAGS)
+AC_SUBST(CPPFLAGS)
+AC_SUBST(LDFLAGS)
+
+AC_ARG_WITH(plugins,
+[  --with-plugins          Add plugin extension support (on)])
+if test "$with_plugins" = ""
+then
+    with_plugins=yes
+fi
+
+AC_MSG_CHECKING([whether shared libraries will be built (required for plugins)])
+if test "$enable_shared" = "no" -a "$with_plugins" = "yes"; then
+	 AC_MSG_RESULT(no)
+	 AC_MSG_WARN([Disabling plugin support.])
+	 AC_MSG_WARN([Plugins require that shared libraries be built.])
+	 with_plugins=no
+else
+	 AC_MSG_RESULT(yes)
+fi
+
+if test "$with_plugins" = "yes" ; then
+  AC_MSG_CHECKING([libxml2 module support])
+  WITH_MODULES="`$XML_CONFIG --modules`"
+  if test "${WITH_MODULES}" = "1"; then
+    AC_MSG_RESULT(yes)
+  else
+    AC_MSG_RESULT(no)
+    WITH_MODULES="0"
+  fi
+else
+  WITH_MODULES="0"
+fi
+
+AC_SUBST(WITH_MODULES)
+AM_CONDITIONAL(WITH_MODULES, test "$WITH_MODULES" = "1")
+
+dnl
+dnl setup default module path
+dnl
+expanded_libdir=$(
+    test "x$prefix" = xNONE && prefix="$ac_default_prefix"
+    test "x$exec_prefix" = xNONE && exec_prefix="$prefix"
+    while test "$libdir_old" != "$libdir"; do
+      libdir_old="$libdir"
+      eval libdir="$libdir"
+    done
+    echo "$libdir"
+)
+LIBXSLT_DEFAULT_PLUGINS_PATH="$expanded_libdir/libxslt-plugins"
+AC_SUBST(LIBXSLT_DEFAULT_PLUGINS_PATH)
+
+WIN32_EXTRA_LIBADD=
+WIN32_EXTRA_LDFLAGS=
+case "$host" in
+ *-*-cygwin*)
+ WIN32_EXTRA_LDFLAGS="-no-undefined"
+ ;;
+ *-*-mingw*)
+ WIN32_EXTRA_LIBADD="-lwsock32"
+ WIN32_EXTRA_LDFLAGS="-no-undefined"
+ AC_DEFINE([_WINSOCKAPI_],1,[Using the Win32 Socket implementation])
+ AC_DEFINE([snprintf],[_snprintf],[Win32 Std C name mangling work-around])
+ AC_DEFINE([vsnprintf],[_vsnprintf],[Win32 Std C name mangling work-around])
+ ;;
+esac
+AC_SUBST(WIN32_EXTRA_LIBADD)
+AC_SUBST(WIN32_EXTRA_LDFLAGS)
+
+
+AC_SUBST(XSLTPROCDV)
+AC_SUBST(PYTHONSODV)
+AC_SUBST(XML_CONFIG)
+AC_SUBST(LIBXML_LIBS)
+AC_SUBST(LIBXML_CFLAGS)
+AC_SUBST(PYTHON)
+AC_SUBST(PYTHON_VERSION)
+AC_SUBST(PYTHON_INCLUDES)
+AC_SUBST(PYTHON_SITE_PACKAGES)
+
+XSLT_LIBDIR='-L${libdir}'
+XSLT_INCLUDEDIR='-I${includedir}'
+XSLT_LIBS="-lxslt $LIBXML_LIBS $M_LIBS"
+AC_SUBST(XSLT_LIBDIR)
+AC_SUBST(XSLT_INCLUDEDIR)
+AC_SUBST(XSLT_LIBS)
+
+EXSLT_LIBDIR='-L${libdir}'
+EXSLT_INCLUDEDIR='-I${includedir}'
+EXSLT_LIBS="-lexslt $XSLT_LIBS $LIBGCRYPT_LIBS"
+AC_SUBST(EXSLT_LIBDIR)
+AC_SUBST(EXSLT_INCLUDEDIR)
+AC_SUBST(EXSLT_LIBS)
+
+AC_SUBST(EXTRA_LIBS)
+
+AC_SUBST(M_LIBS)
+
+dnl for the spec file
+RELDATE=`date +'%a %b %e %Y'`
+AC_SUBST(RELDATE)
+
+rm -f COPYING.LIB COPYING 2>/dev/null && $LN_S $srcdir/Copyright COPYING
+
+
+AC_CONFIG_FILES([
+Makefile
+libxslt.pc
+libexslt.pc
+libxslt/Makefile
+libxslt/xsltconfig.h
+libxslt/xsltwin32config.h
+libexslt/Makefile
+libexslt/exsltconfig.h
+xsltproc/Makefile
+python/Makefile
+python/tests/Makefile
+tests/Makefile
+tests/docs/Makefile
+tests/REC1/Makefile
+tests/REC2/Makefile
+tests/REC/Makefile
+tests/general/Makefile
+tests/reports/Makefile
+tests/extensions/Makefile
+tests/namespaces/Makefile
+tests/keys/Makefile
+tests/numbers/Makefile
+tests/documents/Makefile
+tests/xmlspec/Makefile
+tests/multiple/Makefile
+tests/xinclude/Makefile
+tests/XSLTMark/Makefile
+tests/docbook/Makefile
+tests/exslt/Makefile
+tests/exslt/common/Makefile
+tests/exslt/functions/Makefile
+tests/exslt/math/Makefile
+tests/exslt/saxon/Makefile
+tests/exslt/sets/Makefile
+tests/exslt/strings/Makefile
+tests/exslt/date/Makefile
+tests/exslt/dynamic/Makefile
+tests/exslt/crypto/Makefile
+tests/plugins/Makefile
+doc/Makefile
+xslt-config
+libxslt.spec
+])
+
+AC_OUTPUT
diff --git a/doc/API.html b/doc/API.html
new file mode 100644
index 0000000..bedb6fe
--- /dev/null
+++ b/doc/API.html
@@ -0,0 +1,27 @@
+
+
+The programming API
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

The programming API

Main Menu
Related links
API Indexes

Okay this section is clearly incomplete. But integrating libxslt into your +application should be relatively easy. First check the few steps described +below, then for more detailed information, look at the generated pages for the API and the source +of libxslt/xsltproc.c and the tutorial.

Basically doing an XSLT transformation can be done in a few steps:

    +
  1. configure the parser for XSLT: +

    xmlSubstituteEntitiesDefault(1);

    +

    xmlLoadExtDtdDefaultValue = 1;

    +
  2. +
  3. parse the stylesheet with xsltParseStylesheetFile()
  4. +
  5. parse the document with xmlParseFile()
  6. +
  7. apply the stylesheet using xsltApplyStylesheet()
  8. +
  9. save the result using xsltSaveResultToFile() if needed set + xmlIndentTreeOutput to 1
  10. +

Steps 2,3, and 5 will probably need to be changed depending on you +processing needs and environment for example if reading/saving from/to +memory, or if you want to apply XInclude processing to the stylesheet or +input documents.

Daniel Veillard

diff --git a/doc/APIchunk0.html b/doc/APIchunk0.html new file mode 100644 index 0000000..7d21d79 --- /dev/null +++ b/doc/APIchunk0.html @@ -0,0 +1,251 @@ + + +API Alphabetic Index A-I for libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

API Alphabetic Index A-I for libxslt

Main Menu
Related links
API Indexes

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Letter A:

API
XSLT_ITEM_COMPATIBILITY_FIELDS
+xsltCopyTextString
+xsltCreateRVT
+xsltDocLoaderFunc
+xsltExtensionInstructionResultFinalize
+xsltGetNamespace
+xsltGetPlainNamespace
+xsltGetUTF8Char
+xsltParseAnyXSLTElem
+xsltRegisterLocalRVT
+xsltRegisterTmpRVT
+
ATTENTION:
_xsltStylesheet
+
AVT
xsltAttrTemplateValueProcessNode
+xsltEvalAVT
+xsltEvalAttrValueTemplate
+xsltEvalStaticAttrValueTemplate
+xsltFreeAVTList
+
Add
xslAddCall
+
Adds
xsltCopyTextString
+xsltPointerListAddSize
+
Allocate
xsltAllocateExtra
+xsltAllocateExtraCtxt
+
Apache
XSLT_XALAN_NAMESPACE
+
Apply
xsltApplyAttributeSet
+xsltApplyStylesheet
+xsltApplyStylesheetUser
+xsltProfileStylesheet
+xsltRunStylesheet
+xsltRunStylesheetUser
+
Attribute
_xsltStylesheet
+xsltAttrListTemplateProcess
+xsltAttrTemplateProcess
+

Letter B:

BIG
xsltApplyOneTemplate
+

Letter C:

CDTATA
xsltFindElemSpaceHandling
+
Called
xsltApplyOneTemplate
+xsltAttrListTemplateProcess
+xsltAttrTemplateValueProcessNode
+xsltCheckExtPrefix
+xsltCheckExtURI
+xsltCopyNamespaceList
+xsltGetNamespace
+xsltParseStylesheetProcess
+xsltRegisterExtPrefix
+xsltStyleGetExtData
+
Change
_xsltStyleBasicExpressionItem
+_xsltStylesheet
+xsltSetCtxtParseOptions
+
Char
xsltGetUTF8Char
+
Characters:
xsltFormatNumberConversion
+
Check
IS_XSLT_REAL_NODE
+_xsltStyleItemDocument
+xsltCheckExtPrefix
+xsltCheckExtURI
+xsltCheckRead
+xsltCheckWrite
+xsltEvalStaticAttrValueTemplate
+xsltFindTemplate
+xsltInitAllDocKeys
+xsltIsBlank
+
Checks
IS_XSLT_ELEM
+IS_XSLT_NAME
+xsltNeedElemSpaceHandling
+
Clark
XSLT_XT_NAMESPACE
+
Clean-up
xsltParseTemplateContent
+
Cleanup
xsltCleanupTemplates
+xsltFreeLocales
+
Common
XSLT_ITEM_COMMON_FIELDS
+
Compares
xsltLocaleStrcmp
+
Compilation
_xsltStylesheet
+
Compile
xsltCompilePattern
+xsltXPathCompile
+xsltXPathCompileFlags
+
Computes
xsltGetKey
+xsltInitCtxtKey
+xsltInitCtxtKeys
+
Context
_xsltTransformContext
+
Control
XSLT_TRACE
+
Convert
xsltNumberFormat
+
Copies
xsltAttrListTemplateProcess
+xsltCopyNamespace
+
Create
xsltNewSecurityPrefs
+xsltNewStylesheet
+xsltNewTransformContext
+
Creates
xsltCreateRVT
+xsltNewElemPreComp
+xsltNewLocale
+xsltPointerListCreate
+
Current
_xsltCompilerCtxt
+_xsltTransformContext
+
Currently
XSLT_ITEM_NAVIGATION_FIELDS
+

Letter D:

DTD
xsltGetCNsProp
+xsltGetNsProp
+
Deallocates
xsltElemPreCompDeallocator
+
Debugging
_xsltTransformContext
+
DecimalFormat
xsltFormatNumberConversion
+
Display
xsltPrintErrorContext
+xsltTransformError
+
Don
xsltAttrListTemplateProcess
+xsltTemplateProcess
+
Drop
xslDropCall
+
Dumps
xsltDebugDumpExtensions
+

Letter E:

EXSLT
xsltDocumentElem
+xsltExtensionInstructionResultFinalize
+
Each
xsltEvalUserParams
+
Either
xsltReleaseRVT
+
Element
_xsltStylesheet
+xsltAttrListTemplateProcess
+xsltAttrTemplateProcess
+
Elements
xsltCopyNamespaceList
+
Eliminate
_xsltStylesheet
+
Errors
xsltGetQNameURI
+
Evaluate
XSLT_ITEM_COMPATIBILITY_FIELDS
+xsltEvalAttrValueTemplate
+xsltEvalUserParams
+
Evaluates
xsltAttrTemplateProcess
+xsltEvalGlobalVariables
+
Exaclty
xsltGetPlainNamespace
+
Execute
xsltCopy
+
Extensions
_xsltStylesheet
+_xsltTransformContext
+

Letter F:

FILE
xsltApplyStylesheetUser
+xsltDebugDumpExtensions
+xsltProfileStylesheet
+xsltRunStylesheetUser
+xsltSaveProfiling
+xsltSaveResultToFile
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+
FIXED
xsltGetCNsProp
+xsltGetNsProp
+
Fields
XSLT_ITEM_COMPATIBILITY_FIELDS
+
Finalizes
xsltExtensionInstructionResultFinalize
+
Find
xsltDecimalFormatGetByName
+xsltFindElemSpaceHandling
+xsltGetNamespace
+xsltGetSpecialNamespace
+xsltNextImport
+
Finds
xsltFindTemplate
+xsltGetTemplate
+
Flag
_xsltFormatNumberInfo
+
For
_xsltStylesheet
+xsltEvalGlobalVariables
+xsltEvalOneUserParam
+
Forwards-compatible
_xsltStylesheet
+
Fragment
_xsltTransformContext
+xsltCreateRVT
+xsltRegisterLocalRVT
+xsltRegisterPersistRVT
+xsltRegisterTmpRVT
+xsltReleaseRVT
+
Fragments
_xsltStackElem
+xsltFindDocument
+xsltFreeRVTs
+
Free
xsltFreeAVTList
+xsltFreeAttributeSetsHashes
+xsltFreeCompMatchList
+xsltFreeCtxtExts
+xsltFreeDocumentKeys
+xsltFreeDocuments
+xsltFreeExts
+xsltFreeGlobalVariables
+xsltFreeKeys
+xsltFreeNamespaceAliasHashes
+xsltFreeSecurityPrefs
+xsltFreeStackElemList
+xsltFreeStylePreComps
+xsltFreeStylesheet
+xsltFreeTemplateHashes
+xsltFreeTransformContext
+
Frees
xsltFreeLocale
+xsltFreeRVTs
+xsltFreeStyleDocuments
+xsltPointerListFree
+
Function
xsltGetUTF8Char
+xsltSecurityAllow
+xsltSecurityForbid
+xsltSetCtxtSortFunc
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltSetSortFunc
+xsltSetTransformErrorFunc
+

Letter G:

General
_xsltStylesheet
+
Get
xsltDebugGetDefaultTrace
+xsltGetDebuggerStatus
+xsltGetDefaultSecurityPrefs
+
Global
_xsltPrincipalStylesheetData
+_xsltStylesheet
+_xsltTransformContext
+

Letter I:

INTERNAL
xsltInitAllDocKeys
+
IObuf
xsltRunStylesheet
+xsltRunStylesheetUser
+
ISO
XML_CAST_FPTR
+
Implement
xsltDocumentFunction
+xsltElementAvailableFunction
+xsltFormatNumberFunction
+xsltFunctionAvailableFunction
+xsltFunctionNodeSet
+xsltGenerateIdFunction
+xsltKeyFunction
+xsltSystemPropertyFunction
+xsltUnparsedEntityURIFunction
+
Indicates
_xsltEffectiveNs
+
Indicator
_xsltCompilerCtxt
+
Initialize
xsltInitCtxtExts
+xsltInitGlobals
+
Initializes
xsltInit
+xsltInitElemPreComp
+
Internal
XSLT_FAST_IF
+XSLT_REFACTORED_KEYCOMP
+XSLT_REFACTORED_VARS
+XSLT_REFACTORED_XPATHCOMP
+xsltFreeRVTs
+

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Daniel Veillard

diff --git a/doc/APIchunk1.html b/doc/APIchunk1.html new file mode 100644 index 0000000..cbe3138 --- /dev/null +++ b/doc/APIchunk1.html @@ -0,0 +1,276 @@ + + +API Alphabetic Index J-S for libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

API Alphabetic Index J-S for libxslt

Main Menu
Related links
API Indexes

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Letter J:

JDK
xsltFormatNumberConversion
+
James
XSLT_XT_NAMESPACE
+

Letter K:

Kay
XSLT_SAXON_NAMESPACE
+
Key
_xsltStylesheet
+

Letter L:

LR-element
_xsltCompilerNodeInfo
+
LRE
xsltAttrTemplateValueProcessNode
+xsltEvalAttrValueTemplate
+xsltEvalStaticAttrValueTemplate
+
Length
xsltSaveResultToString
+
Libexslt
xsltGetPlainNamespace
+
Libxslt
xsltGetPlainNamespace
+
Literal
_xsltStylesheet
+xsltAttrListTemplateProcess
+xsltAttrTemplateProcess
+xsltCopyNamespaceList
+
Load
xsltParseStylesheetFile
+
LocationPathPattern
xsltCompilePattern
+
Looks
xsltExtElementLookup
+xsltExtModuleElementLookup
+xsltExtModuleElementPreComputeLookup
+xsltExtModuleFunctionLookup
+xsltExtModuleTopLevelLookup
+xsltGetKey
+
Lookup
xsltGetSecurityPrefs
+

Letter M:

MUST
xsltInitElemPreComp
+
Macro
CHECK_STOPPED
+CHECK_STOPPED0
+CHECK_STOPPEDE
+XML_CAST_FPTR
+XSLT_LOCALE_NONE
+XSLT_RUNTIME_EXTRA
+XSLT_RUNTIME_EXTRA_FREE
+XSLT_RUNTIME_EXTRA_LST
+XSLT_STRANGE
+XSLT_TODO
+
Marks
xsltExtensionInstructionResultRegister
+
Max
XSLT_MAX_SORT
+
May
_xsltDecimalFormat
+
Maybe
xsltFindTemplate
+
Meaning
xsltFormatNumberConversion
+
Memory
xsltSaveResultToString
+
Michael
XSLT_SAXON_NAMESPACE
+

Letter N:

NCName
xsltGetQNameURI
+
NOTE
xsltApplyOneTemplate
+xsltParseStylesheetCallerParam
+
NOTE:
_xsltStylesheet
+xsltApplyOneTemplate
+xsltApplyStylesheet
+xsltGetQNameURI
+xsltInitCtxtKeys
+xsltLocalVariablePush
+xsltRunStylesheet
+xsltRunStylesheetUser
+
Name
xsltEvalStaticAttrValueTemplate
+
Namespace
_xsltPrincipalStylesheetData
+_xsltStylesheet
+
Namespaces
_xsltStylesheet
+
Needed
_xsltTransformContext
+
Norm
XSLT_NORM_SAXON_NAMESPACE
+
Not
_xsltStylesheet
+xsltGetPlainNamespace
+xsltInitCtxtKeys
+
Not-a-number
_xsltDecimalFormat
+
Notation:
xsltFormatNumberConversion
+
Note
XSLT_ITEM_COMPATIBILITY_FIELDS
+xsltExtensionInstructionResultRegister
+xsltGetSpecialNamespace
+
Number
_xsltFormatNumberInfo
+_xsltStylesheet
+

Letter O:

ONLY
xsltInitAllDocKeys
+
Obsolete
xsltGetPlainNamespace
+xsltRegisterTmpRVT
+xsltTemplateProcess
+
One
xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+
Otherwise
xsltDoSortFunction
+
Output
_xsltStylesheet
+

Letter P:

Parser
xsltDocumentFunction
+xsltElementAvailableFunction
+xsltFormatNumberFunction
+xsltFunctionAvailableFunction
+xsltFunctionNodeSet
+xsltGenerateIdFunction
+xsltKeyFunction
+xsltSystemPropertyFunction
+xsltUnparsedEntityURIFunction
+
Parses
xsltParseAnyXSLTElem
+xsltParseGlobalVariable
+xsltParseSequenceConstructor
+xsltParseStylesheetProcess
+
Pattern
xsltCompilePattern
+
Per
_xsltTransformContext
+
Places
xsltLocalVariablePush
+
Pops
xsltLocalVariablePop
+
Pre
_xsltStylePreComp
+xsltDocumentComp
+
Precompile
xsltCompileAttr
+
Precompute
xsltStylePreCompute
+
Precomputed
_xsltStylesheet
+
Precomputes
xsltPreComputeExtModuleElement
+
Process
xsltApplyImports
+xsltAttrTemplateProcess
+xsltAttrTemplateValueProcess
+xsltAttrTemplateValueProcessNode
+xsltAttribute
+xsltComment
+xsltCopyOf
+xsltDebug
+xsltDocumentElem
+xsltElement
+xsltEvalAVT
+xsltEvalXPathPredicate
+xsltEvalXPathString
+xsltEvalXPathStringNs
+xsltForEach
+xsltMessage
+xsltNumber
+xsltProcessOneNode
+xsltProcessingInstruction
+xsltText
+xsltValueOf
+
Processes
xsltApplyOneTemplate
+xsltApplyTemplates
+xsltAttrListTemplateProcess
+xsltCallTemplate
+xsltChoose
+xsltEvalTemplateString
+xsltIf
+xsltParseStylesheetCallerParam
+
Profiling
_xsltTemplate
+
Provides
xsltGetXIncludeDefault
+xsltXPathGetTransformContext
+
Push
xsltAddStackElemList
+

Letter Q:

QName
_xsltStackElem
+_xsltTemplate
+xsltEvalAttrValueTemplate
+xsltGetQNameURI
+xsltGetQNameURI2
+xsltSplitQName
+
QNames
xsltApplyAttributeSet
+xsltSplitQName
+
QUESTION:
xsltAttrTemplateValueProcessNode
+

Letter R:

REVISIT
xsltFindTemplate
+
REVISIT:
xsltCopyNamespaceList
+
RFC
xsltNewLocale
+
ROUTINE
xsltInitAllDocKeys
+
RTF
_xsltTransformContext
+
RVT
_xsltTransformContext
+xsltRegisterLocalRVT
+xsltReleaseRVT
+
RVTs
_xsltTransformContext
+
Read
xsltGetUTF8Char
+xsltNamespaceAlias
+
Register
xsltAddTemplate
+xsltNewDocument
+xsltNewStyleDocument
+xsltRegisterExtModule
+xsltRegisterExtModuleFull
+xsltRegisterPersistRVT
+
Registering
XSLT_REGISTER_FUNCTION_LOOKUP
+XSLT_REGISTER_VARIABLE_LOOKUP
+
Registers
xsltParseStylesheetParam
+xsltParseStylesheetVariable
+xsltRegisterAllElement
+xsltRegisterAllExtras
+xsltRegisterAllFunctions
+xsltRegisterExtElement
+xsltRegisterExtFunction
+xsltRegisterExtModuleElement
+xsltRegisterExtModuleFunction
+xsltRegisterExtModuleTopLevel
+xsltRegisterExtPrefix
+xsltRegisterExtras
+xsltRegisterLocalRVT
+xsltRegisterTestModule
+xsltRegisterTmpRVT
+
Resets
xsltPointerListClear
+
Restore
xsltRestoreDocumentNamespaces
+
Result
_xsltStackElem
+_xsltStylesheet
+_xsltTransformContext
+xsltAttrListTemplateProcess
+xsltAttrTemplateProcess
+xsltCopyNamespaceList
+xsltCreateRVT
+xsltFindDocument
+xsltFreeRVTs
+xsltRegisterLocalRVT
+xsltRegisterPersistRVT
+xsltRegisterTmpRVT
+xsltReleaseRVT
+
Retrieve
xsltGetExtData
+xsltStyleGetExtData
+xsltStyleStylesheetLevelGetExtData
+
Rule
_xsltTransformContext
+

Letter S:

SAX
xsltRunStylesheet
+xsltRunStylesheetUser
+
SAXON
XSLT_NORM_SAXON_NAMESPACE
+
Sampling
XSLT_TIMESTAMP_TICS_PER_SEC
+
Save
xsltSaveProfiling
+xsltSaveResultTo
+xsltSaveResultToFd
+xsltSaveResultToFile
+xsltSaveResultToFilename
+xsltSaveResultToString
+
Saxon
XSLT_SAXON_NAMESPACE
+
Scaling
_xsltFormatNumberInfo
+
Search
xsltGetCNsProp
+xsltGetNsProp
+xsltVariableLookup
+
Set
_xsltCompilerNodeInfo
+xsltDebugSetDefaultTrace
+xsltSetCtxtSecurityPrefs
+xsltSetDefaultSecurityPrefs
+xsltSetLoaderFunc
+xsltSetXIncludeDefault
+
Should
xsltInitCtxtKeys
+
Shutdown
xsltShutdownCtxtExts
+xsltShutdownExts
+
Signature
xsltSortFunc
+xsltTransformFunction
+
Similar
xsltGetCNsProp
+xsltGetNsProp
+xsltQuoteUserParams
+
Size
_xsltTemplate
+_xsltTransformContext
+
Special
UNDEFINED_DEFAULT_NS
+xsltFormatNumberConversion
+
Specific
XSLT_PAT_NO_PRIORITY
+
Speed
_xsltTransformContext
+
Split
xsltSplitQName
+
Storage
_xsltCompilerCtxt
+
Strip
xsltApplyStripSpaces
+
Structure:
xsltFormatNumberConversion
+
Stylesheet
_xsltStylesheet
+xsltNewStylesheet
+
Symbol
xsltFormatNumberConversion
+

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Daniel Veillard

diff --git a/doc/APIchunk10.html b/doc/APIchunk10.html new file mode 100644 index 0000000..5bae01f --- /dev/null +++ b/doc/APIchunk10.html @@ -0,0 +1,468 @@ + + +API Alphabetic Index q-s for libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

API Alphabetic Index q-s for libxslt

Main Menu
Related links
API Indexes

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Letter q:

query
xsltGetKey
+
quick
IS_XSLT_ATTR_FAST
+IS_XSLT_ELEM_FAST
+
quote
xsltFormatNumberConversion
+

Letter r:

raise
xsltApplyOneTemplate
+
rank=
xsltGetProfileInformation
+
read
xsltCheckRead
+xsltRunStylesheet
+xsltRunStylesheetUser
+
read:
_xsltStyleItemDocument
+
ready
xsltAllocateExtraCtxt
+
real
IS_XSLT_REAL_NODE
+
really
XSLT_ITEM_COMPATIBILITY_FIELDS
+_xsltEffectiveNs
+
record
xsltParseGlobalParam
+xsltParseStylesheetOutput
+
recorded
xsltParseStylesheetCallerParam
+
recursive
_xsltTransformContext
+
refactored
XSLT_REFACTORED_VARS
+_xsltStylesheet
+_xsltTemplate
+xsltCopyNamespaceList
+xsltGetNamespace
+xsltInitCtxtKeys
+
reference
xsltParseStylesheetDoc
+
references
xsltAttrListTemplateProcess
+xsltResolveStylesheetAttributeSet
+
referencing
xsltLoadStylesheetPI
+
reflect
XSLT_ITEM_COMPATIBILITY_FIELDS
+
reflected
xsltParseStylesheetDoc
+
register
xsltExtensionInstructionResultRegister
+xsltNamespaceAlias
+
registered
xsltDebugDumpExtensions
+xsltDocLoaderFunc
+xsltFreeRVTs
+xsltInitCtxtExts
+xsltRegisterExtPrefix
+
registers
xsltInit
+xsltParseGlobalVariable
+
related
_xsltStylesheet
+xsltParseStylesheetOutput
+
remain
xsltLocalVariablePop
+
remove
xsltParseSequenceConstructor
+
reorder
xsltComputeSortResult
+xsltDefaultSortFunction
+xsltDoSortFunction
+xsltDocumentSortFunction
+
replace
xsltGetQNameURI
+
replacement
_xsltTemplate
+
report
xsltApplyOneTemplate
+
reports
_xsltCompilerCtxt
+xsltGetSpecialNamespace
+
represented
xsltFreeStyleDocuments
+
representing
xsltFreeStyleDocuments
+
requested
xsltFormatNumberConversion
+xsltGetNamespace
+xsltGetSpecialNamespace
+
required
xsltDocLoaderFunc
+
requirement
xsltComputeSortResult
+xsltDefaultSortFunction
+xsltDoSortFunction
+
requires
xsltNeedElemSpaceHandling
+
reset
xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltSetSortFunc
+xsltSetTransformErrorFunc
+
resets
xsltSetLoaderFunc
+
resolve
xsltResolveStylesheetAttributeSet
+
resource
xsltCheckRead
+xsltCheckWrite
+xsltRunStylesheet
+xsltRunStylesheetUser
+
respect
xsltFindElemSpaceHandling
+
restored
xsltApplyOneTemplate
+
restricts
_xsltStylesheet
+
result-prefix
xsltNamespaceAlias
+
result-tree
xsltFunctionNodeSet
+
resulting
_xsltTransformContext
+xsltEvalTemplateString
+xsltGetKey
+xsltLoadStylesheetPI
+xsltXPathCompile
+xsltXPathCompileFlags
+
results
xsltParseTemplateContent
+
retrieve
xsltXPathGetTransformContext
+
return
CHECK_STOPPED
+CHECK_STOPPED0
+xsltAllocateExtra
+xsltAllocateExtraCtxt
+xsltAttrTemplateValueProcess
+xsltAttrTemplateValueProcessNode
+xsltEvalAVT
+xsltSplitQName
+
returned
xsltExtensionInstructionResultFinalize
+xsltGetProfileInformation
+xsltGetQNameURI
+xsltParseStylesheetDoc
+
reuse
xsltApplyOneTemplate
+xsltReleaseRVT
+
rid
_xsltPrincipalStylesheetData
+_xsltStylesheet
+
right
xsltParseStylesheetProcess
+
root
_xsltCompilerCtxt
+_xsltCompilerNodeInfo
+xsltApplyStripSpaces
+
routine
_xsltRuntimeExtra
+xsltLocalVariablePush
+
routines
xsltSetDebuggerCallbacks
+
rule
xsltFindTemplate
+
rules
XML_CAST_FPTR
+_xsltCompilerCtxt
+
run
_xsltTransformContext
+
run-time
xsltAllocateExtraCtxt
+xsltCompilePattern
+
running
xsltSetTransformErrorFunc
+
runtime
_xsltTransformContext
+xsltAllocateExtra
+xsltAllocateExtraCtxt
+xsltDocLoaderFunc
+

Letter s:

s390
XML_CAST_FPTR
+
same
xsltFindTemplate
+xsltGetPlainNamespace
+xsltGetQNameURI
+
sane
xsltFindTemplate
+
saving
xsltSaveProfiling
+
saxon
xsltFunctionNodeSet
+
scanner
xsltNormalizeCompSteps
+
scope
_xsltKeyDef
+_xsltStylePreComp
+_xsltStylesheet
+xsltApplyOneTemplate
+xsltEvalXPathPredicate
+xsltGetQNameURI
+xsltGetTemplate
+
seaches
xsltGetQNameURI
+
search
xsltExtElementLookup
+
section
_xsltStylesheet
+
security
_xsltTransformContext
+xsltCheckRead
+xsltCheckWrite
+xsltFreeSecurityPrefs
+xsltGetDefaultSecurityPrefs
+xsltGetSecurityPrefs
+xsltNewSecurityPrefs
+xsltSecurityAllow
+xsltSecurityForbid
+xsltSetCtxtSecurityPrefs
+xsltSetDefaultSecurityPrefs
+xsltSetSecurityPrefs
+
see
xsltEvalOneUserParam
+
semantic
xsltGetCNsProp
+xsltGetNsProp
+
separates
xsltFormatNumberConversion
+
separator
xsltFormatNumberConversion
+
sequence
_xsltStackElem
+xsltApplyOneTemplate
+xsltEvalTemplateString
+xsltGetUTF8Char
+xsltParseSequenceConstructor
+
set
NODE_IS_KEYED
+XSLT_MARK_RES_TREE_FRAG
+XSLT_PARSE_OPTIONS
+_xsltStylesheet
+xsltApplyOneTemplate
+xsltCleanupGlobals
+xsltComputeSortResult
+xsltDefaultSortFunction
+xsltDoSortFunction
+xsltDocLoaderFunc
+xsltDocumentSortFunction
+xsltExtensionInstructionResultFinalize
+xsltInitCtxtExts
+xsltSetCtxtSortFunc
+xsltSetDebuggerStatus
+xsltShutdownCtxtExts
+xsltShutdownExts
+
sets
_xsltStylesheet
+xsltAttrTemplateProcess
+xsltFreeAttributeSetsHashes
+xsltResolveStylesheetAttributeSet
+xsltSetDebuggerStatus
+
setting
xsltGetQNameURI
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+
shared
_xsltStylesheet
+_xsltTransformContext
+
sheet
_xsltStylesheet
+xsltLoadStyleDocument
+xsltNewStyleDocument
+
should
CHECK_STOPPED
+CHECK_STOPPED0
+CHECK_STOPPEDE
+_xsltStylesheet
+_xsltTransformContext
+xsltCopyTextString
+xsltDocumentSortFunction
+xsltFindElemSpaceHandling
+xsltFreeRVTs
+xsltGetProfileInformation
+xsltLocalVariablePop
+xsltLocalVariablePush
+xsltNeedElemSpaceHandling
+xsltQuoteUserParams
+xsltRegisterExtElement
+xsltRegisterExtFunction
+xsltSetXIncludeDefault
+xsltSort
+
show
xsltFormatNumberConversion
+
shows
xsltFormatNumberConversion
+
shutdown
xsltExtShutdownFunction
+xsltFreeLocales
+xsltRegisterExtModule
+xsltRegisterExtModuleFull
+xsltStyleExtShutdownFunction
+
sibling
XSLT_ITEM_COMPATIBILITY_FIELDS
+
side
xsltApplyOneTemplate
+
signalled
xsltGetQNameURI
+
signature
xsltDocLoaderFunc
+
similar
xsltGetQNameURI2
+
simplified
_xsltCompilerCtxt
+
simply
xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltSetTransformErrorFunc
+
since
xsltAttrListTemplateProcess
+xsltRegisterTmpRVT
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltTimestamp
+
single
xsltEvalOneUserParam
+xsltQuoteOneUserParam
+
size
_xsltStylesheet
+_xsltTransformContext
+xsltPointerListAddSize
+xsltPointerListCreate
+
slightly
xsltGetCNsProp
+xsltGetNsProp
+
slot
xsltAllocateExtra
+xsltAllocateExtraCtxt
+
slow
xsltDocumentSortFunction
+
some
xsltCheckWrite
+xsltCompileAttr
+
something
xsltParseStylesheetProcess
+
sorted
_xsltTemplate
+
sorting
xsltComputeSortResult
+xsltDefaultSortFunction
+xsltDoSortFunction
+xsltLocaleStrcmp
+xsltSetCtxtSortFunc
+xsltSetSortFunc
+xsltSortFunc
+
sorts
xsltDefaultSortFunction
+xsltDoSortFunction
+xsltLocaleStrcmp
+xsltSortFunc
+
space
_xsltStylesheet
+xsltFindElemSpaceHandling
+xsltFreeDocuments
+xsltNeedElemSpaceHandling
+
spaces
xsltApplyStripSpaces
+
spec
_xsltCompilerCtxt
+
special
_xsltCompilerCtxt
+xsltFormatNumberConversion
+
specialCharacters
xsltFormatNumberConversion
+
specific
XSLT_LIBXSLT_NAMESPACE
+_xsltTransformContext
+xsltDoSortFunction
+xsltExtInitFunction
+xsltSetCtxtSecurityPrefs
+xsltSetTransformErrorFunc
+xsltStyleExtInitFunction
+xsltTransformError
+
specification
XSLT_NAMESPACE
+
specified
XSLT_MAX_SORT
+_xsltCompilerCtxt
+xsltDoSortFunction
+xsltFindTemplate
+xsltGetCNsProp
+xsltGetNsProp
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSetCtxtSortFunc
+
specify
xsltRunStylesheet
+xsltRunStylesheetUser
+
spent
_xsltTemplate
+
stack
_xsltTemplate
+_xsltTransformContext
+xslAddCall
+xslDropCall
+xsltAddStackElemList
+xsltApplyOneTemplate
+xsltFreeStackElemList
+xsltLocalVariablePop
+xsltLocalVariablePush
+
standalone
_xsltStylesheet
+
start
xsltApplyOneTemplate
+xsltEvalGlobalVariables
+
start-node
xsltParseSequenceConstructor
+
starting
xsltEvalUserParams
+xsltQuoteUserParams
+
state
xslHandleDebugger
+xsltCleanupTemplates
+xsltExtensionInstructionResultFinalize
+xsltGetXIncludeDefault
+
states
xsltApplyOneTemplate
+
static
xsltEvalStaticAttrValueTemplate
+
statically
xsltAllocateExtra
+
status
_xsltTransformContext
+
stderr
xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+
stdout
xsltDebugDumpExtensions
+
steps
xsltNormalizeCompSteps
+
still
xsltExtensionInstructionResultRegister
+
stopped
CHECK_STOPPED
+CHECK_STOPPED0
+CHECK_STOPPEDE
+
storage
XSLT_ITEM_COMPATIBILITY_FIELDS
+_xsltDocument
+_xsltEffectiveNs
+
store
xsltInitElemPreComp
+
stored
XSLT_RUNTIME_EXTRA
+XSLT_RUNTIME_EXTRA_FREE
+XSLT_RUNTIME_EXTRA_LST
+_xsltStylesheet
+xsltEvalOneUserParam
+xsltEvalUserParams
+xsltPointerListAddSize
+xsltQuoteOneUserParam
+
stores
xsltReleaseRVT
+
str1
xsltLocaleStrcmp
+
str2
xsltLocaleStrcmp
+
strict
_xsltCompilerCtxt
+
string?
xsltFormatNumberFunction
+
strings
_xsltStylesheet
+_xsltTransformContext
+xsltLocaleStrcmp
+
strip-space
_xsltStylesheet
+xsltFindElemSpaceHandling
+
stripped
xsltFindElemSpaceHandling
+xsltNeedElemSpaceHandling
+
stripping
xsltNeedElemSpaceHandling
+
struct
xsltInitElemPreComp
+
structure
XSLT_ITEM_COMPATIBILITY_FIELDS
+_xsltNsMap
+xsltDocumentComp
+xsltElemPreCompDeallocator
+xsltInitElemPreComp
+xsltLoadStylesheetPI
+xsltParseStylesheetDoc
+xsltParseStylesheetFile
+xsltParseStylesheetImportedDoc
+xsltPointerListAddSize
+xsltPointerListCreate
+xsltPointerListFree
+
structured
_xsltCompilerCtxt
+
structures
xsltCompileAttr
+xsltFreeAVTList
+xsltFreeStyleDocuments
+xsltParseStylesheetDoc
+xsltParseStylesheetImportedDoc
+xsltParseStylesheetProcess
+
stuff
_xsltStylesheet
+
style
_xsltStylesheet
+xsltGetTemplate
+xsltLoadStyleDocument
+xsltNewStyleDocument
+xsltRunStylesheet
+xsltRunStylesheetUser
+
stylesheet-level
xsltFreeStyleDocuments
+xsltParseStylesheetProcess
+
stylesheet-modules
xsltFreeStyleDocuments
+
stylesheet-prefix
xsltNamespaceAlias
+
stylesheets
xsltEvalUserParams
+xsltQuoteUserParams
+
subpattern
xsltFormatNumberConversion
+
subpattern{
xsltFormatNumberConversion
+
subpattern}
xsltFormatNumberConversion
+
subsequent
xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltSetTransformErrorFunc
+
subsidiary
_xsltDocument
+
substituted
xsltEvalAttrValueTemplate
+
substitution
xsltGetCNsProp
+xsltGetNsProp
+
subtree
xsltLoadStylesheetPI
+
success
xsltAddKey
+xsltAddStackElemList
+xsltEvalGlobalVariables
+xsltEvalOneUserParam
+xsltEvalUserParams
+xsltExtensionInstructionResultFinalize
+xsltExtensionInstructionResultRegister
+xsltInitAllDocKeys
+xsltInitCtxtKey
+xsltLocalVariablePush
+xsltParseStylesheetImport
+xsltParseStylesheetInclude
+xsltQuoteOneUserParam
+xsltQuoteUserParams
+xsltRegisterExtElement
+xsltRegisterExtFunction
+xsltRegisterExtPrefix
+xsltRegisterLocalRVT
+xsltRegisterPersistRVT
+xsltRegisterTmpRVT
+xsltRestoreDocumentNamespaces
+xsltSaveResultToString
+xsltSetDebuggerCallbacks
+
successful
xsltRegisterExtModuleElement
+xsltRegisterExtModuleFunction
+xsltRegisterExtModuleTopLevel
+xsltUnregisterExtModuleElement
+xsltUnregisterExtModuleFunction
+xsltUnregisterExtModuleTopLevel
+
sucess
xslAddCall
+
sucessful
xsltRegisterExtModule
+xsltRegisterExtModuleFull
+xsltUnregisterExtModule
+
such
XSLT_ITEM_COMPATIBILITY_FIELDS
+
suffix
_xsltFormatNumberInfo
+xsltFormatNumberConversion
+
suggested
xsltGetSpecialNamespace
+
suitable
xsltCompilePattern
+
sun
xsltFormatNumberConversion
+
support
xsltFreeLocales
+
supported
XSLT_DEFAULT_VERSION
+XSLT_LOCALE_NONE
+
sure
xsltAllocateExtraCtxt
+
system
xsltNewLocale
+
system-property
xsltSystemPropertyFunction
+

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Daniel Veillard

diff --git a/doc/APIchunk11.html b/doc/APIchunk11.html new file mode 100644 index 0000000..eea7cc8 --- /dev/null +++ b/doc/APIchunk11.html @@ -0,0 +1,262 @@ + + +API Alphabetic Index t-u for libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

API Alphabetic Index t-u for libxslt

Main Menu
Related links
API Indexes

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Letter t:

table
_xsltStylesheet
+xsltEvalOneUserParam
+xsltEvalUserParams
+xsltGetExtInfo
+xsltNormalizeCompSteps
+xsltQuoteOneUserParam
+
tables
_xsltDocument
+xsltInitCtxtKey
+xsltInitCtxtKeys
+
tag
xsltNewLocale
+
target
xsltCopyNamespace
+xsltCopyNamespaceList
+
targetted
xsltApplyStylesheetUser
+
temlate
xslHandleDebugger
+
templates
_xsltStylesheet
+_xsltTemplate
+_xsltTransformContext
+xsltAttrTemplateValueProcessNode
+xsltCleanupTemplates
+xsltFindTemplate
+xsltFreeAVTList
+
templtaes
_xsltTransformContext
+
templtes
_xsltTemplate
+_xsltTransformContext
+
temporary
_xsltTransformContext
+xsltFindDocument
+
tenth
xsltTimestamp
+
term
xsltCreateRVT
+
term:
_xsltTransformContext
+xsltRegisterLocalRVT
+xsltRegisterPersistRVT
+xsltRegisterTmpRVT
+
terminated
xsltApplyStylesheet
+xsltApplyStylesheetUser
+xsltEvalOneUserParam
+xsltEvalUserParams
+xsltProfileStylesheet
+xsltQuoteOneUserParam
+xsltQuoteUserParams
+xsltRunStylesheet
+xsltRunStylesheetUser
+
terms
xsltParseSequenceConstructor
+
test
XSLT_IS_RES_TREE_FRAG
+xsltRegisterTestModule
+
test=
XSLT_FAST_IF
+
tests
XSLT_FAST_IF
+
text
IS_XSLT_REAL_NODE
+XSLT_IS_TEXT_NODE
+_xsltStyleItemText
+_xsltStylePreComp
+_xsltStylesheet
+_xsltTransformContext
+xsltCopyTextString
+xsltFormatNumberConversion
+xsltSaveResultToString
+xsltText
+
than
xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+
that
IS_XSLT_ELEM
+IS_XSLT_REAL_NODE
+XSLT_ITEM_COMPATIBILITY_FIELDS
+XSLT_LOCALE_NONE
+XSLT_STRANGE
+xslHandleDebugger
+xsltApplyOneTemplate
+xsltDocLoaderFunc
+xsltExtensionInstructionResultFinalize
+xsltExtensionInstructionResultRegister
+xsltGetCNsProp
+xsltGetNsProp
+xsltGetSpecialNamespace
+xsltLoadStylesheetPI
+xsltNeedElemSpaceHandling
+xsltParseStylesheetCallerParam
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltSetTransformErrorFunc
+xsltXPathGetTransformContext
+
them
xsltApplyOneTemplate
+xsltExtensionInstructionResultFinalize
+xsltNamespaceAlias
+
themselve
xsltDocLoaderFunc
+
then
xslHandleDebugger
+xsltApplyAttributeSet
+xsltCopyNamespace
+xsltFindTemplate
+xsltGetNamespace
+xsltGetSpecialNamespace
+xsltSetCtxtSortFunc
+xsltStrxfrm
+
there
_xsltCompilerCtxt
+xsltAllocateExtraCtxt
+xsltGetQNameURI
+xsltGetQNameURI2
+xsltGetSpecialNamespace
+xsltGetXIncludeDefault
+
they
xsltEvalAttrValueTemplate
+
those
xsltEvalAttrValueTemplate
+xsltFormatNumberConversion
+
time
_xsltTemplate
+xslHandleDebugger
+xsltCompileAttr
+xsltDocLoaderFunc
+xsltExtInitFunction
+xsltExtShutdownFunction
+xsltParseGlobalVariable
+xsltParseStylesheetCallerParam
+xsltParseStylesheetParam
+xsltParseStylesheetVariable
+xsltStyleExtInitFunction
+xsltStyleExtShutdownFunction
+
time=
xsltGetProfileInformation
+
top-level
xsltExtModuleTopLevelLookup
+xsltRegisterExtModuleTopLevel
+xsltUnregisterExtModuleTopLevel
+
topmost
_xsltCompilerCtxt
+xslDropCall
+
tracing
xsltDebugGetDefaultTrace
+xsltDebugSetDefaultTrace
+
track
_xsltStylesheet
+
transfer
xslHandleDebugger
+
transform
xslHandleDebugger
+xsltApplyStylesheetUser
+xsltAttrListTemplateProcess
+xsltCopyNamespaceList
+xsltInitElemPreComp
+xsltNewElemPreComp
+xsltRunStylesheetUser
+xsltStrxfrm
+
transformation-time
xsltCopyNamespaceList
+xsltFindTemplate
+
transformations
xsltEvalUserParams
+xsltQuoteUserParams
+
transformed
xsltLocaleStrcmp
+xsltStrxfrm
+
transmit
xsltTransformError
+
transromation
xsltSetTransformErrorFunc
+
treated
xsltEvalOneUserParam
+xsltQuoteUserParams
+
trees
xsltFreeRVTs
+
tries
xsltLoadStylesheetPI
+
trigger
_xsltCompilerNodeInfo
+
true
xsltEvalXPathPredicate
+
try
xsltGetSpecialNamespace
+
tuples
xsltApplyStylesheet
+xsltApplyStylesheetUser
+xsltEvalUserParams
+xsltProfileStylesheet
+xsltQuoteUserParams
+xsltRunStylesheet
+xsltRunStylesheetUser
+
turned
_xsltCompilerCtxt
+xsltGetCNsProp
+xsltGetNsProp
+
two
xsltLocaleStrcmp
+
type
XSLT_TRACE
+_xsltCompilerNodeInfo
+_xsltElemPreComp
+_xsltStylePreComp
+_xsltTransformContext
+xsltNewLocale
+

Letter u:

ultimately
xsltGetUTF8Char
+
undeclare
xsltGetSpecialNamespace
+
undefined
UNDEFINED_DEFAULT_NS
+
unfortunately
_xsltStylesheet
+
unimplemented
XSLT_TODO
+
unless
xsltGetCNsProp
+xsltGetNsProp
+
unparsed-entity-uri
xsltUnparsedEntityURIFunction
+
unstructured
_xsltCompilerCtxt
+
unused
xsltDocumentComp
+xsltSecurityAllow
+xsltSecurityForbid
+
unwanted
xsltApplyStripSpaces
+xsltParseTemplateContent
+
update
xsltGetSecurityPrefs
+xsltGetUTF8Char
+xsltSetSecurityPrefs
+
usage
XSLT_FAST_IF
+
use
xsltAddKey
+xsltCopyNamespaceList
+xsltDocLoaderFunc
+xsltEvalGlobalVariables
+xsltEvalOneUserParam
+xsltEvalUserParams
+xsltEvalXPathStringNs
+xsltFindTemplate
+xsltGetCNsProp
+xsltGetDefaultSecurityPrefs
+xsltGetNamespace
+xsltGetNsProp
+xsltGetSpecialNamespace
+xsltGetUTF8Char
+xsltRegisterExtras
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSecurityAllow
+xsltSecurityForbid
+xsltSetCtxtSecurityPrefs
+xsltSetDefaultSecurityPrefs
+xsltSetSecurityPrefs
+xsltSortFunc
+xsltTemplateProcess
+xsltTransformError
+
use:
_xsltStylesheet
+
useful
xsltXPathGetTransformContext
+
usefull
xsltInitElemPreComp
+
user
_xsltTransformContext
+xsltApplyStylesheetUser
+xsltRunStylesheetUser
+xsltSetSecurityPrefs
+
user-code
xsltFreeRVTs
+
users!
xsltLocalVariablePush
+
uses
xsltFormatNumberConversion
+xsltRunStylesheet
+xsltRunStylesheetUser
+
using
xsltDoSortFunction
+xsltEvalXPathPredicate
+xsltEvalXPathString
+xsltEvalXPathStringNs
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSetCtxtParseOptions
+

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Daniel Veillard

diff --git a/doc/APIchunk12.html b/doc/APIchunk12.html new file mode 100644 index 0000000..0bc524b --- /dev/null +++ b/doc/APIchunk12.html @@ -0,0 +1,337 @@ + + +API Alphabetic Index v-x for libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

API Alphabetic Index v-x for libxslt

Main Menu
Related links
API Indexes

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Letter v:

validates
xsltParseAnyXSLTElem
+
validating
xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+
value-of
_xsltStyleItemApplyTemplates
+_xsltStyleItemSort
+_xsltStylePreComp
+xsltValueOf
+
value-returning
xsltExtensionInstructionResultFinalize
+xsltExtensionInstructionResultRegister
+
values
_xsltStylePreComp
+xsltApplyStylesheet
+xsltApplyStylesheetUser
+xsltGetCNsProp
+xsltGetNsProp
+xsltInitCtxtKey
+xsltLocalVariablePop
+xsltProfileStylesheet
+xsltQuoteUserParams
+xsltRunStylesheet
+xsltRunStylesheetUser
+
variables
_xsltCompilerCtxt
+_xsltStackElem
+_xsltTransformContext
+xsltApplyOneTemplate
+xsltCleanupGlobals
+xsltEvalGlobalVariables
+xsltEvalUserParams
+xsltFreeGlobalVariables
+xsltInitGlobals
+xsltLocalVariablePop
+
varibale
xsltXPathVariableLookup
+
varibales
xsltInitCtxtKeys
+
vendor
XSLT_DEFAULT_URL
+XSLT_DEFAULT_VENDOR
+
version
XSLT_DEFAULT_VERSION
+_xsltCompilerCtxt
+_xsltStylesheet
+
version=
xsltGetProfileInformation
+
via
xsltAttrListTemplateProcess
+xsltExtensionInstructionResultRegister
+
violated
XML_CAST_FPTR
+
visible
xsltApplyOneTemplate
+
void
XML_CAST_FPTR
+_xsltStylesheet
+xsltXPathFunctionLookup
+xsltXPathVariableLookup
+

Letter w:

want
xsltEvalUserParams
+
warning
XML_CAST_FPTR
+_xsltCompilerCtxt
+
warnings
_xsltCompilerCtxt
+_xsltStylesheet
+
was
XSLT_STRANGE
+_xsltCompilerCtxt
+_xsltCompilerNodeInfo
+_xsltStackElem
+_xsltTemplate
+xsltEvalXPathPredicate
+xsltNewLocale
+xsltNextImport
+xsltRegisterExtPrefix
+
way
xsltFindTemplate
+
well
xsltNamespaceAlias
+
went
xsltParseStylesheetProcess
+
were
_xsltStylesheet
+
when
XSLT_PARSE_OPTIONS
+_xsltTransformContext
+xsltDocLoaderFunc
+xsltGetQNameURI2
+xsltInitElemPreComp
+xsltParseStylesheetDoc
+xsltRegisterLocalRVT
+xsltRegisterPersistRVT
+xsltRegisterTmpRVT
+xsltSetCtxtParseOptions
+xsltXPathFunctionLookup
+xsltXPathGetTransformContext
+xsltXPathVariableLookup
+
where
xslHandleDebugger
+xsltAttrListTemplateProcess
+xsltAttrTemplateProcess
+xsltCopyTextString
+xsltGetQNameURI
+
wherever
_xsltStylesheet
+
whether
IS_XSLT_ELEM_FAST
+_xsltCompilerCtxt
+_xsltCompilerNodeInfo
+_xsltFormatNumberInfo
+xsltEvalStaticAttrValueTemplate
+xsltNeedElemSpaceHandling
+xsltSetXIncludeDefault
+xsltTestCompMatchList
+
which
XSLT_ITEM_COMPATIBILITY_FIELDS
+_xsltStackElem
+_xsltTransformContext
+xsltDocLoaderFunc
+xsltExtensionInstructionResultFinalize
+xsltGetSpecialNamespace
+xsltLocalVariablePop
+xsltRegisterExtElement
+xsltRegisterExtFunction
+xsltRegisterLocalRVT
+xsltReleaseRVT
+
while
xsltAllocateExtra
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltSetTransformErrorFunc
+
white-space
xsltNeedElemSpaceHandling
+
whitespace-stripping
_xsltCompilerCtxt
+
wildcards
xsltFindElemSpaceHandling
+
wise
xsltApplyStylesheet
+xsltRunStylesheet
+xsltRunStylesheetUser
+
with
CHECK_STOPPED0
+xsltAttrTemplateValueProcessNode
+xsltEvalAttrValueTemplate
+xsltEvalStaticAttrValueTemplate
+xsltExtensionInstructionResultRegister
+xsltFreeLocale
+xsltGetCNsProp
+xsltGetNamespace
+xsltGetNsProp
+xsltGetProfileInformation
+xsltGetQNameURI
+xsltGetSpecialNamespace
+xsltGetUTF8Char
+xsltInitCtxtExts
+xsltLocaleStrcmp
+xsltParseStylesheetCallerParam
+xsltStrxfrm
+
with-params
_xsltStyleItemApplyTemplates
+_xsltStyleItemCallTemplate
+
within
xsltExtensionInstructionResultFinalize
+xsltFindDocument
+xsltLoadDocument
+xsltLoadStyleDocument
+xsltLoadStylesheetPI
+xsltParseStylesheetDoc
+
without
XML_CAST_FPTR
+XSLT_PAT_NO_PRIORITY
+_xsltTransformContext
+
won
_xsltTemplate
+xsltCopyNamespaceList
+
work
xsltCheckWrite
+
wrapped
xsltFindElemSpaceHandling
+
wrapper
xsltDoSortFunction
+
write
xsltCheckWrite
+
written
xsltCheckWrite
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSaveResultTo
+xsltSaveResultToFd
+xsltSaveResultToFile
+xsltSaveResultToFilename
+
wrt
xsltLocaleStrcmp
+

Letter x:

xmlDoc
xsltParseStylesheetDoc
+xsltParseStylesheetImportedDoc
+xsltParseStylesheetProcess
+xsltReleaseRVT
+
xmlDocPtr
xsltGetProfileInformation
+xsltRegisterLocalRVT
+xsltSaveResultTo
+xsltSaveResultToFd
+xsltSaveResultToFile
+xsltSaveResultToFilename
+xsltSaveResultToString
+
xmlFree
xsltStrxfrm
+
xmlFreeDoc
xsltGetProfileInformation
+
xmlGetNsProp
xsltGetCNsProp
+xsltGetNsProp
+
xmlGetUTF8Char
xsltGetUTF8Char
+
xmlNodePtr
_xsltTransformContext
+
xmlNs
_xsltNsMap
+
xmlNsPtr
xsltCopyNamespace
+xsltCopyNamespaceList
+
xmlParserOption
xsltDocLoaderFunc
+xsltSetCtxtParseOptions
+
xmlReadxxx
XSLT_PARSE_OPTIONS
+
xmlXPathCompExprPtr
xsltXPathCompile
+xsltXPathCompileFlags
+
xmlXPathCompiledEvalToBoolean
XSLT_FAST_IF
+
xmlns=
xsltGetSpecialNamespace
+
xsl
XSLT_TRACE
+
xsl:
_xsltPrincipalStylesheetData
+
xsl:apply-templates
xsltTransformFunction
+
xsl:choose
xsltChoose
+
xsl:comment
xsltEvalTemplateString
+
xsl:for-each
xsltForEach
+
xsl:if
XSLT_FAST_IF
+xsltIf
+xsltTransformFunction
+
xsl:import
xsltDocLoaderFunc
+
xsl:include
xsltDocLoaderFunc
+
xsl:key
XSLT_REFACTORED_KEYCOMP
+
xsl:message
xsltMessage
+
xsl:namespace-alias
_xsltCompilerCtxt
+xsltNamespaceAlias
+
xsl:param
_xsltTemplate
+xsltApplyOneTemplate
+xsltParseStylesheetCallerParam
+
xsl:processing-instruction
xsltEvalTemplateString
+
xsl:sort
XSLT_MAX_SORT
+xsltSort
+
xsl:template
xsltApplyOneTemplate
+xsltLocalVariablePop
+xsltRegisterTmpRVT
+
xsl:text
xsltParseSequenceConstructor
+
xsl:use-attribute-set
xsltAttrListTemplateProcess
+xsltAttrTemplateProcess
+
xsl:use-attribute-sets
xsltApplyAttributeSet
+
xsl:variable
xsltParseStylesheetVariable
+
xsl:with-param
_xsltStackElem
+xsltParseStylesheetCallerParam
+xsltProcessOneNode
+
xslDebugBreak
xslHandleDebugger
+
xslDebugStatus
xslHandleDebugger
+xsltGetDebuggerStatus
+xsltSetDebuggerStatus
+
xslt
IS_XSLT_ATTR_FAST
+IS_XSLT_ELEM_FAST
+xslHandleDebugger
+xsltAttribute
+xsltCheckExtPrefix
+xsltCheckExtURI
+xsltComment
+xsltElement
+xsltForEach
+xsltNumber
+xsltParseStylesheetProcess
+xsltProcessingInstruction
+xsltRegisterExtPrefix
+xsltSort
+xsltText
+xsltValueOf
+
xslt:text
xsltParseTemplateContent
+
xsltAddTemplate
xsltFreeTemplateHashes
+
xsltApplySequenceConstructor
xsltAttrListTemplateProcess
+xsltGetNamespace
+
xsltAttrTemplateValueProcess
xsltAttrTemplateValueProcessNode
+
xsltCopyPropList
xsltGetNamespace
+
xsltCopyTreeInternal
xsltCopyNamespaceList
+xsltGetNamespace
+
xsltCreateRVT
xsltExtensionInstructionResultRegister
+
xsltDecimalFormatPtr
xsltDecimalFormatGetByName
+
xsltDocLoaderFunc
xsltDocLoaderFunc
+
xsltDocument
xsltFreeStyleDocuments
+
xsltDocumentComp
_xsltStyleItemDocument
+
xsltDocumentPtr
xsltFindDocument
+xsltLoadDocument
+xsltLoadStyleDocument
+
xsltElemPreComp
xsltElemPreCompDeallocator
+xsltInitElemPreComp
+xsltNewElemPreComp
+
xsltElement
xsltGetNamespace
+
xsltEvalAttrValueTemplate
xsltAttrTemplateValueProcessNode
+
xsltEvalUserParams
xsltEvalOneUserParam
+xsltQuoteUserParams
+
xsltEvalVariable
xsltApplyOneTemplate
+
xsltExtElementPreCompTest
xsltStyleGetExtData
+
xsltExtInitTest
xsltStyleGetExtData
+
xsltGetInheritedNsList
xsltCheckExtPrefix
+
xsltGetNamespace
xsltGetPlainNamespace
+
xsltGetQNameURI
xsltGetQNameURI2
+
xsltGetTemplate
xsltFreeTemplateHashes
+
xsltLoadType
xsltDocLoaderFunc
+
xsltLocaleStrcmp
xsltStrxfrm
+
xsltNewLocale
xsltFreeLocale
+xsltStrxfrm
+
xsltParseExtElemPrefixes
xsltRegisterExtPrefix
+
xsltParseStylesheetImportedDoc
xsltParseStylesheetProcess
+
xsltParseStylesheetInclude
xsltParseStylesheetProcess
+
xsltParseTemplateContent
xsltCheckExtPrefix
+xsltCheckExtURI
+
xsltPointerList
xsltPointerListCreate
+xsltPointerListFree
+
xsltPrecomputeStylesheet
xsltCheckExtURI
+
xsltProcessOneUserParamInternal
xsltEvalOneUserParam
+
xsltQuoteOneUserParam
xsltEvalOneUserParam
+
xsltQuoteUserParams
xsltEvalOneUserParam
+xsltEvalUserParams
+xsltQuoteOneUserParam
+
xsltRegisterAllExtras
xsltRegisterExtras
+
xsltRegisterExtPrefix
xsltRegisterExtPrefix
+xsltStyleGetExtData
+
xsltRegisterLocalRVT
xsltExtensionInstructionResultRegister
+xsltRegisterTmpRVT
+
xsltSecurityPrefsPtr
xsltGetDefaultSecurityPrefs
+
xsltSetCtxtSortFunc
xsltDoSortFunction
+
xsltSetSortFunc
xsltDoSortFunction
+
xsltShallowCopyElem
xsltCopyNamespaceList
+
xsltShallowCopyElement
xsltGetNamespace
+
xsltStackElemPtr
xsltParseStylesheetCallerParam
+
xsltStrxfrm
xsltLocaleStrcmp
+
xsltStylesheet
_xsltElemPreComp
+
xsltStylesheetPtr
xsltNewStylesheet
+
xsltTemplatePtr
xsltFindTemplate
+xsltGetTemplate
+
xsltTimestamp
xsltCalibrateAdjust
+
xsltTransformContextPtr
xsltNewTransformContext
+

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Daniel Veillard

diff --git a/doc/APIchunk13.html b/doc/APIchunk13.html new file mode 100644 index 0000000..5388c24 --- /dev/null +++ b/doc/APIchunk13.html @@ -0,0 +1,47 @@ + + +API Alphabetic Index y-z for libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

API Alphabetic Index y-z for libxslt

Main Menu
Related links
API Indexes

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Letter y:

yes
_xsltStylesheet
+xsltCompileAttr
+
yet
xsltRunStylesheet
+xsltRunStylesheetUser
+
you
xsltAttrListTemplateProcess
+xsltEvalUserParams
+
your
xsltEvalUserParams
+

Letter z:

zero
xsltFormatNumberConversion
+

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Daniel Veillard

diff --git a/doc/APIchunk2.html b/doc/APIchunk2.html new file mode 100644 index 0000000..00a8a0c --- /dev/null +++ b/doc/APIchunk2.html @@ -0,0 +1,359 @@ + + +API Alphabetic Index T-a for libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

API Alphabetic Index T-a for libxslt

Main Menu
Related links
API Indexes

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Letter T:

TEMP
_xsltCompilerCtxt
+
TODO:
XSLT_ITEM_COMPATIBILITY_FIELDS
+XSLT_ITEM_NAVIGATION_FIELDS
+_xsltCompilerCtxt
+_xsltStyleBasicExpressionItem
+_xsltStyleItemApplyTemplates
+_xsltStyleItemCallTemplate
+_xsltStyleItemDocument
+_xsltStylesheet
+_xsltTemplate
+xsltFindTemplate
+
Template
_xsltStylesheet
+_xsltTransformContext
+
Templates
xsltAttrListTemplateProcess
+xsltAttrTemplateProcess
+
Test
xsltTestCompMatchList
+
That
XSLT_REFACTORED_KEYCOMP
+
TransformContext
xsltNewTransformContext
+
Transforms
xsltStrxfrm
+
Tree
_xsltStackElem
+_xsltTransformContext
+xsltCreateRVT
+xsltExtensionInstructionResultFinalize
+xsltFindDocument
+xsltFreeRVTs
+xsltRegisterLocalRVT
+xsltRegisterPersistRVT
+xsltRegisterTmpRVT
+xsltReleaseRVT
+
Try
xsltFindDocument
+xsltLoadDocument
+xsltLoadStyleDocument
+

Letter U:

URL
XSLT_DEFAULT_URL
+_xsltStyleItemDocument
+_xsltStylePreComp
+xsltParseStylesheetFile
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSaveResultToFilename
+xsltSecurityCheck
+
UTF-8
xsltGetUTF8Char
+xsltStrxfrm
+
UTF8
xsltGetUTF8Char
+xsltRunStylesheet
+xsltRunStylesheetUser
+
Uninitializes
xsltUninit
+
Unregister
xsltCleanupGlobals
+xsltUnregisterExtModule
+
Unregisters
xsltUnregisterExtModuleElement
+xsltUnregisterExtModuleFunction
+xsltUnregisterExtModuleTopLevel
+
Update
xsltSetSecurityPrefs
+
Use
xsltRegisterTmpRVT
+
Used
_xsltDecimalFormat
+xsltCalibrateAdjust
+xsltTimestamp
+
User
xsltSecurityCheck
+

Letter V:

Value
_xsltTransformContext
+xsltAttrListTemplateProcess
+xsltAttrTemplateProcess
+xsltCreateRVT
+
Variable
xsltVariableLookup
+

Letter W:

WITH_XSLT_DEBUG_BREAKPOINTS
xslAddCall
+
Why
xsltAttrTemplateValueProcessNode
+
Will
CHECK_STOPPED
+CHECK_STOPPED0
+CHECK_STOPPEDE
+

Letter X:

XALAN
XSLT_XALAN_NAMESPACE
+
XInclude
_xsltTransformContext
+xsltGetXIncludeDefault
+xsltSetXIncludeDefault
+
XML
_xsltNsMap
+_xsltStylesheet
+xsltApplyStripSpaces
+xsltApplyStylesheet
+xsltApplyStylesheetUser
+xsltFindDocument
+xsltFindElemSpaceHandling
+xsltGetProfileInformation
+xsltNewDocument
+xsltNewStyleDocument
+xsltParseStylesheetDoc
+xsltParseStylesheetImportedDoc
+xsltParseStylesheetProcess
+xsltProfileStylesheet
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSaveResultToString
+
XML_CAST_FPTR
XML_CAST_FPTR
+
XSLT-1
xsltDocumentComp
+xsltDocumentElem
+
XSLT-attributes
xsltAttrListTemplateProcess
+
XSLT-copy
xsltCopy
+
XSLT_ERROR_SEVERITY_WARNING
_xsltCompilerCtxt
+
XSLT_GET_IMPORT_PTR
xsltRunStylesheet
+xsltRunStylesheetUser
+

Letter a:

absent
xsltFormatNumberConversion
+
accelerators
_xsltNumberData
+
access
XSLT_RUNTIME_EXTRA_LST
+
according
xsltRunStylesheet
+xsltRunStylesheetUser
+xsltStrxfrm
+
accordingly
xsltComputeSortResult
+xsltDefaultSortFunction
+xsltDoSortFunction
+xsltDocumentSortFunction
+
activated
xsltCopyTextString
+
actual
xsltDoSortFunction
+xsltRegisterExtElement
+xsltRegisterExtFunction
+
actually
xsltXPathFunctionLookup
+xsltXPathVariableLookup
+
add
xsltAddKey
+
added
xsltCopyNamespaceList
+xsltGetNamespace
+xsltGetSpecialNamespace
+xsltPointerListAddSize
+
adding
xsltParseStylesheetProcess
+
additionally
xsltExtensionInstructionResultRegister
+xsltParseSequenceConstructor
+
address
xsltSetDebuggerCallbacks
+
after
xsltExtensionInstructionResultFinalize
+xsltGetProfileInformation
+xsltLocaleStrcmp
+xsltParseStylesheetDoc
+
afterwards
xsltApplyOneTemplate
+
alias
_xsltStylesheet
+
aliases
_xsltStylesheet
+xsltCopyNamespaceList
+xsltFreeNamespaceAliasHashes
+
aliasing
XML_CAST_FPTR
+
all
XSLT_ITEM_COMMON_FIELDS
+XSLT_REGISTER_FUNCTION_LOOKUP
+XSLT_REGISTER_VARIABLE_LOOKUP
+_xsltStylesheet
+_xsltTransformContext
+xsltAttrListTemplateProcess
+xsltCleanupGlobals
+xsltEvalGlobalVariables
+xsltFreeCompMatchList
+xsltFreeDocuments
+xsltFreeRVTs
+xsltFreeStyleDocuments
+xsltFreeStylePreComps
+xsltInitCtxtKeys
+xsltLocalVariablePop
+xsltRegisterAllElement
+xsltRegisterAllFunctions
+
allocated
_xsltTransformContext
+xsltFreeCompMatchList
+xsltFreeStackElemList
+xsltFreeStylePreComps
+xsltFreeStylesheet
+xsltFreeTransformContext
+xsltGetCNsProp
+xsltNewStylesheet
+xsltNewTransformContext
+xsltPointerListClear
+xsltSaveResultToString
+xsltSplitQName
+
allow
xsltApplyStylesheetUser
+xsltSecurityAllow
+xsltSetDebuggerCallbacks
+
allowed
xsltCheckRead
+xsltCheckWrite
+
allowing
xsltAttrTemplateValueProcessNode
+xsltEvalXPathStringNs
+
already
_xsltDocument
+_xsltStylesheet
+xsltApplyOneTemplate
+xsltGetKey
+xsltGetNamespace
+xsltGetSpecialNamespace
+xsltRegisterExtPrefix
+
also
xsltGetQNameURI
+xsltParseStylesheetCallerParam
+xsltRunStylesheet
+xsltRunStylesheetUser
+
always
xsltApplyOneTemplate
+xsltSecurityAllow
+xsltSecurityForbid
+
amiss
xsltParseStylesheetProcess
+
analyzes
xsltGetQNameURI
+
anchor
xsltGetSpecialNamespace
+
anchored
xsltGetCNsProp
+xsltGetNsProp
+
another
xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+
any
_xsltStylesheet
+_xsltTransformContext
+xsltExtensionInstructionResultRegister
+xsltFormatNumberConversion
+xsltGetPlainNamespace
+xsltInitAllDocKeys
+xsltInitElemPreComp
+xsltLocalVariablePush
+xsltProcessOneNode
+xsltRunStylesheet
+xsltRunStylesheetUser
+
anymore
xsltApplyOneTemplate
+xsltDocumentSortFunction
+xsltGetNamespace
+xsltInitCtxtKeys
+
api
xsltFormatNumberConversion
+
appear
_xsltDecimalFormat
+
appears
_xsltFormatNumberInfo
+
application-wide
xsltGetDefaultSecurityPrefs
+xsltSetDefaultSecurityPrefs
+
applied
xslAddCall
+xsltApplyAttributeSet
+xsltAttrListTemplateProcess
+xsltParseStylesheetDoc
+
applies
xslHandleDebugger
+
apply
xsltEvalUserParams
+xsltFindTemplate
+xsltNewDocument
+xsltNewStyleDocument
+xsltQuoteUserParams
+
apply-imports
xsltApplyImports
+
apply-templates
_xsltStyleItemApplyTemplates
+_xsltStyleItemSort
+_xsltStylePreComp
+xsltApplyTemplates
+
applying
_xsltCompilerCtxt
+xsltGetTemplate
+xsltSaveResultTo
+xsltSaveResultToFd
+xsltSaveResultToFile
+xsltSaveResultToFilename
+xsltSaveResultToString
+
are
XSLT_LOCALE_NONE
+_xsltDocument
+_xsltStackElem
+_xsltStylesheet
+_xsltTransformContext
+xslHandleDebugger
+xsltApplyAttributeSet
+xsltApplyOneTemplate
+xsltAttrListTemplateProcess
+xsltCopyNamespaceList
+xsltEvalAttrValueTemplate
+xsltExtensionInstructionResultFinalize
+xsltGetProfileInformation
+xsltGetQNameURI
+xsltGetSpecialNamespace
+xsltInitCtxtKeys
+xsltLocaleStrcmp
+xsltQuoteUserParams
+
argument
XSLT_IS_TEXT_NODE
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+
arguments
xsltDocumentFunction
+xsltElementAvailableFunction
+xsltFormatNumberFunction
+xsltFunctionAvailableFunction
+xsltFunctionNodeSet
+xsltGenerateIdFunction
+xsltKeyFunction
+xsltSystemPropertyFunction
+xsltUnparsedEntityURIFunction
+
array
_xsltStylesheet
+xsltApplyStylesheetUser
+xsltComputeSortResult
+xsltDefaultSortFunction
+xsltDoSortFunction
+xsltEvalUserParams
+xsltPointerListClear
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltVariableLookup
+
arry
xsltApplyStylesheet
+xsltDefaultSortFunction
+xsltDoSortFunction
+xsltProfileStylesheet
+xsltQuoteUserParams
+
assign
xsltAttrListTemplateProcess
+
assigned:
_xsltStyleItemDocument
+
associated
_xsltStylesheet
+xsltAddTemplate
+xsltExtShutdownFunction
+xsltFreeAVTList
+xsltFreeDocumentKeys
+xsltFreeGlobalVariables
+xsltGetCNsProp
+xsltGetExtData
+xsltGetNsProp
+xsltGetQNameURI
+xsltParseStylesheetDoc
+xsltParseStylesheetImportedDoc
+xsltParseStylesheetProcess
+xsltRegisterExtElement
+xsltRegisterExtFunction
+xsltRegisterExtModule
+xsltRegisterExtModuleFull
+xsltRegisterExtPrefix
+xsltStyleExtShutdownFunction
+xsltStyleGetExtData
+xsltStyleStylesheetLevelGetExtData
+xsltTransformFunction
+xsltUnregisterExtModule
+xsltXPathGetTransformContext
+
attached
xsltCopyTextString
+xsltSort
+
attempt
xsltLoadStylesheetPI
+
attr
xsltGetSpecialNamespace
+
attribute-set
xsltParseStylesheetAttributeSet
+
attribute-sets
xsltApplyAttributeSet
+
attributes
xsltAttrListTemplateProcess
+xsltNamespaceAlias
+
attrubute
xsltCompileAttr
+
automatically
xsltCopyNamespaceList
+xsltParseStylesheetDoc
+
available
xsltFunctionNodeSet
+xsltGetProfileInformation
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltTransformError
+
availble
xsltGetProfileInformation
+
average=
xsltGetProfileInformation
+
avoid
xsltExtensionInstructionResultRegister
+

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Daniel Veillard

diff --git a/doc/APIchunk3.html b/doc/APIchunk3.html new file mode 100644 index 0000000..98b7586 --- /dev/null +++ b/doc/APIchunk3.html @@ -0,0 +1,387 @@ + + +API Alphabetic Index b-c for libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

API Alphabetic Index b-c for libxslt

Main Menu
Related links
API Indexes

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Letter b:

bar
XSLT_FAST_IF
+
based
_xsltStylesheet
+xsltNewLocale
+
basically
xsltCompileAttr
+
been
xsltGetCNsProp
+xsltGetNsProp
+
before
xsltApplyOneTemplate
+xsltEvalUserParams
+xsltExtensionInstructionResultRegister
+xsltInitCtxtKeys
+xsltLocaleStrcmp
+xsltQuoteUserParams
+
beginning
xsltTimestamp
+
behaviour
_xsltCompilerCtxt
+
being
_xsltStylesheet
+_xsltTransformContext
+xslAddCall
+xslHandleDebugger
+xsltExtensionInstructionResultFinalize
+xsltExtensionInstructionResultRegister
+xsltGetQNameURI
+xsltGetTemplate
+xsltPrintErrorContext
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSetXIncludeDefault
+
between
_xsltStylesheet
+_xsltTransformContext
+xsltResolveStylesheetAttributeSet
+
bit
NODE_IS_KEYED
+
blank
xsltParseTemplateContent
+
blanks
xsltIsBlank
+
block
xsltFreeSecurityPrefs
+xsltGetSecurityPrefs
+xsltNewSecurityPrefs
+xsltSecurityAllow
+xsltSecurityForbid
+xsltSetCtxtSecurityPrefs
+xsltSetDebuggerCallbacks
+xsltSetDefaultSecurityPrefs
+xsltSetSecurityPrefs
+
blocks
XSLT_TODO
+_xsltStylesheet
+xsltFreeStylePreComps
+
boolean
xsltElementAvailableFunction
+xsltFunctionAvailableFunction
+
both
xsltApplyAttributeSet
+xsltGetSpecialNamespace
+xsltLoadStylesheetPI
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSplitQName
+
bound
_xsltStackElem
+
braces
xsltEvalAttrValueTemplate
+xsltEvalStaticAttrValueTemplate
+
breakpoint
xslHandleDebugger
+
broke
XML_CAST_FPTR
+
buffer
xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSaveResultTo
+
build
xsltLoadStylesheetPI
+
building
xsltParseStylesheetDoc
+xsltParseStylesheetImportedDoc
+
built-in
xsltInit
+xsltRegisterAllExtras
+xsltRegisterExtras
+
but
XSLT_REFACTORED_KEYCOMP
+XSLT_REGISTER_FUNCTION_LOOKUP
+XSLT_REGISTER_VARIABLE_LOOKUP
+xsltGetCNsProp
+xsltGetNsProp
+xsltGetQNameURI2
+xsltLoadStylesheetPI
+xsltParseStylesheetCallerParam
+xsltPointerListClear
+xsltQuoteUserParams
+xsltSort
+xsltXPathFunctionLookup
+xsltXPathVariableLookup
+
by:
xsltApplyOneTemplate
+xsltAttrTemplateValueProcessNode
+xsltCheckExtPrefix
+xsltCheckExtURI
+xsltCopyNamespaceList
+xsltGetNamespace
+xsltParseStylesheetProcess
+xsltRegisterExtPrefix
+xsltStyleGetExtData
+
bypass
_xsltStylesheet
+
byte
xsltSaveResultTo
+xsltSaveResultToFilename
+
bytes
xsltGetUTF8Char
+xsltRunStylesheet
+xsltSaveResultToFd
+xsltSaveResultToFile
+

Letter c:

cache
_xsltStackElem
+xsltReleaseRVT
+
calibration
xsltCalibrateAdjust
+
call
xslAddCall
+xslDropCall
+xsltDocLoaderFunc
+
call-template
_xsltStyleItemCallTemplate
+_xsltStylePreComp
+xsltCallTemplate
+
callback
xsltExtElementLookup
+xsltExtModuleElementLookup
+xsltExtModuleElementPreComputeLookup
+xsltExtModuleTopLevelLookup
+xsltGetSecurityPrefs
+xsltRegisterExtModuleElement
+xsltRegisterExtModuleFunction
+xsltRegisterExtModuleTopLevel
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSetDebuggerCallbacks
+xsltSetSecurityPrefs
+xsltXPathFunctionLookup
+
callbacks
xsltSetDebuggerCallbacks
+
called
_xsltTemplate
+xsltCheckExtPrefix
+xsltCheckExtURI
+xsltDoSortFunction
+xsltEvalGlobalVariables
+xsltEvalOneUserParam
+xsltExtInitFunction
+xsltExtShutdownFunction
+xsltFindTemplate
+xsltFreeRVTs
+xsltGetPlainNamespace
+xsltGetProfileInformation
+xsltInitElemPreComp
+xsltLocalVariablePush
+xsltParseStylesheetCallerParam
+xsltQuoteOneUserParam
+xsltRegisterExtElement
+xsltRegisterExtFunction
+xsltRegisterExtPrefix
+xsltSetCtxtSortFunc
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltSetTransformErrorFunc
+xsltSort
+xsltStyleExtInitFunction
+xsltStyleExtShutdownFunction
+xsltXPathGetTransformContext
+
caller
xsltApplyOneTemplate
+xsltAttrTemplateValueProcess
+xsltAttrTemplateValueProcessNode
+xsltEvalAVT
+xsltEvalAttrValueTemplate
+xsltEvalStaticAttrValueTemplate
+xsltEvalTemplateString
+xsltEvalXPathString
+xsltEvalXPathStringNs
+xsltFindTemplate
+xsltGetNsProp
+xsltGetProfileInformation
+xsltXPathCompile
+xsltXPathCompileFlags
+
calls=
xsltGetProfileInformation
+
can
_xsltCompilerCtxt
+_xsltTransformContext
+xsltDocLoaderFunc
+xsltEvalAttrValueTemplate
+xsltExtElementLookup
+xsltFindTemplate
+xsltFormatNumberConversion
+xsltParseTemplateContent
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+
cascading
XSLT_GET_IMPORT_INT
+XSLT_GET_IMPORT_PTR
+
cases
xsltLoadStylesheetPI
+
casting
XML_CAST_FPTR
+
catch
_xsltFormatNumberInfo
+_xsltTransformContext
+
chained
_xsltDecimalFormat
+_xsltDocument
+_xsltElemPreComp
+_xsltStackElem
+_xsltStylePreComp
+_xsltTemplate
+
change
xsltFindTemplate
+xsltGetSpecialNamespace
+
changed
_xsltCompilerNodeInfo
+
changes
xsltParseStylesheetDoc
+
channel
xsltSaveResultTo
+
char
xsltGetUTF8Char
+
character
xsltFormatNumberConversion
+
characters
xsltFormatNumberConversion
+
chars
_xsltFormatNumberInfo
+xsltIsBlank
+
check
CHECK_STOPPED
+CHECK_STOPPED0
+CHECK_STOPPEDE
+IS_XSLT_ATTR_FAST
+IS_XSLT_ELEM_FAST
+NODE_IS_KEYED
+XSLT_HAS_INTERNAL_NSMAP
+XSLT_IS_TEXT_NODE
+xsltSecurityCheck
+
checking
xsltGetSecurityPrefs
+xsltSetSecurityPrefs
+
checks
xsltCompileAttr
+
child
_xsltCompilerNodeInfo
+xsltCopyTextString
+
clash
xsltGetSpecialNamespace
+
class:
xsltFormatNumberConversion
+
cleared
xsltPointerListClear
+
close
xsltSaveResultToFd
+xsltSaveResultToFile
+
closed
xsltParseStylesheetDoc
+
coalescing
_xsltTransformContext
+
code
_xsltStylesheet
+_xsltTemplate
+xsltCopyNamespaceList
+xsltGetNamespace
+xsltInitCtxtKeys
+
collected
xsltExtensionInstructionResultRegister
+
collector
xsltExtensionInstructionResultFinalize
+xsltRegisterLocalRVT
+xsltRegisterPersistRVT
+xsltRegisterTmpRVT
+
com
xsltFormatNumberConversion
+
combination
xsltSetCtxtParseOptions
+
coming
xsltCompileAttr
+
comment
xsltComment
+
common
_xsltElemPreComp
+
comp
xsltFreeCompMatchList
+
compExpr
_xsltStyleBasicExpressionItem
+
compared
xsltStrxfrm
+
comparison
_xsltPrincipalStylesheetData
+xsltFindTemplate
+
compatibility
XSLT_ITEM_COMPATIBILITY_FIELDS
+XSLT_REFACTORED_KEYCOMP
+
compilation
XSLT_REFACTORED_XPATHCOMP
+_xsltCompilerCtxt
+_xsltStylesheet
+xsltDocLoaderFunc
+xsltParseAnyXSLTElem
+xsltParseGlobalVariable
+xsltParseSequenceConstructor
+xsltXPathCompile
+xsltXPathCompileFlags
+
compile-time
_xsltStylesheet
+xsltCheckExtPrefix
+xsltCheckExtURI
+xsltRegisterExtPrefix
+
compiled
_xsltCompilerNodeInfo
+_xsltStackElem
+_xsltStylesheet
+xsltApplyImports
+xsltApplyTemplates
+xsltCallTemplate
+xsltChoose
+xsltEvalXPathPredicate
+xsltEvalXPathString
+xsltEvalXPathStringNs
+xsltForEach
+xsltIf
+xsltNormalizeCompSteps
+xsltTransformFunction
+
compiler
XSLT_CCTXT
+
compiles
xsltParseAnyXSLTElem
+
compiling
xsltAllocateExtra
+
completed
xsltGetProfileInformation
+
compression
xsltSaveResultToFilename
+
computation
XSLT_REFACTORED_KEYCOMP
+
computations
xsltNewDocument
+xsltNewStyleDocument
+
compute
xsltParseStylesheetCallerParam
+
computed
_xsltStackElem
+_xsltStylePreComp
+_xsltTemplate
+xsltApplyOneTemplate
+xsltAttrTemplateValueProcess
+xsltAttrTemplateValueProcessNode
+xsltCopy
+xsltEvalAVT
+xsltEvalAttrValueTemplate
+xsltEvalTemplateString
+xsltEvalXPathString
+xsltEvalXPathStringNs
+xsltInitAllDocKeys
+xsltLoadDocument
+xsltLoadStyleDocument
+
construct
xsltMessage
+
constructor
_xsltStackElem
+xsltApplyOneTemplate
+xsltEvalTemplateString
+xsltParseSequenceConstructor
+
consumption
XSLT_PARSE_OPTIONS
+
contain
xsltEvalAttrValueTemplate
+xsltEvalStaticAttrValueTemplate
+
contained
xsltEvalAttrValueTemplate
+xsltEvalStaticAttrValueTemplate
+xsltLoadStylesheetPI
+
container
xsltParseTemplateContent
+
containing
_xsltTemplate
+xsltCompilePattern
+xsltMessage
+xsltSetDebuggerCallbacks
+
contains
xsltGetQNameURI
+
content
_xsltCompilerNodeInfo
+_xsltTransformContext
+xsltApplyOneTemplate
+xsltCopyTextString
+xsltParseAnyXSLTElem
+xsltParseSequenceConstructor
+xsltParseTemplateContent
+xsltPointerListClear
+xsltPointerListFree
+
content-model
xsltParseTemplateContent
+
contexts
_xsltCompilerCtxt
+
control
xslHandleDebugger
+
converts
xsltEvalTemplateString
+
copied
xsltCopyTextString
+xsltGetUTF8Char
+
copies
xsltAttrTemplateProcess
+
copy
_xsltStyleItemCopy
+_xsltStylePreComp
+xsltCopyNamespaceList
+
copy-of
_xsltStyleItemApplyTemplates
+_xsltStyleItemSort
+_xsltStylePreComp
+xsltCopyOf
+
copying
xsltCopyNamespaceList
+
correct
xsltCalibrateAdjust
+
corresponding
_xsltElemPreComp
+xsltGetProfileInformation
+xsltNamespaceAlias
+
created
_xsltTransformContext
+xsltCopyTextString
+xsltExtensionInstructionResultFinalize
+xsltExtensionInstructionResultRegister
+xsltFreeLocale
+xsltGetNamespace
+xsltGetSpecialNamespace
+xsltRegisterLocalRVT
+xsltStrxfrm
+
creating
xsltCheckWrite
+xsltRunStylesheet
+xsltRunStylesheetUser
+
creation
_xsltCompilerNodeInfo
+
cur
xslHandleDebugger
+
curly
xsltEvalAttrValueTemplate
+xsltEvalStaticAttrValueTemplate
+
currently
xsltRegisterTmpRVT
+

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Daniel Veillard

diff --git a/doc/APIchunk4.html b/doc/APIchunk4.html new file mode 100644 index 0000000..e914342 --- /dev/null +++ b/doc/APIchunk4.html @@ -0,0 +1,342 @@ + + +API Alphabetic Index d-e for libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

API Alphabetic Index d-e for libxslt

Main Menu
Related links
API Indexes

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Letter d:

data
_xsltRuntimeExtra
+_xsltStylesheet
+_xsltTransformContext
+xslHandleDebugger
+xsltDocumentComp
+xsltExtInitFunction
+xsltExtShutdownFunction
+xsltExtensionInstructionResultFinalize
+xsltFreeCtxtExts
+xsltFreeGlobalVariables
+xsltGetExtData
+xsltInitCtxtExts
+xsltInitElemPreComp
+xsltNumberFormat
+xsltPreComputeExtModuleElement
+xsltStyleExtInitFunction
+xsltStyleExtShutdownFunction
+xsltStyleGetExtData
+xsltStyleStylesheetLevelGetExtData
+xsltTimestamp
+xsltXPathGetTransformContext
+
deallocated
xsltAttrTemplateValueProcess
+xsltAttrTemplateValueProcessNode
+xsltEvalAVT
+xsltEvalAttrValueTemplate
+xsltEvalStaticAttrValueTemplate
+xsltEvalXPathString
+xsltEvalXPathStringNs
+
deallocation
_xsltRuntimeExtra
+
deallocator
_xsltElemPreComp
+xsltInitElemPreComp
+
dealy
xsltCalibrateAdjust
+
debug
_xsltTransformContext
+xsltDebug
+xsltDebugGetDefaultTrace
+xsltDebugSetDefaultTrace
+
debugger
xsltSetDebuggerCallbacks
+
debugging
xslHandleDebugger
+
debugtrace
XSLT_TRACE
+
decimal
_xsltFormatNumberInfo
+xsltFormatNumberConversion
+
decimal-format
xsltDecimalFormatGetByName
+
declaration
xsltCopyNamespace
+xsltGetCNsProp
+xsltGetNamespace
+xsltGetNsProp
+xsltGetPlainNamespace
+xsltGetSpecialNamespace
+xsltParseGlobalParam
+xsltParseGlobalVariable
+xsltParseStylesheetParam
+
declared
xsltCheckExtPrefix
+xsltCheckExtURI
+xsltCopyNamespace
+
declaring
xsltGetSpecialNamespace
+
default
XSLT_DEFAULT_VERSION
+_xsltStylesheet
+xsltDebugGetDefaultTrace
+xsltDebugSetDefaultTrace
+xsltFormatNumberConversion
+xsltGetCNsProp
+xsltGetDefaultSecurityPrefs
+xsltGetNsProp
+xsltGetSpecialNamespace
+xsltGetXIncludeDefault
+xsltRegisterAllElement
+xsltRegisterAllFunctions
+xsltSetCtxtParseOptions
+xsltSetDefaultSecurityPrefs
+xsltSetLoaderFunc
+xsltSetSortFunc
+xsltSetXIncludeDefault
+
define
XML_CAST_FPTR
+XSLT_FAST_IF
+XSLT_REFACTORED_KEYCOMP
+XSLT_REFACTORED_VARS
+XSLT_REFACTORED_XPATHCOMP
+XSLT_RUNTIME_EXTRA
+
defined
_xsltTransformContext
+xslAddCall
+xsltGetQNameURI
+
definition
xsltAddKey
+xsltInitCtxtKey
+
definitions
_xsltStylesheet
+
dependent
xsltNewLocale
+
deprecated
xsltRegisterExtras
+
depth
_xsltCompilerCtxt
+_xsltStackElem
+_xsltVarInfo
+xsltLocalVariablePop
+
derived
xsltInitElemPreComp
+
description
xsltEvalOneUserParam
+
descriptions
_xsltStylesheet
+
descriptor
xsltSaveResultToFd
+
desired
xsltFindDocument
+xsltGetExtInfo
+
details
xsltEvalOneUserParam
+
detected
XSLT_STRANGE
+
dict
xsltFindTemplate
+
dictionary
xsltDocLoaderFunc
+xsltGetCNsProp
+xsltGetQNameURI2
+xsltSplitQName
+
dictionary:
_xsltStylesheet
+_xsltTransformContext
+
different
XSLT_REGISTER_FUNCTION_LOOKUP
+XSLT_REGISTER_VARIABLE_LOOKUP
+xsltGetCNsProp
+xsltGetNsProp
+
digit
xsltFormatNumberConversion
+
directly
xsltSort
+
directories
xsltCheckWrite
+
disable-escaping
xsltCopyTextString
+
disabled
XML_CAST_FPTR
+
disattached
xsltAttrListTemplateProcess
+
discard
xsltGetUTF8Char
+
display
_xsltFormatNumberInfo
+xsltTransformError
+
distinct
_xsltStylesheet
+xsltApplyOneTemplate
+
doc
xsltGetKey
+xsltLoadStylesheetPI
+xsltParseStylesheetDoc
+
docs
_xsltTransformContext
+xsltFormatNumberConversion
+
doctype-public
_xsltStylesheet
+
doctype-system
_xsltStylesheet
+
documents
_xsltDocument
+_xsltStylesheet
+_xsltTransformContext
+xsltFreeDocuments
+xsltParseStylesheetImportedDoc
+
does
XSLT_ITEM_COMPATIBILITY_FIELDS
+xsltApplyOneTemplate
+xsltAttrTemplateProcess
+xsltEvalStaticAttrValueTemplate
+xsltGetCNsProp
+xsltGetNsProp
+xsltPointerListClear
+xsltPointerListFree
+xsltSaveResultToFd
+xsltSaveResultToFile
+
doesn
xsltTestCompMatchList
+
done
_xsltDocument
+_xsltStackElem
+_xsltStylesheet
+xsltCompilePattern
+xsltEvalUserParams
+xsltFindTemplate
+xsltGetKey
+xsltInitCtxtKeys
+xsltLoadStylesheetPI
+xsltQuoteUserParams
+
down
xsltXPathCompileFlags
+
dump
xsltProfileStylesheet
+
dunno
_xsltEffectiveNs
+
during
_xsltStylesheet
+xsltRegisterExtPrefix
+xsltSortFunc
+

Letter e:

eclared
_xsltEffectiveNs
+
effect
_xsltCompilerCtxt
+
either
xslHandleDebugger
+xsltDocLoaderFunc
+xsltFormatNumberConversion
+
element-available
xsltElementAvailableFunction
+
elements
_xsltCompilerNodeInfo
+_xsltStylesheet
+_xsltTransformContext
+xsltDebugDumpExtensions
+xsltExtElementLookup
+xsltFreeCompMatchList
+xsltParseSequenceConstructor
+xsltRegisterAllElement
+xsltTransformFunction
+
else
xsltGetExtInfo
+
emitted
XSLT_TRACE
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+
empty
XSLT_ITEM_NAVIGATION_FIELDS
+
enable
XSLT_FAST_IF
+XSLT_REFACTORED_KEYCOMP
+XSLT_REFACTORED_VARS
+XSLT_REFACTORED_XPATHCOMP
+
enabled
_xsltCompilerNodeInfo
+
encoded
xsltGetUTF8Char
+
encoding
_xsltStylesheet
+xsltRunStylesheet
+xsltRunStylesheetUser
+
encountering
XML_CAST_FPTR
+
end
_xsltElemPreComp
+
engine
xsltDocLoaderFunc
+xsltSetCtxtParseOptions
+
entity
xsltGetCNsProp
+xsltGetNsProp
+
entry
xsltGetQNameURI2
+xsltNormalizeCompSteps
+xsltXPathFunctionLookup
+xsltXPathVariableLookup
+
episode
_xsltCompilerCtxt
+
equal
xsltLocaleStrcmp
+
error:
CHECK_STOPPEDE
+
errors
_xsltCompilerCtxt
+_xsltStylesheet
+xsltApplyOneTemplate
+xsltCopyTextString
+xsltCreateRVT
+xsltExtensionInstructionResultFinalize
+xsltGetNamespace
+xsltGetPlainNamespace
+xsltParseAnyXSLTElem
+xsltRegisterLocalRVT
+xsltRegisterTmpRVT
+
establish
xsltCompileAttr
+
etc
xsltInit
+
eval
_xsltStackElem
+
evaluate
xsltEvalXPathPredicate
+
evaluated
xsltEvalOneUserParam
+xsltEvalUserParams
+xsltQuoteUserParams
+
evaluates
xsltAttrListTemplateProcess
+xsltParseStylesheetParam
+xsltParseStylesheetVariable
+
evaluation
_xsltStackElem
+
everything
xsltFindElemSpaceHandling
+xsltParseAnyXSLTElem
+xsltParseStylesheetProcess
+
example
xsltDocLoaderFunc
+xsltXPathGetTransformContext
+
except
xsltFormatNumberConversion
+xsltParseStylesheetImportedDoc
+
excluded
_xsltCompilerNodeInfo
+_xsltStylesheet
+
excluded-result-prefixes
_xsltPrincipalStylesheetData
+
exctract
xsltApplyAttributeSet
+
executed
xslHandleDebugger
+
execution
_xsltStylesheet
+
exension
xsltGetExtData
+xsltStyleGetExtData
+xsltStyleStylesheetLevelGetExtData
+
existent
xsltCopyTextString
+
existing
xsltInitElemPreComp
+
exists
xsltParseStylesheetImportedDoc
+
exit
xsltRegisterTmpRVT
+
exiting
xsltApplyOneTemplate
+
exits
_xsltTransformContext
+xsltApplyOneTemplate
+xsltExtensionInstructionResultFinalize
+xsltExtensionInstructionResultRegister
+xsltRegisterLocalRVT
+xsltRegisterTmpRVT
+
expect
xsltApplyOneTemplate
+
expressed
XSLT_PAT_NO_PRIORITY
+
expression
_xsltStyleBasicExpressionItem
+_xsltStyleItemApplyTemplates
+_xsltStyleItemIf
+_xsltStyleItemSort
+_xsltStyleItemValueOf
+_xsltStylePreComp
+xsltEvalOneUserParam
+xsltEvalUserParams
+xsltEvalXPathPredicate
+xsltEvalXPathString
+xsltEvalXPathStringNs
+xsltXPathCompile
+xsltXPathCompileFlags
+
expressions
XSLT_REFACTORED_XPATHCOMP
+_xsltStylesheet
+xsltEvalAttrValueTemplate
+xsltEvalStaticAttrValueTemplate
+xsltQuoteUserParams
+
exsl:function
xsltApplyOneTemplate
+
exslt:function
xsltApplyOneTemplate
+
exsltFuncFunctionFunction
xsltApplyOneTemplate
+xsltParseStylesheetCallerParam
+
extInfos
xsltGetExtInfo
+
extending
xsltInitElemPreComp
+
extension-element-prefixes
_xsltPrincipalStylesheetData
+
extensions
XSLT_LIBXSLT_NAMESPACE
+XSLT_NORM_SAXON_NAMESPACE
+XSLT_SAXON_NAMESPACE
+XSLT_XALAN_NAMESPACE
+XSLT_XT_NAMESPACE
+xsltCheckExtPrefix
+xsltCheckExtURI
+xsltFreeExts
+xsltInit
+xsltInitGlobals
+xsltRegisterAllExtras
+xsltRegisterExtras
+
external
xsltLoadStylesheetPI
+
extra
XSLT_RUNTIME_EXTRA
+XSLT_RUNTIME_EXTRA_FREE
+XSLT_RUNTIME_EXTRA_LST
+_xsltRuntimeExtra
+_xsltTransformContext
+xsltAllocateExtra
+xsltAllocateExtraCtxt
+xsltProcessOneNode
+xsltTransformError
+xsltXPathCompileFlags
+
extract
xsltGetProfileInformation
+xsltLoadStylesheetPI
+
extras
_xsltTransformContext
+

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Daniel Veillard

diff --git a/doc/APIchunk5.html b/doc/APIchunk5.html new file mode 100644 index 0000000..414ae5c --- /dev/null +++ b/doc/APIchunk5.html @@ -0,0 +1,250 @@ + + +API Alphabetic Index f-g for libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

API Alphabetic Index f-g for libxslt

Main Menu
Related links
API Indexes

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Letter f:

factor
xsltSaveResultToFilename
+
failure
xsltAddKey
+xsltAddStackElemList
+xsltCompilePattern
+xsltInitAllDocKeys
+xsltParseStylesheetImport
+xsltParseStylesheetInclude
+xsltRegisterExtElement
+xsltRegisterExtFunction
+xsltRegisterExtPrefix
+xsltRestoreDocumentNamespaces
+xsltSaveResultTo
+xsltSaveResultToFd
+xsltSaveResultToFile
+xsltSaveResultToFilename
+xsltTestCompMatchList
+
failures
xsltGetNamespace
+xsltGetPlainNamespace
+
fast
xsltCompilePattern
+
fields
XSLT_ITEM_COMMON_FIELDS
+XSLT_ITEM_NAVIGATION_FIELDS
+xsltFindTemplate
+
file
xsltSaveResultToFd
+xsltSaveResultToFilename
+xsltSecurityCheck
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltTransformError
+
filename
xsltParseStylesheetFile
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSaveResultToFilename
+
files
XSLT_PARSE_OPTIONS
+xsltRunStylesheet
+xsltRunStylesheetUser
+
find
xsltDecimalFormatGetByName
+xsltFindDocument
+
fine
xsltParseAnyXSLTElem
+
first
xsltAttrListTemplateProcess
+xsltCopyNamespaceList
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+
fixup
xsltGetNamespace
+xsltGetPlainNamespace
+
flag
XSLT_STRANGE
+XSLT_TODO
+
flags
xsltXPathCompileFlags
+
following
xsltRunStylesheet
+xsltRunStylesheetUser
+
foo
XSLT_FAST_IF
+
for-each
xsltForEach
+
forbid
xsltSecurityForbid
+
force
xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+
form
_xsltStackElem
+xsltCompilePattern
+
format
xsltFormatNumberConversion
+xsltNumberFormat
+xsltTransformError
+
format-number
xsltFormatNumberConversion
+xsltFormatNumberFunction
+
formats
xsltFormatNumberConversion
+
formatting
_xsltStylesheet
+xsltNumberFormat
+
forwards-compatible
_xsltCompilerCtxt
+_xsltCompilerNodeInfo
+
found
_xsltCompilerCtxt
+_xsltStylesheet
+xsltApplyOneTemplate
+xsltCalibrateAdjust
+xsltDocLoaderFunc
+xsltExtElementLookup
+xsltExtModuleElementLookup
+xsltExtModuleElementPreComputeLookup
+xsltExtModuleFunctionLookup
+xsltExtModuleTopLevelLookup
+xsltFindTemplate
+xsltGetCNsProp
+xsltGetExtInfo
+xsltGetNamespace
+xsltGetNsProp
+xsltGetSecurityPrefs
+xsltGetSpecialNamespace
+xsltGetTemplate
+xsltLoadStylesheetPI
+xsltNewLocale
+xsltVariableLookup
+xsltXPathFunctionLookup
+xsltXPathVariableLookup
+
fptr
XML_CAST_FPTR
+
fraction
xsltFormatNumberConversion
+
fractional
_xsltFormatNumberInfo
+
fraction}{suffix}
xsltFormatNumberConversion
+
fragment
_xsltTransformContext
+xsltExtensionInstructionResultFinalize
+xsltRegisterLocalRVT
+xsltRegisterPersistRVT
+xsltRegisterTmpRVT
+
fragments
XSLT_IS_RES_TREE_FRAG
+XSLT_MARK_RES_TREE_FRAG
+_xsltTransformContext
+xsltExtensionInstructionResultFinalize
+xsltExtensionInstructionResultRegister
+
free
XSLT_RUNTIME_EXTRA_FREE
+xsltApplyOneTemplate
+xsltElemPreCompDeallocator
+xsltEvalTemplateString
+xsltExtensionInstructionResultFinalize
+xsltFreeLocale
+xsltFreeSecurityPrefs
+xsltGetNsProp
+xsltGetProfileInformation
+xsltPointerListClear
+xsltPointerListFree
+xsltXPathCompile
+xsltXPathCompileFlags
+
freed
_xsltTransformContext
+xsltDocLoaderFunc
+xsltGetQNameURI
+xsltLoadStylesheetPI
+xsltParseStylesheetDoc
+xsltPointerListFree
+xsltRegisterLocalRVT
+xsltRegisterPersistRVT
+xsltRegisterTmpRVT
+xsltStrxfrm
+
frees
xsltReleaseRVT
+
full
xsltSplitQName
+
function-available
xsltFunctionAvailableFunction
+
function-calling
xsltExtensionInstructionResultFinalize
+
functions
XSLT_ITEM_COMPATIBILITY_FIELDS
+_xsltTransformContext
+xsltApplyOneTemplate
+xsltDebugDumpExtensions
+xsltRegisterAllFunctions
+
future
XSLT_ITEM_NAVIGATION_FIELDS
+xsltApplyOneTemplate
+

Letter g:

garbage
xsltExtensionInstructionResultFinalize
+xsltExtensionInstructionResultRegister
+xsltRegisterLocalRVT
+xsltRegisterPersistRVT
+xsltRegisterTmpRVT
+
gathering
xsltTimestamp
+
gcc
XML_CAST_FPTR
+
gcc4
XML_CAST_FPTR
+
general
XSLT_REGISTER_FUNCTION_LOOKUP
+XSLT_REGISTER_VARIABLE_LOOKUP
+
generally
xsltInitElemPreComp
+
generate
xsltLoadStylesheetPI
+xsltRunStylesheet
+xsltRunStylesheetUser
+
generate-id
xsltGenerateIdFunction
+
generated
xsltAttrTemplateProcess
+xsltCompilePattern
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSaveResultToString
+
generates
xsltCompilePattern
+
get
XSLT_CCTXT
+XSLT_GET_INTERNAL_NSMAP
+_xsltPrincipalStylesheetData
+_xsltStylesheet
+xsltAttrListTemplateProcess
+xsltDoSortFunction
+xsltEvalXPathString
+xsltEvalXPathStringNs
+xsltGetCNsProp
+xsltGetNsProp
+xsltGetSecurityPrefs
+
given
_xsltStackElem
+_xsltTemplate
+xsltAttrTemplateValueProcess
+xsltAttrTemplateValueProcessNode
+xsltCheckExtPrefix
+xsltCheckExtURI
+xsltEvalAVT
+xsltEvalTemplateString
+xsltFreeStyleDocuments
+xsltGetExtData
+xsltGetNamespace
+xsltGetSpecialNamespace
+xsltLoadStylesheetPI
+xsltLocalVariablePop
+xsltProfileStylesheet
+xsltRegisterExtPrefix
+xsltSetTransformErrorFunc
+xsltStyleGetExtData
+xsltStyleStylesheetLevelGetExtData
+xsltVariableLookup
+
gives
xsltTransformError
+
giving
xsltEvalOneUserParam
+xsltQuoteOneUserParam
+
global
_xsltElemPreComp
+_xsltTransformContext
+xsltCleanupGlobals
+xsltDoSortFunction
+xsltEvalGlobalVariables
+xsltEvalOneUserParam
+xsltEvalUserParams
+xsltFreeGlobalVariables
+xsltInitCtxtKeys
+xsltInitGlobals
+xsltParseGlobalVariable
+xsltQuoteOneUserParam
+xsltSetCtxtSortFunc
+xsltSetSortFunc
+
goto
CHECK_STOPPEDE
+
grafted
xsltAttrListTemplateProcess
+xsltAttrTemplateProcess
+
group
_xsltFormatNumberInfo
+
grouping
xsltFormatNumberConversion
+

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Daniel Veillard

diff --git a/doc/APIchunk6.html b/doc/APIchunk6.html new file mode 100644 index 0000000..3903db1 --- /dev/null +++ b/doc/APIchunk6.html @@ -0,0 +1,254 @@ + + +API Alphabetic Index h-i for libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

API Alphabetic Index h-i for libxslt

Main Menu
Related links
API Indexes

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Letter h:

handle
xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltSetLoaderFunc
+
handler
_xsltTransformContext
+xsltNewDocument
+xsltNewStyleDocument
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSetCtxtSortFunc
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltSetSortFunc
+xsltSetTransformErrorFunc
+
handles
xsltCopyNamespaceList
+
handling
_xsltElemPreComp
+_xsltStylePreComp
+_xsltTransformContext
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltSetTransformErrorFunc
+
hard-wire
xsltFindTemplate
+
has
_xsltCompilerCtxt
+_xsltStylesheet
+xsltEvalStaticAttrValueTemplate
+xsltExtensionInstructionResultRegister
+xsltGetCNsProp
+xsltGetNsProp
+xsltGetQNameURI
+xsltXPathCompile
+xsltXPathCompileFlags
+
hash
_xsltStylesheet
+xsltEvalOneUserParam
+xsltEvalUserParams
+xsltGetExtInfo
+xsltNormalizeCompSteps
+xsltQuoteOneUserParam
+
hashtable
xsltNormalizeCompSteps
+
have
_xsltStylesheet
+xsltEvalOneUserParam
+
hence
xsltGetQNameURI
+
hold
XSLT_ITEM_NAVIGATION_FIELDS
+_xsltElemPreComp
+
holding
_xsltNsMap
+_xsltTransformContext
+xsltAttrTemplateValueProcessNode
+xsltEvalAttrValueTemplate
+xsltEvalStaticAttrValueTemplate
+xsltGetQNameURI
+xsltGetQNameURI2
+
holds
xsltInitCtxtKey
+
hosting
xsltEvalAVT
+
how
_xsltTemplate
+
href
xsltGetNamespace
+
html
xsltFormatNumberConversion
+
http:
xsltFormatNumberConversion
+

Letter i:

identifier
xsltLocaleStrcmp
+
ignorable
xsltApplyStripSpaces
+xsltIsBlank
+xsltParseTemplateContent
+
implementation
xsltRegisterExtElement
+xsltRegisterExtFunction
+
implemented
xsltRunStylesheet
+xsltRunStylesheetUser
+
import
XSLT_GET_IMPORT_INT
+XSLT_GET_IMPORT_PTR
+xsltFindElemSpaceHandling
+xsltFindTemplate
+xsltNextImport
+xsltParseStylesheetImport
+
imported
xsltGetTemplate
+xsltNormalizeCompSteps
+xsltParseStylesheetImportedDoc
+
imports
_xsltStylesheet
+xsltCleanupTemplates
+xsltParseStylesheetProcess
+
in-scope
XSLT_ITEM_NSINSCOPE_FIELDS
+_xsltCompilerCtxt
+_xsltCompilerNodeInfo
+_xsltPrincipalStylesheetData
+xsltEvalXPathStringNs
+
include
xsltParseStylesheetInclude
+
included
xsltSaveResultToFilename
+
includes
_xsltDocument
+_xsltStylesheet
+
inclusive
xsltFormatNumberConversion
+
indented
_xsltStylesheet
+
index
nr
+
indicating
XSLT_LOCALE_NONE
+xsltDocLoaderFunc
+
indicator
xsltEvalStaticAttrValueTemplate
+
info
_xsltCompilerNodeInfo
+xsltEvalAVT
+xsltGetKey
+xsltInitCtxtKeys
+
information
XSLT_RUNTIME_EXTRA
+XSLT_RUNTIME_EXTRA_FREE
+XSLT_RUNTIME_EXTRA_LST
+_xsltCompilerNodeInfo
+_xsltPrincipalStylesheetData
+xsltAllocateExtra
+xsltAllocateExtraCtxt
+xsltAttribute
+xsltCallTemplate
+xsltChoose
+xsltComment
+xsltCopy
+xsltCopyOf
+xsltDocumentElem
+xsltElement
+xsltForEach
+xsltIf
+xsltInitCtxtKey
+xsltNumber
+xsltParseStylesheetOutput
+xsltProcessingInstruction
+xsltSort
+xsltText
+xsltTransformFunction
+xsltValueOf
+
informations
_xsltStylesheet
+_xsltTemplate
+_xsltTransformContext
+xsltDebug
+xsltFindElemSpaceHandling
+xsltGetProfileInformation
+xsltNumberFormat
+xsltSaveProfiling
+
infos
_xsltCompilerNodeInfo
+xsltFindDocument
+
inherited
_xsltTemplate
+
initial
xsltApplyOneTemplate
+xsltGetQNameURI
+xsltGetQNameURI2
+xsltPointerListAddSize
+xsltPointerListCreate
+
initialization
xsltExtInitFunction
+xsltRegisterExtModule
+xsltRegisterExtModuleFull
+xsltStyleExtInitFunction
+
initialized
xsltInitCtxtExts
+xsltInitCtxtKeys
+xsltNewElemPreComp
+
initializes
xsltNewElemPreComp
+
initiate
xsltApplyOneTemplate
+
input
xsltApplyStripSpaces
+xsltGetNamespace
+xsltGetPlainNamespace
+xsltInitCtxtKey
+xsltInitCtxtKeys
+xsltNewTransformContext
+xsltTransformFunction
+
insertion
_xsltTransformContext
+
inspected
xsltExtensionInstructionResultRegister
+
instances
xsltFormatNumberConversion
+
instantiated
xsltRegisterTmpRVT
+
instead
xsltRegisterExtras
+xsltRegisterTmpRVT
+
instructions
_xsltTemplate
+xsltApplyOneTemplate
+xsltParseAnyXSLTElem
+
integer
_xsltFormatNumberInfo
+xsltFormatNumberConversion
+
intended
XSLT_ITEM_NAVIGATION_FIELDS
+xsltApplyOneTemplate
+xsltCheckExtPrefix
+xsltCheckExtURI
+xsltCopyNamespaceList
+
interest
_xsltCompilerCtxt
+
interface
xsltRunStylesheet
+xsltRunStylesheetUser
+
intergers
XSLT_GET_IMPORT_INT
+
internal
UNDEFINED_DEFAULT_NS
+XSLT_IS_RES_TREE_FRAG
+XSLT_MARK_RES_TREE_FRAG
+xsltCopyNamespaceList
+xsltCopyTextString
+xsltCreateRVT
+xsltEvalGlobalVariables
+xsltExtensionInstructionResultFinalize
+xsltGetNamespace
+xsltGetPlainNamespace
+xsltLocalVariablePush
+xsltParseAnyXSLTElem
+xsltRegisterLocalRVT
+xsltRegisterTmpRVT
+
internalized
_xsltStylesheet
+_xsltTransformContext
+
internally
XSLT_STRANGE
+xsltFindTemplate
+
interpretation
_xsltDecimalFormat
+
interpreter
xsltXPathGetTransformContext
+
interpretor
xsltXPathFunctionLookup
+xsltXPathVariableLookup
+
into
xsltSetDebuggerCallbacks
+xsltSplitQName
+
invoking
xsltGetSpecialNamespace
+
issues
_xsltTransformContext
+
item
_xsltEffectiveNs
+_xsltElemPreComp
+_xsltTransformContext
+xslDropCall
+xsltPointerListAddSize
+
item1
xsltGetProfileInformation
+
item2|item3
xsltGetProfileInformation
+
items
XSLT_ITEM_COMMON_FIELDS
+xsltApplyOneTemplate
+
its
xsltAllocateExtra
+xsltAllocateExtraCtxt
+xsltApplyStylesheetUser
+xsltFreeGlobalVariables
+xsltGetNamespace
+xsltParseGlobalParam
+xsltParseStylesheetParam
+xsltParseStylesheetVariable
+
itself
xsltLoadStylesheetPI
+

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Daniel Veillard

diff --git a/doc/APIchunk7.html b/doc/APIchunk7.html new file mode 100644 index 0000000..311581f --- /dev/null +++ b/doc/APIchunk7.html @@ -0,0 +1,255 @@ + + +API Alphabetic Index j-m for libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

API Alphabetic Index j-m for libxslt

Main Menu
Related links
API Indexes

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Letter j:

java
xsltFormatNumberConversion
+
jdk
xsltFormatNumberConversion
+
just
_xsltCompilerCtxt
+

Letter k:

keep
_xsltCompilerCtxt
+
keeping
_xsltStylesheet
+
kept
XSLT_REFACTORED_KEYCOMP
+_xsltDocument
+xsltParseStylesheetDoc
+
key
_xsltDocument
+_xsltStylesheet
+xsltAddKey
+xsltGetKey
+xsltInitCtxtKey
+xsltKeyFunction
+xsltNewDocument
+xsltNewStyleDocument
+
keys
_xsltTransformContext
+xsltFreeDocumentKeys
+xsltFreeKeys
+xsltInitAllDocKeys
+xsltInitCtxtKeys
+
kind
xsltDocLoaderFunc
+
known
_xsltTransformContext
+

Letter l:

label
CHECK_STOPPEDE
+
language
xsltNewLocale
+xsltTransformFunction
+
last
_xsltStylesheet
+_xsltTransformContext
+xsltNextImport
+
later
xsltDocLoaderFunc
+xsltReleaseRVT
+
lead
xsltApplyStylesheet
+xsltRunStylesheet
+xsltRunStylesheetUser
+
leaks
xsltAttrListTemplateProcess
+
left
xsltApplyOneTemplate
+
len
xsltGetUTF8Char
+
level
_xsltTransformContext
+xsltDebugGetDefaultTrace
+xsltDebugSetDefaultTrace
+xsltLocalVariablePush
+
libexsl
xsltApplyOneTemplate
+
library
xsltCleanupGlobals
+xsltRegisterExtModule
+xsltRegisterExtModuleFull
+xsltSetDebuggerCallbacks
+xsltUnregisterExtModule
+
libxml2
xsltGetUTF8Char
+xsltSetCtxtParseOptions
+xsltXPathCompileFlags
+
libxslt
XSLT_LIBXSLT_NAMESPACE
+XSLT_REFACTORED_VARS
+xsltFunctionNodeSet
+
lifespan
xsltGetQNameURI
+
lifetime
_xsltStackElem
+
like
_xsltCompilerCtxt
+xsltCheckWrite
+xsltGetProfileInformation
+xsltSecurityCheck
+xsltTransformFunction
+
line
xsltTransformError
+
literal
_xsltCompilerNodeInfo
+_xsltEffectiveNs
+xsltAttrTemplateProcess
+xsltGetSpecialNamespace
+xsltParseTemplateContent
+
literally
xsltEvalOneUserParam
+xsltEvalUserParams
+xsltQuoteUserParams
+
load
xsltDocLoaderFunc
+xsltLoadDocument
+xsltLoadStyleDocument
+xsltLoadStylesheetPI
+xsltSetLoaderFunc
+
loaded
xsltFreeDocuments
+xsltSetXIncludeDefault
+xsltShutdownCtxtExts
+xsltShutdownExts
+
loading
XSLT_PARSE_OPTIONS
+xsltDocLoaderFunc
+xsltSetCtxtParseOptions
+xsltSetLoaderFunc
+
local
_xsltCompilerCtxt
+_xsltStackElem
+_xsltTemplate
+_xsltTransformContext
+xsltLocalVariablePush
+xsltParseStylesheetParam
+xsltParseStylesheetVariable
+xsltSplitQName
+
locale
XSLT_LOCALE_NONE
+xsltFreeLocale
+xsltFreeLocales
+xsltLocaleStrcmp
+xsltNewLocale
+xsltStrxfrm
+
localname
xsltSplitQName
+
locate
xsltLoadStylesheetPI
+
location
_xsltStackElem
+
look
xsltGetKey
+xsltGetTemplate
+
looks
xsltGetCNsProp
+xsltGetExtInfo
+xsltGetNsProp
+
lookup
xsltGetQNameURI
+xsltGetSecurityPrefs
+
lost
xsltRunStylesheet
+xsltRunStylesheetUser
+

Letter m:

macro
XML_CAST_FPTR
+XSLT_GET_IMPORT_INT
+XSLT_GET_IMPORT_PTR
+XSLT_IS_RES_TREE_FRAG
+XSLT_MARK_RES_TREE_FRAG
+XSLT_REGISTER_FUNCTION_LOOKUP
+XSLT_REGISTER_VARIABLE_LOOKUP
+xsltRunStylesheet
+xsltRunStylesheetUser
+
made
xsltDocLoaderFunc
+xsltIsBlank
+
main
_xsltDocument
+xsltRunStylesheet
+xsltRunStylesheetUser
+
make
xsltAllocateExtraCtxt
+
makes
xsltCheckWrite
+
map
XSLT_GET_INTERNAL_NSMAP
+_xsltPrincipalStylesheetData
+xsltRestoreDocumentNamespaces
+
mapped
_xsltNsMap
+
mapping
XSLT_HAS_INTERNAL_NSMAP
+xsltAttrTemplateValueProcessNode
+xsltEvalXPathStringNs
+
marked
xsltExtensionInstructionResultFinalize
+
mask
_xsltTransformContext
+xsltDebugGetDefaultTrace
+xsltDebugSetDefaultTrace
+
massive
xsltRegisterTmpRVT
+
match
xsltAddKey
+xsltNormalizeCompSteps
+
match=
xsltGetProfileInformation
+
matches
xsltTestCompMatchList
+
matching
_xsltTemplate
+xsltCompilePattern
+xsltGetNamespace
+xsltGetSpecialNamespace
+xsltNewLocale
+
may
_xsltDecimalFormat
+xslAddCall
+xsltApplyStylesheet
+xsltRunStylesheet
+xsltRunStylesheetUser
+
means
xsltExtensionInstructionResultFinalize
+xsltGetTemplate
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltSetTransformErrorFunc
+
mechanism
xsltFreeTemplateHashes
+
mechanisms
_xsltCompilerCtxt
+
memory
xsltAttrListTemplateProcess
+xsltFreeAVTList
+xsltFreeAttributeSetsHashes
+xsltFreeCompMatchList
+xsltFreeExts
+xsltFreeKeys
+xsltFreeNamespaceAliasHashes
+xsltFreeStackElemList
+xsltFreeStylePreComps
+xsltFreeStylesheet
+xsltFreeTemplateHashes
+xsltFreeTransformContext
+xsltGetNsProp
+xsltRegisterTmpRVT
+xsltSetDebuggerCallbacks
+
message
xsltMessage
+xsltTransformError
+
messages
XSLT_TRACE
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltSetTransformErrorFunc
+xsltTransformError
+
method
_xsltStylesheet
+
might
xsltApplyOneTemplate
+xsltRegisterTmpRVT
+
mille
xsltFormatNumberConversion
+
milliseconds
xsltTimestamp
+
mode
XSLT_REFACTORED_KEYCOMP
+_xsltCompilerCtxt
+_xsltCompilerNodeInfo
+_xsltTemplate
+_xsltTransformContext
+xsltAddTemplate
+
mode=
xsltGetProfileInformation
+
models
xsltParseAnyXSLTElem
+
modified
xsltDocLoaderFunc
+xsltGetNamespace
+xsltGetSpecialNamespace
+xsltLoadStylesheetPI
+
modules
XSLT_REGISTER_FUNCTION_LOOKUP
+XSLT_REGISTER_VARIABLE_LOOKUP
+xsltInitCtxtExts
+xsltShutdownCtxtExts
+xsltShutdownExts
+
more
xsltEvalOneUserParam
+xsltFormatNumberConversion
+
multiple
_xsltFormatNumberInfo
+xsltRunStylesheet
+xsltRunStylesheetUser
+
multiply
xsltFormatNumberConversion
+
must
xslHandleDebugger
+xsltAttrTemplateValueProcess
+xsltAttrTemplateValueProcessNode
+xsltEvalAVT
+xsltEvalAttrValueTemplate
+xsltEvalStaticAttrValueTemplate
+xsltEvalXPathString
+xsltEvalXPathStringNs
+xsltStrxfrm
+

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Daniel Veillard

diff --git a/doc/APIchunk8.html b/doc/APIchunk8.html new file mode 100644 index 0000000..741f7ea --- /dev/null +++ b/doc/APIchunk8.html @@ -0,0 +1,262 @@ + + +API Alphabetic Index n-o for libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

API Alphabetic Index n-o for libxslt

Main Menu
Related links
API Indexes

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Letter n:

name=
xsltGetProfileInformation
+
nameURI
xsltFindTemplate
+
named
xsltFindTemplate
+
names
_xsltPrincipalStylesheetData
+xsltApplyStylesheet
+xsltApplyStylesheetUser
+xsltProfileStylesheet
+xsltQuoteUserParams
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSplitQName
+
namespace-alias
_xsltStylesheet
+
namespaces
XSLT_ITEM_NSINSCOPE_FIELDS
+_xsltCompilerNodeInfo
+_xsltKeyDef
+_xsltPrincipalStylesheetData
+_xsltStylePreComp
+_xsltStylesheet
+_xsltTemplate
+xsltCopyNamespaceList
+xsltEvalXPathPredicate
+xsltEvalXPathStringNs
+xsltFreeNamespaceAliasHashes
+xsltRestoreDocumentNamespaces
+
navigational
XSLT_ITEM_NAVIGATION_FIELDS
+
necessary
xsltCheckWrite
+
need
XSLT_ITEM_COMPATIBILITY_FIELDS
+_xsltStyleItemDocument
+_xsltStylesheet
+xsltGetProfileInformation
+xsltInitAllDocKeys
+xsltLoadStylesheetPI
+
needed
_xsltEffectiveNs
+_xsltStackElem
+xsltApplyOneTemplate
+xsltCompileAttr
+xsltEvalTemplateString
+xsltFindTemplate
+xsltParseStylesheetImportedDoc
+xsltRegisterExtPrefix
+xsltXPathFunctionLookup
+xsltXPathGetTransformContext
+xsltXPathVariableLookup
+
needs
xsltApplyOneTemplate
+xsltEvalUserParams
+xsltGetTemplate
+
negative
xsltCalibrateAdjust
+xsltFormatNumberConversion
+
nested
_xsltStylesheet
+
newly
xsltCopyTextString
+xsltExtensionInstructionResultRegister
+xsltNewStylesheet
+xsltNewTransformContext
+
next
XSLT_ITEM_COMPATIBILITY_FIELDS
+_xsltEffectiveNs
+_xsltElemPreComp
+_xsltNsAlias
+_xsltNsList
+_xsltNsMap
+_xsltVarInfo
+xsltGetTemplate
+xsltNextImport
+
node-set
xsltDocumentFunction
+xsltFunctionNodeSet
+xsltKeyFunction
+xsltSortFunc
+
node-set?
xsltDocumentFunction
+xsltGenerateIdFunction
+
node-trees
xsltFreeStyleDocuments
+
nodes
_xsltTransformContext
+xsltApplyOneTemplate
+xsltAttrListTemplateProcess
+xsltComputeSortResult
+xsltDefaultSortFunction
+xsltDoSortFunction
+xsltParseTemplateContent
+xsltSort
+
nodeset
xsltComputeSortResult
+xsltGetKey
+
non
xsltAttrListTemplateProcess
+
non-NULL
xsltApplyOneTemplate
+xsltCopyNamespaceList
+xsltGetTemplate
+
non-excluded
_xsltTemplate
+
non-wellformed
xsltApplyStylesheet
+xsltRunStylesheet
+xsltRunStylesheetUser
+
none
xsltGetDefaultSecurityPrefs
+xsltGetNamespace
+xsltGetSpecialNamespace
+
nor
xsltSetGenericErrorFunc
+
normal
xsltExtensionInstructionResultFinalize
+
normalize
xsltNormalizeCompSteps
+
normally
xsltEvalOneUserParam
+xsltQuoteOneUserParam
+
nothing
xsltApplyAttributeSet
+
now
XML_CAST_FPTR
+XSLT_REFACTORED_KEYCOMP
+
nowhere
_xsltStyleItemDocument
+
ns-decl
_xsltNsMap
+
ns-declaration
xsltGetNamespace
+xsltGetSpecialNamespace
+
ns-declarations
xsltCopyNamespaceList
+
ns-name
xsltGetNamespace
+xsltGetSpecialNamespace
+
ns-prefix
xsltGetNamespace
+xsltGetSpecialNamespace
+
ns-prefixes
xsltGetSpecialNamespace
+
null
xsltEvalOneUserParam
+xsltQuoteOneUserParam
+

Letter o:

object
XML_CAST_FPTR
+xsltDocumentFunction
+xsltExtensionInstructionResultRegister
+xsltKeyFunction
+xsltSystemPropertyFunction
+xsltXPathCompile
+xsltXPathCompileFlags
+
obsolete
xsltApplyOneTemplate
+xsltDocumentSortFunction
+
obtained
xsltSaveResultTo
+xsltSaveResultToFd
+xsltSaveResultToFile
+xsltSaveResultToFilename
+xsltSaveResultToString
+
occcur
xslHandleDebugger
+
occurences
_xsltFormatNumberInfo
+
off
_xsltCompilerCtxt
+xslDropCall
+xsltGetCNsProp
+xsltGetNsProp
+
often
_xsltTemplate
+
old
_xsltCompilerCtxt
+xsltGetQNameURI
+xsltRegisterExtPrefix
+
on-demand
XSLT_REFACTORED_KEYCOMP
+
once
xsltLoadStylesheetPI
+
one
xsltAttrTemplateProcess
+xsltCheckExtPrefix
+xsltCheckExtURI
+xsltExtensionInstructionResultRegister
+xsltGetTemplate
+xsltGetUTF8Char
+xsltNextImport
+xsltNumberFormat
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltTestCompMatchList
+
one:
IS_XSLT_REAL_NODE
+
ones
xsltCleanupTemplates
+
only
XSLT_REFACTORED_KEYCOMP
+_xsltCompilerCtxt
+xsltCheckExtPrefix
+xsltCheckExtURI
+xsltCopyNamespaceList
+xsltEvalGlobalVariables
+xsltExtElementLookup
+xsltGetSpecialNamespace
+xsltRegisterTmpRVT
+xsltRunStylesheet
+xsltRunStylesheetUser
+
onto
xsltAddStackElemList
+xsltLocalVariablePush
+
opaque
xsltNewLocale
+
open
xsltSaveResultToFd
+xsltSaveResultToFile
+
operation
xsltSecurityAllow
+xsltSecurityForbid
+
optimization
XSLT_REFACTORED_XPATHCOMP
+_xsltTransformContext
+
option
xsltGetSecurityPrefs
+xsltSetCtxtParseOptions
+xsltSetSecurityPrefs
+
optional
xsltRegisterExtPrefix
+
options
XSLT_PARSE_OPTIONS
+xsltCheckRead
+xsltCheckWrite
+xsltDocLoaderFunc
+xsltSetCtxtParseOptions
+
order
XSLT_GET_IMPORT_INT
+XSLT_GET_IMPORT_PTR
+_xsltCompilerCtxt
+xsltDocumentSortFunction
+xsltExtensionInstructionResultRegister
+
ordered
_xsltStylesheet
+xsltComputeSortResult
+
original
_xsltNsMap
+xsltGetUTF8Char
+
other
xsltFormatNumberConversion
+
otherwise
xslAddCall
+xsltAddTemplate
+xsltCheckExtPrefix
+xsltCheckExtURI
+xsltEvalXPathPredicate
+xsltExtModuleElementLookup
+xsltExtModuleElementPreComputeLookup
+xsltExtModuleFunctionLookup
+xsltExtModuleTopLevelLookup
+xsltGetSecurityPrefs
+xsltGetXIncludeDefault
+xsltIsBlank
+xsltSetCtxtSecurityPrefs
+xsltSetSecurityPrefs
+
ouput
xsltFormatNumberConversion
+
out
xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltSetTransformErrorFunc
+
output
_xsltStylesheet
+_xsltTransformContext
+xsltApplyStylesheet
+xsltApplyStylesheetUser
+xsltDebugDumpExtensions
+xsltGetNamespace
+xsltParseStylesheetOutput
+xsltProfileStylesheet
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSaveResultTo
+
outside
xsltAttrTemplateValueProcessNode
+
over
xsltAttrListTemplateProcess
+xsltAttrTemplateProcess
+
overhead
xsltRegisterTmpRVT
+
own
xsltApplyStylesheetUser
+
owning
_xsltCompilerNodeInfo
+

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Daniel Veillard

diff --git a/doc/APIchunk9.html b/doc/APIchunk9.html new file mode 100644 index 0000000..ca83823 --- /dev/null +++ b/doc/APIchunk9.html @@ -0,0 +1,275 @@ + + +API Alphabetic Index p-p for libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

API Alphabetic Index p-p for libxslt

Main Menu
Related links
API Indexes

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Letter p:

param
_xsltCompilerCtxt
+xsltParseGlobalParam
+xsltParseStylesheetParam
+
parameter
xsltEvalOneUserParam
+xsltEvalUserParams
+xsltParseStylesheetProcess
+xsltQuoteOneUserParam
+
parameters
_xsltStylesheet
+xsltApplyOneTemplate
+xsltApplyStylesheet
+xsltApplyStylesheetUser
+xsltEvalGlobalVariables
+xsltEvalOneUserParam
+xsltEvalUserParams
+xsltProcessOneNode
+xsltProfileStylesheet
+xsltQuoteOneUserParam
+xsltQuoteUserParams
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltTransformError
+
params
_xsltCompilerCtxt
+_xsltTransformContext
+
parent
xsltGetNamespace
+xsltParseStylesheetImportedDoc
+
parse
xsltParseGlobalParam
+xsltParseStylesheetAttributeSet
+xsltParseStylesheetDoc
+xsltParseStylesheetFile
+xsltParseStylesheetImport
+xsltParseStylesheetImportedDoc
+xsltParseStylesheetInclude
+xsltParseStylesheetOutput
+xsltParseTemplateContent
+
parsed
_xsltDocument
+_xsltStylesheet
+xsltApplyStylesheet
+xsltApplyStylesheetUser
+xsltEvalUserParams
+xsltFindDocument
+xsltNewDocument
+xsltNewStyleDocument
+xsltNewTransformContext
+xsltParseSequenceConstructor
+xsltParseStylesheetDoc
+xsltParseStylesheetImportedDoc
+xsltParseStylesheetProcess
+xsltProfileStylesheet
+xsltQuoteUserParams
+xsltRunStylesheet
+xsltRunStylesheetUser
+
parser
xsltFreeTransformContext
+xsltSetCtxtParseOptions
+
parsing
_xsltCompilerCtxt
+xsltDocLoaderFunc
+xsltParseStylesheetDoc
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+
part
XSLT_REFACTORED_VARS
+_xsltElemPreComp
+_xsltFormatNumberInfo
+_xsltStackElem
+_xsltTemplate
+xsltTransformFunction
+
pass
XSLT_PARSE_OPTIONS
+xsltAttrTemplateValueProcessNode
+xsltEvalXPathStringNs
+xsltXPathCompileFlags
+
passed
xsltProcessOneNode
+xsltSetCtxtParseOptions
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+
path
xsltSecurityCheck
+
pattern
XSLT_PAT_NO_PRIORITY
+_xsltDecimalFormat
+_xsltFormatNumberInfo
+xsltAddTemplate
+xsltCompilePattern
+xsltFormatNumberConversion
+xsltTestCompMatchList
+
patterns
xsltTestCompMatchList
+
per
_xsltFormatNumberInfo
+_xsltTransformContext
+xsltFormatNumberConversion
+
percent
_xsltFormatNumberInfo
+
percentage
xsltFormatNumberConversion
+
permille
_xsltFormatNumberInfo
+
persistance
_xsltTransformContext
+
persistant
_xsltTransformContext
+
persistent
_xsltStackElem
+
pertaining
xsltXPathGetTransformContext
+
pertains
IS_XSLT_ELEM
+
place
xsltFormatNumberConversion
+xsltGetQNameURI
+
placeholder
xsltFormatNumberConversion
+
plug
xsltSetDebuggerCallbacks
+
point
_xsltFormatNumberInfo
+xsltXPathFunctionLookup
+xsltXPathVariableLookup
+
pointers
XSLT_GET_IMPORT_PTR
+
points
xsltSetDebuggerCallbacks
+
pops
xsltApplyOneTemplate
+
position
xsltPointerListAddSize
+xsltTransformError
+
possible
xsltFormatNumberConversion
+
possibly
xsltCheckExtPrefix
+xsltCheckExtURI
+
pre-computation
xsltExtModuleElementPreComputeLookup
+xsltRegisterExtModuleElement
+
pre-processing
_xsltDocument
+_xsltStylesheet
+
precedence
xsltFindElemSpaceHandling
+xsltFindTemplate
+xsltNextImport
+
precision
XSLT_TIMESTAMP_TICS_PER_SEC
+
precompiled
_xsltStyleItemApplyTemplates
+_xsltStyleItemIf
+_xsltStyleItemSort
+_xsltStyleItemValueOf
+_xsltStylePreComp
+_xsltStylesheet
+xsltCompilePattern
+xsltDocumentComp
+xsltTestCompMatchList
+
precomputed
_xsltStylesheet
+xsltAttribute
+xsltComment
+xsltCopyOf
+xsltDebug
+xsltDocumentElem
+xsltElement
+xsltFreeStylePreComps
+xsltInitElemPreComp
+xsltNumber
+xsltPreComputeExtModuleElement
+xsltProcessingInstruction
+xsltSort
+xsltText
+xsltValueOf
+
predicate
xsltEvalXPathPredicate
+
preference
xsltFreeSecurityPrefs
+xsltGetDefaultSecurityPrefs
+xsltNewSecurityPrefs
+xsltSetCtxtSecurityPrefs
+xsltSetDefaultSecurityPrefs
+
preferences
_xsltTransformContext
+
prefix
_xsltFormatNumberInfo
+_xsltStylesheet
+xsltCheckExtPrefix
+xsltCheckExtURI
+xsltFormatNumberConversion
+xsltGetNamespace
+xsltGetQNameURI
+xsltGetQNameURI2
+xsltGetSpecialNamespace
+xsltRegisterExtPrefix
+xsltSplitQName
+
prefixed
xsltGetQNameURI
+xsltGetQNameURI2
+
prefixes
_xsltStylesheet
+
preliminary
xsltCheckWrite
+
present
xsltEvalStaticAttrValueTemplate
+xsltGetExtData
+xsltStyleGetExtData
+xsltStyleStylesheetLevelGetExtData
+
preserve
_xsltStylesheet
+xsltGetSpecialNamespace
+
preserve-space
_xsltStylesheet
+xsltFindElemSpaceHandling
+
previous
xsltSetCtxtParseOptions
+
prevompiled
xsltEvalAVT
+
principal
_xsltStylesheet
+
printed
xslAddCall
+
priority
XSLT_PAT_NO_PRIORITY
+_xsltTemplate
+xsltGetSpecialNamespace
+
problem
XSLT_STRANGE
+
processed
_xsltCompilerNodeInfo
+_xsltTransformContext
+xslAddCall
+xslHandleDebugger
+xsltGetTemplate
+xsltPrintErrorContext
+xsltSetXIncludeDefault
+
processing
CHECK_STOPPED
+CHECK_STOPPED0
+CHECK_STOPPEDE
+_xsltCompilerCtxt
+_xsltFormatNumberInfo
+_xsltStylesheet
+xsltDebug
+xsltDocumentElem
+xsltGetProfileInformation
+xsltGetXIncludeDefault
+xsltMessage
+xsltParseStylesheetImportedDoc
+xsltSetXIncludeDefault
+
processing-instruction
_xsltStylesheet
+xsltProcessingInstruction
+
processor
XSLT_DEFAULT_URL
+XSLT_DEFAULT_VENDOR
+XSLT_SAXON_NAMESPACE
+XSLT_XALAN_NAMESPACE
+XSLT_XT_NAMESPACE
+xsltInit
+xsltUninit
+
produce
xsltRegisterTmpRVT
+
products
xsltFormatNumberConversion
+
profile
_xsltTransformContext
+xsltApplyStylesheetUser
+xsltGetProfileInformation
+xsltRunStylesheetUser
+
profiled
_xsltTransformContext
+
profiling
XSLT_TIMESTAMP_TICS_PER_SEC
+xsltGetProfileInformation
+xsltProfileStylesheet
+xsltSaveProfiling
+xsltTimestamp
+
progressive
xsltRunStylesheet
+xsltRunStylesheetUser
+
project
XSLT_XALAN_NAMESPACE
+
properties
xsltAttrListTemplateProcess
+
provide
xsltApplyOneTemplate
+xsltApplyStylesheetUser
+
provided
xsltApplyStylesheetUser
+xsltComputeSortResult
+xsltDefaultSortFunction
+xsltDoSortFunction
+xsltDocLoaderFunc
+xsltRunStylesheetUser
+xsltSecurityCheck
+
public?
xsltAttrTemplateValueProcessNode
+
purpose
XSLT_REGISTER_FUNCTION_LOOKUP
+XSLT_REGISTER_VARIABLE_LOOKUP
+
pushed
xsltLocalVariablePush
+
pushes
xsltApplyOneTemplate
+

A-I +J-S +T-a +b-c +d-e +f-g +h-i +j-m +n-o +p-p +q-s +t-u +v-x +y-z +

Daniel Veillard

diff --git a/doc/APIconstructors.html b/doc/APIconstructors.html new file mode 100644 index 0000000..af1d285 --- /dev/null +++ b/doc/APIconstructors.html @@ -0,0 +1,89 @@ + + +List of constructors for libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

List of constructors for libxslt

Main Menu
Related links
API Indexes

Type const xmlChar *:

xsltEvalStaticAttrValueTemplate
+xsltGetCNsProp
+xsltGetQNameURI
+xsltGetQNameURI2
+xsltSplitQName
+

Type long:

xsltTimestamp
+

Type void *:

xsltExtInitFunction
+xsltGetExtData
+xsltStyleExtInitFunction
+xsltStyleGetExtData
+xsltStyleStylesheetLevelGetExtData
+

Type xmlAttrPtr:

xsltAttrListTemplateProcess
+xsltAttrTemplateProcess
+

Type xmlChar *:

xsltAttrTemplateValueProcess
+xsltAttrTemplateValueProcessNode
+xsltEvalAVT
+xsltEvalAttrValueTemplate
+xsltEvalTemplateString
+xsltEvalXPathString
+xsltEvalXPathStringNs
+xsltGetNsProp
+

Type xmlDocPtr:

xsltApplyStylesheet
+xsltApplyStylesheetUser
+xsltCreateRVT
+xsltDocLoaderFunc
+xsltGetProfileInformation
+xsltProfileStylesheet
+

Type xmlHashTablePtr:

xsltGetExtInfo
+

Type xmlNodePtr:

xsltCopyTextString
+

Type xmlNodePtr *:

xsltTemplateProcess
+

Type xmlNodeSetPtr:

xsltGetKey
+

Type xmlNsPtr:

xsltCopyNamespace
+xsltCopyNamespaceList
+xsltGetNamespace
+xsltGetPlainNamespace
+xsltGetSpecialNamespace
+

Type xmlXPathCompExprPtr:

xsltXPathCompile
+xsltXPathCompileFlags
+

Type xmlXPathError:

xsltFormatNumberConversion
+

Type xmlXPathFunction:

xsltExtModuleFunctionLookup
+xsltXPathFunctionLookup
+

Type xmlXPathObjectPtr:

xsltVariableLookup
+xsltXPathVariableLookup
+

Type xmlXPathObjectPtr *:

xsltComputeSortResult
+

Type xsltCompMatchPtr:

xsltCompilePattern
+

Type xsltDebugTraceCodes:

xsltDebugGetDefaultTrace
+

Type xsltDecimalFormatPtr:

xsltDecimalFormatGetByName
+

Type xsltDocumentPtr:

xsltFindDocument
+xsltLoadDocument
+xsltLoadStyleDocument
+xsltNewDocument
+xsltNewStyleDocument
+

Type xsltElemPreCompPtr:

xsltDocumentComp
+xsltNewElemPreComp
+xsltPreComputeExtModuleElement
+xsltPreComputeFunction
+

Type xsltLocale:

xsltNewLocale
+

Type xsltLocaleChar *:

xsltStrxfrm
+

Type xsltPointerListPtr:

xsltPointerListCreate
+

Type xsltPreComputeFunction:

xsltExtModuleElementPreComputeLookup
+

Type xsltSecurityCheck:

xsltGetSecurityPrefs
+

Type xsltSecurityPrefsPtr:

xsltGetDefaultSecurityPrefs
+xsltNewSecurityPrefs
+

Type xsltStackElemPtr:

xsltParseStylesheetCallerParam
+

Type xsltStylesheetPtr:

xsltLoadStylesheetPI
+xsltNewStylesheet
+xsltNextImport
+xsltParseStylesheetDoc
+xsltParseStylesheetFile
+xsltParseStylesheetImportedDoc
+xsltParseStylesheetProcess
+

Type xsltTemplatePtr:

xsltFindTemplate
+xsltGetTemplate
+

Type xsltTopLevelFunction:

xsltExtModuleTopLevelLookup
+

Type xsltTransformContextPtr:

xsltNewTransformContext
+xsltXPathGetTransformContext
+

Type xsltTransformFunction:

xsltExtElementLookup
+xsltExtModuleElementLookup
+

Daniel Veillard

diff --git a/doc/APIfiles.html b/doc/APIfiles.html new file mode 100644 index 0000000..9510623 --- /dev/null +++ b/doc/APIfiles.html @@ -0,0 +1,581 @@ + + +List of Symbols per Module for libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

List of Symbols per Module for libxslt

Main Menu
Related links
API Indexes

Module attributes:

xsltApplyAttributeSet
+xsltFreeAttributeSetsHashes
+xsltParseStylesheetAttributeSet
+xsltResolveStylesheetAttributeSet
+

Module documents:

XSLT_LOAD_DOCUMENT
+XSLT_LOAD_START
+XSLT_LOAD_STYLESHEET
+xsltDocDefaultLoader
+xsltDocLoaderFunc
+xsltFindDocument
+xsltFreeDocuments
+xsltFreeStyleDocuments
+xsltLoadDocument
+xsltLoadStyleDocument
+xsltLoadType
+xsltNewDocument
+xsltNewStyleDocument
+xsltSetLoaderFunc
+

Module extensions:

xsltCheckExtPrefix
+xsltCheckExtURI
+xsltDebugDumpExtensions
+xsltExtElementLookup
+xsltExtInitFunction
+xsltExtModuleElementLookup
+xsltExtModuleElementPreComputeLookup
+xsltExtModuleFunctionLookup
+xsltExtModuleTopLevelLookup
+xsltExtShutdownFunction
+xsltFreeCtxtExts
+xsltFreeExts
+xsltGetExtData
+xsltGetExtInfo
+xsltInitCtxtExts
+xsltInitElemPreComp
+xsltInitGlobals
+xsltNewElemPreComp
+xsltPreComputeExtModuleElement
+xsltPreComputeFunction
+xsltRegisterExtElement
+xsltRegisterExtFunction
+xsltRegisterExtModule
+xsltRegisterExtModuleElement
+xsltRegisterExtModuleFull
+xsltRegisterExtModuleFunction
+xsltRegisterExtModuleTopLevel
+xsltRegisterExtPrefix
+xsltRegisterTestModule
+xsltShutdownCtxtExts
+xsltShutdownExts
+xsltStyleExtInitFunction
+xsltStyleExtShutdownFunction
+xsltStyleGetExtData
+xsltStyleStylesheetLevelGetExtData
+xsltTopLevelFunction
+xsltUnregisterExtModule
+xsltUnregisterExtModuleElement
+xsltUnregisterExtModuleFunction
+xsltUnregisterExtModuleTopLevel
+xsltXPathGetTransformContext
+

Module extra:

XSLT_LIBXSLT_NAMESPACE
+XSLT_NORM_SAXON_NAMESPACE
+XSLT_SAXON_NAMESPACE
+XSLT_XALAN_NAMESPACE
+XSLT_XT_NAMESPACE
+xsltDebug
+xsltFunctionNodeSet
+xsltRegisterAllExtras
+xsltRegisterExtras
+

Module functions:

XSLT_REGISTER_FUNCTION_LOOKUP
+xsltDocumentFunction
+xsltElementAvailableFunction
+xsltFormatNumberFunction
+xsltFunctionAvailableFunction
+xsltGenerateIdFunction
+xsltKeyFunction
+xsltRegisterAllFunctions
+xsltSystemPropertyFunction
+xsltUnparsedEntityURIFunction
+xsltXPathFunctionLookup
+

Module imports:

XSLT_GET_IMPORT_INT
+XSLT_GET_IMPORT_PTR
+xsltFindElemSpaceHandling
+xsltFindTemplate
+xsltNeedElemSpaceHandling
+xsltNextImport
+xsltParseStylesheetImport
+xsltParseStylesheetInclude
+

Module keys:

NODE_IS_KEYED
+xsltAddKey
+xsltFreeDocumentKeys
+xsltFreeKeys
+xsltGetKey
+xsltInitCtxtKeys
+

Module namespaces:

UNDEFINED_DEFAULT_NS
+xsltCopyNamespace
+xsltCopyNamespaceList
+xsltFreeNamespaceAliasHashes
+xsltGetNamespace
+xsltGetPlainNamespace
+xsltGetSpecialNamespace
+xsltNamespaceAlias
+

Module numbersInternals:

_xsltCompMatch
+_xsltFormatNumberInfo
+_xsltNumberData
+xsltFormatNumberInfo
+xsltFormatNumberInfoPtr
+xsltNumberData
+xsltNumberDataPtr
+

Module pattern:

xsltAddTemplate
+xsltCleanupTemplates
+xsltCompMatch
+xsltCompMatchPtr
+xsltCompilePattern
+xsltFreeCompMatchList
+xsltFreeTemplateHashes
+xsltGetTemplate
+xsltMatchPattern
+xsltNormalizeCompSteps
+xsltTestCompMatchList
+

Module preproc:

xsltDocumentComp
+xsltExtMarker
+xsltFreeStylePreComps
+xsltStylePreCompute
+

Module security:

XSLT_SECPREF_CREATE_DIRECTORY
+XSLT_SECPREF_READ_FILE
+XSLT_SECPREF_READ_NETWORK
+XSLT_SECPREF_WRITE_FILE
+XSLT_SECPREF_WRITE_NETWORK
+xsltCheckRead
+xsltCheckWrite
+xsltFreeSecurityPrefs
+xsltGetDefaultSecurityPrefs
+xsltGetSecurityPrefs
+xsltNewSecurityPrefs
+xsltSecurityAllow
+xsltSecurityCheck
+xsltSecurityForbid
+xsltSecurityOption
+xsltSecurityPrefs
+xsltSecurityPrefsPtr
+xsltSetCtxtSecurityPrefs
+xsltSetDefaultSecurityPrefs
+xsltSetSecurityPrefs
+

Module templates:

xsltAttrListTemplateProcess
+xsltAttrTemplateProcess
+xsltAttrTemplateValueProcess
+xsltAttrTemplateValueProcessNode
+xsltEvalAttrValueTemplate
+xsltEvalStaticAttrValueTemplate
+xsltEvalTemplateString
+xsltEvalXPathPredicate
+xsltEvalXPathString
+xsltEvalXPathStringNs
+xsltTemplateProcess
+

Module transform:

xslHandleDebugger
+xsltApplyImports
+xsltApplyOneTemplate
+xsltApplyStripSpaces
+xsltApplyStylesheet
+xsltApplyStylesheetUser
+xsltApplyTemplates
+xsltAttribute
+xsltCallTemplate
+xsltChoose
+xsltComment
+xsltCopy
+xsltCopyOf
+xsltCopyTextString
+xsltDocumentElem
+xsltElement
+xsltForEach
+xsltFreeTransformContext
+xsltGetXIncludeDefault
+xsltIf
+xsltLocalVariablePop
+xsltLocalVariablePush
+xsltNewTransformContext
+xsltNumber
+xsltProcessOneNode
+xsltProcessingInstruction
+xsltProfileStylesheet
+xsltRegisterAllElement
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSetXIncludeDefault
+xsltSort
+xsltText
+xsltValueOf
+

Module variables:

XSLT_REGISTER_VARIABLE_LOOKUP
+xsltAddStackElemList
+xsltEvalGlobalVariables
+xsltEvalOneUserParam
+xsltEvalUserParams
+xsltFreeGlobalVariables
+xsltParseGlobalParam
+xsltParseGlobalVariable
+xsltParseStylesheetCallerParam
+xsltParseStylesheetParam
+xsltParseStylesheetVariable
+xsltQuoteOneUserParam
+xsltQuoteUserParams
+xsltVariableLookup
+xsltXPathVariableLookup
+

Module xslt:

XSLT_DEFAULT_URL
+XSLT_DEFAULT_VENDOR
+XSLT_DEFAULT_VERSION
+XSLT_NAMESPACE
+XSLT_PARSE_OPTIONS
+xsltCleanupGlobals
+xsltEngineVersion
+xsltInit
+xsltLibxmlVersion
+xsltLibxsltVersion
+xsltMaxDepth
+xsltMaxVars
+

Module xsltInternals:

CHECK_STOPPED
+CHECK_STOPPED0
+CHECK_STOPPEDE
+IS_XSLT_ATTR_FAST
+IS_XSLT_ELEM_FAST
+XML_CAST_FPTR
+XSLT_CCTXT
+XSLT_ERROR_SEVERITY_ERROR
+XSLT_ERROR_SEVERITY_WARNING
+XSLT_FAST_IF
+XSLT_FUNC_APPLYIMPORTS
+XSLT_FUNC_APPLYTEMPLATES
+XSLT_FUNC_ATTRIBUTE
+XSLT_FUNC_ATTRSET
+XSLT_FUNC_CALLTEMPLATE
+XSLT_FUNC_CHOOSE
+XSLT_FUNC_COMMENT
+XSLT_FUNC_COPY
+XSLT_FUNC_COPYOF
+XSLT_FUNC_DOCUMENT
+XSLT_FUNC_ELEMENT
+XSLT_FUNC_EXTENSION
+XSLT_FUNC_FALLBACK
+XSLT_FUNC_FOREACH
+XSLT_FUNC_IF
+XSLT_FUNC_INCLUDE
+XSLT_FUNC_LITERAL_RESULT_ELEMENT
+XSLT_FUNC_MESSAGE
+XSLT_FUNC_NUMBER
+XSLT_FUNC_OTHERWISE
+XSLT_FUNC_PARAM
+XSLT_FUNC_PI
+XSLT_FUNC_SORT
+XSLT_FUNC_TEXT
+XSLT_FUNC_UNKOWN_FORWARDS_COMPAT
+XSLT_FUNC_VALUEOF
+XSLT_FUNC_VARIABLE
+XSLT_FUNC_WHEN
+XSLT_FUNC_WITHPARAM
+XSLT_GET_INTERNAL_NSMAP
+XSLT_HAS_INTERNAL_NSMAP
+XSLT_IS_RES_TREE_FRAG
+XSLT_IS_TEXT_NODE
+XSLT_ITEM_COMMON_FIELDS
+XSLT_ITEM_COMPATIBILITY_FIELDS
+XSLT_ITEM_NAVIGATION_FIELDS
+XSLT_ITEM_NSINSCOPE_FIELDS
+XSLT_MARK_RES_TREE_FRAG
+XSLT_MAX_SORT
+XSLT_OUTPUT_HTML
+XSLT_OUTPUT_TEXT
+XSLT_OUTPUT_XML
+XSLT_PAT_NO_PRIORITY
+XSLT_REFACTORED_KEYCOMP
+XSLT_REFACTORED_VARS
+XSLT_REFACTORED_XPATHCOMP
+XSLT_RUNTIME_EXTRA
+XSLT_RUNTIME_EXTRA_FREE
+XSLT_RUNTIME_EXTRA_LST
+XSLT_STATE_ERROR
+XSLT_STATE_OK
+XSLT_STATE_STOPPED
+_xsltCompilerCtxt
+_xsltCompilerNodeInfo
+_xsltDecimalFormat
+_xsltDocument
+_xsltEffectiveNs
+_xsltElemPreComp
+_xsltKeyDef
+_xsltKeyTable
+_xsltNsAlias
+_xsltNsList
+_xsltNsListContainer
+_xsltNsMap
+_xsltPointerList
+_xsltPrincipalStylesheetData
+_xsltRuntimeExtra
+_xsltStackElem
+_xsltStyleBasicEmptyItem
+_xsltStyleBasicExpressionItem
+_xsltStyleBasicItemVariable
+_xsltStyleItemApplyTemplates
+_xsltStyleItemAttribute
+_xsltStyleItemCallTemplate
+_xsltStyleItemCopy
+_xsltStyleItemDocument
+_xsltStyleItemElement
+_xsltStyleItemExtElement
+_xsltStyleItemIf
+_xsltStyleItemInclude
+_xsltStyleItemLRElementInfo
+_xsltStyleItemMessage
+_xsltStyleItemNumber
+_xsltStyleItemOtherwise
+_xsltStyleItemPI
+_xsltStyleItemParam
+_xsltStyleItemSort
+_xsltStyleItemText
+_xsltStyleItemUknown
+_xsltStyleItemValueOf
+_xsltStyleItemWhen
+_xsltStylePreComp
+_xsltStylesheet
+_xsltTemplate
+_xsltTransformCache
+_xsltTransformContext
+_xsltVarInfo
+xsltAllocateExtra
+xsltAllocateExtraCtxt
+xsltCompileAttr
+xsltCompilerCtxt
+xsltCompilerCtxtPtr
+xsltCompilerNodeInfo
+xsltCompilerNodeInfoPtr
+xsltConstNamespaceNameXSLT
+xsltCreateRVT
+xsltDecimalFormat
+xsltDecimalFormatGetByName
+xsltDecimalFormatPtr
+xsltDocument
+xsltDocumentPtr
+xsltEffectiveNs
+xsltEffectiveNsPtr
+xsltElemPreComp
+xsltElemPreCompDeallocator
+xsltElemPreCompPtr
+xsltErrorSeverityType
+xsltEvalAVT
+xsltExtensionInstructionResultFinalize
+xsltExtensionInstructionResultRegister
+xsltFormatNumberConversion
+xsltFreeAVTList
+xsltFreeRVTs
+xsltFreeStackElemList
+xsltFreeStylesheet
+xsltInitAllDocKeys
+xsltInitCtxtKey
+xsltIsBlank
+xsltKeyDef
+xsltKeyDefPtr
+xsltKeyTable
+xsltKeyTablePtr
+xsltLoadStylesheetPI
+xsltNewStylesheet
+xsltNsAlias
+xsltNsAliasPtr
+xsltNsList
+xsltNsListContainer
+xsltNsListContainerPtr
+xsltNsListPtr
+xsltNsMap
+xsltNsMapPtr
+xsltNumberFormat
+xsltOutputType
+xsltParseAnyXSLTElem
+xsltParseSequenceConstructor
+xsltParseStylesheetDoc
+xsltParseStylesheetFile
+xsltParseStylesheetImportedDoc
+xsltParseStylesheetOutput
+xsltParseStylesheetProcess
+xsltParseTemplateContent
+xsltPointerList
+xsltPointerListAddSize
+xsltPointerListClear
+xsltPointerListCreate
+xsltPointerListFree
+xsltPointerListPtr
+xsltPrincipalStylesheetData
+xsltPrincipalStylesheetDataPtr
+xsltRegisterLocalRVT
+xsltRegisterPersistRVT
+xsltRegisterTmpRVT
+xsltReleaseRVT
+xsltRestoreDocumentNamespaces
+xsltRuntimeExtra
+xsltRuntimeExtraPtr
+xsltSortFunc
+xsltStackElem
+xsltStackElemPtr
+xsltStyleBasicEmptyItem
+xsltStyleBasicEmptyItemPtr
+xsltStyleBasicExpressionItem
+xsltStyleBasicExpressionItemPtr
+xsltStyleBasicItemVariable
+xsltStyleBasicItemVariablePtr
+xsltStyleItemApplyImports
+xsltStyleItemApplyImportsPtr
+xsltStyleItemApplyTemplates
+xsltStyleItemApplyTemplatesPtr
+xsltStyleItemAttribute
+xsltStyleItemAttributePtr
+xsltStyleItemCallTemplate
+xsltStyleItemCallTemplatePtr
+xsltStyleItemChoose
+xsltStyleItemChoosePtr
+xsltStyleItemComment
+xsltStyleItemCommentPtr
+xsltStyleItemCopy
+xsltStyleItemCopyOf
+xsltStyleItemCopyOfPtr
+xsltStyleItemCopyPtr
+xsltStyleItemDocument
+xsltStyleItemDocumentPtr
+xsltStyleItemElement
+xsltStyleItemElementPtr
+xsltStyleItemExtElement
+xsltStyleItemExtElementPtr
+xsltStyleItemFallback
+xsltStyleItemFallbackPtr
+xsltStyleItemForEach
+xsltStyleItemForEachPtr
+xsltStyleItemIf
+xsltStyleItemIfPtr
+xsltStyleItemInclude
+xsltStyleItemIncludePtr
+xsltStyleItemLRElementInfo
+xsltStyleItemLRElementInfoPtr
+xsltStyleItemMessage
+xsltStyleItemMessagePtr
+xsltStyleItemNumber
+xsltStyleItemNumberPtr
+xsltStyleItemOtherwise
+xsltStyleItemOtherwisePtr
+xsltStyleItemPI
+xsltStyleItemPIPtr
+xsltStyleItemParam
+xsltStyleItemParamPtr
+xsltStyleItemSort
+xsltStyleItemSortPtr
+xsltStyleItemText
+xsltStyleItemTextPtr
+xsltStyleItemUknown
+xsltStyleItemUknownPtr
+xsltStyleItemValueOf
+xsltStyleItemValueOfPtr
+xsltStyleItemVariable
+xsltStyleItemVariablePtr
+xsltStyleItemWhen
+xsltStyleItemWhenPtr
+xsltStyleItemWithParam
+xsltStyleItemWithParamPtr
+xsltStylePreComp
+xsltStylePreCompPtr
+xsltStyleType
+xsltStylesheet
+xsltStylesheetPtr
+xsltTemplate
+xsltTemplatePtr
+xsltTransformCache
+xsltTransformCachePtr
+xsltTransformContext
+xsltTransformContextPtr
+xsltTransformFunction
+xsltTransformState
+xsltUninit
+xsltVarInfo
+xsltVarInfoPtr
+xsltXSLTAttrMarker
+

Module xsltexports:

LIBXSLT_PUBLIC
+XSLTCALL
+XSLTPUBFUN
+XSLTPUBVAR
+_REENTRANT
+

Module xsltlocale:

XSLT_LOCALE_NONE
+xsltFreeLocale
+xsltFreeLocales
+xsltLocale
+xsltLocaleChar
+xsltLocaleStrcmp
+xsltNewLocale
+xsltStrxfrm
+

Module xsltutils:

IS_XSLT_ELEM
+IS_XSLT_NAME
+IS_XSLT_REAL_NODE
+XSLT_DEBUG_CONT
+XSLT_DEBUG_INIT
+XSLT_DEBUG_NEXT
+XSLT_DEBUG_NONE
+XSLT_DEBUG_QUIT
+XSLT_DEBUG_RUN
+XSLT_DEBUG_RUN_RESTART
+XSLT_DEBUG_STEP
+XSLT_DEBUG_STEPOUT
+XSLT_DEBUG_STOP
+XSLT_STRANGE
+XSLT_TIMESTAMP_TICS_PER_SEC
+XSLT_TODO
+XSLT_TRACE
+XSLT_TRACE_ALL
+XSLT_TRACE_APPLY_TEMPLATE
+XSLT_TRACE_APPLY_TEMPLATES
+XSLT_TRACE_CALL_TEMPLATE
+XSLT_TRACE_CHOOSE
+XSLT_TRACE_COMMENT
+XSLT_TRACE_COPY
+XSLT_TRACE_COPY_OF
+XSLT_TRACE_COPY_TEXT
+XSLT_TRACE_FOR_EACH
+XSLT_TRACE_IF
+XSLT_TRACE_KEYS
+XSLT_TRACE_NONE
+XSLT_TRACE_PI
+XSLT_TRACE_PROCESS_NODE
+XSLT_TRACE_STRIP_SPACES
+XSLT_TRACE_TEMPLATES
+XSLT_TRACE_VALUE_OF
+XSLT_TRACE_VARIABLES
+xslAddCall
+xslDebugStatus
+xslDropCall
+xsltAddCallCallback
+xsltCalibrateAdjust
+xsltComputeSortResult
+xsltDebugGetDefaultTrace
+xsltDebugSetDefaultTrace
+xsltDebugStatusCodes
+xsltDebugTraceCodes
+xsltDefaultSortFunction
+xsltDoSortFunction
+xsltDocumentSortFunction
+xsltDropCallCallback
+xsltGenericDebug
+xsltGenericDebugContext
+xsltGenericError
+xsltGenericErrorContext
+xsltGetCNsProp
+xsltGetDebuggerStatus
+xsltGetNsProp
+xsltGetProfileInformation
+xsltGetQNameURI
+xsltGetQNameURI2
+xsltGetUTF8Char
+xsltHandleDebuggerCallback
+xsltMessage
+xsltPrintErrorContext
+xsltSaveProfiling
+xsltSaveResultTo
+xsltSaveResultToFd
+xsltSaveResultToFile
+xsltSaveResultToFilename
+xsltSaveResultToString
+xsltSetCtxtParseOptions
+xsltSetCtxtSortFunc
+xsltSetDebuggerCallbacks
+xsltSetDebuggerStatus
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltSetSortFunc
+xsltSetTransformErrorFunc
+xsltSplitQName
+xsltTimestamp
+xsltTransformError
+xsltXPathCompile
+xsltXPathCompileFlags
+

Daniel Veillard

diff --git a/doc/APIfunctions.html b/doc/APIfunctions.html new file mode 100644 index 0000000..f2eba6c --- /dev/null +++ b/doc/APIfunctions.html @@ -0,0 +1,511 @@ + + +List of function manipulating types in libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

List of function manipulating types in libxslt

Main Menu
Related links
API Indexes

Type ...:

xsltTransformError
+

Type FILE *:

xsltApplyStylesheetUser
+xsltDebugDumpExtensions
+xsltProfileStylesheet
+xsltRunStylesheetUser
+xsltSaveProfiling
+xsltSaveResultToFile
+

Type const char **:

xsltApplyStylesheet
+xsltApplyStylesheetUser
+xsltEvalUserParams
+xsltProfileStylesheet
+xsltQuoteUserParams
+xsltRunStylesheet
+xsltRunStylesheetUser
+

Type const unsigned char *:

xsltGetUTF8Char
+

Type const xmlChar *:

xsltAddKey
+xsltAddTemplate
+xsltApplyAttributeSet
+xsltAttrTemplateValueProcess
+xsltAttrTemplateValueProcessNode
+xsltCheckExtPrefix
+xsltCheckExtURI
+xsltCheckRead
+xsltCheckWrite
+xsltCompilePattern
+xsltCopyTextString
+xsltDocLoaderFunc
+xsltEvalAttrValueTemplate
+xsltEvalOneUserParam
+xsltEvalStaticAttrValueTemplate
+xsltExtElementLookup
+xsltExtInitFunction
+xsltExtModuleElementLookup
+xsltExtModuleElementPreComputeLookup
+xsltExtModuleFunctionLookup
+xsltExtModuleTopLevelLookup
+xsltExtShutdownFunction
+xsltFindTemplate
+xsltGetCNsProp
+xsltGetExtData
+xsltGetExtInfo
+xsltGetKey
+xsltGetNsProp
+xsltGetSpecialNamespace
+xsltLoadDocument
+xsltLoadStyleDocument
+xsltMatchPattern
+xsltNewLocale
+xsltNormalizeCompSteps
+xsltParseStylesheetFile
+xsltQuoteOneUserParam
+xsltRegisterExtElement
+xsltRegisterExtFunction
+xsltRegisterExtModule
+xsltRegisterExtModuleElement
+xsltRegisterExtModuleFull
+xsltRegisterExtModuleFunction
+xsltRegisterExtModuleTopLevel
+xsltRegisterExtPrefix
+xsltSplitQName
+xsltStrxfrm
+xsltStyleExtInitFunction
+xsltStyleExtShutdownFunction
+xsltStyleGetExtData
+xsltStyleStylesheetLevelGetExtData
+xsltUnregisterExtModule
+xsltUnregisterExtModuleElement
+xsltUnregisterExtModuleFunction
+xsltUnregisterExtModuleTopLevel
+xsltVariableLookup
+xsltXPathCompile
+xsltXPathCompileFlags
+xsltXPathFunctionLookup
+xsltXPathVariableLookup
+

Type const xmlChar **:

xsltGetQNameURI2
+xsltSplitQName
+

Type const xsltLocaleChar *:

xsltLocaleStrcmp
+

Type double:

xsltFormatNumberConversion
+

Type int *:

xsltEvalStaticAttrValueTemplate
+xsltGetUTF8Char
+xsltSaveResultToString
+

Type long:

xsltCalibrateAdjust
+

Type void *:

xsltDocLoaderFunc
+xsltEvalAVT
+xsltExtShutdownFunction
+xsltFreeAVTList
+xsltNormalizeCompSteps
+xsltPointerListAddSize
+xsltSetDebuggerCallbacks
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltSetTransformErrorFunc
+xsltStyleExtShutdownFunction
+xsltXPathVariableLookup
+

Type xmlAttrPtr:

xsltAttrListTemplateProcess
+xsltAttrTemplateProcess
+xsltCompileAttr
+

Type xmlChar *:

xsltDecimalFormatGetByName
+xsltFormatNumberConversion
+xsltIsBlank
+

Type xmlChar **:

xsltFormatNumberConversion
+xsltGetQNameURI
+xsltSaveResultToString
+

Type xmlDictPtr:

xsltDocLoaderFunc
+xsltSplitQName
+

Type xmlDocPtr:

xsltApplyStylesheet
+xsltApplyStylesheetUser
+xsltCompilePattern
+xsltFindDocument
+xsltLoadStylesheetPI
+xsltMatchPattern
+xsltNewDocument
+xsltNewStyleDocument
+xsltNewTransformContext
+xsltParseStylesheetDoc
+xsltParseStylesheetImportedDoc
+xsltParseStylesheetProcess
+xsltProfileStylesheet
+xsltRegisterLocalRVT
+xsltRegisterPersistRVT
+xsltRegisterTmpRVT
+xsltReleaseRVT
+xsltRestoreDocumentNamespaces
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSaveResultTo
+xsltSaveResultToFd
+xsltSaveResultToFile
+xsltSaveResultToFilename
+xsltSaveResultToString
+

Type xmlGenericErrorFunc:

xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltSetTransformErrorFunc
+

Type xmlNodePtr:

xslAddCall
+xslHandleDebugger
+xsltAddCallCallback
+xsltAddKey
+xsltApplyAttributeSet
+xsltApplyImports
+xsltApplyOneTemplate
+xsltApplyStripSpaces
+xsltApplyTemplates
+xsltAttrListTemplateProcess
+xsltAttrTemplateProcess
+xsltAttrTemplateValueProcessNode
+xsltAttribute
+xsltCallTemplate
+xsltChoose
+xsltComment
+xsltCompilePattern
+xsltComputeSortResult
+xsltCopy
+xsltCopyNamespace
+xsltCopyNamespaceList
+xsltCopyOf
+xsltCopyTextString
+xsltDebug
+xsltDocumentComp
+xsltDocumentElem
+xsltElement
+xsltEvalAVT
+xsltEvalAttrValueTemplate
+xsltEvalStaticAttrValueTemplate
+xsltEvalTemplateString
+xsltFindElemSpaceHandling
+xsltForEach
+xsltGetCNsProp
+xsltGetNamespace
+xsltGetNsProp
+xsltGetPlainNamespace
+xsltGetQNameURI
+xsltGetQNameURI2
+xsltGetSpecialNamespace
+xsltGetTemplate
+xsltHandleDebuggerCallback
+xsltIf
+xsltInitElemPreComp
+xsltMatchPattern
+xsltMessage
+xsltNamespaceAlias
+xsltNewElemPreComp
+xsltNumber
+xsltNumberFormat
+xsltParseAnyXSLTElem
+xsltParseGlobalParam
+xsltParseGlobalVariable
+xsltParseSequenceConstructor
+xsltParseStylesheetAttributeSet
+xsltParseStylesheetCallerParam
+xsltParseStylesheetImport
+xsltParseStylesheetInclude
+xsltParseStylesheetOutput
+xsltParseStylesheetParam
+xsltParseStylesheetVariable
+xsltParseTemplateContent
+xsltPreComputeExtModuleElement
+xsltPreComputeFunction
+xsltPrintErrorContext
+xsltProcessOneNode
+xsltProcessingInstruction
+xsltSort
+xsltStylePreCompute
+xsltTemplateProcess
+xsltTestCompMatchList
+xsltText
+xsltTopLevelFunction
+xsltTransformError
+xsltTransformFunction
+xsltValueOf
+

Type xmlNodePtr *:

xsltDefaultSortFunction
+xsltDoSortFunction
+xsltSortFunc
+

Type xmlNodeSetPtr:

xsltDocumentSortFunction
+

Type xmlNsPtr:

xsltCopyNamespace
+xsltCopyNamespaceList
+xsltGetNamespace
+xsltGetPlainNamespace
+

Type xmlNsPtr *:

xsltEvalXPathPredicate
+xsltEvalXPathStringNs
+

Type xmlOutputBufferPtr:

xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSaveResultTo
+

Type xmlSAXHandlerPtr:

xsltRunStylesheet
+xsltRunStylesheetUser
+

Type xmlXPathCompExprPtr:

xsltEvalXPathPredicate
+xsltEvalXPathString
+xsltEvalXPathStringNs
+

Type xmlXPathContextPtr:

xsltRegisterAllFunctions
+xsltXPathFunctionLookup
+

Type xmlXPathFunction:

xsltRegisterExtFunction
+xsltRegisterExtModuleFunction
+

Type xmlXPathObjectPtr:

xsltExtensionInstructionResultRegister
+

Type xmlXPathParserContextPtr:

xsltDocumentFunction
+xsltElementAvailableFunction
+xsltFormatNumberFunction
+xsltFunctionAvailableFunction
+xsltFunctionNodeSet
+xsltGenerateIdFunction
+xsltKeyFunction
+xsltSystemPropertyFunction
+xsltUnparsedEntityURIFunction
+xsltXPathGetTransformContext
+

Type xsltCompMatchPtr:

xsltFreeCompMatchList
+xsltTestCompMatchList
+

Type xsltCompilerCtxtPtr:

xsltParseAnyXSLTElem
+xsltParseSequenceConstructor
+

Type xsltDebugTraceCodes:

xsltDebugSetDefaultTrace
+

Type xsltDecimalFormatPtr:

xsltFormatNumberConversion
+

Type xsltDocLoaderFunc:

xsltSetLoaderFunc
+

Type xsltDocumentPtr:

xsltFreeDocumentKeys
+xsltInitCtxtKey
+xsltInitCtxtKeys
+

Type xsltElemPreCompDeallocator:

xsltInitElemPreComp
+

Type xsltElemPreCompPtr:

xsltElemPreCompDeallocator
+xsltInitElemPreComp
+xsltTransformFunction
+

Type xsltExtInitFunction:

xsltRegisterExtModule
+xsltRegisterExtModuleFull
+

Type xsltExtShutdownFunction:

xsltRegisterExtModule
+xsltRegisterExtModuleFull
+

Type xsltKeyDefPtr:

xsltInitCtxtKey
+

Type xsltLoadType:

xsltDocLoaderFunc
+

Type xsltLocale:

xsltFreeLocale
+xsltLocaleStrcmp
+xsltStrxfrm
+

Type xsltNsMapPtr:

xsltRestoreDocumentNamespaces
+

Type xsltNumberDataPtr:

xsltNumberFormat
+

Type xsltPointerListPtr:

xsltPointerListAddSize
+xsltPointerListClear
+xsltPointerListFree
+

Type xsltPreComputeFunction:

xsltRegisterExtModuleElement
+

Type xsltSecurityCheck:

xsltSetSecurityPrefs
+

Type xsltSecurityOption:

xsltGetSecurityPrefs
+xsltSetSecurityPrefs
+

Type xsltSecurityPrefsPtr:

xsltCheckRead
+xsltCheckWrite
+xsltFreeSecurityPrefs
+xsltGetSecurityPrefs
+xsltSecurityAllow
+xsltSecurityCheck
+xsltSecurityForbid
+xsltSetCtxtSecurityPrefs
+xsltSetDefaultSecurityPrefs
+xsltSetSecurityPrefs
+

Type xsltSortFunc:

xsltSetCtxtSortFunc
+xsltSetSortFunc
+

Type xsltStackElemPtr:

xsltAddStackElemList
+xsltApplyOneTemplate
+xsltFreeStackElemList
+xsltLocalVariablePush
+xsltProcessOneNode
+

Type xsltStyleExtInitFunction:

xsltRegisterExtModuleFull
+

Type xsltStyleExtShutdownFunction:

xsltRegisterExtModuleFull
+

Type xsltStylePreCompPtr:

xsltApplyImports
+xsltApplyTemplates
+xsltAttribute
+xsltCallTemplate
+xsltChoose
+xsltComment
+xsltCopy
+xsltCopyOf
+xsltDebug
+xsltDocumentElem
+xsltElement
+xsltForEach
+xsltIf
+xsltNumber
+xsltProcessingInstruction
+xsltSort
+xsltText
+xsltValueOf
+

Type xsltStylesheetPtr:

xsltAddKey
+xsltAddTemplate
+xsltAllocateExtra
+xsltApplyStylesheet
+xsltApplyStylesheetUser
+xsltCheckExtPrefix
+xsltCheckExtURI
+xsltCleanupTemplates
+xsltCompileAttr
+xsltCompilePattern
+xsltDecimalFormatGetByName
+xsltDocumentComp
+xsltEvalStaticAttrValueTemplate
+xsltFreeAttributeSetsHashes
+xsltFreeExts
+xsltFreeKeys
+xsltFreeNamespaceAliasHashes
+xsltFreeStyleDocuments
+xsltFreeStylePreComps
+xsltFreeStylesheet
+xsltFreeTemplateHashes
+xsltGetCNsProp
+xsltGetExtInfo
+xsltGetQNameURI2
+xsltGetTemplate
+xsltInitElemPreComp
+xsltLoadStyleDocument
+xsltNamespaceAlias
+xsltNewElemPreComp
+xsltNewStyleDocument
+xsltNewTransformContext
+xsltNextImport
+xsltParseGlobalParam
+xsltParseGlobalVariable
+xsltParseStylesheetAttributeSet
+xsltParseStylesheetImport
+xsltParseStylesheetImportedDoc
+xsltParseStylesheetInclude
+xsltParseStylesheetOutput
+xsltParseStylesheetProcess
+xsltParseTemplateContent
+xsltPreComputeExtModuleElement
+xsltPreComputeFunction
+xsltPrintErrorContext
+xsltProfileStylesheet
+xsltRegisterExtPrefix
+xsltResolveStylesheetAttributeSet
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltSaveResultTo
+xsltSaveResultToFd
+xsltSaveResultToFile
+xsltSaveResultToFilename
+xsltSaveResultToString
+xsltShutdownExts
+xsltStyleExtInitFunction
+xsltStyleExtShutdownFunction
+xsltStyleGetExtData
+xsltStylePreCompute
+xsltStyleStylesheetLevelGetExtData
+xsltTopLevelFunction
+xsltTransformError
+xsltXPathCompile
+xsltXPathCompileFlags
+

Type xsltTemplatePtr:

xslAddCall
+xslHandleDebugger
+xsltAddCallCallback
+xsltAddTemplate
+xsltApplyOneTemplate
+xsltHandleDebuggerCallback
+

Type xsltTopLevelFunction:

xsltRegisterExtModuleTopLevel
+

Type xsltTransformContextPtr:

xslHandleDebugger
+xsltAddStackElemList
+xsltAllocateExtraCtxt
+xsltApplyAttributeSet
+xsltApplyImports
+xsltApplyOneTemplate
+xsltApplyStripSpaces
+xsltApplyStylesheetUser
+xsltApplyTemplates
+xsltAttrListTemplateProcess
+xsltAttrTemplateProcess
+xsltAttrTemplateValueProcess
+xsltAttrTemplateValueProcessNode
+xsltAttribute
+xsltCallTemplate
+xsltCheckRead
+xsltCheckWrite
+xsltChoose
+xsltComment
+xsltCompilePattern
+xsltComputeSortResult
+xsltCopy
+xsltCopyNamespace
+xsltCopyNamespaceList
+xsltCopyOf
+xsltCopyTextString
+xsltCreateRVT
+xsltDebug
+xsltDefaultSortFunction
+xsltDoSortFunction
+xsltDocumentElem
+xsltElement
+xsltEvalAVT
+xsltEvalAttrValueTemplate
+xsltEvalGlobalVariables
+xsltEvalOneUserParam
+xsltEvalTemplateString
+xsltEvalUserParams
+xsltEvalXPathPredicate
+xsltEvalXPathString
+xsltEvalXPathStringNs
+xsltExtElementLookup
+xsltExtInitFunction
+xsltExtShutdownFunction
+xsltExtensionInstructionResultFinalize
+xsltExtensionInstructionResultRegister
+xsltFindDocument
+xsltFindElemSpaceHandling
+xsltFindTemplate
+xsltForEach
+xsltFreeCtxtExts
+xsltFreeDocuments
+xsltFreeGlobalVariables
+xsltFreeRVTs
+xsltFreeTransformContext
+xsltGetExtData
+xsltGetKey
+xsltGetNamespace
+xsltGetPlainNamespace
+xsltGetProfileInformation
+xsltGetSpecialNamespace
+xsltGetTemplate
+xsltHandleDebuggerCallback
+xsltIf
+xsltInitAllDocKeys
+xsltInitCtxtExts
+xsltInitCtxtKey
+xsltInitCtxtKeys
+xsltLoadDocument
+xsltLocalVariablePop
+xsltLocalVariablePush
+xsltMatchPattern
+xsltMessage
+xsltNeedElemSpaceHandling
+xsltNewDocument
+xsltNumber
+xsltNumberFormat
+xsltParseStylesheetCallerParam
+xsltParseStylesheetParam
+xsltParseStylesheetVariable
+xsltPrintErrorContext
+xsltProcessOneNode
+xsltProcessingInstruction
+xsltQuoteOneUserParam
+xsltQuoteUserParams
+xsltRegisterAllElement
+xsltRegisterExtElement
+xsltRegisterExtFunction
+xsltRegisterExtras
+xsltRegisterLocalRVT
+xsltRegisterPersistRVT
+xsltRegisterTmpRVT
+xsltReleaseRVT
+xsltRunStylesheetUser
+xsltSaveProfiling
+xsltSecurityAllow
+xsltSecurityCheck
+xsltSecurityForbid
+xsltSetCtxtParseOptions
+xsltSetCtxtSecurityPrefs
+xsltSetCtxtSortFunc
+xsltSetTransformErrorFunc
+xsltShutdownCtxtExts
+xsltSort
+xsltSortFunc
+xsltTemplateProcess
+xsltTestCompMatchList
+xsltText
+xsltTransformError
+xsltTransformFunction
+xsltValueOf
+xsltVariableLookup
+

Type xsltTransformFunction:

xsltDocumentComp
+xsltInitElemPreComp
+xsltNewElemPreComp
+xsltPreComputeFunction
+xsltRegisterExtElement
+xsltRegisterExtModuleElement
+

Daniel Veillard

diff --git a/doc/APIsymbols.html b/doc/APIsymbols.html new file mode 100644 index 0000000..f5500a1 --- /dev/null +++ b/doc/APIsymbols.html @@ -0,0 +1,581 @@ + + +Alphabetic List of Symbols in libxslt
Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
Made with Libxslt Logo

The XSLT C library for GNOME

Alphabetic List of Symbols in libxslt

Main Menu
Related links
API Indexes

Letter C:

CHECK_STOPPED
+CHECK_STOPPED0
+CHECK_STOPPEDE
+

Letter I:

IS_XSLT_ATTR_FAST
+IS_XSLT_ELEM
+IS_XSLT_ELEM_FAST
+IS_XSLT_NAME
+IS_XSLT_REAL_NODE
+

Letter L:

LIBXSLT_PUBLIC
+

Letter N:

NODE_IS_KEYED
+

Letter U:

UNDEFINED_DEFAULT_NS
+

Letter X:

XML_CAST_FPTR
+XSLTCALL
+XSLTPUBFUN
+XSLTPUBVAR
+XSLT_CCTXT
+XSLT_DEBUG_CONT
+XSLT_DEBUG_INIT
+XSLT_DEBUG_NEXT
+XSLT_DEBUG_NONE
+XSLT_DEBUG_QUIT
+XSLT_DEBUG_RUN
+XSLT_DEBUG_RUN_RESTART
+XSLT_DEBUG_STEP
+XSLT_DEBUG_STEPOUT
+XSLT_DEBUG_STOP
+XSLT_DEFAULT_URL
+XSLT_DEFAULT_VENDOR
+XSLT_DEFAULT_VERSION
+XSLT_ERROR_SEVERITY_ERROR
+XSLT_ERROR_SEVERITY_WARNING
+XSLT_FAST_IF
+XSLT_FUNC_APPLYIMPORTS
+XSLT_FUNC_APPLYTEMPLATES
+XSLT_FUNC_ATTRIBUTE
+XSLT_FUNC_ATTRSET
+XSLT_FUNC_CALLTEMPLATE
+XSLT_FUNC_CHOOSE
+XSLT_FUNC_COMMENT
+XSLT_FUNC_COPY
+XSLT_FUNC_COPYOF
+XSLT_FUNC_DOCUMENT
+XSLT_FUNC_ELEMENT
+XSLT_FUNC_EXTENSION
+XSLT_FUNC_FALLBACK
+XSLT_FUNC_FOREACH
+XSLT_FUNC_IF
+XSLT_FUNC_INCLUDE
+XSLT_FUNC_LITERAL_RESULT_ELEMENT
+XSLT_FUNC_MESSAGE
+XSLT_FUNC_NUMBER
+XSLT_FUNC_OTHERWISE
+XSLT_FUNC_PARAM
+XSLT_FUNC_PI
+XSLT_FUNC_SORT
+XSLT_FUNC_TEXT
+XSLT_FUNC_UNKOWN_FORWARDS_COMPAT
+XSLT_FUNC_VALUEOF
+XSLT_FUNC_VARIABLE
+XSLT_FUNC_WHEN
+XSLT_FUNC_WITHPARAM
+XSLT_GET_IMPORT_INT
+XSLT_GET_IMPORT_PTR
+XSLT_GET_INTERNAL_NSMAP
+XSLT_HAS_INTERNAL_NSMAP
+XSLT_IS_RES_TREE_FRAG
+XSLT_IS_TEXT_NODE
+XSLT_ITEM_COMMON_FIELDS
+XSLT_ITEM_COMPATIBILITY_FIELDS
+XSLT_ITEM_NAVIGATION_FIELDS
+XSLT_ITEM_NSINSCOPE_FIELDS
+XSLT_LIBXSLT_NAMESPACE
+XSLT_LOAD_DOCUMENT
+XSLT_LOAD_START
+XSLT_LOAD_STYLESHEET
+XSLT_LOCALE_NONE
+XSLT_MARK_RES_TREE_FRAG
+XSLT_MAX_SORT
+XSLT_NAMESPACE
+XSLT_NORM_SAXON_NAMESPACE
+XSLT_OUTPUT_HTML
+XSLT_OUTPUT_TEXT
+XSLT_OUTPUT_XML
+XSLT_PARSE_OPTIONS
+XSLT_PAT_NO_PRIORITY
+XSLT_REFACTORED_KEYCOMP
+XSLT_REFACTORED_VARS
+XSLT_REFACTORED_XPATHCOMP
+XSLT_REGISTER_FUNCTION_LOOKUP
+XSLT_REGISTER_VARIABLE_LOOKUP
+XSLT_RUNTIME_EXTRA
+XSLT_RUNTIME_EXTRA_FREE
+XSLT_RUNTIME_EXTRA_LST
+XSLT_SAXON_NAMESPACE
+XSLT_SECPREF_CREATE_DIRECTORY
+XSLT_SECPREF_READ_FILE
+XSLT_SECPREF_READ_NETWORK
+XSLT_SECPREF_WRITE_FILE
+XSLT_SECPREF_WRITE_NETWORK
+XSLT_STATE_ERROR
+XSLT_STATE_OK
+XSLT_STATE_STOPPED
+XSLT_STRANGE
+XSLT_TIMESTAMP_TICS_PER_SEC
+XSLT_TODO
+XSLT_TRACE
+XSLT_TRACE_ALL
+XSLT_TRACE_APPLY_TEMPLATE
+XSLT_TRACE_APPLY_TEMPLATES
+XSLT_TRACE_CALL_TEMPLATE
+XSLT_TRACE_CHOOSE
+XSLT_TRACE_COMMENT
+XSLT_TRACE_COPY
+XSLT_TRACE_COPY_OF
+XSLT_TRACE_COPY_TEXT
+XSLT_TRACE_FOR_EACH
+XSLT_TRACE_IF
+XSLT_TRACE_KEYS
+XSLT_TRACE_NONE
+XSLT_TRACE_PI
+XSLT_TRACE_PROCESS_NODE
+XSLT_TRACE_STRIP_SPACES
+XSLT_TRACE_TEMPLATES
+XSLT_TRACE_VALUE_OF
+XSLT_TRACE_VARIABLES
+XSLT_XALAN_NAMESPACE
+XSLT_XT_NAMESPACE
+

Letter _:

_REENTRANT
+_xsltCompMatch
+_xsltCompilerCtxt
+_xsltCompilerNodeInfo
+_xsltDecimalFormat
+_xsltDocument
+_xsltEffectiveNs
+_xsltElemPreComp
+_xsltFormatNumberInfo
+_xsltKeyDef
+_xsltKeyTable
+_xsltNsAlias
+_xsltNsList
+_xsltNsListContainer
+_xsltNsMap
+_xsltNumberData
+_xsltPointerList
+_xsltPrincipalStylesheetData
+_xsltRuntimeExtra
+_xsltStackElem
+_xsltStyleBasicEmptyItem
+_xsltStyleBasicExpressionItem
+_xsltStyleBasicItemVariable
+_xsltStyleItemApplyTemplates
+_xsltStyleItemAttribute
+_xsltStyleItemCallTemplate
+_xsltStyleItemCopy
+_xsltStyleItemDocument
+_xsltStyleItemElement
+_xsltStyleItemExtElement
+_xsltStyleItemIf
+_xsltStyleItemInclude
+_xsltStyleItemLRElementInfo
+_xsltStyleItemMessage
+_xsltStyleItemNumber
+_xsltStyleItemOtherwise
+_xsltStyleItemPI
+_xsltStyleItemParam
+_xsltStyleItemSort
+_xsltStyleItemText
+_xsltStyleItemUknown
+_xsltStyleItemValueOf
+_xsltStyleItemWhen
+_xsltStylePreComp
+_xsltStylesheet
+_xsltTemplate
+_xsltTransformCache
+_xsltTransformContext
+_xsltVarInfo
+

Letter x:

xslAddCall
+xslDebugStatus
+xslDropCall
+xslHandleDebugger
+xsltAddCallCallback
+xsltAddKey
+xsltAddStackElemList
+xsltAddTemplate
+xsltAllocateExtra
+xsltAllocateExtraCtxt
+xsltApplyAttributeSet
+xsltApplyImports
+xsltApplyOneTemplate
+xsltApplyStripSpaces
+xsltApplyStylesheet
+xsltApplyStylesheetUser
+xsltApplyTemplates
+xsltAttrListTemplateProcess
+xsltAttrTemplateProcess
+xsltAttrTemplateValueProcess
+xsltAttrTemplateValueProcessNode
+xsltAttribute
+xsltCalibrateAdjust
+xsltCallTemplate
+xsltCheckExtPrefix
+xsltCheckExtURI
+xsltCheckRead
+xsltCheckWrite
+xsltChoose
+xsltCleanupGlobals
+xsltCleanupTemplates
+xsltComment
+xsltCompMatch
+xsltCompMatchPtr
+xsltCompileAttr
+xsltCompilePattern
+xsltCompilerCtxt
+xsltCompilerCtxtPtr
+xsltCompilerNodeInfo
+xsltCompilerNodeInfoPtr
+xsltComputeSortResult
+xsltConstNamespaceNameXSLT
+xsltCopy
+xsltCopyNamespace
+xsltCopyNamespaceList
+xsltCopyOf
+xsltCopyTextString
+xsltCreateRVT
+xsltDebug
+xsltDebugDumpExtensions
+xsltDebugGetDefaultTrace
+xsltDebugSetDefaultTrace
+xsltDebugStatusCodes
+xsltDebugTraceCodes
+xsltDecimalFormat
+xsltDecimalFormatGetByName
+xsltDecimalFormatPtr
+xsltDefaultSortFunction
+xsltDoSortFunction
+xsltDocDefaultLoader
+xsltDocLoaderFunc
+xsltDocument
+xsltDocumentComp
+xsltDocumentElem
+xsltDocumentFunction
+xsltDocumentPtr
+xsltDocumentSortFunction
+xsltDropCallCallback
+xsltEffectiveNs
+xsltEffectiveNsPtr
+xsltElemPreComp
+xsltElemPreCompDeallocator
+xsltElemPreCompPtr
+xsltElement
+xsltElementAvailableFunction
+xsltEngineVersion
+xsltErrorSeverityType
+xsltEvalAVT
+xsltEvalAttrValueTemplate
+xsltEvalGlobalVariables
+xsltEvalOneUserParam
+xsltEvalStaticAttrValueTemplate
+xsltEvalTemplateString
+xsltEvalUserParams
+xsltEvalXPathPredicate
+xsltEvalXPathString
+xsltEvalXPathStringNs
+xsltExtElementLookup
+xsltExtInitFunction
+xsltExtMarker
+xsltExtModuleElementLookup
+xsltExtModuleElementPreComputeLookup
+xsltExtModuleFunctionLookup
+xsltExtModuleTopLevelLookup
+xsltExtShutdownFunction
+xsltExtensionInstructionResultFinalize
+xsltExtensionInstructionResultRegister
+xsltFindDocument
+xsltFindElemSpaceHandling
+xsltFindTemplate
+xsltForEach
+xsltFormatNumberConversion
+xsltFormatNumberFunction
+xsltFormatNumberInfo
+xsltFormatNumberInfoPtr
+xsltFreeAVTList
+xsltFreeAttributeSetsHashes
+xsltFreeCompMatchList
+xsltFreeCtxtExts
+xsltFreeDocumentKeys
+xsltFreeDocuments
+xsltFreeExts
+xsltFreeGlobalVariables
+xsltFreeKeys
+xsltFreeLocale
+xsltFreeLocales
+xsltFreeNamespaceAliasHashes
+xsltFreeRVTs
+xsltFreeSecurityPrefs
+xsltFreeStackElemList
+xsltFreeStyleDocuments
+xsltFreeStylePreComps
+xsltFreeStylesheet
+xsltFreeTemplateHashes
+xsltFreeTransformContext
+xsltFunctionAvailableFunction
+xsltFunctionNodeSet
+xsltGenerateIdFunction
+xsltGenericDebug
+xsltGenericDebugContext
+xsltGenericError
+xsltGenericErrorContext
+xsltGetCNsProp
+xsltGetDebuggerStatus
+xsltGetDefaultSecurityPrefs
+xsltGetExtData
+xsltGetExtInfo
+xsltGetKey
+xsltGetNamespace
+xsltGetNsProp
+xsltGetPlainNamespace
+xsltGetProfileInformation
+xsltGetQNameURI
+xsltGetQNameURI2
+xsltGetSecurityPrefs
+xsltGetSpecialNamespace
+xsltGetTemplate
+xsltGetUTF8Char
+xsltGetXIncludeDefault
+xsltHandleDebuggerCallback
+xsltIf
+xsltInit
+xsltInitAllDocKeys
+xsltInitCtxtExts
+xsltInitCtxtKey
+xsltInitCtxtKeys
+xsltInitElemPreComp
+xsltInitGlobals
+xsltIsBlank
+xsltKeyDef
+xsltKeyDefPtr
+xsltKeyFunction
+xsltKeyTable
+xsltKeyTablePtr
+xsltLibxmlVersion
+xsltLibxsltVersion
+xsltLoadDocument
+xsltLoadStyleDocument
+xsltLoadStylesheetPI
+xsltLoadType
+xsltLocalVariablePop
+xsltLocalVariablePush
+xsltLocale
+xsltLocaleChar
+xsltLocaleStrcmp
+xsltMatchPattern
+xsltMaxDepth
+xsltMaxVars
+xsltMessage
+xsltNamespaceAlias
+xsltNeedElemSpaceHandling
+xsltNewDocument
+xsltNewElemPreComp
+xsltNewLocale
+xsltNewSecurityPrefs
+xsltNewStyleDocument
+xsltNewStylesheet
+xsltNewTransformContext
+xsltNextImport
+xsltNormalizeCompSteps
+xsltNsAlias
+xsltNsAliasPtr
+xsltNsList
+xsltNsListContainer
+xsltNsListContainerPtr
+xsltNsListPtr
+xsltNsMap
+xsltNsMapPtr
+xsltNumber
+xsltNumberData
+xsltNumberDataPtr
+xsltNumberFormat
+xsltOutputType
+xsltParseAnyXSLTElem
+xsltParseGlobalParam
+xsltParseGlobalVariable
+xsltParseSequenceConstructor
+xsltParseStylesheetAttributeSet
+xsltParseStylesheetCallerParam
+xsltParseStylesheetDoc
+xsltParseStylesheetFile
+xsltParseStylesheetImport
+xsltParseStylesheetImportedDoc
+xsltParseStylesheetInclude
+xsltParseStylesheetOutput
+xsltParseStylesheetParam
+xsltParseStylesheetProcess
+xsltParseStylesheetVariable
+xsltParseTemplateContent
+xsltPointerList
+xsltPointerListAddSize
+xsltPointerListClear
+xsltPointerListCreate
+xsltPointerListFree
+xsltPointerListPtr
+xsltPreComputeExtModuleElement
+xsltPreComputeFunction
+xsltPrincipalStylesheetData
+xsltPrincipalStylesheetDataPtr
+xsltPrintErrorContext
+xsltProcessOneNode
+xsltProcessingInstruction
+xsltProfileStylesheet
+xsltQuoteOneUserParam
+xsltQuoteUserParams
+xsltRegisterAllElement
+xsltRegisterAllExtras
+xsltRegisterAllFunctions
+xsltRegisterExtElement
+xsltRegisterExtFunction
+xsltRegisterExtModule
+xsltRegisterExtModuleElement
+xsltRegisterExtModuleFull
+xsltRegisterExtModuleFunction
+xsltRegisterExtModuleTopLevel
+xsltRegisterExtPrefix
+xsltRegisterExtras
+xsltRegisterLocalRVT
+xsltRegisterPersistRVT
+xsltRegisterTestModule
+xsltRegisterTmpRVT
+xsltReleaseRVT
+xsltResolveStylesheetAttributeSet
+xsltRestoreDocumentNamespaces
+xsltRunStylesheet
+xsltRunStylesheetUser
+xsltRuntimeExtra
+xsltRuntimeExtraPtr
+xsltSaveProfiling
+xsltSaveResultTo
+xsltSaveResultToFd
+xsltSaveResultToFile
+xsltSaveResultToFilename
+xsltSaveResultToString
+xsltSecurityAllow
+xsltSecurityCheck
+xsltSecurityForbid
+xsltSecurityOption
+xsltSecurityPrefs
+xsltSecurityPrefsPtr
+xsltSetCtxtParseOptions
+xsltSetCtxtSecurityPrefs
+xsltSetCtxtSortFunc
+xsltSetDebuggerCallbacks
+xsltSetDebuggerStatus
+xsltSetDefaultSecurityPrefs
+xsltSetGenericDebugFunc
+xsltSetGenericErrorFunc
+xsltSetLoaderFunc
+xsltSetSecurityPrefs
+xsltSetSortFunc
+xsltSetTransformErrorFunc
+xsltSetXIncludeDefault
+xsltShutdownCtxtExts
+xsltShutdownExts
+xsltSort
+xsltSortFunc
+xsltSplitQName
+xsltStackElem
+xsltStackElemPtr
+xsltStrxfrm
+xsltStyleBasicEmptyItem
+xsltStyleBasicEmptyItemPtr
+xsltStyleBasicExpressionItem
+xsltStyleBasicExpressionItemPtr
+xsltStyleBasicItemVariable
+xsltStyleBasicItemVariablePtr
+xsltStyleExtInitFunction
+xsltStyleExtShutdownFunction
+xsltStyleGetExtData
+xsltStyleItemApplyImports
+xsltStyleItemApplyImportsPtr
+xsltStyleItemApplyTemplates
+xsltStyleItemApplyTemplatesPtr
+xsltStyleItemAttribute
+xsltStyleItemAttributePtr
+xsltStyleItemCallTemplate
+xsltStyleItemCallTemplatePtr
+xsltStyleItemChoose
+xsltStyleItemChoosePtr
+xsltStyleItemComment
+xsltStyleItemCommentPtr
+xsltStyleItemCopy
+xsltStyleItemCopyOf
+xsltStyleItemCopyOfPtr
+xsltStyleItemCopyPtr
+xsltStyleItemDocument
+xsltStyleItemDocumentPtr
+xsltStyleItemElement
+xsltStyleItemElementPtr
+xsltStyleItemExtElement
+xsltStyleItemExtElementPtr
+xsltStyleItemFallback
+xsltStyleItemFallbackPtr
+xsltStyleItemForEach
+xsltStyleItemForEachPtr
+xsltStyleItemIf
+xsltStyleItemIfPtr
+xsltStyleItemInclude
+xsltStyleItemIncludePtr
+xsltStyleItemLRElementInfo
+xsltStyleItemLRElementInfoPtr
+xsltStyleItemMessage
+xsltStyleItemMessagePtr
+xsltStyleItemNumber
+xsltStyleItemNumberPtr
+xsltStyleItemOtherwise
+xsltStyleItemOtherwisePtr
+xsltStyleItemPI
+xsltStyleItemPIPtr
+xsltStyleItemParam
+xsltStyleItemParamPtr
+xsltStyleItemSort
+xsltStyleItemSortPtr
+xsltStyleItemText
+xsltStyleItemTextPtr
+xsltStyleItemUknown
+xsltStyleItemUknownPtr
+xsltStyleItemValueOf
+xsltStyleItemValueOfPtr
+xsltStyleItemVariable
+xsltStyleItemVariablePtr
+xsltStyleItemWhen
+xsltStyleItemWhenPtr
+xsltStyleItemWithParam
+xsltStyleItemWithParamPtr
+xsltStylePreComp
+xsltStylePreCompPtr
+xsltStylePreCompute
+xsltStyleStylesheetLevelGetExtData
+xsltStyleType
+xsltStylesheet
+xsltStylesheetPtr
+xsltSystemPropertyFunction
+xsltTemplate
+xsltTemplateProcess
+xsltTemplatePtr
+xsltTestCompMatchList
+xsltText
+xsltTimestamp
+xsltTopLevelFunction
+xsltTransformCache
+xsltTransformCachePtr
+xsltTransformContext
+xsltTransformContextPtr
+xsltTransformError
+xsltTransformFunction
+xsltTransformState
+xsltUninit
+xsltUnparsedEntityURIFunction
+xsltUnregisterExtModule
+xsltUnregisterExtModuleElement
+xsltUnregisterExtModuleFunction
+xsltUnregisterExtModuleTopLevel
+xsltValueOf
+xsltVarInfo
+xsltVarInfoPtr
+xsltVariableLookup
+xsltXPathCompile
+xsltXPathCompileFlags
+xsltXPathFunctionLookup
+xsltXPathGetTransformContext
+xsltXPathVariableLookup
+xsltXSLTAttrMarker
+

Daniel Veillard

diff --git a/doc/ChangeLog.xsl b/doc/ChangeLog.xsl new file mode 100644 index 0000000..c94f9f0 --- /dev/null +++ b/doc/ChangeLog.xsl @@ -0,0 +1,113 @@ + + + + + + + + + + + libxslt + + + API Menu + +
+ + +
+ +
+ + + + + + + +
  • +
    + + + +

    + + + + + +

      + +
    +

    +
    + + + ChangeLog last entries of + + + + + + + + + + + + + + + +
    + + + + + +
    + + + + + + +
    + + + + +
    + + + + +
    + +

    Daniel Veillard

    +
    +
    +
    +
    +
    + + +
    + +
    diff --git a/doc/EXSLT/APIchunk0.html b/doc/EXSLT/APIchunk0.html new file mode 100644 index 0000000..b9666d4 --- /dev/null +++ b/doc/EXSLT/APIchunk0.html @@ -0,0 +1,132 @@ + + +API Alphabetic Index C-u for libexslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The EXSLT C library for Gnome

    API Alphabetic Index C-u for libexslt

    Main Menu
    Related links
    API Indexes

    C-u +

    Letter C:

    Common
    exsltCommonRegister
    +
    Crypto
    exsltCryptoRegister
    +

    Letter D:

    Dates
    exsltDateRegister
    +exsltDateXpathCtxtRegister
    +
    Dynamic
    exsltDynRegister
    +

    Letter E:

    EXSLT
    EXSLT_COMMON_NAMESPACE
    +EXSLT_CRYPTO_NAMESPACE
    +EXSLT_DATE_NAMESPACE
    +EXSLT_DYNAMIC_NAMESPACE
    +EXSLT_FUNCTIONS_NAMESPACE
    +EXSLT_MATH_NAMESPACE
    +EXSLT_SETS_NAMESPACE
    +EXSLT_STRINGS_NAMESPACE
    +exsltCommonRegister
    +exsltCryptoRegister
    +exsltDateRegister
    +exsltDateXpathCtxtRegister
    +exsltDynRegister
    +exsltFuncRegister
    +exsltMathRegister
    +exsltMathXpathCtxtRegister
    +exsltRegisterAll
    +exsltSetsRegister
    +exsltSetsXpathCtxtRegister
    +exsltStrRegister
    +exsltStrXpathCtxtRegister
    +

    Letter F:

    Functions
    exsltFuncRegister
    +

    Letter M:

    Math
    exsltMathRegister
    +exsltMathXpathCtxtRegister
    +

    Letter N:

    Namespace
    EXSLT_COMMON_NAMESPACE
    +EXSLT_CRYPTO_NAMESPACE
    +EXSLT_DATE_NAMESPACE
    +EXSLT_DYNAMIC_NAMESPACE
    +EXSLT_FUNCTIONS_NAMESPACE
    +EXSLT_MATH_NAMESPACE
    +EXSLT_SETS_NAMESPACE
    +EXSLT_STRINGS_NAMESPACE
    +SAXON_NAMESPACE
    +

    Letter R:

    Registers
    exsltCommonRegister
    +exsltCryptoRegister
    +exsltDateRegister
    +exsltDateXpathCtxtRegister
    +exsltDynRegister
    +exsltFuncRegister
    +exsltMathRegister
    +exsltMathXpathCtxtRegister
    +exsltRegisterAll
    +exsltSaxonRegister
    +exsltSetsRegister
    +exsltSetsXpathCtxtRegister
    +exsltStrRegister
    +exsltStrXpathCtxtRegister
    +

    Letter S:

    SAXON
    SAXON_NAMESPACE
    +exsltSaxonRegister
    +
    Sets
    exsltSetsRegister
    +exsltSetsXpathCtxtRegister
    +
    Strings
    exsltStrRegister
    +exsltStrXpathCtxtRegister
    +

    Letter T:

    Times
    exsltDateRegister
    +exsltDateXpathCtxtRegister
    +

    Letter X:

    XSLT
    exsltDateXpathCtxtRegister
    +exsltMathXpathCtxtRegister
    +exsltSetsXpathCtxtRegister
    +exsltStrXpathCtxtRegister
    +

    Letter a:

    all
    exsltRegisterAll
    +
    available
    exsltRegisterAll
    +

    Letter c:

    common
    EXSLT_COMMON_NAMESPACE
    +
    crypto
    EXSLT_CRYPTO_NAMESPACE
    +

    Letter d:

    date
    EXSLT_DATE_NAMESPACE
    +
    dynamic
    EXSLT_DYNAMIC_NAMESPACE
    +

    Letter e:

    extension
    EXSLT_FUNCTIONS_NAMESPACE
    +exsltSaxonRegister
    +
    extensions
    SAXON_NAMESPACE
    +exsltRegisterAll
    +

    Letter f:

    for
    EXSLT_COMMON_NAMESPACE
    +EXSLT_CRYPTO_NAMESPACE
    +EXSLT_DATE_NAMESPACE
    +EXSLT_DYNAMIC_NAMESPACE
    +EXSLT_FUNCTIONS_NAMESPACE
    +EXSLT_MATH_NAMESPACE
    +EXSLT_SETS_NAMESPACE
    +EXSLT_STRINGS_NAMESPACE
    +SAXON_NAMESPACE
    +exsltDateXpathCtxtRegister
    +exsltMathXpathCtxtRegister
    +exsltSetsXpathCtxtRegister
    +exsltStrXpathCtxtRegister
    +
    functions
    EXSLT_COMMON_NAMESPACE
    +EXSLT_CRYPTO_NAMESPACE
    +EXSLT_DATE_NAMESPACE
    +EXSLT_DYNAMIC_NAMESPACE
    +EXSLT_FUNCTIONS_NAMESPACE
    +EXSLT_MATH_NAMESPACE
    +EXSLT_SETS_NAMESPACE
    +EXSLT_STRINGS_NAMESPACE
    +SAXON_NAMESPACE
    +

    Letter m:

    math
    EXSLT_MATH_NAMESPACE
    +
    module
    exsltCommonRegister
    +exsltCryptoRegister
    +exsltDateRegister
    +exsltDateXpathCtxtRegister
    +exsltDynRegister
    +exsltFuncRegister
    +exsltMathRegister
    +exsltMathXpathCtxtRegister
    +exsltSaxonRegister
    +exsltSetsRegister
    +exsltSetsXpathCtxtRegister
    +exsltStrRegister
    +exsltStrXpathCtxtRegister
    +

    Letter o:

    outside
    exsltDateXpathCtxtRegister
    +exsltMathXpathCtxtRegister
    +exsltSetsXpathCtxtRegister
    +exsltStrXpathCtxtRegister
    +

    Letter s:

    set
    EXSLT_SETS_NAMESPACE
    +
    strings
    EXSLT_STRINGS_NAMESPACE
    +

    Letter u:

    use
    exsltDateXpathCtxtRegister
    +exsltMathXpathCtxtRegister
    +exsltSetsXpathCtxtRegister
    +exsltStrXpathCtxtRegister
    +

    C-u +

    Daniel Veillard

    diff --git a/doc/EXSLT/APIconstructors.html b/doc/EXSLT/APIconstructors.html new file mode 100644 index 0000000..b23646e --- /dev/null +++ b/doc/EXSLT/APIconstructors.html @@ -0,0 +1,10 @@ + + +List of constructors for libexslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The EXSLT C library for Gnome

    List of constructors for libexslt

    Main Menu
    Related links
    API Indexes

    Daniel Veillard

    diff --git a/doc/EXSLT/APIfiles.html b/doc/EXSLT/APIfiles.html new file mode 100644 index 0000000..d925364 --- /dev/null +++ b/doc/EXSLT/APIfiles.html @@ -0,0 +1,42 @@ + + +List of Symbols per Module for libexslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The EXSLT C library for Gnome

    List of Symbols per Module for libexslt

    Main Menu
    Related links
    API Indexes

    Module exslt:

    EXSLT_COMMON_NAMESPACE
    +EXSLT_CRYPTO_NAMESPACE
    +EXSLT_DATE_NAMESPACE
    +EXSLT_DYNAMIC_NAMESPACE
    +EXSLT_FUNCTIONS_NAMESPACE
    +EXSLT_MATH_NAMESPACE
    +EXSLT_SETS_NAMESPACE
    +EXSLT_STRINGS_NAMESPACE
    +SAXON_NAMESPACE
    +exsltCommonRegister
    +exsltCryptoRegister
    +exsltDateRegister
    +exsltDateXpathCtxtRegister
    +exsltDynRegister
    +exsltFuncRegister
    +exsltLibexsltVersion
    +exsltLibraryVersion
    +exsltLibxmlVersion
    +exsltLibxsltVersion
    +exsltMathRegister
    +exsltMathXpathCtxtRegister
    +exsltRegisterAll
    +exsltSaxonRegister
    +exsltSetsRegister
    +exsltSetsXpathCtxtRegister
    +exsltStrRegister
    +exsltStrXpathCtxtRegister
    +

    Module exsltexports:

    EXSLTCALL
    +EXSLTPUBFUN
    +EXSLTPUBVAR
    +LIBEXSLT_PUBLIC
    +_REENTRANT
    +

    Daniel Veillard

    diff --git a/doc/EXSLT/APIfunctions.html b/doc/EXSLT/APIfunctions.html new file mode 100644 index 0000000..aa3d910 --- /dev/null +++ b/doc/EXSLT/APIfunctions.html @@ -0,0 +1,18 @@ + + +List of function manipulating types in libexslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The EXSLT C library for Gnome

    List of function manipulating types in libexslt

    Main Menu
    Related links
    API Indexes

    Type const xmlChar *:

    exsltDateXpathCtxtRegister
    +exsltMathXpathCtxtRegister
    +exsltSetsXpathCtxtRegister
    +exsltStrXpathCtxtRegister
    +

    Type xmlXPathContextPtr:

    exsltDateXpathCtxtRegister
    +exsltMathXpathCtxtRegister
    +exsltSetsXpathCtxtRegister
    +exsltStrXpathCtxtRegister
    +

    Daniel Veillard

    diff --git a/doc/EXSLT/APIsymbols.html b/doc/EXSLT/APIsymbols.html new file mode 100644 index 0000000..da77889 --- /dev/null +++ b/doc/EXSLT/APIsymbols.html @@ -0,0 +1,42 @@ + + +Alphabetic List of Symbols in libexslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The EXSLT C library for Gnome

    Alphabetic List of Symbols in libexslt

    Main Menu
    Related links
    API Indexes

    Letter E:

    EXSLTCALL
    +EXSLTPUBFUN
    +EXSLTPUBVAR
    +EXSLT_COMMON_NAMESPACE
    +EXSLT_CRYPTO_NAMESPACE
    +EXSLT_DATE_NAMESPACE
    +EXSLT_DYNAMIC_NAMESPACE
    +EXSLT_FUNCTIONS_NAMESPACE
    +EXSLT_MATH_NAMESPACE
    +EXSLT_SETS_NAMESPACE
    +EXSLT_STRINGS_NAMESPACE
    +

    Letter L:

    LIBEXSLT_PUBLIC
    +

    Letter S:

    SAXON_NAMESPACE
    +

    Letter _:

    _REENTRANT
    +

    Letter e:

    exsltCommonRegister
    +exsltCryptoRegister
    +exsltDateRegister
    +exsltDateXpathCtxtRegister
    +exsltDynRegister
    +exsltFuncRegister
    +exsltLibexsltVersion
    +exsltLibraryVersion
    +exsltLibxmlVersion
    +exsltLibxsltVersion
    +exsltMathRegister
    +exsltMathXpathCtxtRegister
    +exsltRegisterAll
    +exsltSaxonRegister
    +exsltSetsRegister
    +exsltSetsXpathCtxtRegister
    +exsltStrRegister
    +exsltStrXpathCtxtRegister
    +

    Daniel Veillard

    diff --git a/doc/EXSLT/bugs.html b/doc/EXSLT/bugs.html new file mode 100644 index 0000000..bdd9bc5 --- /dev/null +++ b/doc/EXSLT/bugs.html @@ -0,0 +1,62 @@ + + +Reporting bugs and getting help
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The EXSLT C library for Gnome

    Reporting bugs and getting help

    Main Menu
    Related links
    API Indexes

    Well, bugs or missing features are always possible, and I will make a +point of fixing them in a timely fashion. The best way to report a bug is to +use the Gnome +bug tracking database (make sure to use the "libxslt" module name). I +look at reports there regularly and it's good to have a reminder when a bug +is still open. Be sure to specify that the bug is for the package libxslt.

    For small problems you can try to get help on IRC, the #xml channel on +irc.gnome.org (port 6667) usually have a few person subscribed which may help +(but there is no guarantee and if a real issue is raised it should go on the +mailing-list for archival).

    There is also a mailing-list xslt@gnome.org for libxslt, with an on-line archive. To subscribe +to this list, please visit the associated Web page +and follow the instructions.

    Alternatively, you can just send the bug to the xslt@gnome.org list, if it's really libxslt +related I will approve it.. Please do not send me mail directly especially +for portability problem, it makes things really harder to track and in some +cases I'm not the best person to answer a given question, ask the list +instead. Do not send code, I won't debug it (but patches are +really appreciated!).

    Check the following too before +posting:

    • use the search engine to get informations + related to your problem.
    • +
    • make sure you are using a recent + version, and that the problem still shows up in those
    • +
    • check the list + archives to see if the problem was reported already, in this case + there is probably a fix available, similarly check the registered + open bugs
    • +
    • make sure you can reproduce the bug with xsltproc, a very useful thing + to do is run the transformation with -v argument and redirect the + standard error to a file, then search in this file for the transformation + logs just preceding the possible problem
    • +
    • Please send the command showing the error as well as the input and + stylesheet (as an attachment)
    • +

    Then send the bug with associated informations to reproduce it to the xslt@gnome.org list; if it's really libxslt +related I will approve it. Please do not send mail to me directly, it makes +things really hard to track and in some cases I am not the best person to +answer a given question, ask on the list.

    To be really clear about support:

    • Support or help request MUST be sent to + the list or on bugzilla in case of problems, so that the Question + and Answers can be shared publicly. Failing to do so carries the implicit + message "I want free support but I don't want to share the benefits with + others" and is not welcome. I will automatically Carbon-Copy the + xslt@gnome.org mailing list for any technical reply made about libxml2 or + libxslt.
    • +
    • There is no garantee for support, + if your question remains unanswered after a week, repost it, making sure + you gave all the detail needed and the informations requested.
    • +
    • Failing to provide informations as requested or double checking first + for prior feedback also carries the implicit message "the time of the + library maintainers is less valuable than my time" and might not be + welcome.
    • +

    Of course, bugs reports with a suggested patch for fixing them will +probably be processed faster.

    If you're looking for help, a quick look at the list archive may actually +provide the answer, I usually send source samples when answering libxslt +usage questions. The auto-generated documentation is +not as polished as I would like (I need to learn more about Docbook), but +it's a good starting point.

    Daniel Veillard

    diff --git a/doc/EXSLT/docs.html b/doc/EXSLT/docs.html new file mode 100644 index 0000000..6bb951c --- /dev/null +++ b/doc/EXSLT/docs.html @@ -0,0 +1,18 @@ + + +Documentation
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The EXSLT C library for Gnome

    Documentation

    Main Menu
    Related links
    API Indexes

    There are some on-line resources about using libxslt:

    1. Check the API + documentation automatically extracted from code comments (using + the program apibuild.py, developed for libxml, together with the + xsl script 'newapi.xsl' and the libxslt xsltproc program).
    2. +
    3. Look at the mailing-list + archive.
    4. +
    5. Of course since libxslt is based on libxml, it's a good idea to at + least read libxml description
    6. +

    Daniel Veillard

    diff --git a/doc/EXSLT/downloads.html b/doc/EXSLT/downloads.html new file mode 100644 index 0000000..85251de --- /dev/null +++ b/doc/EXSLT/downloads.html @@ -0,0 +1,29 @@ + + +Downloads
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The EXSLT C library for Gnome

    Downloads

    Main Menu
    Related links
    API Indexes

    The latest versions of libxslt can be found on xmlsoft.org (Seattle, France) or on the Gnome FTP server as a +source +archive, Antonin Sprinzl also provides a mirror in Austria. (NOTE that +you need the libxml2, +libxml2-devel, +libxslt and libxslt-devel +packages installed to compile applications using libxslt.) Igor Zlatkovic is now the maintainer of +the Windows port, he provides +binaries. Gary Pennington +provides Solaris binaries. +Steve Ball provides Mac Os X +binaries.

    Contribs:

    I do accept external contributions, especially if compiling on another +platform, get in touch with me to upload the package. I will keep them in the +contrib directory

    Libxslt is also available from CVS:

    Daniel Veillard

    diff --git a/doc/EXSLT/exslt.html b/doc/EXSLT/exslt.html new file mode 100644 index 0000000..e39aba5 --- /dev/null +++ b/doc/EXSLT/exslt.html @@ -0,0 +1,214 @@ + + + + The EXSLT C library for Gnome + + + + + +

    The EXSLT C library for Gnome

    + +

    libexslt

    + +

    Libexslt is the EXSLT C library + developed for libxslt (a part of the Gnome project). Much of the + initial work on the library was done by Thomas Broyer. EXSLT itself + is a community initiative to provide extensions to XSLT. + +

    This library is free software and can be reused in commercial applications + (see the intro)

    + +

    + +

    Logo designed by Marc Liyanage.

    + +

    Introduction

    + +

    This document describes libxslt, +the XSLT C library developed for the +Gnome project.

    + +

    Here are some key points about libxslt:

    +
      +
    • Libxslt is a C implementation
    • +
    • Libxslt is based on libxml for XML parsing, tree manipulation and XPath + support
    • +
    • It is written in plain C, making as few assumptions as possible, and + sticking closely to ANSI C/POSIX for easy embedding. Should works on + Linux/Unix/Windows.
    • +
    • This library is released under the MIT + Licence
    • +
    • Though not designed primarily with performances in mind, libxslt seems + to be a relatively fast processor.
    • +
    + +

    Documentation

    + +

    There are some on-line resources about using libxslt:

    +
      +
    1. Check the API + documentation automatically extracted from code comments (using + the program apibuild.py, developed for libxml, together with the + xsl script 'newapi.xsl' and the libxslt xsltproc program).
    2. +
    3. Look at the mailing-list + archive.
    4. +
    5. Of course since libxslt is based on libxml, it's a good idea to at + least read libxml description
    6. +
    + +

    Reporting bugs and getting help

    + +

    Well, bugs or missing features are always possible, and I will make a +point of fixing them in a timely fashion. The best way to report a bug is to +use the Gnome +bug tracking database (make sure to use the "libxslt" module name). I +look at reports there regularly and it's good to have a reminder when a bug +is still open. Be sure to specify that the bug is for the package libxslt.

    + +

    For small problems you can try to get help on IRC, the #xml channel on +irc.gnome.org (port 6667) usually have a few person subscribed which may help +(but there is no guarantee and if a real issue is raised it should go on the +mailing-list for archival).

    + +

    There is also a mailing-list xslt@gnome.org for libxslt, with an on-line archive. To subscribe +to this list, please visit the associated Web page +and follow the instructions.

    + +

    Alternatively, you can just send the bug to the xslt@gnome.org list, if it's really libxslt +related I will approve it.. Please do not send me mail directly especially +for portability problem, it makes things really harder to track and in some +cases I'm not the best person to answer a given question, ask the list +instead. Do not send code, I won't debug it (but patches are +really appreciated!).

    + +

    Check the following too before +posting:

    +
      +
    • use the search engine to get informations + related to your problem.
    • +
    • make sure you are using a recent + version, and that the problem still shows up in those
    • +
    • check the list + archives to see if the problem was reported already, in this case + there is probably a fix available, similarly check the registered + open bugs
    • +
    • make sure you can reproduce the bug with xsltproc, a very useful thing + to do is run the transformation with -v argument and redirect the + standard error to a file, then search in this file for the transformation + logs just preceding the possible problem
    • +
    • Please send the command showing the error as well as the input and + stylesheet (as an attachment)
    • +
    + +

    Then send the bug with associated informations to reproduce it to the xslt@gnome.org list; if it's really libxslt +related I will approve it. Please do not send mail to me directly, it makes +things really hard to track and in some cases I am not the best person to +answer a given question, ask on the list.

    + +

    To be really clear about support:

    +
      +
    • Support or help request MUST be sent to + the list or on bugzilla in case of problems, so that the Question + and Answers can be shared publicly. Failing to do so carries the implicit + message "I want free support but I don't want to share the benefits with + others" and is not welcome. I will automatically Carbon-Copy the + xslt@gnome.org mailing list for any technical reply made about libxml2 or + libxslt.
    • +
    • There is no garantee for support, + if your question remains unanswered after a week, repost it, making sure + you gave all the detail needed and the informations requested.
    • +
    • Failing to provide informations as requested or double checking first + for prior feedback also carries the implicit message "the time of the + library maintainers is less valuable than my time" and might not be + welcome.
    • +
    + +

    Of course, bugs reports with a suggested patch for fixing them will +probably be processed faster.

    + +

    If you're looking for help, a quick look at the list archive may actually +provide the answer, I usually send source samples when answering libxslt +usage questions. The auto-generated documentation is +not as polished as I would like (I need to learn more about Docbook), but +it's a good starting point.

    + +

    How to help

    + +

    You can help the project in various ways, the best thing to do first is to +subscribe to the mailing-list as explained before, check the archives and the Gnome bug +database::

    +
      +
    1. provide patches when you find problems
    2. +
    3. provide the diffs when you port libxslt to a new platform. They may not + be integrated in all cases but help pinpointing portability problems + and
    4. +
    5. provide documentation fixes (either as patches to the code comments or + as HTML diffs).
    6. +
    7. provide new documentations pieces (translations, examples, etc ...)
    8. +
    9. Check the TODO file and try to close one of the items
    10. +
    11. take one of the points raised in the archive or the bug database and + provide a fix. Get in touch with me + before to avoid synchronization problems and check that the suggested + fix will fit in nicely :-)
    12. +
    + +

    Downloads

    + +

    The latest versions of libxslt can be found on xmlsoft.org (Seattle, France) or on the Gnome FTP server as a +source +archive, Antonin Sprinzl also provides a mirror in Austria. (NOTE that +you need the libxml2, +libxml2-devel, +libxslt and libxslt-devel +packages installed to compile applications using libxslt.) Igor Zlatkovic is now the maintainer of +the Windows port, he provides +binaries. Gary Pennington +provides Solaris binaries. +Steve Ball provides Mac Os X +binaries.

    + +

    Contribs:

    + +

    I do accept external contributions, especially if compiling on another +platform, get in touch with me to upload the package. I will keep them in the +contrib directory

    + +

    Libxslt is also available from CVS:

    + + +

    + +

    Daniel Veillard

    + + diff --git a/doc/EXSLT/help.html b/doc/EXSLT/help.html new file mode 100644 index 0000000..4672f65 --- /dev/null +++ b/doc/EXSLT/help.html @@ -0,0 +1,24 @@ + + +How to help
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The EXSLT C library for Gnome

    How to help

    Main Menu
    Related links
    API Indexes

    You can help the project in various ways, the best thing to do first is to +subscribe to the mailing-list as explained before, check the archives and the Gnome bug +database::

    1. provide patches when you find problems
    2. +
    3. provide the diffs when you port libxslt to a new platform. They may not + be integrated in all cases but help pinpointing portability problems + and
    4. +
    5. provide documentation fixes (either as patches to the code comments or + as HTML diffs).
    6. +
    7. provide new documentations pieces (translations, examples, etc ...)
    8. +
    9. Check the TODO file and try to close one of the items
    10. +
    11. take one of the points raised in the archive or the bug database and + provide a fix. Get in touch with me + before to avoid synchronization problems and check that the suggested + fix will fit in nicely :-)
    12. +

    Daniel Veillard

    diff --git a/doc/EXSLT/html/book1.html b/doc/EXSLT/html/book1.html new file mode 100644 index 0000000..604875f --- /dev/null +++ b/doc/EXSLT/html/book1.html @@ -0,0 +1,10 @@ + + +Reference Manual for libexslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The EXSLT C library for GNOME

    Reference Manual for libexslt

    API Menu
    Related links
    API Indexes

    Table of Contents

    Daniel Veillard

    diff --git a/doc/EXSLT/html/home.png b/doc/EXSLT/html/home.png new file mode 100644 index 0000000..1700361 Binary files /dev/null and b/doc/EXSLT/html/home.png differ diff --git a/doc/EXSLT/html/index.html b/doc/EXSLT/html/index.html new file mode 100644 index 0000000..604875f --- /dev/null +++ b/doc/EXSLT/html/index.html @@ -0,0 +1,10 @@ + + +Reference Manual for libexslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The EXSLT C library for GNOME

    Reference Manual for libexslt

    API Menu
    Related links
    API Indexes

    Table of Contents

    Daniel Veillard

    diff --git a/doc/EXSLT/html/left.png b/doc/EXSLT/html/left.png new file mode 100644 index 0000000..2d05b3d Binary files /dev/null and b/doc/EXSLT/html/left.png differ diff --git a/doc/EXSLT/html/libexslt-exslt.html b/doc/EXSLT/html/libexslt-exslt.html new file mode 100644 index 0000000..e1afa10 --- /dev/null +++ b/doc/EXSLT/html/libexslt-exslt.html @@ -0,0 +1,62 @@ + + +Module exslt from libexslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The EXSLT C library for GNOME

    Module exslt from libexslt

    API Menu
    Related links
    API Indexes

    Table of Contents

    #define EXSLT_COMMON_NAMESPACE
    #define EXSLT_CRYPTO_NAMESPACE
    #define EXSLT_DATE_NAMESPACE
    #define EXSLT_DYNAMIC_NAMESPACE
    #define EXSLT_FUNCTIONS_NAMESPACE
    #define EXSLT_MATH_NAMESPACE
    #define EXSLT_SETS_NAMESPACE
    #define EXSLT_STRINGS_NAMESPACE
    #define SAXON_NAMESPACE
    void	exsltCommonRegister		(void)
    +
    void	exsltCryptoRegister		(void)
    +
    void	exsltDateRegister		(void)
    +
    int	exsltDateXpathCtxtRegister	(xmlXPathContextPtr ctxt, 
    const xmlChar * prefix)
    +
    void	exsltDynRegister		(void)
    +
    void	exsltFuncRegister		(void)
    +
    void	exsltMathRegister		(void)
    +
    int	exsltMathXpathCtxtRegister	(xmlXPathContextPtr ctxt, 
    const xmlChar * prefix)
    +
    void	exsltRegisterAll		(void)
    +
    void	exsltSaxonRegister		(void)
    +
    void	exsltSetsRegister		(void)
    +
    int	exsltSetsXpathCtxtRegister	(xmlXPathContextPtr ctxt, 
    const xmlChar * prefix)
    +
    void	exsltStrRegister		(void)
    +
    int	exsltStrXpathCtxtRegister	(xmlXPathContextPtr ctxt, 
    const xmlChar * prefix)
    +

    Description

    +

    Macro: EXSLT_COMMON_NAMESPACE

    #define EXSLT_COMMON_NAMESPACE

    Namespace for EXSLT common functions

    +

    Macro: EXSLT_CRYPTO_NAMESPACE

    #define EXSLT_CRYPTO_NAMESPACE

    Namespace for EXSLT crypto functions

    +

    Macro: EXSLT_DATE_NAMESPACE

    #define EXSLT_DATE_NAMESPACE

    Namespace for EXSLT date functions

    +

    Macro: EXSLT_DYNAMIC_NAMESPACE

    #define EXSLT_DYNAMIC_NAMESPACE

    Namespace for EXSLT dynamic functions

    +

    Macro: EXSLT_FUNCTIONS_NAMESPACE

    #define EXSLT_FUNCTIONS_NAMESPACE

    Namespace for EXSLT functions extension functions

    +

    Macro: EXSLT_MATH_NAMESPACE

    #define EXSLT_MATH_NAMESPACE

    Namespace for EXSLT math functions

    +

    Macro: EXSLT_SETS_NAMESPACE

    #define EXSLT_SETS_NAMESPACE

    Namespace for EXSLT set functions

    +

    Macro: EXSLT_STRINGS_NAMESPACE

    #define EXSLT_STRINGS_NAMESPACE

    Namespace for EXSLT strings functions

    +

    Macro: SAXON_NAMESPACE

    #define SAXON_NAMESPACE

    Namespace for SAXON extensions functions

    +

    Function: exsltCommonRegister

    void	exsltCommonRegister		(void)
    +

    Registers the EXSLT - Common module

    +

    Function: exsltCryptoRegister

    void	exsltCryptoRegister		(void)
    +

    Registers the EXSLT - Crypto module

    +

    Function: exsltDateRegister

    void	exsltDateRegister		(void)
    +

    Registers the EXSLT - Dates and Times module

    +

    Function: exsltDateXpathCtxtRegister

    int	exsltDateXpathCtxtRegister	(xmlXPathContextPtr ctxt, 
    const xmlChar * prefix)
    +

    Registers the EXSLT - Dates and Times module for use outside XSLT

    +
    ctxt:
    prefix:
    Returns:

    Function: exsltDynRegister

    void	exsltDynRegister		(void)
    +

    Registers the EXSLT - Dynamic module

    +

    Function: exsltFuncRegister

    void	exsltFuncRegister		(void)
    +

    Registers the EXSLT - Functions module

    +

    Function: exsltMathRegister

    void	exsltMathRegister		(void)
    +

    Registers the EXSLT - Math module

    +

    Function: exsltMathXpathCtxtRegister

    int	exsltMathXpathCtxtRegister	(xmlXPathContextPtr ctxt, 
    const xmlChar * prefix)
    +

    Registers the EXSLT - Math module for use outside XSLT

    +
    ctxt:
    prefix:
    Returns:

    Function: exsltRegisterAll

    void	exsltRegisterAll		(void)
    +

    Registers all available EXSLT extensions

    +

    Function: exsltSaxonRegister

    void	exsltSaxonRegister		(void)
    +

    Registers the SAXON extension module

    +

    Function: exsltSetsRegister

    void	exsltSetsRegister		(void)
    +

    Registers the EXSLT - Sets module

    +

    Function: exsltSetsXpathCtxtRegister

    int	exsltSetsXpathCtxtRegister	(xmlXPathContextPtr ctxt, 
    const xmlChar * prefix)
    +

    Registers the EXSLT - Sets module for use outside XSLT

    +
    ctxt:
    prefix:
    Returns:

    Function: exsltStrRegister

    void	exsltStrRegister		(void)
    +

    Registers the EXSLT - Strings module

    +

    Function: exsltStrXpathCtxtRegister

    int	exsltStrXpathCtxtRegister	(xmlXPathContextPtr ctxt, 
    const xmlChar * prefix)
    +

    Registers the EXSLT - Strings module for use outside XSLT

    +
    ctxt:
    prefix:
    Returns:

    Daniel Veillard

    diff --git a/doc/EXSLT/html/libexslt-exsltexports.html b/doc/EXSLT/html/libexslt-exsltexports.html new file mode 100644 index 0000000..656210c --- /dev/null +++ b/doc/EXSLT/html/libexslt-exsltexports.html @@ -0,0 +1,16 @@ + + +Module exsltexports from libexslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The EXSLT C library for GNOME

    Module exsltexports from libexslt

    API Menu
    Related links
    API Indexes

    Table of Contents

    #define EXSLTCALL
    #define EXSLTPUBFUN
    #define EXSLTPUBVAR
    #define LIBEXSLT_PUBLIC
    #define _REENTRANT

    Description

    +

    Macro: EXSLTCALL

    #define EXSLTCALL

    +

    Macro: EXSLTPUBFUN

    #define EXSLTPUBFUN

    +

    Macro: EXSLTPUBVAR

    #define EXSLTPUBVAR

    +

    Macro: LIBEXSLT_PUBLIC

    #define LIBEXSLT_PUBLIC

    +

    Macro: _REENTRANT

    #define _REENTRANT

    +

    Daniel Veillard

    diff --git a/doc/EXSLT/html/libexslt-lib.html b/doc/EXSLT/html/libexslt-lib.html new file mode 100644 index 0000000..604875f --- /dev/null +++ b/doc/EXSLT/html/libexslt-lib.html @@ -0,0 +1,10 @@ + + +Reference Manual for libexslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The EXSLT C library for GNOME

    Reference Manual for libexslt

    API Menu
    Related links
    API Indexes

    Table of Contents

    Daniel Veillard

    diff --git a/doc/EXSLT/html/right.png b/doc/EXSLT/html/right.png new file mode 100644 index 0000000..92832e3 Binary files /dev/null and b/doc/EXSLT/html/right.png differ diff --git a/doc/EXSLT/html/up.png b/doc/EXSLT/html/up.png new file mode 100644 index 0000000..85b3e2a Binary files /dev/null and b/doc/EXSLT/html/up.png differ diff --git a/doc/EXSLT/index.html b/doc/EXSLT/index.html new file mode 100644 index 0000000..a662c1c --- /dev/null +++ b/doc/EXSLT/index.html @@ -0,0 +1,16 @@ + + +libexslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The EXSLT C library for Gnome

    libexslt

    Main Menu
    Related links
    API Indexes

    Libexslt is the EXSLT C library + developed for libxslt (a part of the Gnome project). Much of the + initial work on the library was done by Thomas Broyer. EXSLT itself + is a community initiative to provide extensions to XSLT. + +

    This library is free software and can be reused in commercial applications + (see the intro)

    Logo designed by Marc Liyanage.

    Daniel Veillard

    diff --git a/doc/EXSLT/intro.html b/doc/EXSLT/intro.html new file mode 100644 index 0000000..1c96efa --- /dev/null +++ b/doc/EXSLT/intro.html @@ -0,0 +1,22 @@ + + +Introduction
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The EXSLT C library for Gnome

    Introduction

    Main Menu
    Related links
    API Indexes

    This document describes libxslt, +the XSLT C library developed for the +Gnome project.

    Here are some key points about libxslt:

    • Libxslt is a C implementation
    • +
    • Libxslt is based on libxml for XML parsing, tree manipulation and XPath + support
    • +
    • It is written in plain C, making as few assumptions as possible, and + sticking closely to ANSI C/POSIX for easy embedding. Should works on + Linux/Unix/Windows.
    • +
    • This library is released under the MIT + Licence
    • +
    • Though not designed primarily with performances in mind, libxslt seems + to be a relatively fast processor.
    • +

    Daniel Veillard

    diff --git a/doc/EXSLT/libexslt-api.xml b/doc/EXSLT/libexslt-api.xml new file mode 100644 index 0000000..bf35d34 --- /dev/null +++ b/doc/EXSLT/libexslt-api.xml @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Namespace for EXSLT common functions + + + Namespace for EXSLT crypto functions + + + Namespace for EXSLT date functions + + + Namespace for EXSLT dynamic functions + + + Namespace for EXSLT functions extension functions + + + Namespace for EXSLT math functions + + + Namespace for EXSLT set functions + + + Namespace for EXSLT strings functions + + + + + Namespace for SAXON extensions functions + + + + + + + + + Registers the EXSLT - Common module + + + + Registers the EXSLT - Crypto module + + + + Registers the EXSLT - Dates and Times module + + + + Registers the EXSLT - Dates and Times module for use outside XSLT + + + + + + Registers the EXSLT - Dynamic module + + + + Registers the EXSLT - Functions module + + + + Registers the EXSLT - Math module + + + + Registers the EXSLT - Math module for use outside XSLT + + + + + + Registers all available EXSLT extensions + + + + Registers the SAXON extension module + + + + Registers the EXSLT - Sets module + + + + Registers the EXSLT - Sets module for use outside XSLT + + + + + + Registers the EXSLT - Strings module + + + + Registers the EXSLT - Strings module for use outside XSLT + + + + + + diff --git a/doc/EXSLT/libexslt-refs.xml b/doc/EXSLT/libexslt-refs.xml new file mode 100644 index 0000000..bddfb06 --- /dev/null +++ b/doc/EXSLT/libexslt-refs.xml @@ -0,0 +1,360 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/FAQ.html b/doc/FAQ.html new file mode 100644 index 0000000..17b8c33 --- /dev/null +++ b/doc/FAQ.html @@ -0,0 +1,44 @@ + + +FAQ
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    FAQ

    Main Menu
    Related links
    API Indexes
      +
    1. Troubles compiling or linking programs using libxslt +

      Usually the problem comes from the fact that the compiler doesn't get + the right compilation or linking flags. There is a small shell script + xslt-config which is installed as part of libxslt usual + install process which provides those flags. Use

      +

      xslt-config --cflags

      +

      to get the compilation flags and

      +

      xslt-config --libs

      +

      to get the linker flags. Usually this is done directly from the + Makefile as:

      +

      CFLAGS=`xslt-config --cflags`

      +

      LIBS=`xslt-config --libs`

      +

      Note also that if you use the EXSLT extensions from the program then + you should prepend -lexslt to the LIBS options

      +
    2. +
    3. passing parameters on the xsltproc command line doesn't work +

      xsltproc --param test alpha foo.xsl foo.xml

      +

      the param does not get passed and ends up as ""

      +

      In a nutshell do a double escaping at the shell prompt:

      +

      xsltproc --param test "'alpha'" foo.xsl foo.xml

      +

      i.e. the string value is surrounded by " and ' then terminated by ' + and ". Libxslt interpret the parameter values as XPath expressions, so + the string ->alpha<- is intepreted as the node set + matching this string. You really want ->'alpha'<- to + be passed to the processor. And to allow this you need to escape the + quotes at the shell level using ->"'alpha'"<- .

      +

      or use

      +

      xsltproc --stringparam test alpha foo.xsl foo.xml

      +
    4. +
    5. Is there C++ bindings ? +

      Yes for example xmlwrapp , see the related pages about bindings

      +
    6. +

    Daniel Veillard

    diff --git a/doc/Libxslt-Logo-180x168.gif b/doc/Libxslt-Logo-180x168.gif new file mode 100644 index 0000000..cfb6ccb Binary files /dev/null and b/doc/Libxslt-Logo-180x168.gif differ diff --git a/doc/Libxslt-Logo-90x34.gif b/doc/Libxslt-Logo-90x34.gif new file mode 100644 index 0000000..e63c877 Binary files /dev/null and b/doc/Libxslt-Logo-90x34.gif differ diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..a69995a --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,328 @@ +## Process this file with automake to produce Makefile.in + +# The top-level SGML file. +DOC_MAIN_XML_FILE=libxslt.xml + +# The directory containing the source code (if it contains documentation). +DOC_SOURCE_DIR=.. + +# A file in win32 depends upon two of the doc files +WIN32_DIR=$(top_srcdir)/win32 + +PAGES= API.html bugs.html contribs.html FAQ.html docs.html \ + downloads.html help.html index.html intro.html news.html \ + xsltproc2.html + +EPAGES= EXSLT/bugs.html EXSLT/docs.html EXSLT/downloads.html \ + EXSLT/help.html EXSLT/index.html EXSLT/intro.html + +APIPAGES=APIconstructors.html APIfiles.html APIfunctions.html \ + APIsymbols.html APIchunk0.html search.templ + +EAPIPAGES=EXSLT/APIconstructors.html EXSLT/APIfiles.html \ + EXSLT/APIfunctions.html EXSLT/APIsymbols.html EXSLT/APIchunk0.html + +EXTRA_DIST = \ + $(PAGES) \ + $(EPAGES) \ + $(EAPIPAGES) \ + APIchunk0.html \ + APIchunk1.html \ + APIchunk2.html \ + APIchunk3.html \ + APIchunk4.html \ + APIchunk5.html \ + APIchunk6.html \ + APIchunk7.html \ + APIchunk8.html \ + APIchunk9.html \ + APIchunk10.html \ + APIchunk11.html \ + APIchunk12.html \ + APIchunk13.html \ + APIconstructors.html \ + APIfiles.html \ + APIfunctions.html \ + APIsymbols.html \ + EXSLT/exslt.html \ + EXSLT/html/book1.html \ + EXSLT/html/home.png \ + EXSLT/html/index.html \ + EXSLT/html/left.png \ + EXSLT/html/libexslt-exslt.html \ + EXSLT/html/libexslt-exsltexports.html \ + EXSLT/html/libexslt-lib.html \ + EXSLT/html/right.png \ + EXSLT/html/up.png \ + EXSLT/libexslt-api.xml \ + EXSLT/libexslt-refs.xml \ + Libxslt-Logo-180x168.gif \ + Libxslt-Logo-90x34.gif \ + api.xsl \ + apibuild.py \ + checkapisym.xsl \ + contexts.gif \ + docbook.html \ + duck.png \ + epatents.png \ + extensions.html \ + gnome2.png \ + html/book1.html \ + html/home.png \ + html/index.html \ + html/left.png \ + html/libxslt-attributes.html \ + html/libxslt-documents.html \ + html/libxslt-extensions.html \ + html/libxslt-extra.html \ + html/libxslt-functions.html \ + html/libxslt-imports.html \ + html/libxslt-keys.html \ + html/libxslt-lib.html \ + html/libxslt-namespaces.html \ + html/libxslt-numbersInternals.html \ + html/libxslt-pattern.html \ + html/libxslt-preproc.html \ + html/libxslt-security.html \ + html/libxslt-templates.html \ + html/libxslt-transform.html \ + html/libxslt-variables.html \ + html/libxslt-xslt.html \ + html/libxslt-xsltInternals.html \ + html/libxslt-xsltexports.html \ + html/libxslt-xsltlocale.html \ + html/libxslt-xsltutils.html \ + html/right.png \ + html/up.png \ + images/callouts/1.png \ + images/callouts/10.png \ + images/callouts/2.png \ + images/callouts/3.png \ + images/callouts/4.png \ + images/callouts/5.png \ + images/callouts/6.png \ + images/callouts/7.png \ + images/callouts/8.png \ + images/callouts/9.png \ + internals.html \ + libxslt-api.xml \ + libxslt-refs.xml \ + libxslt.xsa \ + newapi.xsl \ + news.xsl \ + node.gif \ + object.gif \ + processing.gif \ + python.html \ + redhat.gif \ + search.xml \ + site.xsl \ + smallfootonly.gif \ + stylesheet.gif \ + symbols.xml \ + syms.xsl \ + templates.gif \ + tutorial/libxslt_tutorial.c \ + tutorial/libxslttutorial.html \ + tutorial/libxslttutorial.xml \ + tutorial2/libxslt_pipes.c \ + tutorial2/libxslt_pipes.html \ + tutorial2/libxslt_pipes.xml \ + w3c.png \ + xsa.xsl \ + xslt.html \ + xsltproc.1 \ + xsltproc.html \ + xsltproc.xml + +man_MANS = xsltproc.1 + +all-local: web ../NEWS libxslt.xsa $(man_MANS) + +api: libxslt-api.xml libxslt-refs.xml $(APIPAGES) search.php \ + html/index.html $(WIN32_DIR)/libxslt.def.src + +eapi: EXSLT/libexslt-api.xml EXSLT/libexslt-refs.xml $(EAPIPAGES) \ + EXSLT/html/index.html $(WIN32_DIR)/libexslt.def.src + +web: $(PAGES) $(EPAGES) + +$(PAGES): $(srcdir)/xslt.html $(srcdir)/site.xsl + -@(if [ -x $(XSLTPROC) ] ; then \ + echo "Rebuilding the HTML Web pages from xslt.html" ; \ + $(XSLTPROC) --nonet --html $(srcdir)/site.xsl \ + $(srcdir)/xslt.html > index.html ; fi ) + -@(if [ -x $(XMLLINT) ] ; then \ + echo "Validating the HTML Web pages" ; \ + $(XMLLINT) --nonet --valid --noout $(PAGES) ; fi ); + +$(EPAGES): $(srcdir)/EXSLT/exslt.html $(srcdir)/site.xsl + -@(if [ ! -d EXSLT/html ] ; then \ + mkdir -p EXSLT/html ; fi ) + -@(if [ -x $(XSLTPROC) ] ; then \ + echo "Rebuilding the HTML Web pages from exslt.html" ; \ + $(XSLTPROC) --nonet --html \ + --stringparam dirname EXSLT/ \ + --stringparam libname libexslt \ + --stringparam logo_base ../ \ + $(srcdir)/site.xsl \ + $(srcdir)/EXSLT/exslt.html > EXSLT/index.html ; fi ) + -@(if [ -x $(XMLLINT) ] ; then \ + echo "Validating the HTML Web pages" ; \ + $(XMLLINT) --nonet --valid --noout $(EPAGES) ; fi ); + +../NEWS: $(srcdir)/news.xsl $(srcdir)/news.html + -@(if [ -x $(XSLTPROC) ] ; then \ + $(XSLTPROC) --nonet $(srcdir)/news.xsl \ + $(srcdir)/news.html > ../NEWS ; fi ); + +libxslt.xsa: $(srcdir)/xsa.xsl $(srcdir)/news.html + -@(if [ -x $(XSLTPROC) ] ; then \ + $(XSLTPROC) --nonet $(srcdir)/xsa.xsl \ + news.html > libxslt.xsa ; fi ); + +$(APIPAGES): libxslt-refs.xml site.xsl api.xsl $(srcdir)/site.xsl \ + $(srcdir)/api.xsl + -@(if [ -x $(XSLTPROC) ] ; then \ + echo "Rebuilding the HTML API pages from libxslt-refs.xml" ; \ + $(XSLTPROC) --nonet --html \ + $(srcdir)/api.xsl \ + $(srcdir)/xslt.html ; fi ); + -@(if [ -x $(XMLLINT) ] ; then \ + echo "Validating the HTML API pages" ; \ + $(XMLLINT) --nonet --valid --noout API*.html; fi ); + +$(EAPIPAGES): EXSLT/libexslt-refs.xml site.xsl api.xsl + -@(if [ -x $(XSLTPROC) ] ; then \ + echo "Rebuilding the HTML API pages from libexslt-refs.xml" ; \ + $(XSLTPROC) --nonet --html --output EXSLT/ \ + --stringparam libname libexslt \ + --stringparam dirname EXSLT/ \ + --stringparam logo_base ../ \ + $(srcdir)/api.xsl \ + $(srcdir)/EXSLT/exslt.html ; fi ); + +html/index.html: libxslt-api.xml $(srcdir)/newapi.xsl + -@(if [ -x $(XSLTPROC) ] ; then \ + echo "Rebuilding the HTML pages from the XSLT API" ; \ + $(XSLTPROC) --nonet \ + $(srcdir)/newapi.xsl $(srcdir)/libxslt-api.xml ; fi ); + -@(if [ -x $(XMLLINT) ] ; then \ + echo "Validating the resulting XHTML pages" ; \ + $(XMLLINT) --nonet --valid --noout html/*.html ; fi ); + +wiki: libxslt-api.xml $(srcdir)/wiki.xsl + -@(if [ -x $(XSLTPROC) ] ; then \ + echo "Rebuilding the wiki HTML pages from the XSLT API" ; \ + $(XSLTPROC) --nonet $(srcdir)/wiki.xsl $(srcdir)/libxslt-api.xml; fi ) + +EXSLT/html/index.html: EXSLT/libexslt-api.xml \ + $(srcdir)/newapi.xsl + -@(if [ -x $(XSLTPROC) ] ; then \ + echo "Rebuilding the HTML pages from the EXSLT API" ; \ + $(XSLTPROC) --nonet --output EXSLT/ \ + --stringparam libname libexslt \ + --stringparam dirname EXSLT/ \ + --stringparam logo_base ../../ \ + $(srcdir)/newapi.xsl \ + $(srcdir)/EXSLT/libexslt-api.xml ; fi ); + -@(if [ -x $(XMLLINT) ] ; then \ + echo "Validating the resulting XHTML pages" ; \ + $(XMLLINT) --nonet --valid --noout EXSLT/html/*.html ; fi ); + + +libxslt-api.xml libxslt-refs.xml EXSLT/libexslt-api.xml \ + EXSLT/libexslt-refs.xml ../libxslt/libxslt.syms : $(srcdir)/apibuild.py $(top_srcdir)/libxslt/*.h \ + $(top_srcdir)/libxslt/*.c $(top_srcdir)/libexslt/*.h \ + $(top_srcdir)/libexslt/*.c + -(cd $(srcdir) && ./apibuild.py) + ($(XSLTPROC) $(srcdir)/checkapisym.xsl $(srcdir)/libxslt-api.xml) + ($(XSLTPROC) -o ../libxslt/libxslt.syms $(srcdir)/syms.xsl $(srcdir)/symbols.xml) + +xsltproc.1: $(srcdir)/xsltproc.xml + -@(if [ -x $(XSLTPROC) ] ; then \ + echo "Rebuilding the man pages from the xml" ; \ + $(XSLTPROC) --nonet $(srcdir)/xsltproc.xml ; fi) + +# Note that in the following, xmllint output is piped to xsltproc +search.php: $(srcdir)/api.xsl $(srcdir)/site.xsl $(srcdir)/search.templ \ + $(srcdir)/search.xml $(srcdir)/search.php.inc + -@(if test -x $(XMLLINT) -a -x $(XSLTPROC); then \ + echo "Rebuilding search.php" ; \ + $(XMLLINT) --xinclude --nonet \ + $(srcdir)/search.xml | \ + $(XSLTPROC) --nonet - search.templ \ + > search.php ; else \ + echo "Unable to find xmllint or xsltproc in $(bindir)" ; fi) + +$(WIN32_DIR)/libxslt.def.src: libxslt-api.xml + -@(if [ -x $(XSLTPROC) ] ; then \ + $(XSLTPROC) -o $(WIN32_DIR)/libxslt.def.src \ + --nonet $(WIN32_DIR)/defgen.xsl $(srcdir)/libxslt-api.xml ; fi ) + +$(WIN32_DIR)/libexslt.def.src: EXSLT/libexslt-api.xml + -@(if [ -x $(XSLTPROC) ] ; then \ + $(XSLTPROC) -o $(WIN32_DIR)/libexslt.def.src \ + --nonet $(WIN32_DIR)/defgen.xsl $(srcdir)/EXSLT/libexslt-api.xml ; fi ) + +clean-local: + rm -f *~ *.1 *.bak *.hierarchy *.signals *-unused.txt + +distclean-local: + if test ! -r Makefile.am ; then \ + rm -f *.html *.templ *.xsa ; \ + rm -rf EXSLT html ; \ + fi + +rebuild: api eapi all + +wildcards = \ + *.1 \ + *.gif \ + *.html \ + *.png \ + *.xsl \ + EXSLT/*.html \ + EXSLT/html/*.html \ + EXSLT/html/*.png \ + html/*.html \ + html/*.png \ + images/callouts/*.png \ + tutorial*/libxslt* + +# This target verifies that EXTRA_DIST contains all the files matched by +# the above list of wildcards. Note that this will only work properly when +# srcdir = builddir. +# +check-extra-dist: + @for a in $(wildcards) ; do \ + if test ! -f "$$a" ; then \ + echo "not found: $$a" ; \ + continue ; \ + fi ; \ + present= ; \ + for b in $(EXTRA_DIST) ; do \ + test "$$a" = "$$b" && present=1 && break ; \ + done ; \ + test -n "$$present" || echo "not in EXTRA_DIST: $$a" ; \ + done + +install-data-local: + $(MKDIR_P) $(DESTDIR)$(HTML_DIR) + -$(INSTALL) -m 0644 $(srcdir)/*.html $(DESTDIR)$(HTML_DIR) + -$(INSTALL) -m 0644 $(srcdir)/*.gif $(DESTDIR)$(HTML_DIR) + $(MKDIR_P) $(DESTDIR)$(HTML_DIR)/html + -$(INSTALL) -m 0644 $(srcdir)/html/*.html $(DESTDIR)$(HTML_DIR)/html + -$(INSTALL) -m 0644 $(srcdir)/html/*.png $(DESTDIR)$(HTML_DIR)/html + -$(INSTALL) -m 0644 $(srcdir)/html/index.sgml $(DESTDIR)$(HTML_DIR)/html + $(MKDIR_P) $(DESTDIR)$(HTML_DIR)/EXSLT + -$(INSTALL) -m 0644 $(srcdir)/EXSLT/*.html $(DESTDIR)$(HTML_DIR)/EXSLT + $(MKDIR_P) $(DESTDIR)$(HTML_DIR)/tutorial + -$(INSTALL) -m 0644 $(srcdir)/tutorial/* $(DESTDIR)$(HTML_DIR)/tutorial + $(MKDIR_P) $(DESTDIR)$(HTML_DIR)/tutorial2 + -$(INSTALL) -m 0644 $(srcdir)/tutorial2/* $(DESTDIR)$(HTML_DIR)/tutorial2 + +uninstall-local: + rm -rf $(DESTDIR)$(HTML_DIR) + +.PHONY : api eapi web wiki rebuild check-extra-dist diff --git a/doc/api.xsl b/doc/api.xsl new file mode 100644 index 0000000..2e61ba0 --- /dev/null +++ b/doc/api.xsl @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    + + +

    Type :

    +

    + + + + + +

    +
    + + +

    Letter :

    +

    + + + + + +

    +
    + + +

    Module :

    +

    + + + + + +

    +
    + +

    Letter :

    +
    + +
    +
    + + + + + +
    +
    +
    +
    + + + Generating API Constructors + List of constructors for + + + + + + + + + + + + Generating API List of symbols per file + List of Symbols per Module for + + + + + + + + + + + + Generating API Functions by Type + List of function manipulating types in + + + + + + + + + + + + Generating API Alphabetic list + Alphabetic List of Symbols in + + + + + + + + + + + +

    + + + + + + + + + +

    +
    + + + + + + + + API Alphabetic Index for + + + + + + + + + + + + + + Generating API Index + + + + + Generating API Cross References + + + + + + + + + Executing api.xsl + + + Generating search template + + + + + + + + + + + + + +
    diff --git a/doc/apibuild.py b/doc/apibuild.py new file mode 100755 index 0000000..df1d66b --- /dev/null +++ b/doc/apibuild.py @@ -0,0 +1,1914 @@ +#!/usr/bin/python -u +# +# This is the API builder, it parses the C sources and build the +# API formal description in XML. +# +# See Copyright for the status of this software. +# +# daniel@veillard.com +# +import os, sys +import string +import glob + +debug=0 + +# +# C parser analysis code +# +ignored_files = { + "trio": "too many non standard macros", + "trio.c": "too many non standard macros", + "trionan.c": "too many non standard macros", + "triostr.c": "too many non standard macros", + "acconfig.h": "generated portability layer", + "config.h": "generated portability layer", + "libxml.h": "internal only", + "testOOM.c": "out of memory tester", + "testOOMlib.h": "out of memory tester", + "testOOMlib.c": "out of memory tester", +} + +ignored_words = { + "WINAPI": (0, "Windows keyword"), + "LIBXML_DLL_IMPORT": (0, "Special macro to flag external keywords"), + "XMLPUBVAR": (0, "Special macro for extern vars for win32"), + "XSLTPUBVAR": (0, "Special macro for extern vars for win32"), + "EXSLTPUBVAR": (0, "Special macro for extern vars for win32"), + "XMLPUBFUN": (0, "Special macro for extern funcs for win32"), + "XSLTPUBFUN": (0, "Special macro for extern funcs for win32"), + "EXSLTPUBFUN": (0, "Special macro for extern funcs for win32"), + "XMLCALL": (0, "Special macro for win32 calls"), + "XSLTCALL": (0, "Special macro for win32 calls"), + "EXSLTCALL": (0, "Special macro for win32 calls"), + "__declspec": (3, "Windows keyword"), + "ATTRIBUTE_UNUSED": (0, "macro keyword"), + "LIBEXSLT_PUBLIC": (0, "macro keyword"), + "X_IN_Y": (5, "macro function builder"), + "XSLT_ITEM_COMMON_FIELDS": (0, "Special macro"), + "CALLBACK": (0, "macro keyword"), +} + +def escape(raw): + raw = string.replace(raw, '&', '&') + raw = string.replace(raw, '<', '<') + raw = string.replace(raw, '>', '>') + raw = string.replace(raw, "'", ''') + raw = string.replace(raw, '"', '"') + return raw + +def uniq(items): + d = {} + for item in items: + d[item]=1 + return d.keys() + +class identifier: + def __init__(self, name, module=None, type=None, lineno = 0, + info=None, extra=None): + self.name = name + self.module = module + self.type = type + self.info = info + self.extra = extra + self.lineno = lineno + self.static = 0 + + def __repr__(self): + r = "%s %s:" % (self.type, self.name) + if self.static: + r = r + " static" + if self.module != None: + r = r + " from %s" % (self.module) + if self.info != None: + r = r + " " + `self.info` + if self.extra != None: + r = r + " " + `self.extra` + return r + + + def set_module(self, module): + self.module = module + def set_type(self, type): + self.type = type + def set_info(self, info): + self.info = info + def set_extra(self, extra): + self.extra = extra + def set_lineno(self, lineno): + self.lineno = lineno + def set_static(self, static): + self.static = static + + def get_name(self): + return self.name + def get_module(self): + return self.module + def get_type(self): + return self.type + def get_info(self): + return self.info + def get_lineno(self): + return self.lineno + def get_extra(self): + return self.extra + def get_static(self): + return self.static + + def update(self, module, type = None, info = None, extra=None): + if module != None and self.module == None: + self.set_module(module) + if type != None and self.type == None: + self.set_type(type) + if info != None: + self.set_info(info) + if extra != None: + self.set_extra(extra) + + +class index: + def __init__(self, name = "noname"): + self.name = name + self.identifiers = {} + self.functions = {} + self.variables = {} + self.includes = {} + self.structs = {} + self.enums = {} + self.typedefs = {} + self.macros = {} + self.references = {} + self.info = {} + + def add_ref(self, name, module, static, type, lineno, info=None, extra=None): + if name[0:2] == '__': + return None + d = None + try: + d = self.identifiers[name] + d.update(module, type, lineno, info, extra) + except: + d = identifier(name, module, type, lineno, info, extra) + self.identifiers[name] = d + + if d != None and static == 1: + d.set_static(1) + + if d != None and name != None and type != None: + self.references[name] = d + + def add(self, name, module, static, type, lineno, info=None, extra=None): + if name[0:2] == '__': + return None + d = None + try: + d = self.identifiers[name] + d.update(module, type, lineno, info, extra) + except: + d = identifier(name, module, type, lineno, info, extra) + self.identifiers[name] = d + + if d != None and static == 1: + d.set_static(1) + + if d != None and name != None and type != None: + if type == "function": + self.functions[name] = d + elif type == "functype": + self.functions[name] = d + elif type == "variable": + self.variables[name] = d + elif type == "include": + self.includes[name] = d + elif type == "struct": + self.structs[name] = d + elif type == "enum": + self.enums[name] = d + elif type == "typedef": + self.typedefs[name] = d + elif type == "macro": + self.macros[name] = d + else: + print "Unable to register type ", type + return d + + def merge(self, idx): + for id in idx.functions.keys(): + # + # macro might be used to override functions or variables + # definitions + # + if self.macros.has_key(id): + del self.macros[id] + if self.functions.has_key(id): + print "function %s from %s redeclared in %s" % ( + id, self.functions[id].module, idx.functions[id].module) + else: + self.functions[id] = idx.functions[id] + self.identifiers[id] = idx.functions[id] + for id in idx.variables.keys(): + # + # macro might be used to override functions or variables + # definitions + # + if self.macros.has_key(id): + del self.macros[id] + if self.variables.has_key(id): + print "variable %s from %s redeclared in %s" % ( + id, self.variables[id].module, idx.variables[id].module) + else: + self.variables[id] = idx.variables[id] + self.identifiers[id] = idx.variables[id] + for id in idx.structs.keys(): + if self.structs.has_key(id): + print "struct %s from %s redeclared in %s" % ( + id, self.structs[id].module, idx.structs[id].module) + else: + self.structs[id] = idx.structs[id] + self.identifiers[id] = idx.structs[id] + for id in idx.typedefs.keys(): + if self.typedefs.has_key(id): + print "typedef %s from %s redeclared in %s" % ( + id, self.typedefs[id].module, idx.typedefs[id].module) + else: + self.typedefs[id] = idx.typedefs[id] + self.identifiers[id] = idx.typedefs[id] + for id in idx.macros.keys(): + # + # macro might be used to override functions or variables + # definitions + # + if self.variables.has_key(id): + continue + if self.functions.has_key(id): + continue + if self.enums.has_key(id): + continue + if self.macros.has_key(id): + print "macro %s from %s redeclared in %s" % ( + id, self.macros[id].module, idx.macros[id].module) + else: + self.macros[id] = idx.macros[id] + self.identifiers[id] = idx.macros[id] + for id in idx.enums.keys(): + if self.enums.has_key(id): + print "enum %s from %s redeclared in %s" % ( + id, self.enums[id].module, idx.enums[id].module) + else: + self.enums[id] = idx.enums[id] + self.identifiers[id] = idx.enums[id] + + def merge_public(self, idx): + for id in idx.functions.keys(): + if self.functions.has_key(id): + up = idx.functions[id] + self.functions[id].update(None, up.type, up.info, up.extra) + # else: + # print "Function %s from %s is not declared in headers" % ( + # id, idx.functions[id].module) + # TODO: do the same for variables. + + def analyze_dict(self, type, dict): + count = 0 + public = 0 + for name in dict.keys(): + id = dict[name] + count = count + 1 + if id.static == 0: + public = public + 1 + if count != public: + print " %d %s , %d public" % (count, type, public) + elif count != 0: + print " %d public %s" % (count, type) + + + def analyze(self): + self.analyze_dict("functions", self.functions) + self.analyze_dict("variables", self.variables) + self.analyze_dict("structs", self.structs) + self.analyze_dict("typedefs", self.typedefs) + self.analyze_dict("macros", self.macros) + +class CLexer: + """A lexer for the C language, tokenize the input by reading and + analyzing it line by line""" + def __init__(self, input): + self.input = input + self.tokens = [] + self.line = "" + self.lineno = 0 + + def getline(self): + line = '' + while line == '': + line = self.input.readline() + if not line: + return None + self.lineno = self.lineno + 1 + line = string.lstrip(line) + line = string.rstrip(line) + if line == '': + continue + while line[-1] == '\\': + line = line[:-1] + n = self.input.readline() + self.lineno = self.lineno + 1 + n = string.lstrip(n) + n = string.rstrip(n) + if not n: + break + else: + line = line + n + return line + + def getlineno(self): + return self.lineno + + def push(self, token): + self.tokens.insert(0, token); + + def debug(self): + print "Last token: ", self.last + print "Token queue: ", self.tokens + print "Line %d end: " % (self.lineno), self.line + + def token(self): + while self.tokens == []: + if self.line == "": + line = self.getline() + else: + line = self.line + self.line = "" + if line == None: + return None + + if line[0] == '#': + self.tokens = map((lambda x: ('preproc', x)), + string.split(line)) + break; + l = len(line) + if line[0] == '"' or line[0] == "'": + end = line[0] + line = line[1:] + found = 0 + tok = "" + while found == 0: + i = 0 + l = len(line) + while i < l: + if line[i] == end: + self.line = line[i+1:] + line = line[:i] + l = i + found = 1 + break + if line[i] == '\\': + i = i + 1 + i = i + 1 + tok = tok + line + if found == 0: + line = self.getline() + if line == None: + return None + self.last = ('string', tok) + return self.last + + if l >= 2 and line[0] == '/' and line[1] == '*': + line = line[2:] + found = 0 + tok = "" + while found == 0: + i = 0 + l = len(line) + while i < l: + if line[i] == '*' and i+1 < l and line[i+1] == '/': + self.line = line[i+2:] + line = line[:i-1] + l = i + found = 1 + break + i = i + 1 + if tok != "": + tok = tok + "\n" + tok = tok + line + if found == 0: + line = self.getline() + if line == None: + return None + self.last = ('comment', tok) + return self.last + if l >= 2 and line[0] == '/' and line[1] == '/': + line = line[2:] + self.last = ('comment', line) + return self.last + i = 0 + while i < l: + if line[i] == '/' and i+1 < l and line[i+1] == '/': + self.line = line[i:] + line = line[:i] + break + if line[i] == '/' and i+1 < l and line[i+1] == '*': + self.line = line[i:] + line = line[:i] + break + if line[i] == '"' or line[i] == "'": + self.line = line[i:] + line = line[:i] + break + i = i + 1 + l = len(line) + i = 0 + while i < l: + if line[i] == ' ' or line[i] == '\t': + i = i + 1 + continue + o = ord(line[i]) + if (o >= 97 and o <= 122) or (o >= 65 and o <= 90) or \ + (o >= 48 and o <= 57): + s = i + while i < l: + o = ord(line[i]) + if (o >= 97 and o <= 122) or (o >= 65 and o <= 90) or \ + (o >= 48 and o <= 57) or string.find( + " \t(){}:;,+-*/%&!|[]=><", line[i]) == -1: + i = i + 1 + else: + break + self.tokens.append(('name', line[s:i])) + continue + if string.find("(){}:;,[]", line[i]) != -1: +# if line[i] == '(' or line[i] == ')' or line[i] == '{' or \ +# line[i] == '}' or line[i] == ':' or line[i] == ';' or \ +# line[i] == ',' or line[i] == '[' or line[i] == ']': + self.tokens.append(('sep', line[i])) + i = i + 1 + continue + if string.find("+-*><=/%&!|.", line[i]) != -1: +# if line[i] == '+' or line[i] == '-' or line[i] == '*' or \ +# line[i] == '>' or line[i] == '<' or line[i] == '=' or \ +# line[i] == '/' or line[i] == '%' or line[i] == '&' or \ +# line[i] == '!' or line[i] == '|' or line[i] == '.': + if line[i] == '.' and i + 2 < l and \ + line[i+1] == '.' and line[i+2] == '.': + self.tokens.append(('name', '...')) + i = i + 3 + continue + + j = i + 1 + if j < l and ( + string.find("+-*><=/%&!|", line[j]) != -1): +# line[j] == '+' or line[j] == '-' or line[j] == '*' or \ +# line[j] == '>' or line[j] == '<' or line[j] == '=' or \ +# line[j] == '/' or line[j] == '%' or line[j] == '&' or \ +# line[j] == '!' or line[j] == '|'): + self.tokens.append(('op', line[i:j+1])) + i = j + 1 + else: + self.tokens.append(('op', line[i])) + i = i + 1 + continue + s = i + while i < l: + o = ord(line[i]) + if (o >= 97 and o <= 122) or (o >= 65 and o <= 90) or \ + (o >= 48 and o <= 57) or ( + string.find(" \t(){}:;,+-*/%&!|[]=><", line[i]) == -1): +# line[i] != ' ' and line[i] != '\t' and +# line[i] != '(' and line[i] != ')' and +# line[i] != '{' and line[i] != '}' and +# line[i] != ':' and line[i] != ';' and +# line[i] != ',' and line[i] != '+' and +# line[i] != '-' and line[i] != '*' and +# line[i] != '/' and line[i] != '%' and +# line[i] != '&' and line[i] != '!' and +# line[i] != '|' and line[i] != '[' and +# line[i] != ']' and line[i] != '=' and +# line[i] != '*' and line[i] != '>' and +# line[i] != '<'): + i = i + 1 + else: + break + self.tokens.append(('name', line[s:i])) + + tok = self.tokens[0] + self.tokens = self.tokens[1:] + self.last = tok + return tok + +class CParser: + """The C module parser""" + def __init__(self, filename, idx = None): + self.filename = filename + if len(filename) > 2 and filename[-2:] == '.h': + self.is_header = 1 + else: + self.is_header = 0 + self.input = open(filename) + self.lexer = CLexer(self.input) + if idx == None: + self.index = index() + else: + self.index = idx + self.top_comment = "" + self.last_comment = "" + self.comment = None + self.collect_ref = 0 + self.no_error = 0 + + def collect_references(self): + self.collect_ref = 1 + + def stop_error(self): + self.no_error = 1 + + def start_error(self): + self.no_error = 0 + + def lineno(self): + return self.lexer.getlineno() + + def index_add(self, name, module, static, type, info=None, extra = None): + self.index.add(name, module, static, type, self.lineno(), + info, extra) + + def index_add_ref(self, name, module, static, type, info=None, + extra = None): + self.index.add_ref(name, module, static, type, self.lineno(), + info, extra) + + def warning(self, msg): + if self.no_error: + return + print msg + + def error(self, msg, token=-1): + if self.no_error: + return + + print "Parse Error: " + msg + if token != -1: + print "Got token ", token + self.lexer.debug() + sys.exit(1) + + def debug(self, msg, token=-1): + print "Debug: " + msg + if token != -1: + print "Got token ", token + self.lexer.debug() + + def parseTopComment(self, comment): + res = {} + lines = string.split(comment, "\n") + item = None + for line in lines: + while line != "" and (line[0] == ' ' or line[0] == '\t'): + line = line[1:] + while line != "" and line[0] == '*': + line = line[1:] + while line != "" and (line[0] == ' ' or line[0] == '\t'): + line = line[1:] + try: + (it, line) = string.split(line, ":", 1) + item = it + while line != "" and (line[0] == ' ' or line[0] == '\t'): + line = line[1:] + if res.has_key(item): + res[item] = res[item] + " " + line + else: + res[item] = line + except: + if item != None: + if res.has_key(item): + res[item] = res[item] + " " + line + else: + res[item] = line + self.index.info = res + + def parseComment(self, token): + if self.top_comment == "": + self.top_comment = token[1] + if self.comment == None or token[1][0] == '*': + self.comment = token[1]; + else: + self.comment = self.comment + token[1] + token = self.lexer.token() + + if string.find(self.comment, "DOC_DISABLE") != -1: + self.stop_error() + + if string.find(self.comment, "DOC_ENABLE") != -1: + self.start_error() + + return token + + # + # Parse a comment block associate to a macro + # + def parseMacroComment(self, name, quiet = 0): + if name[0:2] == '__': + quiet = 1 + + args = [] + desc = "" + + if self.comment == None: + if not quiet: + self.warning("Missing comment for macro %s" % (name)) + return((args, desc)) + if self.comment[0] != '*': + if not quiet: + self.warning("Missing * in macro comment for %s" % (name)) + return((args, desc)) + lines = string.split(self.comment, '\n') + if lines[0] == '*': + del lines[0] + if lines[0] != "* %s:" % (name): + if not quiet: + self.warning("Misformatted macro comment for %s" % (name)) + self.warning(" Expecting '* %s:' got '%s'" % (name, lines[0])) + return((args, desc)) + del lines[0] + while lines[0] == '*': + del lines[0] + while len(lines) > 0 and lines[0][0:3] == '* @': + l = lines[0][3:] + try: + (arg, desc) = string.split(l, ':', 1) + desc=string.strip(desc) + arg=string.strip(arg) + except: + if not quiet: + self.warning("Misformatted macro comment for %s" % (name)) + self.warning(" problem with '%s'" % (lines[0])) + del lines[0] + continue + del lines[0] + l = string.strip(lines[0]) + while len(l) > 2 and l[0:3] != '* @': + while l[0] == '*': + l = l[1:] + desc = desc + ' ' + string.strip(l) + del lines[0] + if len(lines) == 0: + break + l = lines[0] + args.append((arg, desc)) + while len(lines) > 0 and lines[0] == '*': + del lines[0] + desc = "" + while len(lines) > 0: + l = lines[0] + while len(l) > 0 and l[0] == '*': + l = l[1:] + l = string.strip(l) + desc = desc + " " + l + del lines[0] + + desc = string.strip(desc) + + if quiet == 0: + if desc == "": + self.warning("Macro comment for %s lack description of the macro" % (name)) + + return((args, desc)) + + # + # Parse a comment block and merge the informations found in the + # parameters descriptions, finally returns a block as complete + # as possible + # + def mergeFunctionComment(self, name, description, quiet = 0): + if name == 'main': + quiet = 1 + if name[0:2] == '__': + quiet = 1 + + (ret, args) = description + desc = "" + retdesc = "" + + if self.comment == None: + if not quiet: + self.warning("Missing comment for function %s" % (name)) + return(((ret[0], retdesc), args, desc)) + if self.comment[0] != '*': + if not quiet: + self.warning("Missing * in function comment for %s" % (name)) + return(((ret[0], retdesc), args, desc)) + lines = string.split(self.comment, '\n') + if lines[0] == '*': + del lines[0] + if lines[0] != "* %s:" % (name): + if not quiet: + self.warning("Misformatted function comment for %s" % (name)) + self.warning(" Expecting '* %s:' got '%s'" % (name, lines[0])) + return(((ret[0], retdesc), args, desc)) + del lines[0] + while len(lines) > 0 and lines[0] == '*': + del lines[0] + nbargs = len(args) + while len(lines) > 0 and lines[0][0:3] == '* @': + l = lines[0][3:] + try: + (arg, desc) = string.split(l, ':', 1) + desc=string.strip(desc) + arg=string.strip(arg) + except: + if not quiet: + self.warning("Misformatted function comment for %s" % (name)) + self.warning(" problem with '%s'" % (lines[0])) + del lines[0] + continue + del lines[0] + l = string.strip(lines[0]) + while len(l) > 2 and l[0:3] != '* @': + while l[0] == '*': + l = l[1:] + desc = desc + ' ' + string.strip(l) + del lines[0] + if len(lines) == 0: + break + l = lines[0] + i = 0 + while i < nbargs: + if args[i][1] == arg: + args[i] = (args[i][0], arg, desc) + break; + i = i + 1 + if i >= nbargs: + if not quiet: + self.warning("Unable to find arg %s from function comment for %s" % ( + arg, name)) + while len(lines) > 0 and lines[0] == '*': + del lines[0] + desc = "" + while len(lines) > 0: + l = lines[0] + while len(l) > 0 and l[0] == '*': + l = l[1:] + l = string.strip(l) + if len(l) >= 6 and l[0:6] == "return" or l[0:6] == "Return": + try: + l = string.split(l, ' ', 1)[1] + except: + l = "" + retdesc = string.strip(l) + del lines[0] + while len(lines) > 0: + l = lines[0] + while len(l) > 0 and l[0] == '*': + l = l[1:] + l = string.strip(l) + retdesc = retdesc + " " + l + del lines[0] + else: + desc = desc + " " + l + del lines[0] + + retdesc = string.strip(retdesc) + desc = string.strip(desc) + + if quiet == 0: + # + # report missing comments + # + i = 0 + while i < nbargs: + if args[i][2] == None and args[i][0] != "void" and args[i][1] != None: + self.warning("Function comment for %s lack description of arg %s" % (name, args[i][1])) + i = i + 1 + if retdesc == "" and ret[0] != "void": + self.warning("Function comment for %s lack description of return value" % (name)) + if desc == "": + self.warning("Function comment for %s lack description of the function" % (name)) + + + return(((ret[0], retdesc), args, desc)) + + def parsePreproc(self, token): + name = token[1] + if name == "#include": + token = self.lexer.token() + if token == None: + return None + if token[0] == 'preproc': + self.index_add(token[1], self.filename, not self.is_header, + "include") + return self.lexer.token() + return token + if name == "#define": + token = self.lexer.token() + if token == None: + return None + if token[0] == 'preproc': + # TODO macros with arguments + name = token[1] + lst = [] + token = self.lexer.token() + while token != None and token[0] == 'preproc' and \ + token[1][0] != '#': + lst.append(token[1]) + token = self.lexer.token() + try: + name = string.split(name, '(') [0] + except: + pass + info = self.parseMacroComment(name, not self.is_header) + self.index_add(name, self.filename, not self.is_header, + "macro", info) + return token + token = self.lexer.token() + while token != None and token[0] == 'preproc' and \ + token[1][0] != '#': + token = self.lexer.token() + return token + + # + # token acquisition on top of the lexer, it handle internally + # preprocessor and comments since they are logically not part of + # the program structure. + # + def token(self): + global ignored_words + + token = self.lexer.token() + while token != None: + if token[0] == 'comment': + token = self.parseComment(token) + continue + elif token[0] == 'preproc': + token = self.parsePreproc(token) + continue + elif token[0] == "name" and ignored_words.has_key(token[1]): + (n, info) = ignored_words[token[1]] + i = 0 + while i < n: + token = self.lexer.token() + i = i + 1 + token = self.lexer.token() + continue + else: + if debug: + print "=> ", token + return token + return None + + # + # Parse a typedef, it records the type and its name. + # + def parseTypedef(self, token): + if token == None: + return None + token = self.parseType(token) + if token == None: + self.error("parsing typedef") + return None + base_type = self.type + type = base_type + #self.debug("end typedef type", token) + while token != None: + if token[0] == "name": + name = token[1] + signature = self.signature + if signature != None: + type = string.split(type, '(')[0] + d = self.mergeFunctionComment(name, + ((type, None), signature), 1) + self.index_add(name, self.filename, not self.is_header, + "functype", d) + else: + if base_type == "struct": + self.index_add(name, self.filename, not self.is_header, + "struct", type) + base_type = "struct " + name + else: + self.index_add(name, self.filename, not self.is_header, + "typedef", type) + token = self.token() + else: + self.error("parsing typedef: expecting a name") + return token + #self.debug("end typedef", token) + if token != None and token[0] == 'sep' and token[1] == ',': + type = base_type + token = self.token() + while token != None and token[0] == "op": + type = type + token[1] + token = self.token() + elif token != None and token[0] == 'sep' and token[1] == ';': + break; + elif token != None and token[0] == 'name': + type = base_type + continue; + else: + self.error("parsing typedef: expecting ';'", token) + return token + token = self.token() + return token + + # + # Parse a C code block, used for functions it parse till + # the balancing } included + # + def parseBlock(self, token): + while token != None: + if token[0] == "sep" and token[1] == "{": + token = self.token() + token = self.parseBlock(token) + elif token[0] == "sep" and token[1] == "}": + self.comment = None + token = self.token() + return token + else: + if self.collect_ref == 1: + oldtok = token + token = self.token() + if oldtok[0] == "name" and oldtok[1][0:3] == "xml": + if token[0] == "sep" and token[1] == "(": + self.index_add_ref(oldtok[1], self.filename, + 0, "function") + token = self.token() + elif token[0] == "name": + token = self.token() + if token[0] == "sep" and (token[1] == ";" or + token[1] == "," or token[1] == "="): + self.index_add_ref(oldtok[1], self.filename, + 0, "type") + elif oldtok[0] == "name" and oldtok[1][0:4] == "XML_": + self.index_add_ref(oldtok[1], self.filename, + 0, "typedef") + elif oldtok[0] == "name" and oldtok[1][0:7] == "LIBXML_": + self.index_add_ref(oldtok[1], self.filename, + 0, "typedef") + + else: + token = self.token() + return token + + # + # Parse a C struct definition till the balancing } + # + def parseStruct(self, token): + fields = [] + #self.debug("start parseStruct", token) + while token != None: + if token[0] == "sep" and token[1] == "{": + token = self.token() + token = self.parseTypeBlock(token) + elif token[0] == "sep" and token[1] == "}": + self.struct_fields = fields + #self.debug("end parseStruct", token) + #print fields + token = self.token() + return token + else: + base_type = self.type + #self.debug("before parseType", token) + token = self.parseType(token) + #self.debug("after parseType", token) + if token != None and token[0] == "name": + fname = token[1] + token = self.token() + if token[0] == "sep" and token[1] == ";": + self.comment = None + token = self.token() + fields.append((self.type, fname, self.comment)) + self.comment = None + else: + self.error("parseStruct: expecting ;", token) + elif token != None and token[0] == "sep" and token[1] == "{": + token = self.token() + token = self.parseTypeBlock(token) + if token != None and token[0] == "name": + token = self.token() + if token != None and token[0] == "sep" and token[1] == ";": + token = self.token() + else: + self.error("parseStruct: expecting ;", token) + else: + self.error("parseStruct: name", token) + token = self.token() + self.type = base_type; + self.struct_fields = fields + #self.debug("end parseStruct", token) + #print fields + return token + + # + # Parse a C enum block, parse till the balancing } + # + def parseEnumBlock(self, token): + self.enums = [] + name = None + self.comment = None + comment = "" + value = "0" + while token != None: + if token[0] == "sep" and token[1] == "{": + token = self.token() + token = self.parseTypeBlock(token) + elif token[0] == "sep" and token[1] == "}": + if name != None: + if self.comment != None: + comment = self.comment + self.comment = None + self.enums.append((name, value, comment)) + token = self.token() + return token + elif token[0] == "name": + if name != None: + if self.comment != None: + comment = string.strip(self.comment) + self.comment = None + self.enums.append((name, value, comment)) + name = token[1] + comment = "" + token = self.token() + if token[0] == "op" and token[1][0] == "=": + value = "" + if len(token[1]) > 1: + value = token[1][1:] + token = self.token() + while token[0] != "sep" or (token[1] != ',' and + token[1] != '}'): + value = value + token[1] + token = self.token() + else: + try: + value = "%d" % (int(value) + 1) + except: + self.warning("Failed to compute value of enum %s" % (name)) + value="" + if token[0] == "sep" and token[1] == ",": + token = self.token() + else: + token = self.token() + return token + + # + # Parse a C definition block, used for structs it parse till + # the balancing } + # + def parseTypeBlock(self, token): + while token != None: + if token[0] == "sep" and token[1] == "{": + token = self.token() + token = self.parseTypeBlock(token) + elif token[0] == "sep" and token[1] == "}": + token = self.token() + return token + else: + token = self.token() + return token + + # + # Parse a type: the fact that the type name can either occur after + # the definition or within the definition makes it a little harder + # if inside, the name token is pushed back before returning + # + def parseType(self, token): + self.type = "" + self.struct_fields = [] + self.signature = None + if token == None: + return token + + while token[0] == "name" and ( + token[1] == "const" or token[1] == "unsigned" or + token[1] == "signed"): + if self.type == "": + self.type = token[1] + else: + self.type = self.type + " " + token[1] + token = self.token() + + if token[0] == "name" and (token[1] == "long" or token[1] == "short"): + if self.type == "": + self.type = token[1] + else: + self.type = self.type + " " + token[1] + if token[0] == "name" and token[1] == "int": + if self.type == "": + self.type = tmp[1] + else: + self.type = self.type + " " + tmp[1] + + elif token[0] == "name" and token[1] == "struct": + if self.type == "": + self.type = token[1] + else: + self.type = self.type + " " + token[1] + token = self.token() + nametok = None + if token[0] == "name": + nametok = token + token = self.token() + if token != None and token[0] == "sep" and token[1] == "{": + token = self.token() + token = self.parseStruct(token) + elif token != None and token[0] == "op" and token[1] == "*": + self.type = self.type + " " + nametok[1] + " *" + token = self.token() + while token != None and token[0] == "op" and token[1] == "*": + self.type = self.type + " *" + token = self.token() + if token[0] == "name": + nametok = token + token = self.token() + else: + self.error("struct : expecting name", token) + return token + elif token != None and token[0] == "name" and nametok != None: + self.type = self.type + " " + nametok[1] + return token + + if nametok != None: + self.lexer.push(token) + token = nametok + return token + + elif token[0] == "name" and token[1] == "enum": + if self.type == "": + self.type = token[1] + else: + self.type = self.type + " " + token[1] + self.enums = [] + token = self.token() + if token != None and token[0] == "sep" and token[1] == "{": + token = self.token() + token = self.parseEnumBlock(token) + else: + self.error("parsing enum: expecting '{'", token) + enum_type = None + if token != None and token[0] != "name": + self.lexer.push(token) + token = ("name", "enum") + else: + enum_type = token[1] + for enum in self.enums: + self.index_add(enum[0], self.filename, + not self.is_header, "enum", + (enum[1], enum[2], enum_type)) + return token + + elif token[0] == "name": + if self.type == "": + self.type = token[1] + else: + self.type = self.type + " " + token[1] + else: + self.error("parsing type %s: expecting a name" % (self.type), + token) + return token + token = self.token() + while token != None and (token[0] == "op" or + token[0] == "name" and token[1] == "const"): + self.type = self.type + " " + token[1] + token = self.token() + + # + # if there is a parenthesis here, this means a function type + # + if token != None and token[0] == "sep" and token[1] == '(': + self.type = self.type + token[1] + token = self.token() + while token != None and token[0] == "op" and token[1] == '*': + self.type = self.type + token[1] + token = self.token() + if token == None or token[0] != "name" : + self.error("parsing function type, name expected", token); + return token + self.type = self.type + token[1] + nametok = token + token = self.token() + if token != None and token[0] == "sep" and token[1] == ')': + self.type = self.type + token[1] + token = self.token() + if token != None and token[0] == "sep" and token[1] == '(': + token = self.token() + type = self.type; + token = self.parseSignature(token); + self.type = type; + else: + self.error("parsing function type, '(' expected", token); + return token + else: + self.error("parsing function type, ')' expected", token); + return token + self.lexer.push(token) + token = nametok + return token + + # + # do some lookahead for arrays + # + if token != None and token[0] == "name": + nametok = token + token = self.token() + if token != None and token[0] == "sep" and token[1] == '[': + self.type = self.type + nametok[1] + while token != None and token[0] == "sep" and token[1] == '[': + self.type = self.type + token[1] + token = self.token() + while token != None and token[0] != 'sep' and \ + token[1] != ']' and token[1] != ';': + self.type = self.type + token[1] + token = self.token() + if token != None and token[0] == 'sep' and token[1] == ']': + self.type = self.type + token[1] + token = self.token() + else: + self.error("parsing array type, ']' expected", token); + return token + elif token != None and token[0] == "sep" and token[1] == ':': + # remove :12 in case it's a limited int size + token = self.token() + token = self.token() + self.lexer.push(token) + token = nametok + + return token + + # + # Parse a signature: '(' has been parsed and we scan the type definition + # up to the ')' included + def parseSignature(self, token): + signature = [] + if token != None and token[0] == "sep" and token[1] == ')': + self.signature = [] + token = self.token() + return token + while token != None: + token = self.parseType(token) + if token != None and token[0] == "name": + signature.append((self.type, token[1], None)) + token = self.token() + elif token != None and token[0] == "sep" and token[1] == ',': + token = self.token() + continue + elif token != None and token[0] == "sep" and token[1] == ')': + # only the type was provided + if self.type == "...": + signature.append((self.type, "...", None)) + else: + signature.append((self.type, None, None)) + if token != None and token[0] == "sep": + if token[1] == ',': + token = self.token() + continue + elif token[1] == ')': + token = self.token() + break + self.signature = signature + return token + + # + # Parse a global definition, be it a type, variable or function + # the extern "C" blocks are a bit nasty and require it to recurse. + # + def parseGlobal(self, token): + static = 0 + if token[1] == 'extern': + token = self.token() + if token == None: + return token + if token[0] == 'string': + if token[1] == 'C': + token = self.token() + if token == None: + return token + if token[0] == 'sep' and token[1] == "{": + token = self.token() +# print 'Entering extern "C line ', self.lineno() + while token != None and (token[0] != 'sep' or + token[1] != "}"): + if token[0] == 'name': + token = self.parseGlobal(token) + else: + self.error( + "token %s %s unexpected at the top level" % ( + token[0], token[1])) + token = self.parseGlobal(token) +# print 'Exiting extern "C" line', self.lineno() + token = self.token() + return token + else: + return token + elif token[1] == 'static': + static = 1 + token = self.token() + if token == None or token[0] != 'name': + return token + + if token[1] == 'typedef': + token = self.token() + return self.parseTypedef(token) + else: + token = self.parseType(token) + type_orig = self.type + if token == None or token[0] != "name": + return token + type = type_orig + self.name = token[1] + token = self.token() + while token != None and (token[0] == "sep" or token[0] == "op"): + if token[0] == "sep": + if token[1] == "[": + type = type + token[1] + token = self.token() + while token != None and (token[0] != "sep" or \ + token[1] != ";"): + type = type + token[1] + token = self.token() + + if token != None and token[0] == "op" and token[1] == "=": + # + # Skip the initialization of the variable + # + token = self.token() + if token[0] == 'sep' and token[1] == '{': + token = self.token() + token = self.parseBlock(token) + else: + self.comment = None + while token != None and (token[0] != "sep" or \ + (token[1] != ';' and token[1] != ',')): + token = self.token() + self.comment = None + if token == None or token[0] != "sep" or (token[1] != ';' and + token[1] != ','): + self.error("missing ';' or ',' after value") + + if token != None and token[0] == "sep": + if token[1] == ";": + self.comment = None + token = self.token() + if type == "struct": + self.index_add(self.name, self.filename, + not self.is_header, "struct", self.struct_fields) + else: + self.index_add(self.name, self.filename, + not self.is_header, "variable", type) + break + elif token[1] == "(": + token = self.token() + token = self.parseSignature(token) + if token == None: + return None + if token[0] == "sep" and token[1] == ";": + d = self.mergeFunctionComment(self.name, + ((type, None), self.signature), 1) + self.index_add(self.name, self.filename, static, + "function", d) + token = self.token() + elif token[0] == "sep" and token[1] == "{": + d = self.mergeFunctionComment(self.name, + ((type, None), self.signature), static) + self.index_add(self.name, self.filename, static, + "function", d) + token = self.token() + token = self.parseBlock(token); + elif token[1] == ',': + self.comment = None + self.index_add(self.name, self.filename, static, + "variable", type) + type = type_orig + token = self.token() + while token != None and token[0] == "sep": + type = type + token[1] + token = self.token() + if token != None and token[0] == "name": + self.name = token[1] + token = self.token() + else: + break + + return token + + def parse(self): + self.warning("Parsing %s" % (self.filename)) + token = self.token() + while token != None: + if token[0] == 'name': + token = self.parseGlobal(token) + else: + self.error("token %s %s unexpected at the top level" % ( + token[0], token[1])) + token = self.parseGlobal(token) + return + self.parseTopComment(self.top_comment) + return self.index + + +class docBuilder: + """A documentation builder""" + def __init__(self, name, directories=['.'], excludes=[]): + self.name = name + self.directories = directories + self.excludes = excludes + ignored_files.keys() + self.modules = {} + self.headers = {} + self.idx = index() + self.xref = {} + self.index = {} + if name == 'libxml2': + self.basename = 'libxml' + else: + self.basename = name + + def indexString(self, id, str): + if str == None: + return + str = string.replace(str, "'", ' ') + str = string.replace(str, '"', ' ') + str = string.replace(str, "/", ' ') + str = string.replace(str, '*', ' ') + str = string.replace(str, "[", ' ') + str = string.replace(str, "]", ' ') + str = string.replace(str, "(", ' ') + str = string.replace(str, ")", ' ') + str = string.replace(str, "<", ' ') + str = string.replace(str, '>', ' ') + str = string.replace(str, "&", ' ') + str = string.replace(str, '#', ' ') + str = string.replace(str, ",", ' ') + str = string.replace(str, '.', ' ') + str = string.replace(str, ';', ' ') + tokens = string.split(str) + for token in tokens: + try: + c = token[0] + if string.find(string.letters, c) < 0: + pass + elif len(token) < 3: + pass + else: + lower = string.lower(token) + # TODO: generalize this a bit + if lower == 'and' or lower == 'the': + pass + elif self.xref.has_key(token): + self.xref[token].append(id) + else: + self.xref[token] = [id] + except: + pass + + def analyze(self): + print "Project %s : %d headers, %d modules" % (self.name, len(self.headers.keys()), len(self.modules.keys())) + self.idx.analyze() + + def scanHeaders(self): + for header in self.headers.keys(): + parser = CParser(header) + idx = parser.parse() + self.headers[header] = idx; + self.idx.merge(idx) + + def scanModules(self): + for module in self.modules.keys(): + parser = CParser(module) + idx = parser.parse() + # idx.analyze() + self.modules[module] = idx + self.idx.merge_public(idx) + + def scan(self): + for directory in self.directories: + files = glob.glob(directory + "/*.c") + for file in files: + skip = 0 + for excl in self.excludes: + if string.find(file, excl) != -1: + skip = 1; + break + if skip == 0: + self.modules[file] = None; + files = glob.glob(directory + "/*.h") + for file in files: + skip = 0 + for excl in self.excludes: + if string.find(file, excl) != -1: + skip = 1; + break + if skip == 0: + self.headers[file] = None; + self.scanHeaders() + self.scanModules() + + def modulename_file(self, file): + module = os.path.basename(file) + if module[-2:] == '.h': + module = module[:-2] + return module + + def serialize_enum(self, output, name): + id = self.idx.enums[name] + output.write(" \n") + + def serialize_macro(self, output, name): + id = self.idx.macros[name] + output.write(" \n" % (name, + self.modulename_file(id.module))) + if id.info != None: + try: + (args, desc) = id.info + if desc != None and desc != "": + output.write(" %s\n" % (escape(desc))) + self.indexString(name, desc) + for arg in args: + (name, desc) = arg + if desc != None and desc != "": + output.write(" \n" % ( + name, escape(desc))) + self.indexString(name, desc) + else: + output.write(" \n" % (name)) + except: + pass + output.write(" \n") + + def serialize_typedef(self, output, name): + id = self.idx.typedefs[name] + if id.info[0:7] == 'struct ': + output.write(" \n"); + try: + for field in self.idx.structs[name].info: + desc = field[2] + self.indexString(name, desc) + if desc == None: + desc = '' + else: + desc = escape(desc) + output.write(" \n" % (field[1] , field[0], desc)) + except: + print "Failed to serialize struct %s" % (name) + output.write(" \n") + else: + output.write("/>\n"); + else : + output.write(" \n" % ( + name, self.modulename_file(id.module), id.info)) + + def serialize_variable(self, output, name): + id = self.idx.variables[name] + if id.info != None: + output.write(" \n" % ( + name, self.modulename_file(id.module), id.info)) + else: + output.write(" \n" % ( + name, self.modulename_file(id.module))) + + def serialize_function(self, output, name): + id = self.idx.functions[name] + output.write(" <%s name='%s' file='%s'>\n" % (id.type, name, + self.modulename_file(id.module))) + try: + (ret, params, desc) = id.info + output.write(" %s\n" % (escape(desc))) + self.indexString(name, desc) + if ret[0] != None: + if ret[0] == "void": + output.write(" \n") + else: + output.write(" \n" % ( + ret[0], escape(ret[1]))) + self.indexString(name, ret[1]) + for param in params: + if param[0] == 'void': + continue + if param[2] == None: + output.write(" \n" % (param[1], param[0])) + else: + output.write(" \n" % (param[1], param[0], escape(param[2]))) + self.indexString(name, param[2]) + except: + print "Failed to save function %s info: " % name, `id.info` + output.write(" \n" % (id.type)) + + def serialize_exports(self, output, file): + module = self.modulename_file(file) + output.write(" \n" % (module)) + dict = self.headers[file] + if dict.info != None: + for data in ('Summary', 'Description', 'Author'): + try: + output.write(" <%s>%s\n" % ( + string.lower(data), + escape(dict.info[data]), + string.lower(data))) + except: + print "Header %s lacks a %s description" % (module, data) + if dict.info.has_key('Description'): + desc = dict.info['Description'] + if string.find(desc, "DEPRECATED") != -1: + output.write(" \n") + + ids = dict.macros.keys() + ids.sort() + for id in uniq(ids): + # Macros are sometime used to masquerade other types. + if dict.functions.has_key(id): + continue + if dict.variables.has_key(id): + continue + if dict.typedefs.has_key(id): + continue + if dict.structs.has_key(id): + continue + if dict.enums.has_key(id): + continue + output.write(" \n" % (id)) + ids = dict.enums.keys() + ids.sort() + for id in uniq(ids): + output.write(" \n" % (id)) + ids = dict.typedefs.keys() + ids.sort() + for id in uniq(ids): + output.write(" \n" % (id)) + ids = dict.structs.keys() + ids.sort() + for id in uniq(ids): + output.write(" \n" % (id)) + ids = dict.variables.keys() + ids.sort() + for id in uniq(ids): + output.write(" \n" % (id)) + ids = dict.functions.keys() + ids.sort() + for id in uniq(ids): + output.write(" \n" % (id)) + output.write(" \n") + + def serialize_xrefs_files(self, output): + headers = self.headers.keys() + headers.sort() + for file in headers: + module = self.modulename_file(file) + output.write(" \n" % (module)) + dict = self.headers[file] + ids = uniq(dict.functions.keys() + dict.variables.keys() + \ + dict.macros.keys() + dict.typedefs.keys() + \ + dict.structs.keys() + dict.enums.keys()) + ids.sort() + for id in ids: + output.write(" \n" % (id)) + output.write(" \n") + pass + + def serialize_xrefs_functions(self, output): + funcs = {} + for name in self.idx.functions.keys(): + id = self.idx.functions[name] + try: + (ret, params, desc) = id.info + for param in params: + if param[0] == 'void': + continue + if funcs.has_key(param[0]): + funcs[param[0]].append(name) + else: + funcs[param[0]] = [name] + except: + pass + typ = funcs.keys() + typ.sort() + for type in typ: + if type == '' or type == 'void' or type == "int" or \ + type == "char *" or type == "const char *" : + continue + output.write(" \n" % (type)) + ids = funcs[type] + ids.sort() + pid = '' # not sure why we have dups, but get rid of them! + for id in ids: + if id != pid: + output.write(" \n" % (id)) + pid = id + output.write(" \n") + + def serialize_xrefs_constructors(self, output): + funcs = {} + for name in self.idx.functions.keys(): + id = self.idx.functions[name] + try: + (ret, params, desc) = id.info + if ret[0] == "void": + continue + if funcs.has_key(ret[0]): + funcs[ret[0]].append(name) + else: + funcs[ret[0]] = [name] + except: + pass + typ = funcs.keys() + typ.sort() + for type in typ: + if type == '' or type == 'void' or type == "int" or \ + type == "char *" or type == "const char *" : + continue + output.write(" \n" % (type)) + ids = funcs[type] + ids.sort() + for id in ids: + output.write(" \n" % (id)) + output.write(" \n") + + def serialize_xrefs_alpha(self, output): + letter = None + ids = self.idx.identifiers.keys() + ids.sort() + for id in ids: + if id[0] != letter: + if letter != None: + output.write(" \n") + letter = id[0] + output.write(" \n" % (letter)) + output.write(" \n" % (id)) + if letter != None: + output.write(" \n") + + def serialize_xrefs_references(self, output): + typ = self.idx.identifiers.keys() + typ.sort() + for id in typ: + idf = self.idx.identifiers[id] + module = idf.module + output.write(" \n" % (id, + 'html/' + self.basename + '-' + + self.modulename_file(module) + '.html#' + + id)) + + def serialize_xrefs_index(self, output): + index = self.xref + typ = index.keys() + typ.sort() + letter = None + count = 0 + chunk = 0 + chunks = [] + for id in typ: + if len(index[id]) > 30: + continue + if id[0] != letter: + if letter == None or count > 200: + if letter != None: + output.write(" \n") + output.write(" \n") + count = 0 + chunks.append(["chunk%s" % (chunk -1), first_letter, letter]) + output.write(" \n" % (chunk)) + first_letter = id[0] + chunk = chunk + 1 + elif letter != None: + output.write(" \n") + letter = id[0] + output.write(" \n" % (letter)) + output.write(" \n" % (id)) + tokens = index[id]; + tokens.sort() + tok = None + for token in tokens: + if tok == token: + continue + tok = token + output.write(" \n" % (token)) + count = count + 1 + output.write(" \n") + if letter != None: + output.write(" \n") + output.write(" \n") + if count != 0: + chunks.append(["chunk%s" % (chunk -1), first_letter, letter]) + output.write(" \n") + for ch in chunks: + output.write(" \n" % ( + ch[0], ch[1], ch[2])) + output.write(" \n") + + def serialize_xrefs(self, output): + output.write(" \n") + self.serialize_xrefs_references(output) + output.write(" \n") + output.write(" \n") + self.serialize_xrefs_alpha(output) + output.write(" \n") + output.write(" \n") + self.serialize_xrefs_constructors(output) + output.write(" \n") + output.write(" \n") + self.serialize_xrefs_functions(output) + output.write(" \n") + output.write(" \n") + self.serialize_xrefs_files(output) + output.write(" \n") + output.write(" \n") + self.serialize_xrefs_index(output) + output.write(" \n") + + def serialize(self, outdir): + filename = outdir + "%s-api.xml" % self.name + print "Saving XML description %s" % (filename) + output = open(filename, "w") + output.write('\n') + output.write("\n" % self.name) + output.write(" \n") + headers = self.headers.keys() + headers.sort() + for file in headers: + self.serialize_exports(output, file) + output.write(" \n") + output.write(" \n") + macros = self.idx.macros.keys() + macros.sort() + for macro in macros: + self.serialize_macro(output, macro) + enums = self.idx.enums.keys() + enums.sort() + for enum in enums: + self.serialize_enum(output, enum) + typedefs = self.idx.typedefs.keys() + typedefs.sort() + for typedef in typedefs: + self.serialize_typedef(output, typedef) + variables = self.idx.variables.keys() + variables.sort() + for variable in variables: + self.serialize_variable(output, variable) + functions = self.idx.functions.keys() + functions.sort() + for function in functions: + self.serialize_function(output, function) + output.write(" \n") + output.write("\n") + output.close() + + filename = outdir + "%s-refs.xml" % self.name + print "Saving XML Cross References %s" % (filename) + output = open(filename, "w") + output.write('\n') + output.write("\n" % self.name) + self.serialize_xrefs(output) + output.write("\n") + output.close() + + +def rebuild(): + builder = None + if glob.glob("parser.c") != [] : + print "Rebuilding API description for libxml2" + builder = docBuilder("libxml2", [".", "."], + ["xmlwin32version.h", "tst.c"]) + elif glob.glob("../parser.c") != [] : + print "Rebuilding API description for libxml2" + builder = docBuilder("libxml2", ["..", "../include/libxml"], + ["xmlwin32version.h", "tst.c"]) + elif glob.glob("../libxslt/transform.c") != [] : + print "Rebuilding API description for libxslt" + builder = docBuilder("libxslt", ["../libxslt"], + ["win32config.h", "libxslt.h", "tst.c"]) + else: + print "rebuild() failed, unable to guess the module" + return None + builder.scan() + builder.analyze() + builder.serialize("./") + if glob.glob("../libexslt/exslt.c") != [] : + extra = docBuilder("libexslt", ["../libexslt"], ["libexslt.h"]) + extra.scan() + extra.analyze() + extra.serialize("EXSLT/") + return builder + +# +# for debugging the parser +# +def parse(filename): + parser = CParser(filename) + idx = parser.parse() + return idx + +if __name__ == "__main__": + rebuild() diff --git a/doc/bugs.html b/doc/bugs.html new file mode 100644 index 0000000..8beb6ef --- /dev/null +++ b/doc/bugs.html @@ -0,0 +1,96 @@ + + +Reporting bugs and getting help
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Reporting bugs and getting help

    Main Menu
    Related links
    API Indexes

    If you need help with the XSLT language itself, here are a number of +useful resources:

    Well, bugs or missing features are always possible, and I will make a +point of fixing them in a timely fashion. The best way to report a bug is to +use the GNOME bug +tracking database (make sure to use the "libxslt" module name). Before +filing a bug, check the list of existing +libxslt bugs to make sure it hasn't already been filed. I look at reports +there regularly and it's good to have a reminder when a bug is still open. Be +sure to specify that the bug is for the package libxslt.

    For small problems you can try to get help on IRC, the #xml channel on +irc.gnome.org (port 6667) usually have a few person subscribed which may help +(but there is no guarantee and if a real issue is raised it should go on the +mailing-list for archival).

    There is also a mailing-list xslt@gnome.org for libxslt, with an on-line archive. To subscribe +to this list, please visit the associated Web page +and follow the instructions.

    Alternatively, you can just send the bug to the xslt@gnome.org list, if it's really libxslt +related I will approve it.. Please do not send me mail directly especially +for portability problem, it makes things really harder to track and in some +cases I'm not the best person to answer a given question, ask the list +instead. Do not send code, I won't debug it (but patches are +really appreciated!).

    Please note that with the current amount of virus and SPAM, sending mail +to the list without being subscribed won't work. There is *far too many +bounces* (in the order of a thousand a day !) I cannot approve them manually +anymore. If your mail to the list bounced waiting for administrator approval, +it is LOST ! Repost it and fix the problem triggering the error. Also please +note that emails with +a legal warning asking to not copy or redistribute freely the information +they contain are NOT acceptable for the mailing-list, +such mail will as much as possible be discarded automatically, and are less +likely to be answered if they made it to the list, DO NOT +post to the list from an email address where such legal requirements are +automatically added, get private paying support if you can't share +information.

    Check the following too before +posting:

      +
    • use the search engine to get information + related to your problem.
    • +
    • make sure you are using a recent + version, and that the problem still shows up in those
    • +
    • check the list + archives to see if the problem was reported already, in this case + there is probably a fix available, similarly check the registered + open bugs
    • +
    • make sure you can reproduce the bug with xsltproc, a very useful thing + to do is run the transformation with -v argument and redirect the + standard error to a file, then search in this file for the transformation + logs just preceding the possible problem
    • +
    • Please send the command showing the error as well as the input and + stylesheet (as an attachment)
    • +

    Then send the bug with associated information to reproduce it to the xslt@gnome.org list; if it's really libxslt +related I will approve it. Please do not send mail to me directly, it makes +things really hard to track and in some cases I am not the best person to +answer a given question, ask on the list.

    To be really clear about support:

      +
    • Support or help request MUST be sent to + the list or on bugzilla in case of problems, so that the Question + and Answers can be shared publicly. Failing to do so carries the implicit + message "I want free support but I don't want to share the benefits with + others" and is not welcome. I will automatically Carbon-Copy the + xslt@gnome.org mailing list for any technical reply made about libxml2 or + libxslt.
    • +
    • There is no guarantee for support, + if your question remains unanswered after a week, repost it, making sure + you gave all the detail needed and the information requested.
    • +
    • Failing to provide information as requested or double checking first + for prior feedback also carries the implicit message "the time of the + library maintainers is less valuable than my time" and might not be + welcome.
    • +

    Of course, bugs reports with a suggested patch for fixing them will +probably be processed faster.

    If you're looking for help, a quick look at the list archive may actually +provide the answer, I usually send source samples when answering libxslt +usage questions. The auto-generated documentation is +not as polished as I would like (I need to learn more about Docbook), but +it's a good starting point.

    Daniel Veillard

    diff --git a/doc/checkapisym.xsl b/doc/checkapisym.xsl new file mode 100644 index 0000000..8591393 --- /dev/null +++ b/doc/checkapisym.xsl @@ -0,0 +1,48 @@ + + + + + + + + + + + + Looking for functions in symbols.xml + + + + Found + + functions + + + Looking for variables in symbols.xml + + + + Found + + variables + + + + + + + + + Failed to find export in symbols.xml: + + + + + + + diff --git a/doc/contexts.fig b/doc/contexts.fig new file mode 100644 index 0000000..4fa4b8d --- /dev/null +++ b/doc/contexts.fig @@ -0,0 +1,175 @@ +#FIG 3.2 +Landscape +Center +Inches +Letter +100.00 +Single +-2 +1200 2 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 3000 750 4650 750 4650 3150 3000 3150 3000 750 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 3000 1050 4650 1050 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 3000 1350 4650 1350 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 3000 1650 4650 1650 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 4275 900 6450 900 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 3225 1200 1425 1425 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 3150 1500 1575 3675 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 3000 2850 4650 2850 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 3150 3000 2325 5250 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 2391 5400 3216 3150 +2 4 0 1 0 7 50 0 -1 0.000 0 0 7 0 0 5 + 4950 5700 3675 5700 3675 4425 4950 4425 4950 5700 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 2400 5700 3675 5250 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 3825 7200 5475 7200 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 3825 7500 5475 7500 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 3825 7800 5475 7800 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 900 5250 2550 5250 2550 7650 900 7650 900 5250 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 900 5550 2550 5550 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 900 5850 2550 5850 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 900 6150 2550 6150 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 900 6450 2550 6450 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 900 6750 2550 6750 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 900 7050 2550 7050 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 3825 6900 5475 6900 5475 8250 3825 8250 3825 6900 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 3975 7050 2550 6225 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 5175 7350 6450 5850 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 5175 7650 7275 6675 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 4 + 225 675 225 2175 1800 2175 1800 300 +2 1 0 3 0 7 50 0 -1 8.000 0 0 -1 1 0 2 + 0 0 3.00 180.00 360.00 + 1500 1125 1500 300 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 225 1875 1800 1875 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 225 1575 1800 1575 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 225 1275 1800 1275 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 4 + 225 2925 225 4425 1800 4425 1800 2550 +2 1 0 3 0 7 50 0 -1 8.000 0 0 -1 1 0 2 + 0 0 3.00 180.00 360.00 + 1500 3375 1500 2550 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 225 4125 1800 4125 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 225 3825 1800 3825 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 225 3525 1800 3525 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 4 + 6450 4875 6450 6375 8025 6375 8025 4500 +2 1 0 3 0 7 50 0 -1 8.000 0 0 -1 1 0 2 + 0 0 3.00 180.00 360.00 + 7725 5325 7725 4500 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 6450 6075 8025 6075 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 6450 5775 8025 5775 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 6450 5475 8025 5475 +2 2 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 5 + 7275 6525 7575 6525 7575 6825 7275 6825 7275 6525 +2 2 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 5 + 6900 7050 7200 7050 7200 7350 6900 7350 6900 7050 +2 2 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 5 + 6525 7500 6825 7500 6825 7800 6525 7800 6525 7500 +2 2 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 5 + 7200 7500 7500 7500 7500 7800 7200 7800 7200 7500 +2 2 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 5 + 7650 7050 7950 7050 7950 7350 7650 7350 7650 7050 +2 2 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 5 + 6975 7950 7275 7950 7275 8250 6975 8250 6975 7950 +2 2 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 5 + 7500 7950 7800 7950 7800 8250 7500 8250 7500 7950 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 2 + 7275 6825 7200 7050 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 2 + 7575 6825 7650 7050 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 2 + 6900 7350 6825 7500 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 2 + 7200 7350 7350 7500 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 3 + 7200 7800 7200 7800 7125 7950 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 2 + 7500 7800 7575 7950 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 6450 825 8100 825 8100 3675 6450 3675 6450 825 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 6450 1200 8100 1200 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 6450 1575 8100 1575 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 6450 1950 8100 1950 +3 0 0 1 0 7 50 0 -1 0.000 0 0 0 4 + 225 675 750 750 1350 300 1800 300 + 0.000 1.000 1.000 0.000 +3 0 0 1 0 7 50 0 -1 0.000 0 0 0 4 + 225 2925 750 3000 1350 2550 1800 2550 + 0.000 1.000 1.000 0.000 +3 0 0 1 0 7 50 0 -1 0.000 0 0 0 4 + 6450 4875 6975 4950 7575 4500 8025 4500 + 0.000 1.000 1.000 0.000 +4 0 0 50 0 0 18 0.0000 4 195 585 3000 525 xsltT\001 +4 0 0 50 0 0 18 0.0000 4 195 1530 3600 525 ransformCtxt\001 +4 0 0 50 0 0 18 0.0000 4 255 510 3375 975 style\001 +4 0 0 50 0 0 18 0.0000 4 255 1545 6450 525 xsltStylesheet\001 +4 0 0 50 0 0 18 0.0000 4 255 645 3375 1275 templ\001 +4 0 0 50 0 0 18 0.0000 4 135 465 3375 1575 vars\001 +4 0 0 50 0 0 18 0.0000 4 255 1125 3300 3075 xpathCtxt\001 +4 0 0 50 0 0 18 0.0000 4 195 1620 450 5025 xmlXPathCtxt\001 +4 0 0 50 0 0 18 0.0000 4 195 1125 3750 5100 Functions\001 +4 0 0 50 0 0 18 0.0000 4 195 1320 1125 7020 namespaces\001 +4 0 0 50 0 0 18 0.0000 4 195 1305 1125 6705 contextSize\001 +4 0 0 50 0 0 18 0.0000 4 195 540 1125 6390 node\001 +4 0 0 50 0 0 18 0.0000 4 195 390 1125 6075 doc\001 +4 0 0 50 0 0 18 0.0000 4 195 1065 1125 5775 funcHash\001 +4 0 0 50 0 0 18 0.0000 4 165 570 1125 5475 extra\001 +4 0 0 50 0 0 18 0.0000 4 195 2325 3075 8700 xmlXPathParserCtxt\001 +4 0 0 50 0 0 18 0.0000 4 165 840 4200 7125 context\001 +4 0 0 50 0 0 18 0.0000 4 195 585 4200 7425 value\001 +4 0 0 50 0 0 18 0.0000 4 255 3015 6075 8700 XPath compiled expression\001 +4 0 0 50 0 0 18 0.0000 4 195 615 4200 7725 comp\001 +4 0 0 50 0 0 18 0.0000 4 195 570 450 2115 stack\001 +4 0 0 50 0 0 18 0.0000 4 255 1080 450 1800 templates\001 +4 0 0 50 0 0 18 0.0000 4 195 570 450 4365 stack\001 +4 0 0 50 0 0 18 0.0000 4 195 885 450 3750 variable\001 +4 0 0 50 0 0 18 0.0000 4 135 105 1350 3750 s\001 +4 0 0 50 0 0 18 0.0000 4 255 1275 450 4050 and params\001 +4 0 0 50 0 0 18 0.0000 4 195 570 6675 6315 stack\001 +4 0 0 50 0 0 18 0.0000 4 255 780 6675 6000 objects\001 +4 0 0 50 0 0 18 0.0000 4 195 690 6675 5700 XPath\001 diff --git a/doc/contexts.gif b/doc/contexts.gif new file mode 100644 index 0000000..5ca52c6 Binary files /dev/null and b/doc/contexts.gif differ diff --git a/doc/contribs.html b/doc/contribs.html new file mode 100644 index 0000000..e9b057c --- /dev/null +++ b/doc/contribs.html @@ -0,0 +1,42 @@ + + +Contributions
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Contributions

    Main Menu
    Related links
    API Indexes

    Daniel Veillard

    diff --git a/doc/docbook.html b/doc/docbook.html new file mode 100644 index 0000000..957b9e8 --- /dev/null +++ b/doc/docbook.html @@ -0,0 +1,65 @@ + + +DocBook
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    DocBook

    Main Menu
    Related links
    API Indexes

    The duck picture

    DocBook is an +XML/SGML vocabulary particularly well suited to books and papers about +computer hardware and software.

    xsltproc and libxslt are not specifically dependant on DocBook, but since +a lot of people use xsltproc and libxml2 for DocBook formatting, here are a +few pointers and information which may be helpful:

    Do not use the --docbook option of xsltproc to process XML DocBook +documents, this option is only intended to provide some (limited) support of +the SGML version of DocBook.

    Points which are not DocBook specific but still worth mentionning +again:

      +
    • if you think DocBook processing time is too slow, make sure you have + XML Catalogs pointing to a local installation of the DTD of DocBook. + Check the XML Catalog page + to understand more on this subject.
    • +
    • before processing a new document, use the command +

      xmllint --valid --noout path_to_document

      +

      to make sure that your input is valid DocBook. And fixes the errors + before processing further. Note that XSLT processing may work correctly + with some forms of validity errors left, but in general it can give + troubles on output.

      +
    • +

    Daniel Veillard

    diff --git a/doc/docs.html b/doc/docs.html new file mode 100644 index 0000000..97a48f4 --- /dev/null +++ b/doc/docs.html @@ -0,0 +1,20 @@ + + +Documentation
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Documentation

    Main Menu
    Related links
    API Indexes

    There are some on-line resources about using libxslt:

      +
    1. Check the API + documentation automatically extracted from code comments (using the + program apibuild.py, developed for libxml, together with the xsl script + 'newapi.xsl' and the libxslt xsltproc program).
    2. +
    3. Look at the mailing-list + archive.
    4. +
    5. Of course since libxslt is based on libxml, it's a good idea to at + least read libxml description
    6. +

    Daniel Veillard

    diff --git a/doc/downloads.html b/doc/downloads.html new file mode 100644 index 0000000..8f868a0 --- /dev/null +++ b/doc/downloads.html @@ -0,0 +1,31 @@ + + +Downloads
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Downloads

    Main Menu
    Related links
    API Indexes

    The latest versions of libxslt can be found on the xmlsoft.org server. (NOTE that +you need the libxml2, +libxml2-devel, +libxslt and libxslt-devel +packages installed to compile applications using libxslt.) Igor Zlatkovic is now the maintainer of +the Windows port, he provides +binaries. CSW provides +Solaris binaries, and +Steve Ball provides Mac Os X +binaries.

    Snapshot:

    Contribs:

    I do accept external contributions, especially if compiling on another +platform, get in touch with me to upload the package. I will keep them in the +contrib directory

    Libxslt is also available from GIT:

      +
    • See libxslt Git web. + To checkout a local tree use:

      +
      git clone git://git.gnome.org/libxslt
      +
    • +
    • The libxml2 module is also present + there
    • +

    Daniel Veillard

    diff --git a/doc/duck.png b/doc/duck.png new file mode 100644 index 0000000..9c8ef74 Binary files /dev/null and b/doc/duck.png differ diff --git a/doc/epatents.png b/doc/epatents.png new file mode 100644 index 0000000..6cd3a13 Binary files /dev/null and b/doc/epatents.png differ diff --git a/doc/extensions.html b/doc/extensions.html new file mode 100644 index 0000000..30fa4c8 --- /dev/null +++ b/doc/extensions.html @@ -0,0 +1,287 @@ + + +Writing extensions
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Writing extensions

    Main Menu
    Related links
    API Indexes

    Table of content

    Introduction

    This document describes the work needed to write extensions to the +standard XSLT library for use with libxslt, the XSLT C library developed for the GNOME project.

    Before starting reading this document it is highly recommended to get +familiar with the libxslt internals.

    Note: this documentation is by definition incomplete and I am not good at +spelling, grammar, so patches and suggestions are really welcome.

    Basics

    The XSLT specification provides +two ways to extend an XSLT engine:

    In both cases the extensions need to be associated to a new namespace, +i.e. an URI used as the name for the extension's namespace (there is no need +to have a resource there for this to work).

    libxslt provides a few extensions itself, either in the libxslt namespace +"http://xmlsoft.org/XSLT/namespace" or in namespaces for other well known +extensions provided by other XSLT processors like Saxon, Xalan or XT.

    Extension modules

    Since extensions are bound to a namespace name, usually sets of extensions +coming from a given source are using the same namespace name defining in +practice a group of extensions providing elements, functions or both. From +the libxslt point of view those are considered as an "extension module", and +most of the APIs work at a module point of view.

    Registration of new functions or elements are bound to the activation of +the module. This is currently done by declaring the namespace as an extension +by using the attribute extension-element-prefixes on the +xsl:stylesheet +element.

    An extension module is defined by 3 objects:

      +
    • the namespace name associated
    • +
    • an initialization function
    • +
    • a shutdown function
    • +

    Registering a module

    Currently a libxslt module has to be compiled within the application using +libxslt. There is no code to load dynamically shared libraries associated to +a namespace (this may be added but is likely to become a portability +nightmare).

    The current way to register a module is to link the code implementing it +with the application and to call a registration function:

    int xsltRegisterExtModule(const xmlChar *URI,
    +                          xsltExtInitFunction initFunc,
    +                          xsltExtShutdownFunction shutdownFunc);

    The associated header is read by:

    #include<libxslt/extensions.h>

    which also defines the type for the initialization and shutdown +functions

    Loading a module

    Once the module URI has been registered and if the XSLT processor detects +that a given stylesheet needs the functionalities of an extended module, this +one is initialized.

    The xsltExtInitFunction type defines the interface for an initialization +function:

    /**
    + * xsltExtInitFunction:
    + * @ctxt:  an XSLT transformation context
    + * @URI:  the namespace URI for the extension
    + *
    + * A function called at initialization time of an XSLT
    + * extension module
    + *
    + * Returns a pointer to the module specific data for this
    + * transformation
    + */
    +typedef void *(*xsltExtInitFunction)(xsltTransformContextPtr ctxt,
    +                                     const xmlChar *URI);

    There are 3 things to notice:

      +
    • The function gets passed the namespace name URI as an argument. This + allows a single function to provide the initialization for multiple + logical modules.
    • +
    • It also gets passed a transformation context. The initialization is + done at run time before any processing occurs on the stylesheet but it + will be invoked separately each time for each transformation.
    • +
    • It returns a pointer. This can be used to store module specific + information which can be retrieved later when a function or an element + from the extension is used. An obvious example is a connection to a + database which should be kept and reused along with the transformation. + NULL is a perfectly valid return; there is no way to indicate a failure + at this level
    • +

    What this function is expected to do is:

      +
    • prepare the context for this module (like opening the database + connection)
    • +
    • register the extensions specific to this module
    • +

    Registering an extension function

    There is a single call to do this registration:

    int xsltRegisterExtFunction(xsltTransformContextPtr ctxt,
    +                            const xmlChar *name,
    +                            const xmlChar *URI,
    +                            xmlXPathEvalFunc function);

    The registration is bound to a single transformation instance referred by +ctxt, name is the UTF8 encoded name for the NCName of the function, and URI +is the namespace name for the extension (no checking is done, a module could +register functions or elements from a different namespace, but it is not +recommended).

    Implementing an extension function

    The implementation of the function must have the signature of a libxml +XPath function:

    /**
    + * xmlXPathEvalFunc:
    + * @ctxt: an XPath parser context
    + * @nargs: the number of arguments passed to the function
    + *
    + * an XPath evaluation function, the parameters are on the
    + * XPath context stack
    + */
    +
    +typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt,
    +                                 int nargs);

    The context passed to an XPath function is not an XSLT context but an XPath context. However it is possible to +find one from the other:

      +
    • The function xsltXPathGetTransformContext provides this lookup facility: +
      xsltTransformContextPtr
      +         xsltXPathGetTransformContext
      +                          (xmlXPathParserContextPtr ctxt);
      +
    • +
    • The xmlXPathContextPtr associated to an + xsltTransformContext is stored in the xpathCtxt + field.
    • +

    The first thing an extension function may want to do is to check the +arguments passed on the stack, the nargs parameter will tell how +many of them were provided on the XPath expression. The macro valuePop will +extract them from the XPath stack:

    #include <libxml/xpath.h>
    +#include <libxml/xpathInternals.h>
    +
    +xmlXPathObjectPtr obj = valuePop(ctxt); 

    Note that ctxt is the XPath context not the XSLT one. It is +then possible to examine the content of the value. Check the description of XPath objects if +necessary. The following is a common sequence checking whether the argument +passed is a string and converting it using the built-in XPath +string() function if this is not the case:

    if (obj->type != XPATH_STRING) {
    +    valuePush(ctxt, obj);
    +    xmlXPathStringFunction(ctxt, 1);
    +    obj = valuePop(ctxt);
    +}

    Most common XPath functions are available directly at the C level and are +exported either in <libxml/xpath.h> or in +<libxml/xpathInternals.h>.

    The extension function may also need to retrieve the data associated to +this module instance (the database connection in the previous example) this +can be done using the xsltGetExtData:

    void * xsltGetExtData(xsltTransformContextPtr ctxt,
    +                      const xmlChar *URI);

    Again the URI to be provided is the one which was used when registering +the module.

    Once the function finishes, don't forget to:

      +
    • push the return value on the stack using valuePush(ctxt, + obj)
    • +
    • deallocate the parameters passed to the function using + xmlXPathFreeObject(obj)
    • +

    Examples for extension functions

    The module libxslt/functions.c contains the sources of the XSLT built-in +functions, including document(), key(), generate-id(), etc. as well as a full +example module at the end. Here is the test function implementation for the +libxslt:test function:

    /**
    + * xsltExtFunctionTest:
    + * @ctxt:  the XPath Parser context
    + * @nargs:  the number of arguments
    + *
    + * function libxslt:test() for testing the extensions support.
    + */
    +static void
    +xsltExtFunctionTest(xmlXPathParserContextPtr ctxt, int nargs)
    +{
    +    xsltTransformContextPtr tctxt;
    +    void *data;
    +
    +    tctxt = xsltXPathGetTransformContext(ctxt);
    +    if (tctxt == NULL) {
    +        xsltGenericError(xsltGenericErrorContext,
    +            "xsltExtFunctionTest: failed to get the transformation context\n");
    +        return;
    +    }
    +    data = xsltGetExtData(tctxt, (const xmlChar *) XSLT_DEFAULT_URL);
    +    if (data == NULL) {
    +        xsltGenericError(xsltGenericErrorContext,
    +            "xsltExtFunctionTest: failed to get module data\n");
    +        return;
    +    }
    +#ifdef WITH_XSLT_DEBUG_FUNCTION
    +    xsltGenericDebug(xsltGenericDebugContext,
    +                     "libxslt:test() called with %d args\n", nargs);
    +#endif
    +}

    Registering an extension element

    There is a single call to do this registration:

    int xsltRegisterExtElement(xsltTransformContextPtr ctxt,
    +                           const xmlChar *name,
    +                           const xmlChar *URI,
    +                           xsltTransformFunction function);

    It is similar to the mechanism used to register an extension function, +except that the signature of an extension element implementation is +different.

    The registration is bound to a single transformation instance referred to +by ctxt, name is the UTF8 encoded name for the NCName of the element, and URI +is the namespace name for the extension (no checking is done, a module could +register elements for a different namespace, but it is not recommended).

    Implementing an extension element

    The implementation of the element must have the signature of an XSLT +transformation function:

    /** 
    + * xsltTransformFunction: 
    + * @ctxt: the XSLT transformation context
    + * @node: the input node
    + * @inst: the stylesheet node 
    + * @comp: the compiled information from the stylesheet 
    + * 
    + * signature of the function associated to elements part of the
    + * stylesheet language like xsl:if or xsl:apply-templates.
    + */ 
    +typedef void (*xsltTransformFunction)
    +                          (xsltTransformContextPtr ctxt,
    +                           xmlNodePtr node,
    +                           xmlNodePtr inst,
    +                           xsltStylePreCompPtr comp);

    The first argument is the XSLT transformation context. The second and +third arguments are xmlNodePtr i.e. internal memory representation of XML nodes. They are +respectively node from the the input document being transformed +by the stylesheet and inst the extension element in the +stylesheet. The last argument is comp a pointer to a precompiled +representation of inst but usually for an extension function +this value is NULL by default (it could be added and associated +to the instruction in inst->_private).

    The same functions are available from a function implementing an extension +element as in an extension function, including +xsltGetExtData().

    The goal of an extension element being usually to enrich the generated +output, it is expected that they will grow the currently generated output +tree. This can be done by grabbing ctxt->insert which is the current +libxml node being generated (Note this can also be the intermediate value +tree being built for example to initialize a variable, the processing should +be similar). The functions for libxml tree manipulation from <libxml/tree.h> can +be employed to extend or modify the tree, but it is required to preserve the +insertion node and its ancestors since there are existing pointers to those +elements still in use in the XSLT template execution stack.

    Example for extension elements

    The module libxslt/transform.c contains the sources of the XSLT built-in +elements, including xsl:element, xsl:attribute, xsl:if, etc. There is a small +but full example in functions.c providing the implementation for the +libxslt:test element, it will output a comment in the result tree:

    /**
    + * xsltExtElementTest:
    + * @ctxt:  an XSLT processing context
    + * @node:  The current node
    + * @inst:  the instruction in the stylesheet
    + * @comp:  precomputed information
    + *
    + * Process a libxslt:test node
    + */
    +static void
    +xsltExtElementTest(xsltTransformContextPtr ctxt, xmlNodePtr node,
    +                   xmlNodePtr inst,
    +                   xsltStylePreCompPtr comp)
    +{
    +    xmlNodePtr comment;
    +
    +    if (ctxt == NULL) {
    +        xsltGenericError(xsltGenericErrorContext,
    +                         "xsltExtElementTest: no transformation context\n");
    +        return;
    +    }
    +    if (node == NULL) {
    +        xsltGenericError(xsltGenericErrorContext,
    +                         "xsltExtElementTest: no current node\n");
    +        return;
    +    }
    +    if (inst == NULL) {
    +        xsltGenericError(xsltGenericErrorContext,
    +                         "xsltExtElementTest: no instruction\n");
    +        return;
    +    }
    +    if (ctxt->insert == NULL) {
    +        xsltGenericError(xsltGenericErrorContext,
    +                         "xsltExtElementTest: no insertion point\n");
    +        return;
    +    }
    +    comment =
    +        xmlNewComment((const xmlChar *)
    +                      "libxslt:test element test worked");
    +    xmlAddChild(ctxt->insert, comment);
    +}

    The shutdown of a module

    When the XSLT processor ends a transformation, the shutdown function (if +it exists) for each of the modules initialized is called. The +xsltExtShutdownFunction type defines the interface for a shutdown +function:

    /**
    + * xsltExtShutdownFunction:
    + * @ctxt:  an XSLT transformation context
    + * @URI:  the namespace URI for the extension
    + * @data:  the data associated to this module
    + *
    + * A function called at shutdown time of an XSLT extension module
    + */
    +typedef void (*xsltExtShutdownFunction) (xsltTransformContextPtr ctxt,
    +                                         const xmlChar *URI,
    +                                         void *data);

    This is really similar to a module initialization function except a third +argument is passed, it's the value that was returned by the initialization +function. This allows the routine to deallocate resources from the module for +example close the connection to the database to keep the same example.

    Future work

    Well, some of the pieces missing:

      +
    • a way to load shared libraries to instantiate new modules
    • +
    • a better detection of extension functions usage and their registration + without having to use the extension prefix which ought to be reserved to + element extensions.
    • +
    • more examples
    • +
    • implementations of the EXSLT common + extension libraries, Thomas Broyer nearly finished implementing them.
    • +

    Daniel Veillard

    diff --git a/doc/gnome2.png b/doc/gnome2.png new file mode 100644 index 0000000..4a16fb1 Binary files /dev/null and b/doc/gnome2.png differ diff --git a/doc/help.html b/doc/help.html new file mode 100644 index 0000000..108d616 --- /dev/null +++ b/doc/help.html @@ -0,0 +1,26 @@ + + +How to help
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    How to help

    Main Menu
    Related links
    API Indexes

    You can help the project in various ways, the best thing to do first is to +subscribe to the mailing-list as explained before, check the archives and the GNOME bug +database::

      +
    1. provide patches when you find problems
    2. +
    3. provide the diffs when you port libxslt to a new platform. They may not + be integrated in all cases but help pinpointing portability problems + and
    4. +
    5. provide documentation fixes (either as patches to the code comments or + as HTML diffs).
    6. +
    7. provide new documentations pieces (translations, examples, etc ...)
    8. +
    9. Check the TODO file and try to close one of the items
    10. +
    11. take one of the points raised in the archive or the bug database and + provide a fix. Get in touch with me + before to avoid synchronization problems and check that the suggested + fix will fit in nicely :-)
    12. +

    Daniel Veillard

    diff --git a/doc/html/book1.html b/doc/html/book1.html new file mode 100644 index 0000000..f3ccb11 --- /dev/null +++ b/doc/html/book1.html @@ -0,0 +1,10 @@ + + +Reference Manual for libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Reference Manual for libxslt

    API Menu
    Related links
    API Indexes

    Table of Contents

    • attributes: interface for the XSLT attribute handling
    • documents: interface for the document handling
    • extensions: interface for the extension support
    • extra: interface for the non-standard features
    • functions: interface for the XSLT functions not from XPath
    • imports: interface for the XSLT import support
    • keys: interface for the key matching used in key() and template matches.
    • namespaces: interface for the XSLT namespace handling
    • numbersInternals: Implementation of the XSLT number functions
    • pattern: interface for the pattern matching used in template matches.
    • preproc: precomputing stylesheets
    • security: interface for the libxslt security framework
    • templates: interface for the template processing
    • transform: the XSLT engine transformation part.
    • variables: interface for the variable matching and lookup.
    • xslt: Interfaces, constants and types related to the XSLT engine
    • xsltInternals: internal data structures, constants and functions
    • xsltexports: macros for marking symbols as exportable/importable.
    • xsltlocale: Locale handling
    • xsltutils: set of utilities for the XSLT engine

    Daniel Veillard

    diff --git a/doc/html/home.png b/doc/html/home.png new file mode 100644 index 0000000..1700361 Binary files /dev/null and b/doc/html/home.png differ diff --git a/doc/html/index.html b/doc/html/index.html new file mode 100644 index 0000000..f3ccb11 --- /dev/null +++ b/doc/html/index.html @@ -0,0 +1,10 @@ + + +Reference Manual for libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Reference Manual for libxslt

    API Menu
    Related links
    API Indexes

    Table of Contents

    • attributes: interface for the XSLT attribute handling
    • documents: interface for the document handling
    • extensions: interface for the extension support
    • extra: interface for the non-standard features
    • functions: interface for the XSLT functions not from XPath
    • imports: interface for the XSLT import support
    • keys: interface for the key matching used in key() and template matches.
    • namespaces: interface for the XSLT namespace handling
    • numbersInternals: Implementation of the XSLT number functions
    • pattern: interface for the pattern matching used in template matches.
    • preproc: precomputing stylesheets
    • security: interface for the libxslt security framework
    • templates: interface for the template processing
    • transform: the XSLT engine transformation part.
    • variables: interface for the variable matching and lookup.
    • xslt: Interfaces, constants and types related to the XSLT engine
    • xsltInternals: internal data structures, constants and functions
    • xsltexports: macros for marking symbols as exportable/importable.
    • xsltlocale: Locale handling
    • xsltutils: set of utilities for the XSLT engine

    Daniel Veillard

    diff --git a/doc/html/left.png b/doc/html/left.png new file mode 100644 index 0000000..2d05b3d Binary files /dev/null and b/doc/html/left.png differ diff --git a/doc/html/libxslt-attributes.html b/doc/html/libxslt-attributes.html new file mode 100644 index 0000000..84f4862 --- /dev/null +++ b/doc/html/libxslt-attributes.html @@ -0,0 +1,23 @@ + + +Module attributes from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module attributes from libxslt

    API Menu
    Related links
    API Indexes

    this module handles the specificities of attribute and attribute groups processing.

    Table of Contents

    void	xsltApplyAttributeSet		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    const xmlChar * attrSets)
    +
    void	xsltFreeAttributeSetsHashes	(xsltStylesheetPtr style)
    +
    void	xsltParseStylesheetAttributeSet	(xsltStylesheetPtr style, 
    xmlNodePtr cur)
    +
    void	xsltResolveStylesheetAttributeSet	(xsltStylesheetPtr style)
    +

    Description

    +

    Function: xsltApplyAttributeSet

    void	xsltApplyAttributeSet		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    const xmlChar * attrSets)
    +

    Apply the xsl:use-attribute-sets. If @attrSets is NULL, then @inst will be used to exctract this value. If both, @attrSets and @inst, are NULL, then this will do nothing.

    +
    ctxt:the XSLT stylesheet
    node:the node in the source tree.
    inst:the attribute node "xsl:use-attribute-sets"
    attrSets:the list of QNames of the attribute-sets to be applied

    Function: xsltFreeAttributeSetsHashes

    void	xsltFreeAttributeSetsHashes	(xsltStylesheetPtr style)
    +

    Free up the memory used by attribute sets

    +
    style:an XSLT stylesheet

    Function: xsltParseStylesheetAttributeSet

    void	xsltParseStylesheetAttributeSet	(xsltStylesheetPtr style, 
    xmlNodePtr cur)
    +

    parse an XSLT stylesheet attribute-set element

    +
    style:the XSLT stylesheet
    cur:the "attribute-set" element

    Function: xsltResolveStylesheetAttributeSet

    void	xsltResolveStylesheetAttributeSet	(xsltStylesheetPtr style)
    +

    resolve the references between attribute sets.

    +
    style:the XSLT stylesheet

    Daniel Veillard

    diff --git a/doc/html/libxslt-documents.html b/doc/html/libxslt-documents.html new file mode 100644 index 0000000..57e9b8b --- /dev/null +++ b/doc/html/libxslt-documents.html @@ -0,0 +1,47 @@ + + +Module documents from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module documents from libxslt

    API Menu
    Related links
    API Indexes

    implements document loading and cache (multiple document() reference for the same resources must be equal.

    Table of Contents

    Enum xsltLoadType
    +
    Function type: xsltDocLoaderFunc
    +xmlDocPtr	xsltDocLoaderFunc	(const xmlChar * URI, 
    xmlDictPtr dict,
    int options,
    void * ctxt,
    xsltLoadType type) +
    +
    xsltDocumentPtr	xsltFindDocument	(xsltTransformContextPtr ctxt, 
    xmlDocPtr doc)
    +
    void	xsltFreeDocuments		(xsltTransformContextPtr ctxt)
    +
    void	xsltFreeStyleDocuments		(xsltStylesheetPtr style)
    +
    xsltDocumentPtr	xsltLoadDocument	(xsltTransformContextPtr ctxt, 
    const xmlChar * URI)
    +
    xsltDocumentPtr	xsltLoadStyleDocument	(xsltStylesheetPtr style, 
    const xmlChar * URI)
    +
    xsltDocumentPtr	xsltNewDocument		(xsltTransformContextPtr ctxt, 
    xmlDocPtr doc)
    +
    xsltDocumentPtr	xsltNewStyleDocument	(xsltStylesheetPtr style, 
    xmlDocPtr doc)
    +
    void	xsltSetLoaderFunc		(xsltDocLoaderFunc f)
    +

    Description

    +

    Enum xsltLoadType

    Enum xsltLoadType {
    +    XSLT_LOAD_START = 0 : loading for a top stylesheet
    +    XSLT_LOAD_STYLESHEET = 1 : loading for a stylesheet include/import
    +    XSLT_LOAD_DOCUMENT = 2 : loading document at transformation time
    +}
    +

    Function type: xsltDocLoaderFunc

    Function type: xsltDocLoaderFunc
    +xmlDocPtr	xsltDocLoaderFunc	(const xmlChar * URI, 
    xmlDictPtr dict,
    int options,
    void * ctxt,
    xsltLoadType type) +

    An xsltDocLoaderFunc is a signature for a function which can be registered to load document not provided by the compilation or transformation API themselve, for example when an xsl:import, xsl:include is found at compilation time or when a document() call is made at runtime.

    URI:the URI of the document to load
    dict:the dictionary to use when parsing that document
    options:parsing options, a set of xmlParserOption
    ctxt:the context, either a stylesheet or a transformation context
    type:the xsltLoadType indicating the kind of loading required
    Returns:the pointer to the document (which will be modified and freed by the engine later), or NULL in case of error.

    +

    Function: xsltFindDocument

    xsltDocumentPtr	xsltFindDocument	(xsltTransformContextPtr ctxt, 
    xmlDocPtr doc)
    +

    Try to find a document within the XSLT transformation context. This will not find document infos for temporary Result Tree Fragments.

    +
    ctxt:an XSLT transformation context
    doc:a parsed XML document
    Returns:the desired xsltDocumentPtr or NULL in case of error

    Function: xsltFreeDocuments

    void	xsltFreeDocuments		(xsltTransformContextPtr ctxt)
    +

    Free up all the space used by the loaded documents

    +
    ctxt:an XSLT transformation context

    Function: xsltFreeStyleDocuments

    void	xsltFreeStyleDocuments		(xsltStylesheetPtr style)
    +

    Frees the node-trees (and xsltDocument structures) of all stylesheet-modules of the stylesheet-level represented by the given @style.

    +
    style:an XSLT stylesheet (representing a stylesheet-level)

    Function: xsltLoadDocument

    xsltDocumentPtr	xsltLoadDocument	(xsltTransformContextPtr ctxt, 
    const xmlChar * URI)
    +

    Try to load a document (not a stylesheet) within the XSLT transformation context

    +
    ctxt:an XSLT transformation context
    URI:the computed URI of the document
    Returns:the new xsltDocumentPtr or NULL in case of error

    Function: xsltLoadStyleDocument

    xsltDocumentPtr	xsltLoadStyleDocument	(xsltStylesheetPtr style, 
    const xmlChar * URI)
    +

    Try to load a stylesheet document within the XSLT transformation context

    +
    style:an XSLT style sheet
    URI:the computed URI of the document
    Returns:the new xsltDocumentPtr or NULL in case of error

    Function: xsltNewDocument

    xsltDocumentPtr	xsltNewDocument		(xsltTransformContextPtr ctxt, 
    xmlDocPtr doc)
    +

    Register a new document, apply key computations

    +
    ctxt:an XSLT transformation context (or NULL)
    doc:a parsed XML document
    Returns:a handler to the document

    Function: xsltNewStyleDocument

    xsltDocumentPtr	xsltNewStyleDocument	(xsltStylesheetPtr style, 
    xmlDocPtr doc)
    +

    Register a new document, apply key computations

    +
    style:an XSLT style sheet
    doc:a parsed XML document
    Returns:a handler to the document

    Function: xsltSetLoaderFunc

    void	xsltSetLoaderFunc		(xsltDocLoaderFunc f)
    +

    Set the new function to load document, if NULL it resets it to the default function.

    +
    f:the new function to handle document loading.

    Daniel Veillard

    diff --git a/doc/html/libxslt-extensions.html b/doc/html/libxslt-extensions.html new file mode 100644 index 0000000..40b61ff --- /dev/null +++ b/doc/html/libxslt-extensions.html @@ -0,0 +1,152 @@ + + +Module extensions from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module extensions from libxslt

    API Menu
    Related links
    API Indexes

    This provide the API needed for simple and module extension support.

    Table of Contents

    int	xsltCheckExtPrefix		(xsltStylesheetPtr style, 
    const xmlChar * URI)
    +
    int	xsltCheckExtURI			(xsltStylesheetPtr style, 
    const xmlChar * URI)
    +
    void	xsltDebugDumpExtensions		(FILE * output)
    +
    xsltTransformFunction	xsltExtElementLookup	(xsltTransformContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * URI)
    +
    Function type: xsltExtInitFunction
    +void *	xsltExtInitFunction		(xsltTransformContextPtr ctxt, 
    const xmlChar * URI) +
    +
    xsltTransformFunction	xsltExtModuleElementLookup	(const xmlChar * name, 
    const xmlChar * URI)
    +
    xsltPreComputeFunction	xsltExtModuleElementPreComputeLookup	(const xmlChar * name, 
    const xmlChar * URI)
    +
    xmlXPathFunction	xsltExtModuleFunctionLookup	(const xmlChar * name, 
    const xmlChar * URI)
    +
    xsltTopLevelFunction	xsltExtModuleTopLevelLookup	(const xmlChar * name, 
    const xmlChar * URI)
    +
    Function type: xsltExtShutdownFunction
    +void	xsltExtShutdownFunction		(xsltTransformContextPtr ctxt, 
    const xmlChar * URI,
    void * data) +
    +
    void	xsltFreeCtxtExts		(xsltTransformContextPtr ctxt)
    +
    void	xsltFreeExts			(xsltStylesheetPtr style)
    +
    void *	xsltGetExtData			(xsltTransformContextPtr ctxt, 
    const xmlChar * URI)
    +
    xmlHashTablePtr	xsltGetExtInfo		(xsltStylesheetPtr style, 
    const xmlChar * URI)
    +
    int	xsltInitCtxtExts		(xsltTransformContextPtr ctxt)
    +
    void	xsltInitElemPreComp		(xsltElemPreCompPtr comp, 
    xsltStylesheetPtr style,
    xmlNodePtr inst,
    xsltTransformFunction function,
    xsltElemPreCompDeallocator freeFunc)
    +
    void	xsltInitGlobals			(void)
    +
    xsltElemPreCompPtr	xsltNewElemPreComp	(xsltStylesheetPtr style, 
    xmlNodePtr inst,
    xsltTransformFunction function)
    +
    xsltElemPreCompPtr	xsltPreComputeExtModuleElement	(xsltStylesheetPtr style, 
    xmlNodePtr inst)
    +
    Function type: xsltPreComputeFunction
    +xsltElemPreCompPtr	xsltPreComputeFunction	(xsltStylesheetPtr style, 
    xmlNodePtr inst,
    xsltTransformFunction function) +
    +
    int	xsltRegisterExtElement		(xsltTransformContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * URI,
    xsltTransformFunction function)
    +
    int	xsltRegisterExtFunction		(xsltTransformContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * URI,
    xmlXPathFunction function)
    +
    int	xsltRegisterExtModule		(const xmlChar * URI, 
    xsltExtInitFunction initFunc,
    xsltExtShutdownFunction shutdownFunc)
    +
    int	xsltRegisterExtModuleElement	(const xmlChar * name, 
    const xmlChar * URI,
    xsltPreComputeFunction precomp,
    xsltTransformFunction transform)
    +
    int	xsltRegisterExtModuleFull	(const xmlChar * URI, 
    xsltExtInitFunction initFunc,
    xsltExtShutdownFunction shutdownFunc,
    xsltStyleExtInitFunction styleInitFunc,
    xsltStyleExtShutdownFunction styleShutdownFunc)
    +
    int	xsltRegisterExtModuleFunction	(const xmlChar * name, 
    const xmlChar * URI,
    xmlXPathFunction function)
    +
    int	xsltRegisterExtModuleTopLevel	(const xmlChar * name, 
    const xmlChar * URI,
    xsltTopLevelFunction function)
    +
    int	xsltRegisterExtPrefix		(xsltStylesheetPtr style, 
    const xmlChar * prefix,
    const xmlChar * URI)
    +
    void	xsltRegisterTestModule		(void)
    +
    void	xsltShutdownCtxtExts		(xsltTransformContextPtr ctxt)
    +
    void	xsltShutdownExts		(xsltStylesheetPtr style)
    +
    Function type: xsltStyleExtInitFunction
    +void *	xsltStyleExtInitFunction	(xsltStylesheetPtr style, 
    const xmlChar * URI) +
    +
    Function type: xsltStyleExtShutdownFunction
    +void	xsltStyleExtShutdownFunction	(xsltStylesheetPtr style, 
    const xmlChar * URI,
    void * data) +
    +
    void *	xsltStyleGetExtData		(xsltStylesheetPtr style, 
    const xmlChar * URI)
    +
    void *	xsltStyleStylesheetLevelGetExtData	(xsltStylesheetPtr style, 
    const xmlChar * URI)
    +
    Function type: xsltTopLevelFunction
    +void	xsltTopLevelFunction		(xsltStylesheetPtr style, 
    xmlNodePtr inst) +
    +
    int	xsltUnregisterExtModule		(const xmlChar * URI)
    +
    int	xsltUnregisterExtModuleElement	(const xmlChar * name, 
    const xmlChar * URI)
    +
    int	xsltUnregisterExtModuleFunction	(const xmlChar * name, 
    const xmlChar * URI)
    +
    int	xsltUnregisterExtModuleTopLevel	(const xmlChar * name, 
    const xmlChar * URI)
    +
    xsltTransformContextPtr	xsltXPathGetTransformContext	(xmlXPathParserContextPtr ctxt)
    +

    Description

    +

    Function: xsltCheckExtPrefix

    int	xsltCheckExtPrefix		(xsltStylesheetPtr style, 
    const xmlChar * URI)
    +

    Check if the given prefix is one of the declared extensions. This is intended to be called only at compile-time. Called by: xsltGetInheritedNsList() (xslt.c) xsltParseTemplateContent (xslt.c)

    +
    style:the stylesheet
    URI:the namespace prefix (possibly NULL)
    Returns:1 if this is an extension, 0 otherwise

    Function: xsltCheckExtURI

    int	xsltCheckExtURI			(xsltStylesheetPtr style, 
    const xmlChar * URI)
    +

    Check if the given prefix is one of the declared extensions. This is intended to be called only at compile-time. Called by: xsltPrecomputeStylesheet() (xslt.c) xsltParseTemplateContent (xslt.c)

    +
    style:the stylesheet
    URI:the namespace URI (possibly NULL)
    Returns:1 if this is an extension, 0 otherwise

    Function: xsltDebugDumpExtensions

    void	xsltDebugDumpExtensions		(FILE * output)
    +

    Dumps a list of the registered XSLT extension functions and elements

    +
    output:the FILE * for the output, if NULL stdout is used

    Function: xsltExtElementLookup

    xsltTransformFunction	xsltExtElementLookup	(xsltTransformContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * URI)
    +

    Looks up an extension element. @ctxt can be NULL to search only in module elements.

    +
    ctxt:an XSLT process context
    name:the element name
    URI:the element namespace URI
    Returns:the element callback or NULL if not found

    Function type: xsltExtInitFunction

    Function type: xsltExtInitFunction
    +void *	xsltExtInitFunction		(xsltTransformContextPtr ctxt, 
    const xmlChar * URI) +

    A function called at initialization time of an XSLT extension module.

    ctxt:an XSLT transformation context
    URI:the namespace URI for the extension
    Returns:a pointer to the module specific data for this transformation.

    +

    Function: xsltExtModuleElementLookup

    xsltTransformFunction	xsltExtModuleElementLookup	(const xmlChar * name, 
    const xmlChar * URI)
    +

    Looks up an extension module element

    +
    name:the element name
    URI:the element namespace URI
    Returns:the callback function if found, NULL otherwise.

    Function: xsltExtModuleElementPreComputeLookup

    xsltPreComputeFunction	xsltExtModuleElementPreComputeLookup	(const xmlChar * name, 
    const xmlChar * URI)
    +

    Looks up an extension module element pre-computation function

    +
    name:the element name
    URI:the element namespace URI
    Returns:the callback function if found, NULL otherwise.

    Function: xsltExtModuleFunctionLookup

    xmlXPathFunction	xsltExtModuleFunctionLookup	(const xmlChar * name, 
    const xmlChar * URI)
    +

    Looks up an extension module function

    +
    name:the function name
    URI:the function namespace URI
    Returns:the function if found, NULL otherwise.

    Function: xsltExtModuleTopLevelLookup

    xsltTopLevelFunction	xsltExtModuleTopLevelLookup	(const xmlChar * name, 
    const xmlChar * URI)
    +

    Looks up an extension module top-level element

    +
    name:the top-level element name
    URI:the top-level element namespace URI
    Returns:the callback function if found, NULL otherwise.

    Function type: xsltExtShutdownFunction

    Function type: xsltExtShutdownFunction
    +void	xsltExtShutdownFunction		(xsltTransformContextPtr ctxt, 
    const xmlChar * URI,
    void * data) +

    A function called at shutdown time of an XSLT extension module.

    ctxt:an XSLT transformation context
    URI:the namespace URI for the extension
    data:the data associated to this module

    +

    Function: xsltFreeCtxtExts

    void	xsltFreeCtxtExts		(xsltTransformContextPtr ctxt)
    +

    Free the XSLT extension data

    +
    ctxt:an XSLT transformation context

    Function: xsltFreeExts

    void	xsltFreeExts			(xsltStylesheetPtr style)
    +

    Free up the memory used by XSLT extensions in a stylesheet

    +
    style:an XSLT stylesheet

    Function: xsltGetExtData

    void *	xsltGetExtData			(xsltTransformContextPtr ctxt, 
    const xmlChar * URI)
    +

    Retrieve the data associated to the extension module in this given transformation.

    +
    ctxt:an XSLT transformation context
    URI:the URI associated to the exension module
    Returns:the pointer or NULL if not present

    Function: xsltGetExtInfo

    xmlHashTablePtr	xsltGetExtInfo		(xsltStylesheetPtr style, 
    const xmlChar * URI)
    +

    looks up URI in extInfos of the stylesheet

    +
    style:pointer to a stylesheet
    URI:the namespace URI desired
    Returns:a pointer to the hash table if found, else NULL

    Function: xsltInitCtxtExts

    int	xsltInitCtxtExts		(xsltTransformContextPtr ctxt)
    +

    Initialize the set of modules with registered stylesheet data

    +
    ctxt:an XSLT transformation context
    Returns:the number of modules initialized or -1 in case of error

    Function: xsltInitElemPreComp

    void	xsltInitElemPreComp		(xsltElemPreCompPtr comp, 
    xsltStylesheetPtr style,
    xmlNodePtr inst,
    xsltTransformFunction function,
    xsltElemPreCompDeallocator freeFunc)
    +

    Initializes an existing #xsltElemPreComp structure. This is usefull when extending an #xsltElemPreComp to store precomputed data. This function MUST be called on any extension element precomputed data struct.

    +
    comp:an #xsltElemPreComp (or generally a derived structure)
    style:the XSLT stylesheet
    inst:the element node
    function:the transform function
    freeFunc:the @comp deallocator

    Function: xsltInitGlobals

    void	xsltInitGlobals			(void)
    +

    Initialize the global variables for extensions

    +

    Function: xsltNewElemPreComp

    xsltElemPreCompPtr	xsltNewElemPreComp	(xsltStylesheetPtr style, 
    xmlNodePtr inst,
    xsltTransformFunction function)
    +

    Creates and initializes an #xsltElemPreComp

    +
    style:the XSLT stylesheet
    inst:the element node
    function:the transform function
    Returns:the new and initialized #xsltElemPreComp

    Function: xsltPreComputeExtModuleElement

    xsltElemPreCompPtr	xsltPreComputeExtModuleElement	(xsltStylesheetPtr style, 
    xmlNodePtr inst)
    +

    Precomputes an extension module element

    +
    style:the stylesheet
    inst:the element node
    Returns:the precomputed data

    Function type: xsltPreComputeFunction

    Function type: xsltPreComputeFunction
    +xsltElemPreCompPtr	xsltPreComputeFunction	(xsltStylesheetPtr style, 
    xmlNodePtr inst,
    xsltTransformFunction function) +

    style:
    inst:
    function:
    Returns:

    +

    Function: xsltRegisterExtElement

    int	xsltRegisterExtElement		(xsltTransformContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * URI,
    xsltTransformFunction function)
    +

    Registers an extension element

    +
    ctxt:an XSLT transformation context
    name:the name of the element
    URI:the URI associated to the element
    function:the actual implementation which should be called
    Returns:0 in case of success, -1 in case of failure

    Function: xsltRegisterExtFunction

    int	xsltRegisterExtFunction		(xsltTransformContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * URI,
    xmlXPathFunction function)
    +

    Registers an extension function

    +
    ctxt:an XSLT transformation context
    name:the name of the element
    URI:the URI associated to the element
    function:the actual implementation which should be called
    Returns:0 in case of success, -1 in case of failure

    Function: xsltRegisterExtModule

    int	xsltRegisterExtModule		(const xmlChar * URI, 
    xsltExtInitFunction initFunc,
    xsltExtShutdownFunction shutdownFunc)
    +

    Register an XSLT extension module to the library.

    +
    URI:URI associated to this module
    initFunc:the module initialization function
    shutdownFunc:the module shutdown function
    Returns:0 if sucessful, -1 in case of error

    Function: xsltRegisterExtModuleElement

    int	xsltRegisterExtModuleElement	(const xmlChar * name, 
    const xmlChar * URI,
    xsltPreComputeFunction precomp,
    xsltTransformFunction transform)
    +

    Registers an extension module element.

    +
    name:the element name
    URI:the element namespace URI
    precomp:the pre-computation callback
    transform:the transformation callback
    Returns:0 if successful, -1 in case of error.

    Function: xsltRegisterExtModuleFull

    int	xsltRegisterExtModuleFull	(const xmlChar * URI, 
    xsltExtInitFunction initFunc,
    xsltExtShutdownFunction shutdownFunc,
    xsltStyleExtInitFunction styleInitFunc,
    xsltStyleExtShutdownFunction styleShutdownFunc)
    +

    Register an XSLT extension module to the library.

    +
    URI:URI associated to this module
    initFunc:the module initialization function
    shutdownFunc:the module shutdown function
    styleInitFunc:the module initialization function
    styleShutdownFunc:the module shutdown function
    Returns:0 if sucessful, -1 in case of error

    Function: xsltRegisterExtModuleFunction

    int	xsltRegisterExtModuleFunction	(const xmlChar * name, 
    const xmlChar * URI,
    xmlXPathFunction function)
    +

    Registers an extension module function.

    +
    name:the function name
    URI:the function namespace URI
    function:the function callback
    Returns:0 if successful, -1 in case of error.

    Function: xsltRegisterExtModuleTopLevel

    int	xsltRegisterExtModuleTopLevel	(const xmlChar * name, 
    const xmlChar * URI,
    xsltTopLevelFunction function)
    +

    Registers an extension module top-level element.

    +
    name:the top-level element name
    URI:the top-level element namespace URI
    function:the top-level element callback
    Returns:0 if successful, -1 in case of error.

    Function: xsltRegisterExtPrefix

    int	xsltRegisterExtPrefix		(xsltStylesheetPtr style, 
    const xmlChar * prefix,
    const xmlChar * URI)
    +

    Registers an extension namespace This is called from xslt.c during compile-time. The given prefix is not needed. Called by: xsltParseExtElemPrefixes() (new function) xsltRegisterExtPrefix() (old function)

    +
    style:an XSLT stylesheet
    prefix:the prefix used (optional)
    URI:the URI associated to the extension
    Returns:0 in case of success, 1 if the @URI was already registered as an extension namespace and -1 in case of failure

    Function: xsltRegisterTestModule

    void	xsltRegisterTestModule		(void)
    +

    Registers the test module

    +

    Function: xsltShutdownCtxtExts

    void	xsltShutdownCtxtExts		(xsltTransformContextPtr ctxt)
    +

    Shutdown the set of modules loaded

    +
    ctxt:an XSLT transformation context

    Function: xsltShutdownExts

    void	xsltShutdownExts		(xsltStylesheetPtr style)
    +

    Shutdown the set of modules loaded

    +
    style:an XSLT stylesheet

    Function type: xsltStyleExtInitFunction

    Function type: xsltStyleExtInitFunction
    +void *	xsltStyleExtInitFunction	(xsltStylesheetPtr style, 
    const xmlChar * URI) +

    A function called at initialization time of an XSLT extension module.

    style:
    URI:the namespace URI for the extension
    Returns:a pointer to the module specific data for this transformation.

    +

    Function type: xsltStyleExtShutdownFunction

    Function type: xsltStyleExtShutdownFunction
    +void	xsltStyleExtShutdownFunction	(xsltStylesheetPtr style, 
    const xmlChar * URI,
    void * data) +

    A function called at shutdown time of an XSLT extension module.

    style:
    URI:the namespace URI for the extension
    data:the data associated to this module

    +

    Function: xsltStyleGetExtData

    void *	xsltStyleGetExtData		(xsltStylesheetPtr style, 
    const xmlChar * URI)
    +

    Retrieve the data associated to the extension module in this given stylesheet. Called by: xsltRegisterExtPrefix(), ( xsltExtElementPreCompTest(), xsltExtInitTest )

    +
    style:an XSLT stylesheet
    URI:the URI associated to the exension module
    Returns:the pointer or NULL if not present

    Function: xsltStyleStylesheetLevelGetExtData

    void *	xsltStyleStylesheetLevelGetExtData	(xsltStylesheetPtr style, 
    const xmlChar * URI)
    +

    Retrieve the data associated to the extension module in this given stylesheet.

    +
    style:an XSLT stylesheet
    URI:the URI associated to the exension module
    Returns:the pointer or NULL if not present

    Function type: xsltTopLevelFunction

    Function type: xsltTopLevelFunction
    +void	xsltTopLevelFunction		(xsltStylesheetPtr style, 
    xmlNodePtr inst) +

    style:
    inst:

    +

    Function: xsltUnregisterExtModule

    int	xsltUnregisterExtModule		(const xmlChar * URI)
    +

    Unregister an XSLT extension module from the library.

    +
    URI:URI associated to this module
    Returns:0 if sucessful, -1 in case of error

    Function: xsltUnregisterExtModuleElement

    int	xsltUnregisterExtModuleElement	(const xmlChar * name, 
    const xmlChar * URI)
    +

    Unregisters an extension module element

    +
    name:the element name
    URI:the element namespace URI
    Returns:0 if successful, -1 in case of error.

    Function: xsltUnregisterExtModuleFunction

    int	xsltUnregisterExtModuleFunction	(const xmlChar * name, 
    const xmlChar * URI)
    +

    Unregisters an extension module function

    +
    name:the function name
    URI:the function namespace URI
    Returns:0 if successful, -1 in case of error.

    Function: xsltUnregisterExtModuleTopLevel

    int	xsltUnregisterExtModuleTopLevel	(const xmlChar * name, 
    const xmlChar * URI)
    +

    Unregisters an extension module top-level element

    +
    name:the top-level element name
    URI:the top-level element namespace URI
    Returns:0 if successful, -1 in case of error.

    Function: xsltXPathGetTransformContext

    xsltTransformContextPtr	xsltXPathGetTransformContext	(xmlXPathParserContextPtr ctxt)
    +

    Provides the XSLT transformation context from the XPath transformation context. This is useful when an XPath function in the extension module is called by the XPath interpreter and that the XSLT context is needed for example to retrieve the associated data pertaining to this XSLT transformation.

    +
    ctxt:an XPath transformation context
    Returns:the XSLT transformation context or NULL in case of error.

    Daniel Veillard

    diff --git a/doc/html/libxslt-extra.html b/doc/html/libxslt-extra.html new file mode 100644 index 0000000..9e03622 --- /dev/null +++ b/doc/html/libxslt-extra.html @@ -0,0 +1,28 @@ + + +Module extra from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module extra from libxslt

    API Menu
    Related links
    API Indexes

    implement some extension outside the XSLT namespace but not EXSLT with is in a different library.

    Table of Contents

    #define XSLT_LIBXSLT_NAMESPACE
    #define XSLT_NORM_SAXON_NAMESPACE
    #define XSLT_SAXON_NAMESPACE
    #define XSLT_XALAN_NAMESPACE
    #define XSLT_XT_NAMESPACE
    void	xsltDebug			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr comp)
    +
    void	xsltFunctionNodeSet		(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +
    void	xsltRegisterAllExtras		(void)
    +
    void	xsltRegisterExtras		(xsltTransformContextPtr ctxt)
    +

    Description

    +

    Macro: XSLT_LIBXSLT_NAMESPACE

    #define XSLT_LIBXSLT_NAMESPACE

    This is the libxslt namespace for specific extensions.

    +

    Macro: XSLT_NORM_SAXON_NAMESPACE

    #define XSLT_NORM_SAXON_NAMESPACE

    This is Norm's namespace for SAXON extensions.

    +

    Macro: XSLT_SAXON_NAMESPACE

    #define XSLT_SAXON_NAMESPACE

    This is Michael Kay's Saxon processor namespace for extensions.

    +

    Macro: XSLT_XALAN_NAMESPACE

    #define XSLT_XALAN_NAMESPACE

    This is the Apache project XALAN processor namespace for extensions.

    +

    Macro: XSLT_XT_NAMESPACE

    #define XSLT_XT_NAMESPACE

    This is James Clark's XT processor namespace for extensions.

    +

    Function: xsltDebug

    void	xsltDebug			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr comp)
    +

    Process an debug node

    +
    ctxt:an XSLT processing context
    node:The current node
    inst:the instruction in the stylesheet
    comp:precomputed informations

    Function: xsltFunctionNodeSet

    void	xsltFunctionNodeSet		(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +

    Implement the node-set() XSLT function node-set node-set(result-tree) This function is available in libxslt, saxon or xt namespace.

    +
    ctxt:the XPath Parser context
    nargs:the number of arguments

    Function: xsltRegisterAllExtras

    void	xsltRegisterAllExtras		(void)
    +

    Registers the built-in extensions

    +

    Function: xsltRegisterExtras

    void	xsltRegisterExtras		(xsltTransformContextPtr ctxt)
    +

    Registers the built-in extensions. This function is deprecated, use xsltRegisterAllExtras instead.

    +
    ctxt:a XSLT process context

    Daniel Veillard

    diff --git a/doc/html/libxslt-functions.html b/doc/html/libxslt-functions.html new file mode 100644 index 0000000..6e7c424 --- /dev/null +++ b/doc/html/libxslt-functions.html @@ -0,0 +1,42 @@ + + +Module functions from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module functions from libxslt

    API Menu
    Related links
    API Indexes

    a set of extra functions coming from XSLT but not in XPath

    Table of Contents

    #define XSLT_REGISTER_FUNCTION_LOOKUP
    void	xsltDocumentFunction		(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +
    void	xsltElementAvailableFunction	(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +
    void	xsltFormatNumberFunction	(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +
    void	xsltFunctionAvailableFunction	(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +
    void	xsltGenerateIdFunction		(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +
    void	xsltKeyFunction			(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +
    void	xsltRegisterAllFunctions	(xmlXPathContextPtr ctxt)
    +
    void	xsltSystemPropertyFunction	(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +
    void	xsltUnparsedEntityURIFunction	(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +
    xmlXPathFunction	xsltXPathFunctionLookup	(xmlXPathContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * ns_uri)
    +

    Description

    +

    Macro: XSLT_REGISTER_FUNCTION_LOOKUP

    #define XSLT_REGISTER_FUNCTION_LOOKUP

    Registering macro, not general purpose at all but used in different modules.

    +

    Function: xsltDocumentFunction

    void	xsltDocumentFunction		(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +

    Implement the document() XSLT function node-set document(object, node-set?)

    +
    ctxt:the XPath Parser context
    nargs:the number of arguments

    Function: xsltElementAvailableFunction

    void	xsltElementAvailableFunction	(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +

    Implement the element-available() XSLT function boolean element-available(string)

    +
    ctxt:the XPath Parser context
    nargs:the number of arguments

    Function: xsltFormatNumberFunction

    void	xsltFormatNumberFunction	(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +

    Implement the format-number() XSLT function string format-number(number, string, string?)

    +
    ctxt:the XPath Parser context
    nargs:the number of arguments

    Function: xsltFunctionAvailableFunction

    void	xsltFunctionAvailableFunction	(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +

    Implement the function-available() XSLT function boolean function-available(string)

    +
    ctxt:the XPath Parser context
    nargs:the number of arguments

    Function: xsltGenerateIdFunction

    void	xsltGenerateIdFunction		(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +

    Implement the generate-id() XSLT function string generate-id(node-set?)

    +
    ctxt:the XPath Parser context
    nargs:the number of arguments

    Function: xsltKeyFunction

    void	xsltKeyFunction			(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +

    Implement the key() XSLT function node-set key(string, object)

    +
    ctxt:the XPath Parser context
    nargs:the number of arguments

    Function: xsltRegisterAllFunctions

    void	xsltRegisterAllFunctions	(xmlXPathContextPtr ctxt)
    +

    Registers all default XSLT functions in this context

    +
    ctxt:the XPath context

    Function: xsltSystemPropertyFunction

    void	xsltSystemPropertyFunction	(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +

    Implement the system-property() XSLT function object system-property(string)

    +
    ctxt:the XPath Parser context
    nargs:the number of arguments

    Function: xsltUnparsedEntityURIFunction

    void	xsltUnparsedEntityURIFunction	(xmlXPathParserContextPtr ctxt, 
    int nargs)
    +

    Implement the unparsed-entity-uri() XSLT function string unparsed-entity-uri(string)

    +
    ctxt:the XPath Parser context
    nargs:the number of arguments

    Function: xsltXPathFunctionLookup

    xmlXPathFunction	xsltXPathFunctionLookup	(xmlXPathContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * ns_uri)
    +

    This is the entry point when a function is needed by the XPath interpretor.

    +
    ctxt:a void * but the XSLT transformation context actually
    name:the function name
    ns_uri:the function namespace URI
    Returns:the callback function or NULL if not found

    Daniel Veillard

    diff --git a/doc/html/libxslt-imports.html b/doc/html/libxslt-imports.html new file mode 100644 index 0000000..8b7de45 --- /dev/null +++ b/doc/html/libxslt-imports.html @@ -0,0 +1,31 @@ + + +Module imports from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module imports from libxslt

    API Menu
    Related links
    API Indexes

    macros and fuctions needed to implement and access the import tree

    Table of Contents

    #define XSLT_GET_IMPORT_INT
    #define XSLT_GET_IMPORT_PTR
    int	xsltFindElemSpaceHandling	(xsltTransformContextPtr ctxt, 
    xmlNodePtr node)
    +
    xsltTemplatePtr	xsltFindTemplate	(xsltTransformContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * nameURI)
    +
    int	xsltNeedElemSpaceHandling	(xsltTransformContextPtr ctxt)
    +
    xsltStylesheetPtr	xsltNextImport	(xsltStylesheetPtr cur)
    +
    int	xsltParseStylesheetImport	(xsltStylesheetPtr style, 
    xmlNodePtr cur)
    +
    int	xsltParseStylesheetInclude	(xsltStylesheetPtr style, 
    xmlNodePtr cur)
    +

    Description

    +

    Macro: XSLT_GET_IMPORT_INT

    #define XSLT_GET_IMPORT_INT

    A macro to import intergers from the stylesheet cascading order.

    +

    Macro: XSLT_GET_IMPORT_PTR

    #define XSLT_GET_IMPORT_PTR

    A macro to import pointers from the stylesheet cascading order.

    +

    Function: xsltFindElemSpaceHandling

    int	xsltFindElemSpaceHandling	(xsltTransformContextPtr ctxt, 
    xmlNodePtr node)
    +

    Find strip-space or preserve-space informations for an element respect the import precedence or the wildcards

    +
    ctxt:an XSLT transformation context
    node:an XML node
    Returns:1 if space should be stripped, 0 if not, and 2 if everything should be CDTATA wrapped.

    Function: xsltFindTemplate

    xsltTemplatePtr	xsltFindTemplate	(xsltTransformContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * nameURI)
    +

    Finds the named template, apply import precedence rule. REVISIT TODO: We'll change the nameURI fields of templates to be in the string dict, so if the specified @nameURI is in the same dict, then use pointer comparison. Check if this can be done in a sane way. Maybe this function is not needed internally at transformation-time if we hard-wire the called templates to the caller.

    +
    ctxt:an XSLT transformation context
    name:the template name
    nameURI:the template name URI
    Returns:the xsltTemplatePtr or NULL if not found

    Function: xsltNeedElemSpaceHandling

    int	xsltNeedElemSpaceHandling	(xsltTransformContextPtr ctxt)
    +

    Checks whether that stylesheet requires white-space stripping

    +
    ctxt:an XSLT transformation context
    Returns:1 if space should be stripped, 0 if not

    Function: xsltNextImport

    xsltStylesheetPtr	xsltNextImport	(xsltStylesheetPtr cur)
    +

    Find the next stylesheet in import precedence.

    +
    cur:the current XSLT stylesheet
    Returns:the next stylesheet or NULL if it was the last one

    Function: xsltParseStylesheetImport

    int	xsltParseStylesheetImport	(xsltStylesheetPtr style, 
    xmlNodePtr cur)
    +

    parse an XSLT stylesheet import element

    +
    style:the XSLT stylesheet
    cur:the import element
    Returns:0 in case of success -1 in case of failure.

    Function: xsltParseStylesheetInclude

    int	xsltParseStylesheetInclude	(xsltStylesheetPtr style, 
    xmlNodePtr cur)
    +

    parse an XSLT stylesheet include element

    +
    style:the XSLT stylesheet
    cur:the include node
    Returns:0 in case of success -1 in case of failure

    Daniel Veillard

    diff --git a/doc/html/libxslt-keys.html b/doc/html/libxslt-keys.html new file mode 100644 index 0000000..55bef1c --- /dev/null +++ b/doc/html/libxslt-keys.html @@ -0,0 +1,27 @@ + + +Module keys from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module keys from libxslt

    API Menu
    Related links
    API Indexes

    implementation of the key mechanims.

    Table of Contents

    #define NODE_IS_KEYED
    int	xsltAddKey			(xsltStylesheetPtr style, 
    const xmlChar * name,
    const xmlChar * nameURI,
    const xmlChar * match,
    const xmlChar * use,
    xmlNodePtr inst)
    +
    void	xsltFreeDocumentKeys		(xsltDocumentPtr idoc)
    +
    void	xsltFreeKeys			(xsltStylesheetPtr style)
    +
    xmlNodeSetPtr	xsltGetKey		(xsltTransformContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * nameURI,
    const xmlChar * value)
    +
    void	xsltInitCtxtKeys		(xsltTransformContextPtr ctxt, 
    xsltDocumentPtr idoc)
    +

    Description

    +

    Macro: NODE_IS_KEYED

    #define NODE_IS_KEYED

    check for bit 15 set

    +

    Function: xsltAddKey

    int	xsltAddKey			(xsltStylesheetPtr style, 
    const xmlChar * name,
    const xmlChar * nameURI,
    const xmlChar * match,
    const xmlChar * use,
    xmlNodePtr inst)
    +

    add a key definition to a stylesheet

    +
    style:an XSLT stylesheet
    name:the key name or NULL
    nameURI:the name URI or NULL
    match:the match value
    use:the use value
    inst:the key instruction
    Returns:0 in case of success, and -1 in case of failure.

    Function: xsltFreeDocumentKeys

    void	xsltFreeDocumentKeys		(xsltDocumentPtr idoc)
    +

    Free the keys associated to a document

    +
    idoc:a XSLT document

    Function: xsltFreeKeys

    void	xsltFreeKeys			(xsltStylesheetPtr style)
    +

    Free up the memory used by XSLT keys in a stylesheet

    +
    style:an XSLT stylesheet

    Function: xsltGetKey

    xmlNodeSetPtr	xsltGetKey		(xsltTransformContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * nameURI,
    const xmlChar * value)
    +

    Looks up a key of the in current source doc (the document info on @ctxt->document). Computes the key if not already done for the current source doc.

    +
    ctxt:an XSLT transformation context
    name:the key name or NULL
    nameURI:the name URI or NULL
    value:the key value to look for
    Returns:the nodeset resulting from the query or NULL

    Function: xsltInitCtxtKeys

    void	xsltInitCtxtKeys		(xsltTransformContextPtr ctxt, 
    xsltDocumentPtr idoc)
    +

    Computes all the keys tables for the current input document. Should be done before global varibales are initialized. NOTE: Not used anymore in the refactored code.

    +
    ctxt:an XSLT transformation context
    idoc:a document info

    Daniel Veillard

    diff --git a/doc/html/libxslt-lib.html b/doc/html/libxslt-lib.html new file mode 100644 index 0000000..f3ccb11 --- /dev/null +++ b/doc/html/libxslt-lib.html @@ -0,0 +1,10 @@ + + +Reference Manual for libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Reference Manual for libxslt

    API Menu
    Related links
    API Indexes

    Table of Contents

    • attributes: interface for the XSLT attribute handling
    • documents: interface for the document handling
    • extensions: interface for the extension support
    • extra: interface for the non-standard features
    • functions: interface for the XSLT functions not from XPath
    • imports: interface for the XSLT import support
    • keys: interface for the key matching used in key() and template matches.
    • namespaces: interface for the XSLT namespace handling
    • numbersInternals: Implementation of the XSLT number functions
    • pattern: interface for the pattern matching used in template matches.
    • preproc: precomputing stylesheets
    • security: interface for the libxslt security framework
    • templates: interface for the template processing
    • transform: the XSLT engine transformation part.
    • variables: interface for the variable matching and lookup.
    • xslt: Interfaces, constants and types related to the XSLT engine
    • xsltInternals: internal data structures, constants and functions
    • xsltexports: macros for marking symbols as exportable/importable.
    • xsltlocale: Locale handling
    • xsltutils: set of utilities for the XSLT engine

    Daniel Veillard

    diff --git a/doc/html/libxslt-namespaces.html b/doc/html/libxslt-namespaces.html new file mode 100644 index 0000000..bb9099d --- /dev/null +++ b/doc/html/libxslt-namespaces.html @@ -0,0 +1,33 @@ + + +Module namespaces from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module namespaces from libxslt

    API Menu
    Related links
    API Indexes

    set of function easing the processing and generation of namespace nodes in XSLT.

    Table of Contents

    #define UNDEFINED_DEFAULT_NS
    xmlNsPtr	xsltCopyNamespace	(xsltTransformContextPtr ctxt, 
    xmlNodePtr elem,
    xmlNsPtr ns)
    +
    xmlNsPtr	xsltCopyNamespaceList	(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNsPtr cur)
    +
    void	xsltFreeNamespaceAliasHashes	(xsltStylesheetPtr style)
    +
    xmlNsPtr	xsltGetNamespace	(xsltTransformContextPtr ctxt, 
    xmlNodePtr cur,
    xmlNsPtr ns,
    xmlNodePtr out)
    +
    xmlNsPtr	xsltGetPlainNamespace	(xsltTransformContextPtr ctxt, 
    xmlNodePtr cur,
    xmlNsPtr ns,
    xmlNodePtr out)
    +
    xmlNsPtr	xsltGetSpecialNamespace	(xsltTransformContextPtr ctxt, 
    xmlNodePtr invocNode,
    const xmlChar * nsName,
    const xmlChar * nsPrefix,
    xmlNodePtr target)
    +
    void	xsltNamespaceAlias		(xsltStylesheetPtr style, 
    xmlNodePtr node)
    +

    Description

    +

    Macro: UNDEFINED_DEFAULT_NS

    #define UNDEFINED_DEFAULT_NS

    Special value for undefined namespace, internal

    +

    Function: xsltCopyNamespace

    xmlNsPtr	xsltCopyNamespace	(xsltTransformContextPtr ctxt, 
    xmlNodePtr elem,
    xmlNsPtr ns)
    +

    Copies a namespace node (declaration). If @elem is not NULL, then the new namespace will be declared on @elem.

    +
    ctxt:a transformation context
    elem:the target element node
    ns:the namespace node
    Returns:a new xmlNsPtr, or NULL in case of an error.

    Function: xsltCopyNamespaceList

    xmlNsPtr	xsltCopyNamespaceList	(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNsPtr cur)
    +

    Do a copy of an namespace list. If @node is non-NULL the new namespaces are added automatically. This handles namespaces aliases. This function is intended only for *internal* use at transformation-time for copying ns-declarations of Literal Result Elements. Called by: xsltCopyTreeInternal() (transform.c) xsltShallowCopyElem() (transform.c) REVISIT: This function won't be used in the refactored code.

    +
    ctxt:a transformation context
    node:the target node
    cur:the first namespace
    Returns:a new xmlNsPtr, or NULL in case of error.

    Function: xsltFreeNamespaceAliasHashes

    void	xsltFreeNamespaceAliasHashes	(xsltStylesheetPtr style)
    +

    Free up the memory used by namespaces aliases

    +
    style:an XSLT stylesheet

    Function: xsltGetNamespace

    xmlNsPtr	xsltGetNamespace	(xsltTransformContextPtr ctxt, 
    xmlNodePtr cur,
    xmlNsPtr ns,
    xmlNodePtr out)
    +

    Find a matching (prefix and ns-name) ns-declaration for the requested @ns->prefix and @ns->href in the result tree. If none is found then a new ns-declaration will be added to @resultElem. If, in this case, the given prefix is already in use, then a ns-declaration with a modified ns-prefix be we created. Called by: - xsltCopyPropList() (*not* anymore) - xsltShallowCopyElement() - xsltCopyTreeInternal() (*not* anymore) - xsltApplySequenceConstructor() (*not* in the refactored code), - xsltElement() (*not* anymore)

    +
    ctxt:a transformation context
    cur:the input node
    ns:the namespace
    out:the output node (or its parent)
    Returns:a namespace declaration or NULL in case of namespace fixup failures or API or internal errors.

    Function: xsltGetPlainNamespace

    xmlNsPtr	xsltGetPlainNamespace	(xsltTransformContextPtr ctxt, 
    xmlNodePtr cur,
    xmlNsPtr ns,
    xmlNodePtr out)
    +

    Obsolete. *Not* called by any Libxslt/Libexslt function. Exaclty the same as xsltGetNamespace().

    +
    ctxt:a transformation context
    cur:the input node
    ns:the namespace
    out:the result element
    Returns:a namespace declaration or NULL in case of namespace fixup failures or API or internal errors.

    Function: xsltGetSpecialNamespace

    xmlNsPtr	xsltGetSpecialNamespace	(xsltTransformContextPtr ctxt, 
    xmlNodePtr invocNode,
    const xmlChar * nsName,
    const xmlChar * nsPrefix,
    xmlNodePtr target)
    +

    Find a matching (prefix and ns-name) ns-declaration for the requested @nsName and @nsPrefix in the result tree. If none is found then a new ns-declaration will be added to @resultElem. If, in this case, the given prefix is already in use, then a ns-declaration with a modified ns-prefix be we created. Note that this function's priority is to preserve ns-prefixes; it will only change a prefix if there's a namespace clash. If both @nsName and @nsPrefix are NULL, then this will try to "undeclare" a default namespace by declaring an xmlns="".

    +
    ctxt:the transformation context
    invocNode:the invoking node; e.g. a literal result element/attr; only used for error reports
    nsName:the namespace name (or NULL)
    nsPrefix:the suggested namespace prefix (or NULL)
    target:the result element on which to anchor a namespace
    Returns:a namespace declaration or NULL.

    Function: xsltNamespaceAlias

    void	xsltNamespaceAlias		(xsltStylesheetPtr style, 
    xmlNodePtr node)
    +

    Read the stylesheet-prefix and result-prefix attributes, register them as well as the corresponding namespace.

    +
    style:the XSLT stylesheet
    node:the xsl:namespace-alias node

    Daniel Veillard

    diff --git a/doc/html/libxslt-numbersInternals.html b/doc/html/libxslt-numbersInternals.html new file mode 100644 index 0000000..def3056 --- /dev/null +++ b/doc/html/libxslt-numbersInternals.html @@ -0,0 +1,39 @@ + + +Module numbersInternals from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module numbersInternals from libxslt

    API Menu
    Related links
    API Indexes

    Implementation of the XSLT number functions

    Table of Contents

    Structure xsltFormatNumberInfo
    struct _xsltFormatNumberInfo +
    Typedef xsltFormatNumberInfo * xsltFormatNumberInfoPtr
    +
    Structure xsltNumberData
    struct _xsltNumberData +
    Typedef xsltNumberData * xsltNumberDataPtr
    +

    Description

    +

    Structure xsltFormatNumberInfo

    Structure xsltFormatNumberInfo
    struct _xsltFormatNumberInfo { + int integer_hash : Number of '#' in integer part + int integer_digits : Number of '0' in integer part + int frac_digits : Number of '0' in fractional part + int frac_hash : Number of '#' in fractional part + int group : Number of chars per display 'group' + int multiplier : Scaling for percent or permille + char add_decimal : Flag for whether decimal point appears + char is_multiplier_set : Flag to catch multiple occurences of pe + char is_negative_pattern : Flag for processing -ve prefix/suffix +}

    Structure xsltNumberData

    Structure xsltNumberData
    struct _xsltNumberData { + const xmlChar * level + const xmlChar * count + const xmlChar * from + const xmlChar * value + const xmlChar * format + int has_format + int digitsPerGroup + int groupingCharacter + int groupingCharacterLen + xmlDocPtr doc + xmlNodePtr node + struct _xsltCompMatch * countPat + struct _xsltCompMatch * fromPat : * accelerators * +}

    Daniel Veillard

    diff --git a/doc/html/libxslt-pattern.html b/doc/html/libxslt-pattern.html new file mode 100644 index 0000000..c5334c6 --- /dev/null +++ b/doc/html/libxslt-pattern.html @@ -0,0 +1,43 @@ + + +Module pattern from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module pattern from libxslt

    API Menu
    Related links
    API Indexes

    the implementation of the lookup of the right template for a given node must be really fast in order to keep decent performances.

    Table of Contents

    Structure xsltCompMatch
    struct _xsltCompMatch +The content of this structure is not made public by the API. +
    Typedef xsltCompMatch * xsltCompMatchPtr
    +
    int	xsltAddTemplate			(xsltStylesheetPtr style, 
    xsltTemplatePtr cur,
    const xmlChar * mode,
    const xmlChar * modeURI)
    +
    void	xsltCleanupTemplates		(xsltStylesheetPtr style)
    +
    xsltCompMatchPtr	xsltCompilePattern	(const xmlChar * pattern, 
    xmlDocPtr doc,
    xmlNodePtr node,
    xsltStylesheetPtr style,
    xsltTransformContextPtr runtime)
    +
    void	xsltFreeCompMatchList		(xsltCompMatchPtr comp)
    +
    void	xsltFreeTemplateHashes		(xsltStylesheetPtr style)
    +
    xsltTemplatePtr	xsltGetTemplate		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xsltStylesheetPtr style)
    +
    int	xsltMatchPattern		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    const xmlChar * pattern,
    xmlDocPtr ctxtdoc,
    xmlNodePtr ctxtnode)
    +
    void	xsltNormalizeCompSteps		(void * payload, 
    void * data,
    const xmlChar * name)
    +
    int	xsltTestCompMatchList		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xsltCompMatchPtr comp)
    +

    Description

    +

    Structure xsltCompMatch

    Structure xsltCompMatch
    struct _xsltCompMatch { +The content of this structure is not made public by the API. +}

    Function: xsltAddTemplate

    int	xsltAddTemplate			(xsltStylesheetPtr style, 
    xsltTemplatePtr cur,
    const xmlChar * mode,
    const xmlChar * modeURI)
    +

    Register the XSLT pattern associated to @cur

    +
    style:an XSLT stylesheet
    cur:an XSLT template
    mode:the mode name or NULL
    modeURI:the mode URI or NULL
    Returns:-1 in case of error, 0 otherwise

    Function: xsltCleanupTemplates

    void	xsltCleanupTemplates		(xsltStylesheetPtr style)
    +

    Cleanup the state of the templates used by the stylesheet and the ones it imports.

    +
    style:an XSLT stylesheet

    Function: xsltCompilePattern

    xsltCompMatchPtr	xsltCompilePattern	(const xmlChar * pattern, 
    xmlDocPtr doc,
    xmlNodePtr node,
    xsltStylesheetPtr style,
    xsltTransformContextPtr runtime)
    +

    Compile the XSLT pattern and generates a list of precompiled form suitable for fast matching. [1] Pattern ::= LocationPathPattern | Pattern '|' LocationPathPattern

    +
    pattern:an XSLT pattern
    doc:the containing document
    node:the containing element
    style:the stylesheet
    runtime:the transformation context, if done at run-time
    Returns:the generated pattern list or NULL in case of failure

    Function: xsltFreeCompMatchList

    void	xsltFreeCompMatchList		(xsltCompMatchPtr comp)
    +

    Free up the memory allocated by all the elements of @comp

    +
    comp:an XSLT comp list

    Function: xsltFreeTemplateHashes

    void	xsltFreeTemplateHashes		(xsltStylesheetPtr style)
    +

    Free up the memory used by xsltAddTemplate/xsltGetTemplate mechanism

    +
    style:an XSLT stylesheet

    Function: xsltGetTemplate

    xsltTemplatePtr	xsltGetTemplate		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xsltStylesheetPtr style)
    +

    Finds the template applying to this node, if @style is non-NULL it means one needs to look for the next imported template in scope.

    +
    ctxt:a XSLT process context
    node:the node being processed
    style:the current style
    Returns:the xsltTemplatePtr or NULL if not found

    Function: xsltMatchPattern

    int	xsltMatchPattern		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    const xmlChar * pattern,
    xmlDocPtr ctxtdoc,
    xmlNodePtr ctxtnode)
    +

    +
    ctxt:
    node:
    pattern:
    ctxtdoc:
    ctxtnode:
    Returns:

    Function: xsltNormalizeCompSteps

    void	xsltNormalizeCompSteps		(void * payload, 
    void * data,
    const xmlChar * name)
    +

    This is a hashtable scanner function to normalize the compiled steps of an imported stylesheet.

    +
    payload:pointer to template hash table entry
    data:pointer to the stylesheet
    name:template match name

    Function: xsltTestCompMatchList

    int	xsltTestCompMatchList		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xsltCompMatchPtr comp)
    +

    Test whether the node matches one of the patterns in the list

    +
    ctxt:a XSLT process context
    node:a node
    comp:the precompiled pattern list
    Returns:1 if it matches, 0 if it doesn't and -1 in case of failure

    Daniel Veillard

    diff --git a/doc/html/libxslt-preproc.html b/doc/html/libxslt-preproc.html new file mode 100644 index 0000000..f664304 --- /dev/null +++ b/doc/html/libxslt-preproc.html @@ -0,0 +1,20 @@ + + +Module preproc from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module preproc from libxslt

    API Menu
    Related links
    API Indexes

    this is the compilation phase, where most of the stylesheet is "compiled" into faster to use data.

    Table of Contents

    xsltElemPreCompPtr	xsltDocumentComp	(xsltStylesheetPtr style, 
    xmlNodePtr inst,
    xsltTransformFunction function)
    +
    void	xsltFreeStylePreComps		(xsltStylesheetPtr style)
    +
    void	xsltStylePreCompute		(xsltStylesheetPtr style, 
    xmlNodePtr inst)
    +

    Description

    +

    Function: xsltDocumentComp

    xsltElemPreCompPtr	xsltDocumentComp	(xsltStylesheetPtr style, 
    xmlNodePtr inst,
    xsltTransformFunction function)
    +

    Pre process an XSLT-1.1 document element

    +
    style:the XSLT stylesheet
    inst:the instruction in the stylesheet
    function:unused
    Returns:a precompiled data structure for the element

    Function: xsltFreeStylePreComps

    void	xsltFreeStylePreComps		(xsltStylesheetPtr style)
    +

    Free up the memory allocated by all precomputed blocks

    +
    style:an XSLT transformation context

    Function: xsltStylePreCompute

    void	xsltStylePreCompute		(xsltStylesheetPtr style, 
    xmlNodePtr inst)
    +

    Precompute an XSLT stylesheet element

    +
    style:the XSLT stylesheet
    inst:the instruction in the stylesheet

    Daniel Veillard

    diff --git a/doc/html/libxslt-security.html b/doc/html/libxslt-security.html new file mode 100644 index 0000000..8b200ec --- /dev/null +++ b/doc/html/libxslt-security.html @@ -0,0 +1,63 @@ + + +Module security from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module security from libxslt

    API Menu
    Related links
    API Indexes

    the libxslt security framework allow to restrict the access to new resources (file or URL) from the stylesheet at runtime.

    Table of Contents

    Enum xsltSecurityOption
    +
    Structure xsltSecurityPrefs
    struct _xsltSecurityPrefs +The content of this structure is not made public by the API. +
    Typedef xsltSecurityPrefs * xsltSecurityPrefsPtr
    +
    int	xsltCheckRead			(xsltSecurityPrefsPtr sec, 
    xsltTransformContextPtr ctxt,
    const xmlChar * URL)
    +
    int	xsltCheckWrite			(xsltSecurityPrefsPtr sec, 
    xsltTransformContextPtr ctxt,
    const xmlChar * URL)
    +
    void	xsltFreeSecurityPrefs		(xsltSecurityPrefsPtr sec)
    +
    xsltSecurityPrefsPtr	xsltGetDefaultSecurityPrefs	(void)
    +
    xsltSecurityCheck	xsltGetSecurityPrefs	(xsltSecurityPrefsPtr sec, 
    xsltSecurityOption option)
    +
    xsltSecurityPrefsPtr	xsltNewSecurityPrefs	(void)
    +
    int	xsltSecurityAllow		(xsltSecurityPrefsPtr sec, 
    xsltTransformContextPtr ctxt,
    const char * value)
    +
    Function type: xsltSecurityCheck
    +int	xsltSecurityCheck		(xsltSecurityPrefsPtr sec, 
    xsltTransformContextPtr ctxt,
    const char * value) +
    +
    int	xsltSecurityForbid		(xsltSecurityPrefsPtr sec, 
    xsltTransformContextPtr ctxt,
    const char * value)
    +
    int	xsltSetCtxtSecurityPrefs	(xsltSecurityPrefsPtr sec, 
    xsltTransformContextPtr ctxt)
    +
    void	xsltSetDefaultSecurityPrefs	(xsltSecurityPrefsPtr sec)
    +
    int	xsltSetSecurityPrefs		(xsltSecurityPrefsPtr sec, 
    xsltSecurityOption option,
    xsltSecurityCheck func)
    +

    Description

    +

    Enum xsltSecurityOption

    Enum xsltSecurityOption {
    +    XSLT_SECPREF_READ_FILE = 1
    +    XSLT_SECPREF_WRITE_FILE = 2
    +    XSLT_SECPREF_CREATE_DIRECTORY = 3
    +    XSLT_SECPREF_READ_NETWORK = 4
    +    XSLT_SECPREF_WRITE_NETWORK = 5
    +}
    +

    Structure xsltSecurityPrefs

    Structure xsltSecurityPrefs
    struct _xsltSecurityPrefs { +The content of this structure is not made public by the API. +}

    Function: xsltCheckRead

    int	xsltCheckRead			(xsltSecurityPrefsPtr sec, 
    xsltTransformContextPtr ctxt,
    const xmlChar * URL)
    +

    Check if the resource is allowed to be read

    +
    sec:the security options
    ctxt:an XSLT transformation context
    URL:the resource to be read
    Returns:1 if read is allowed, 0 if not and -1 in case or error.

    Function: xsltCheckWrite

    int	xsltCheckWrite			(xsltSecurityPrefsPtr sec, 
    xsltTransformContextPtr ctxt,
    const xmlChar * URL)
    +

    Check if the resource is allowed to be written, if necessary makes some preliminary work like creating directories

    +
    sec:the security options
    ctxt:an XSLT transformation context
    URL:the resource to be written
    Returns:1 if write is allowed, 0 if not and -1 in case or error.

    Function: xsltFreeSecurityPrefs

    void	xsltFreeSecurityPrefs		(xsltSecurityPrefsPtr sec)
    +

    Free up a security preference block

    +
    sec:the security block to free

    Function: xsltGetDefaultSecurityPrefs

    xsltSecurityPrefsPtr	xsltGetDefaultSecurityPrefs	(void)
    +

    Get the default security preference application-wide

    +
    Returns:the current xsltSecurityPrefsPtr in use or NULL if none

    Function: xsltGetSecurityPrefs

    xsltSecurityCheck	xsltGetSecurityPrefs	(xsltSecurityPrefsPtr sec, 
    xsltSecurityOption option)
    +

    Lookup the security option to get the callback checking function

    +
    sec:the security block to update
    option:the option to lookup
    Returns:NULL if not found, the function otherwise

    Function: xsltNewSecurityPrefs

    xsltSecurityPrefsPtr	xsltNewSecurityPrefs	(void)
    +

    Create a new security preference block

    +
    Returns:a pointer to the new block or NULL in case of error

    Function: xsltSecurityAllow

    int	xsltSecurityAllow		(xsltSecurityPrefsPtr sec, 
    xsltTransformContextPtr ctxt,
    const char * value)
    +

    Function used to always allow an operation

    +
    sec:the security block to use
    ctxt:an XSLT transformation context
    value:unused
    Returns:1 always

    Function type: xsltSecurityCheck

    Function type: xsltSecurityCheck
    +int	xsltSecurityCheck		(xsltSecurityPrefsPtr sec, 
    xsltTransformContextPtr ctxt,
    const char * value) +

    User provided function to check the value of a string like a file path or an URL ...

    sec:
    ctxt:
    value:
    Returns:

    +

    Function: xsltSecurityForbid

    int	xsltSecurityForbid		(xsltSecurityPrefsPtr sec, 
    xsltTransformContextPtr ctxt,
    const char * value)
    +

    Function used to always forbid an operation

    +
    sec:the security block to use
    ctxt:an XSLT transformation context
    value:unused
    Returns:0 always

    Function: xsltSetCtxtSecurityPrefs

    int	xsltSetCtxtSecurityPrefs	(xsltSecurityPrefsPtr sec, 
    xsltTransformContextPtr ctxt)
    +

    Set the security preference for a specific transformation

    +
    sec:the security block to use
    ctxt:an XSLT transformation context
    Returns:-1 in case of error, 0 otherwise

    Function: xsltSetDefaultSecurityPrefs

    void	xsltSetDefaultSecurityPrefs	(xsltSecurityPrefsPtr sec)
    +

    Set the default security preference application-wide

    +
    sec:the security block to use

    Function: xsltSetSecurityPrefs

    int	xsltSetSecurityPrefs		(xsltSecurityPrefsPtr sec, 
    xsltSecurityOption option,
    xsltSecurityCheck func)
    +

    Update the security option to use the new callback checking function

    +
    sec:the security block to update
    option:the option to update
    func:the user callback to use for this option
    Returns:-1 in case of error, 0 otherwise

    Daniel Veillard

    diff --git a/doc/html/libxslt-templates.html b/doc/html/libxslt-templates.html new file mode 100644 index 0000000..2a1241d --- /dev/null +++ b/doc/html/libxslt-templates.html @@ -0,0 +1,44 @@ + + +Module templates from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module templates from libxslt

    API Menu
    Related links
    API Indexes

    This set of routine encapsulates XPath calls and Attribute Value Templates evaluation.

    Table of Contents

    xmlAttrPtr	xsltAttrListTemplateProcess	(xsltTransformContextPtr ctxt, 
    xmlNodePtr target,
    xmlAttrPtr attrs)
    +
    xmlAttrPtr	xsltAttrTemplateProcess	(xsltTransformContextPtr ctxt, 
    xmlNodePtr target,
    xmlAttrPtr attr)
    +
    xmlChar *	xsltAttrTemplateValueProcess	(xsltTransformContextPtr ctxt, 
    const xmlChar * str)
    +
    xmlChar *	xsltAttrTemplateValueProcessNode	(xsltTransformContextPtr ctxt, 
    const xmlChar * str,
    xmlNodePtr inst)
    +
    xmlChar *	xsltEvalAttrValueTemplate	(xsltTransformContextPtr ctxt, 
    xmlNodePtr inst,
    const xmlChar * name,
    const xmlChar * ns)
    +
    const xmlChar *	xsltEvalStaticAttrValueTemplate	(xsltStylesheetPtr style, 
    xmlNodePtr inst,
    const xmlChar * name,
    const xmlChar * ns,
    int * found)
    +
    xmlChar *	xsltEvalTemplateString	(xsltTransformContextPtr ctxt, 
    xmlNodePtr contextNode,
    xmlNodePtr inst)
    +
    int	xsltEvalXPathPredicate		(xsltTransformContextPtr ctxt, 
    xmlXPathCompExprPtr comp,
    xmlNsPtr * nsList,
    int nsNr)
    +
    xmlChar *	xsltEvalXPathString	(xsltTransformContextPtr ctxt, 
    xmlXPathCompExprPtr comp)
    +
    xmlChar *	xsltEvalXPathStringNs	(xsltTransformContextPtr ctxt, 
    xmlXPathCompExprPtr comp,
    int nsNr,
    xmlNsPtr * nsList)
    +
    xmlNodePtr *	xsltTemplateProcess	(xsltTransformContextPtr ctxt, 
    xmlNodePtr node)
    +

    Description

    +

    Function: xsltAttrListTemplateProcess

    xmlAttrPtr	xsltAttrListTemplateProcess	(xsltTransformContextPtr ctxt, 
    xmlNodePtr target,
    xmlAttrPtr attrs)
    +

    Processes all attributes of a Literal Result Element. Attribute references are applied via xsl:use-attribute-set attributes. Copies all non XSLT-attributes over to the @target element and evaluates Attribute Value Templates. Called by xsltApplySequenceConstructor() (transform.c).

    +
    ctxt:the XSLT transformation context
    target:the element where the attributes will be grafted
    attrs:the first attribute
    Returns:a new list of attribute nodes, or NULL in case of error. (Don't assign the result to @target->properties; if the result is NULL, you'll get memory leaks, since the attributes will be disattached.)

    Function: xsltAttrTemplateProcess

    xmlAttrPtr	xsltAttrTemplateProcess	(xsltTransformContextPtr ctxt, 
    xmlNodePtr target,
    xmlAttrPtr attr)
    +

    Process one attribute of a Literal Result Element (in the stylesheet). Evaluates Attribute Value Templates and copies the attribute over to the result element. This does *not* process attribute sets (xsl:use-attribute-set).

    +
    ctxt:the XSLT transformation context
    target:the element where the attribute will be grafted
    attr:the attribute node of a literal result element
    Returns:the generated attribute node.

    Function: xsltAttrTemplateValueProcess

    xmlChar *	xsltAttrTemplateValueProcess	(xsltTransformContextPtr ctxt, 
    const xmlChar * str)
    +

    Process the given node and return the new string value.

    +
    ctxt:the XSLT transformation context
    str:the attribute template node value
    Returns:the computed string value or NULL, must be deallocated by the caller.

    Function: xsltAttrTemplateValueProcessNode

    xmlChar *	xsltAttrTemplateValueProcessNode	(xsltTransformContextPtr ctxt, 
    const xmlChar * str,
    xmlNodePtr inst)
    +

    Process the given string, allowing to pass a namespace mapping context and return the new string value. Called by: - xsltAttrTemplateValueProcess() (templates.c) - xsltEvalAttrValueTemplate() (templates.c) QUESTION: Why is this function public? It is not used outside of templates.c.

    +
    ctxt:the XSLT transformation context
    str:the attribute template node value
    inst:the instruction (or LRE) in the stylesheet holding the attribute with an AVT
    Returns:the computed string value or NULL, must be deallocated by the caller.

    Function: xsltEvalAttrValueTemplate

    xmlChar *	xsltEvalAttrValueTemplate	(xsltTransformContextPtr ctxt, 
    xmlNodePtr inst,
    const xmlChar * name,
    const xmlChar * ns)
    +

    Evaluate a attribute value template, i.e. the attribute value can contain expressions contained in curly braces ({}) and those are substituted by they computed value.

    +
    ctxt:the XSLT transformation context
    inst:the instruction (or LRE) in the stylesheet holding the attribute with an AVT
    name:the attribute QName
    ns:the attribute namespace URI
    Returns:the computed string value or NULL, must be deallocated by the caller.

    Function: xsltEvalStaticAttrValueTemplate

    const xmlChar *	xsltEvalStaticAttrValueTemplate	(xsltStylesheetPtr style, 
    xmlNodePtr inst,
    const xmlChar * name,
    const xmlChar * ns,
    int * found)
    +

    Check if an attribute value template has a static value, i.e. the attribute value does not contain expressions contained in curly braces ({})

    +
    style:the XSLT stylesheet
    inst:the instruction (or LRE) in the stylesheet holding the attribute with an AVT
    name:the attribute Name
    ns:the attribute namespace URI
    found:indicator whether the attribute is present
    Returns:the static string value or NULL, must be deallocated by the caller.

    Function: xsltEvalTemplateString

    xmlChar *	xsltEvalTemplateString	(xsltTransformContextPtr ctxt, 
    xmlNodePtr contextNode,
    xmlNodePtr inst)
    +

    Processes the sequence constructor of the given instruction on @contextNode and converts the resulting tree to a string. This is needed by e.g. xsl:comment and xsl:processing-instruction.

    +
    ctxt:the XSLT transformation context
    contextNode:the current node in the source tree
    inst:the XSLT instruction (xsl:comment, xsl:processing-instruction)
    Returns:the computed string value or NULL; it's up to the caller to free the result.

    Function: xsltEvalXPathPredicate

    int	xsltEvalXPathPredicate		(xsltTransformContextPtr ctxt, 
    xmlXPathCompExprPtr comp,
    xmlNsPtr * nsList,
    int nsNr)
    +

    Process the expression using XPath and evaluate the result as an XPath predicate

    +
    ctxt:the XSLT transformation context
    comp:the XPath compiled expression
    nsList:the namespaces in scope
    nsNr:the number of namespaces in scope
    Returns:1 is the predicate was true, 0 otherwise

    Function: xsltEvalXPathString

    xmlChar *	xsltEvalXPathString	(xsltTransformContextPtr ctxt, 
    xmlXPathCompExprPtr comp)
    +

    Process the expression using XPath and get a string

    +
    ctxt:the XSLT transformation context
    comp:the compiled XPath expression
    Returns:the computed string value or NULL, must be deallocated by the caller.

    Function: xsltEvalXPathStringNs

    xmlChar *	xsltEvalXPathStringNs	(xsltTransformContextPtr ctxt, 
    xmlXPathCompExprPtr comp,
    int nsNr,
    xmlNsPtr * nsList)
    +

    Process the expression using XPath, allowing to pass a namespace mapping context and get a string

    +
    ctxt:the XSLT transformation context
    comp:the compiled XPath expression
    nsNr:the number of namespaces in the list
    nsList:the list of in-scope namespaces to use
    Returns:the computed string value or NULL, must be deallocated by the caller.

    Function: xsltTemplateProcess

    xmlNodePtr *	xsltTemplateProcess	(xsltTransformContextPtr ctxt, 
    xmlNodePtr node)
    +

    Obsolete. Don't use it.

    +
    ctxt:the XSLT transformation context
    node:the attribute template node
    Returns:NULL.

    Daniel Veillard

    diff --git a/doc/html/libxslt-transform.html b/doc/html/libxslt-transform.html new file mode 100644 index 0000000..be71f2c --- /dev/null +++ b/doc/html/libxslt-transform.html @@ -0,0 +1,113 @@ + + +Module transform from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module transform from libxslt

    API Menu
    Related links
    API Indexes

    This module implements the bulk of the actual

    Table of Contents

    void	xslHandleDebugger		(xmlNodePtr cur, 
    xmlNodePtr node,
    xsltTemplatePtr templ,
    xsltTransformContextPtr ctxt)
    +
    void	xsltApplyImports		(xsltTransformContextPtr ctxt, 
    xmlNodePtr contextNode,
    xmlNodePtr inst,
    xsltStylePreCompPtr comp)
    +
    void	xsltApplyOneTemplate		(xsltTransformContextPtr ctxt, 
    xmlNodePtr contextNode,
    xmlNodePtr list,
    xsltTemplatePtr templ,
    xsltStackElemPtr params)
    +
    void	xsltApplyStripSpaces		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node)
    +
    xmlDocPtr	xsltApplyStylesheet	(xsltStylesheetPtr style, 
    xmlDocPtr doc,
    const char ** params)
    +
    xmlDocPtr	xsltApplyStylesheetUser	(xsltStylesheetPtr style, 
    xmlDocPtr doc,
    const char ** params,
    const char * output,
    FILE * profile,
    xsltTransformContextPtr userCtxt)
    +
    void	xsltApplyTemplates		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +
    void	xsltAttribute			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr comp)
    +
    void	xsltCallTemplate		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +
    void	xsltChoose			(xsltTransformContextPtr ctxt, 
    xmlNodePtr contextNode,
    xmlNodePtr inst,
    xsltStylePreCompPtr comp)
    +
    void	xsltComment			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr comp)
    +
    void	xsltCopy			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +
    void	xsltCopyOf			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +
    xmlNodePtr	xsltCopyTextString	(xsltTransformContextPtr ctxt, 
    xmlNodePtr target,
    const xmlChar * string,
    int noescape)
    +
    void	xsltDocumentElem		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +
    void	xsltElement			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +
    void	xsltForEach			(xsltTransformContextPtr ctxt, 
    xmlNodePtr contextNode,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +
    void	xsltFreeTransformContext	(xsltTransformContextPtr ctxt)
    +
    int	xsltGetXIncludeDefault		(void)
    +
    void	xsltIf			(xsltTransformContextPtr ctxt, 
    xmlNodePtr contextNode,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +
    void	xsltLocalVariablePop		(xsltTransformContextPtr ctxt, 
    int limitNr,
    int level)
    +
    int	xsltLocalVariablePush		(xsltTransformContextPtr ctxt, 
    xsltStackElemPtr variable,
    int level)
    +
    xsltTransformContextPtr	xsltNewTransformContext	(xsltStylesheetPtr style, 
    xmlDocPtr doc)
    +
    void	xsltNumber			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +
    void	xsltProcessOneNode		(xsltTransformContextPtr ctxt, 
    xmlNodePtr contextNode,
    xsltStackElemPtr withParams)
    +
    void	xsltProcessingInstruction	(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +
    xmlDocPtr	xsltProfileStylesheet	(xsltStylesheetPtr style, 
    xmlDocPtr doc,
    const char ** params,
    FILE * output)
    +
    void	xsltRegisterAllElement		(xsltTransformContextPtr ctxt)
    +
    int	xsltRunStylesheet		(xsltStylesheetPtr style, 
    xmlDocPtr doc,
    const char ** params,
    const char * output,
    xmlSAXHandlerPtr SAX,
    xmlOutputBufferPtr IObuf)
    +
    int	xsltRunStylesheetUser		(xsltStylesheetPtr style, 
    xmlDocPtr doc,
    const char ** params,
    const char * output,
    xmlSAXHandlerPtr SAX,
    xmlOutputBufferPtr IObuf,
    FILE * profile,
    xsltTransformContextPtr userCtxt)
    +
    void	xsltSetXIncludeDefault		(int xinclude)
    +
    void	xsltSort			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr comp)
    +
    void	xsltText			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr comp)
    +
    void	xsltValueOf			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +

    Description

    +

    Function: xslHandleDebugger

    void	xslHandleDebugger		(xmlNodePtr cur, 
    xmlNodePtr node,
    xsltTemplatePtr templ,
    xsltTransformContextPtr ctxt)
    +

    If either cur or node are a breakpoint, or xslDebugStatus in state where debugging must occcur at this time then transfer control to the xslDebugBreak function

    +
    cur:source node being executed
    node:data node being processed
    templ:temlate that applies to node
    ctxt:the xslt transform context

    Function: xsltApplyImports

    void	xsltApplyImports		(xsltTransformContextPtr ctxt, 
    xmlNodePtr contextNode,
    xmlNodePtr inst,
    xsltStylePreCompPtr comp)
    +

    Process the XSLT apply-imports element.

    +
    ctxt:an XSLT transformation context
    contextNode:the current node in the source tree.
    inst:the element node of the XSLT 'apply-imports' instruction
    comp:the compiled instruction

    Function: xsltApplyOneTemplate

    void	xsltApplyOneTemplate		(xsltTransformContextPtr ctxt, 
    xmlNodePtr contextNode,
    xmlNodePtr list,
    xsltTemplatePtr templ,
    xsltStackElemPtr params)
    +

    Processes a sequence constructor on the current node in the source tree. @params are the already computed variable stack items; this function pushes them on the variable stack, and pops them before exiting; it's left to the caller to free or reuse @params afterwards. The initial states of the variable stack will always be restored before this function exits. NOTE that this does *not* initiate a new distinct variable scope; i.e. variables already on the stack are visible to the process. The caller's side needs to start a new variable scope if needed (e.g. in exsl:function). @templ is obsolete and not used anymore (e.g. <exslt:function> does not provide a @templ); a non-NULL @templ might raise an error in the future. BIG NOTE: This function is not intended to process the content of an xsl:template; it does not expect xsl:param instructions in @list and will report errors if found. Called by: - xsltEvalVariable() (variables.c) - exsltFuncFunctionFunction() (libexsl/functions.c)

    +
    ctxt:a XSLT process context
    contextNode:the node in the source tree.
    list:the nodes of a sequence constructor
    templ:not used
    params:a set of parameters (xsl:param) or NULL

    Function: xsltApplyStripSpaces

    void	xsltApplyStripSpaces		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node)
    +

    Strip the unwanted ignorable spaces from the input tree

    +
    ctxt:a XSLT process context
    node:the root of the XML tree

    Function: xsltApplyStylesheet

    xmlDocPtr	xsltApplyStylesheet	(xsltStylesheetPtr style, 
    xmlDocPtr doc,
    const char ** params)
    +

    Apply the stylesheet to the document NOTE: This may lead to a non-wellformed output XML wise !

    +
    style:a parsed XSLT stylesheet
    doc:a parsed XML document
    params:a NULL terminated arry of parameters names/values tuples
    Returns:the result document or NULL in case of error

    Function: xsltApplyStylesheetUser

    xmlDocPtr	xsltApplyStylesheetUser	(xsltStylesheetPtr style, 
    xmlDocPtr doc,
    const char ** params,
    const char * output,
    FILE * profile,
    xsltTransformContextPtr userCtxt)
    +

    Apply the stylesheet to the document and allow the user to provide its own transformation context.

    +
    style:a parsed XSLT stylesheet
    doc:a parsed XML document
    params:a NULL terminated array of parameters names/values tuples
    output:the targetted output
    profile:profile FILE * output or NULL
    userCtxt:user provided transform context
    Returns:the result document or NULL in case of error

    Function: xsltApplyTemplates

    void	xsltApplyTemplates		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +

    Processes the XSLT 'apply-templates' instruction on the current node.

    +
    ctxt:a XSLT transformation context
    node:the 'current node' in the source tree
    inst:the element node of an XSLT 'apply-templates' instruction
    castedComp:the compiled instruction

    Function: xsltAttribute

    void	xsltAttribute			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr comp)
    +

    Process the xslt attribute node on the source node

    +
    ctxt:a XSLT process context
    node:the node in the source tree.
    inst:the xslt attribute node
    comp:precomputed information

    Function: xsltCallTemplate

    void	xsltCallTemplate		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +

    Processes the XSLT call-template instruction on the source node.

    +
    ctxt:a XSLT transformation context
    node:the "current node" in the source tree
    inst:the XSLT 'call-template' instruction
    castedComp:the compiled information of the instruction

    Function: xsltChoose

    void	xsltChoose			(xsltTransformContextPtr ctxt, 
    xmlNodePtr contextNode,
    xmlNodePtr inst,
    xsltStylePreCompPtr comp)
    +

    Processes the xsl:choose instruction on the source node.

    +
    ctxt:a XSLT process context
    contextNode:the current node in the source tree
    inst:the xsl:choose instruction
    comp:compiled information of the instruction

    Function: xsltComment

    void	xsltComment			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr comp)
    +

    Process the xslt comment node on the source node

    +
    ctxt:a XSLT process context
    node:the node in the source tree.
    inst:the xslt comment node
    comp:precomputed information

    Function: xsltCopy

    void	xsltCopy			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +

    Execute the XSLT-copy instruction on the source node.

    +
    ctxt:an XSLT process context
    node:the node in the source tree
    inst:the element node of the XSLT-copy instruction
    castedComp:computed information of the XSLT-copy instruction

    Function: xsltCopyOf

    void	xsltCopyOf			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +

    Process the XSLT copy-of instruction.

    +
    ctxt:an XSLT transformation context
    node:the current node in the source tree
    inst:the element node of the XSLT copy-of instruction
    castedComp:precomputed information of the XSLT copy-of instruction

    Function: xsltCopyTextString

    xmlNodePtr	xsltCopyTextString	(xsltTransformContextPtr ctxt, 
    xmlNodePtr target,
    const xmlChar * string,
    int noescape)
    +

    Adds @string to a newly created or an existent text node child of @target.

    +
    ctxt:a XSLT process context
    target:the element where the text will be attached
    string:the text string
    noescape:should disable-escaping be activated for this text node.
    Returns:the text node, where the text content of @cur is copied to. NULL in case of API or internal errors.

    Function: xsltDocumentElem

    void	xsltDocumentElem		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +

    Process an EXSLT/XSLT-1.1 document element

    +
    ctxt:an XSLT processing context
    node:The current node
    inst:the instruction in the stylesheet
    castedComp:precomputed information

    Function: xsltElement

    void	xsltElement			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +

    Process the xslt element node on the source node

    +
    ctxt:a XSLT process context
    node:the node in the source tree.
    inst:the xslt element node
    castedComp:precomputed information

    Function: xsltForEach

    void	xsltForEach			(xsltTransformContextPtr ctxt, 
    xmlNodePtr contextNode,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +

    Process the xslt for-each node on the source node

    +
    ctxt:an XSLT transformation context
    contextNode:the "current node" in the source tree
    inst:the element node of the xsl:for-each instruction
    castedComp:the compiled information of the instruction

    Function: xsltFreeTransformContext

    void	xsltFreeTransformContext	(xsltTransformContextPtr ctxt)
    +

    Free up the memory allocated by @ctxt

    +
    ctxt:an XSLT parser context

    Function: xsltGetXIncludeDefault

    int	xsltGetXIncludeDefault		(void)
    +

    Provides the default state for XInclude processing

    +
    Returns:0 if there is no processing 1 otherwise

    Function: xsltIf

    void	xsltIf			(xsltTransformContextPtr ctxt, 
    xmlNodePtr contextNode,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +

    Processes the xsl:if instruction on the source node.

    +
    ctxt:a XSLT process context
    contextNode:the current node in the source tree
    inst:the xsl:if instruction
    castedComp:compiled information of the instruction

    Function: xsltLocalVariablePop

    void	xsltLocalVariablePop		(xsltTransformContextPtr ctxt, 
    int limitNr,
    int level)
    +

    Pops all variable values at the given @depth from the stack.

    +
    ctxt:the transformation context
    limitNr:number of variables which should remain
    level:the depth in the xsl:template's tree

    Function: xsltLocalVariablePush

    int	xsltLocalVariablePush		(xsltTransformContextPtr ctxt, 
    xsltStackElemPtr variable,
    int level)
    +

    Places the variable onto the local variable stack

    +
    ctxt:the transformation context
    variable:variable to be pushed to the variable stack
    level:new value for variable's level
    Returns:0 for success, -1 for any error **NOTE:** This is an internal routine and should not be called by users!

    Function: xsltNewTransformContext

    xsltTransformContextPtr	xsltNewTransformContext	(xsltStylesheetPtr style, 
    xmlDocPtr doc)
    +

    Create a new XSLT TransformContext

    +
    style:a parsed XSLT stylesheet
    doc:the input document
    Returns:the newly allocated xsltTransformContextPtr or NULL in case of error

    Function: xsltNumber

    void	xsltNumber			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +

    Process the xslt number node on the source node

    +
    ctxt:a XSLT process context
    node:the node in the source tree.
    inst:the xslt number node
    castedComp:precomputed information

    Function: xsltProcessOneNode

    void	xsltProcessOneNode		(xsltTransformContextPtr ctxt, 
    xmlNodePtr contextNode,
    xsltStackElemPtr withParams)
    +

    Process the source node.

    +
    ctxt:a XSLT process context
    contextNode:the "current node" in the source tree
    withParams:extra parameters (e.g. xsl:with-param) passed to the template if any

    Function: xsltProcessingInstruction

    void	xsltProcessingInstruction	(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +

    Process the xslt processing-instruction node on the source node

    +
    ctxt:a XSLT process context
    node:the node in the source tree.
    inst:the xslt processing-instruction node
    castedComp:precomputed information

    Function: xsltProfileStylesheet

    xmlDocPtr	xsltProfileStylesheet	(xsltStylesheetPtr style, 
    xmlDocPtr doc,
    const char ** params,
    FILE * output)
    +

    Apply the stylesheet to the document and dump the profiling to the given output.

    +
    style:a parsed XSLT stylesheet
    doc:a parsed XML document
    params:a NULL terminated arry of parameters names/values tuples
    output:a FILE * for the profiling output
    Returns:the result document or NULL in case of error

    Function: xsltRegisterAllElement

    void	xsltRegisterAllElement		(xsltTransformContextPtr ctxt)
    +

    Registers all default XSLT elements in this context

    +
    ctxt:the XPath context

    Function: xsltRunStylesheet

    int	xsltRunStylesheet		(xsltStylesheetPtr style, 
    xmlDocPtr doc,
    const char ** params,
    const char * output,
    xmlSAXHandlerPtr SAX,
    xmlOutputBufferPtr IObuf)
    +

    Apply the stylesheet to the document and generate the output according to @output @SAX and @IObuf. It's an error to specify both @SAX and @IObuf. NOTE: This may lead to a non-wellformed output XML wise ! NOTE: This may also result in multiple files being generated NOTE: using IObuf, the result encoding used will be the one used for creating the output buffer, use the following macro to read it from the stylesheet XSLT_GET_IMPORT_PTR(encoding, style, encoding) NOTE: using SAX, any encoding specified in the stylesheet will be lost since the interface uses only UTF8

    +
    style:a parsed XSLT stylesheet
    doc:a parsed XML document
    params:a NULL terminated array of parameters names/values tuples
    output:the URL/filename ot the generated resource if available
    SAX:a SAX handler for progressive callback output (not implemented yet)
    IObuf:an output buffer for progressive output (not implemented yet)
    Returns:the number of bytes written to the main resource or -1 in case of error.

    Function: xsltRunStylesheetUser

    int	xsltRunStylesheetUser		(xsltStylesheetPtr style, 
    xmlDocPtr doc,
    const char ** params,
    const char * output,
    xmlSAXHandlerPtr SAX,
    xmlOutputBufferPtr IObuf,
    FILE * profile,
    xsltTransformContextPtr userCtxt)
    +

    Apply the stylesheet to the document and generate the output according to @output @SAX and @IObuf. It's an error to specify both @SAX and @IObuf. NOTE: This may lead to a non-wellformed output XML wise ! NOTE: This may also result in multiple files being generated NOTE: using IObuf, the result encoding used will be the one used for creating the output buffer, use the following macro to read it from the stylesheet XSLT_GET_IMPORT_PTR(encoding, style, encoding) NOTE: using SAX, any encoding specified in the stylesheet will be lost since the interface uses only UTF8

    +
    style:a parsed XSLT stylesheet
    doc:a parsed XML document
    params:a NULL terminated array of parameters names/values tuples
    output:the URL/filename ot the generated resource if available
    SAX:a SAX handler for progressive callback output (not implemented yet)
    IObuf:an output buffer for progressive output (not implemented yet)
    profile:profile FILE * output or NULL
    userCtxt:user provided transform context
    Returns:the number of by written to the main resource or -1 in case of error.

    Function: xsltSetXIncludeDefault

    void	xsltSetXIncludeDefault		(int xinclude)
    +

    Set whether XInclude should be processed on document being loaded by default

    +
    xinclude:whether to do XInclude processing

    Function: xsltSort

    void	xsltSort			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr comp)
    +

    function attached to xsl:sort nodes, but this should not be called directly

    +
    ctxt:a XSLT process context
    node:the node in the source tree.
    inst:the xslt sort node
    comp:precomputed information

    Function: xsltText

    void	xsltText			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr comp)
    +

    Process the xslt text node on the source node

    +
    ctxt:a XSLT process context
    node:the node in the source tree.
    inst:the xslt text node
    comp:precomputed information

    Function: xsltValueOf

    void	xsltValueOf			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltStylePreCompPtr castedComp)
    +

    Process the xslt value-of node on the source node

    +
    ctxt:a XSLT process context
    node:the node in the source tree.
    inst:the xslt value-of node
    castedComp:precomputed information

    Daniel Veillard

    diff --git a/doc/html/libxslt-variables.html b/doc/html/libxslt-variables.html new file mode 100644 index 0000000..2a7f71d --- /dev/null +++ b/doc/html/libxslt-variables.html @@ -0,0 +1,54 @@ + + +Module variables from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module variables from libxslt

    API Menu
    Related links
    API Indexes

    interface for the variable matching and lookup.

    Table of Contents

    #define XSLT_REGISTER_VARIABLE_LOOKUP
    int	xsltAddStackElemList		(xsltTransformContextPtr ctxt, 
    xsltStackElemPtr elems)
    +
    int	xsltEvalGlobalVariables		(xsltTransformContextPtr ctxt)
    +
    int	xsltEvalOneUserParam		(xsltTransformContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * value)
    +
    int	xsltEvalUserParams		(xsltTransformContextPtr ctxt, 
    const char ** params)
    +
    void	xsltFreeGlobalVariables		(xsltTransformContextPtr ctxt)
    +
    void	xsltParseGlobalParam		(xsltStylesheetPtr style, 
    xmlNodePtr cur)
    +
    void	xsltParseGlobalVariable		(xsltStylesheetPtr style, 
    xmlNodePtr cur)
    +
    xsltStackElemPtr	xsltParseStylesheetCallerParam	(xsltTransformContextPtr ctxt, 
    xmlNodePtr inst)
    +
    void	xsltParseStylesheetParam	(xsltTransformContextPtr ctxt, 
    xmlNodePtr cur)
    +
    void	xsltParseStylesheetVariable	(xsltTransformContextPtr ctxt, 
    xmlNodePtr inst)
    +
    int	xsltQuoteOneUserParam		(xsltTransformContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * value)
    +
    int	xsltQuoteUserParams		(xsltTransformContextPtr ctxt, 
    const char ** params)
    +
    xmlXPathObjectPtr	xsltVariableLookup	(xsltTransformContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * ns_uri)
    +
    xmlXPathObjectPtr	xsltXPathVariableLookup	(void * ctxt, 
    const xmlChar * name,
    const xmlChar * ns_uri)
    +

    Description

    +

    Macro: XSLT_REGISTER_VARIABLE_LOOKUP

    #define XSLT_REGISTER_VARIABLE_LOOKUP

    Registering macro, not general purpose at all but used in different modules.

    +

    Function: xsltAddStackElemList

    int	xsltAddStackElemList		(xsltTransformContextPtr ctxt, 
    xsltStackElemPtr elems)
    +

    Push an element list onto the stack.

    +
    ctxt:xn XSLT transformation context
    elems:a stack element list
    Returns:0 in case of success, -1 in case of failure.

    Function: xsltEvalGlobalVariables

    int	xsltEvalGlobalVariables		(xsltTransformContextPtr ctxt)
    +

    Evaluates all global variables and parameters of a stylesheet. For internal use only. This is called at start of a transformation.

    +
    ctxt:the XSLT transformation context
    Returns:0 in case of success, -1 in case of error

    Function: xsltEvalOneUserParam

    int	xsltEvalOneUserParam		(xsltTransformContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * value)
    +

    This is normally called from xsltEvalUserParams to process a single parameter from a list of parameters. The @value is evaluated as an XPath expression and the result is stored in the context's global variable/parameter hash table. To have a parameter treated literally (not as an XPath expression) use xsltQuoteUserParams (or xsltQuoteOneUserParam). For more details see description of xsltProcessOneUserParamInternal.

    +
    ctxt:the XSLT transformation context
    name:a null terminated string giving the name of the parameter
    value:a null terminated string giving the XPath expression to be evaluated
    Returns:0 in case of success, -1 in case of error.

    Function: xsltEvalUserParams

    int	xsltEvalUserParams		(xsltTransformContextPtr ctxt, 
    const char ** params)
    +

    Evaluate the global variables of a stylesheet. This needs to be done on parsed stylesheets before starting to apply transformations. Each of the parameters is evaluated as an XPath expression and stored in the global variables/parameter hash table. If you want your parameter used literally, use xsltQuoteUserParams.

    +
    ctxt:the XSLT transformation context
    params:a NULL terminated array of parameters name/value tuples
    Returns:0 in case of success, -1 in case of error

    Function: xsltFreeGlobalVariables

    void	xsltFreeGlobalVariables		(xsltTransformContextPtr ctxt)
    +

    Free up the data associated to the global variables its value.

    +
    ctxt:the XSLT transformation context

    Function: xsltParseGlobalParam

    void	xsltParseGlobalParam		(xsltStylesheetPtr style, 
    xmlNodePtr cur)
    +

    parse an XSLT transformation param declaration and record its value.

    +
    style:the XSLT stylesheet
    cur:the "param" element

    Function: xsltParseGlobalVariable

    void	xsltParseGlobalVariable		(xsltStylesheetPtr style, 
    xmlNodePtr cur)
    +

    Parses a global XSLT 'variable' declaration at compilation time and registers it

    +
    style:the XSLT stylesheet
    cur:the "variable" element

    Function: xsltParseStylesheetCallerParam

    xsltStackElemPtr	xsltParseStylesheetCallerParam	(xsltTransformContextPtr ctxt, 
    xmlNodePtr inst)
    +

    Processes an xsl:with-param instruction at transformation time. The value is compute, but not recorded. NOTE that this is also called with an *xsl:param* element from exsltFuncFunctionFunction().

    +
    ctxt:the XSLT transformation context
    inst:the xsl:with-param instruction element
    Returns:the new xsltStackElemPtr or NULL

    Function: xsltParseStylesheetParam

    void	xsltParseStylesheetParam	(xsltTransformContextPtr ctxt, 
    xmlNodePtr cur)
    +

    Registers a local XSLT 'param' declaration at transformation time and evaluates its value.

    +
    ctxt:the XSLT transformation context
    cur:the XSLT 'param' element

    Function: xsltParseStylesheetVariable

    void	xsltParseStylesheetVariable	(xsltTransformContextPtr ctxt, 
    xmlNodePtr inst)
    +

    Registers a local XSLT 'variable' instruction at transformation time and evaluates its value.

    +
    ctxt:the XSLT transformation context
    inst:the xsl:variable instruction element

    Function: xsltQuoteOneUserParam

    int	xsltQuoteOneUserParam		(xsltTransformContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * value)
    +

    This is normally called from xsltQuoteUserParams to process a single parameter from a list of parameters. The @value is stored in the context's global variable/parameter hash table.

    +
    ctxt:the XSLT transformation context
    name:a null terminated string giving the name of the parameter
    value:a null terminated string giving the parameter value
    Returns:0 in case of success, -1 in case of error.

    Function: xsltQuoteUserParams

    int	xsltQuoteUserParams		(xsltTransformContextPtr ctxt, 
    const char ** params)
    +

    Similar to xsltEvalUserParams, but the values are treated literally and are * *not* evaluated as XPath expressions. This should be done on parsed stylesheets before starting to apply transformations.

    +
    ctxt:the XSLT transformation context
    params:a NULL terminated arry of parameters names/values tuples
    Returns:0 in case of success, -1 in case of error.

    Function: xsltVariableLookup

    xmlXPathObjectPtr	xsltVariableLookup	(xsltTransformContextPtr ctxt, 
    const xmlChar * name,
    const xmlChar * ns_uri)
    +

    Search in the Variable array of the context for the given variable value.

    +
    ctxt:the XSLT transformation context
    name:the variable name
    ns_uri:the variable namespace URI
    Returns:the value or NULL if not found

    Function: xsltXPathVariableLookup

    xmlXPathObjectPtr	xsltXPathVariableLookup	(void * ctxt, 
    const xmlChar * name,
    const xmlChar * ns_uri)
    +

    This is the entry point when a varibale is needed by the XPath interpretor.

    +
    ctxt:a void * but the the XSLT transformation context actually
    name:the variable name
    ns_uri:the variable namespace URI
    Returns:the value or NULL if not found

    Daniel Veillard

    diff --git a/doc/html/libxslt-xslt.html b/doc/html/libxslt-xslt.html new file mode 100644 index 0000000..6d822a4 --- /dev/null +++ b/doc/html/libxslt-xslt.html @@ -0,0 +1,22 @@ + + +Module xslt from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module xslt from libxslt

    API Menu
    Related links
    API Indexes

    Interfaces, constants and types related to the XSLT engine

    Table of Contents

    #define XSLT_DEFAULT_URL
    #define XSLT_DEFAULT_VENDOR
    #define XSLT_DEFAULT_VERSION
    #define XSLT_NAMESPACE
    #define XSLT_PARSE_OPTIONS
    void	xsltCleanupGlobals		(void)
    +
    void	xsltInit			(void)
    +

    Description

    +

    Macro: XSLT_DEFAULT_URL

    #define XSLT_DEFAULT_URL

    The XSLT "vendor" URL for this processor.

    +

    Macro: XSLT_DEFAULT_VENDOR

    #define XSLT_DEFAULT_VENDOR

    The XSLT "vendor" string for this processor.

    +

    Macro: XSLT_DEFAULT_VERSION

    #define XSLT_DEFAULT_VERSION

    The default version of XSLT supported.

    +

    Macro: XSLT_NAMESPACE

    #define XSLT_NAMESPACE

    The XSLT specification namespace.

    +

    Macro: XSLT_PARSE_OPTIONS

    #define XSLT_PARSE_OPTIONS

    The set of options to pass to an xmlReadxxx when loading files for XSLT consumption.

    +

    Function: xsltCleanupGlobals

    void	xsltCleanupGlobals		(void)
    +

    Unregister all global variables set up by the XSLT library

    +

    Function: xsltInit

    void	xsltInit			(void)
    +

    Initializes the processor (e.g. registers built-in extensions, etc.)

    +

    Daniel Veillard

    diff --git a/doc/html/libxslt-xsltInternals.html b/doc/html/libxslt-xsltInternals.html new file mode 100644 index 0000000..5cd9cc3 --- /dev/null +++ b/doc/html/libxslt-xsltInternals.html @@ -0,0 +1,754 @@ + + +Module xsltInternals from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module xsltInternals from libxslt

    API Menu
    Related links
    API Indexes

    Internal data structures, constants and functions used by the XSLT engine. They are not part of the API or ABI, i.e. they can change without prior notice, use carefully.

    Table of Contents

    #define CHECK_STOPPED
    #define CHECK_STOPPED0
    #define CHECK_STOPPEDE
    #define IS_XSLT_ATTR_FAST
    #define IS_XSLT_ELEM_FAST
    #define XML_CAST_FPTR
    #define XSLT_CCTXT
    #define XSLT_FAST_IF
    #define XSLT_GET_INTERNAL_NSMAP
    #define XSLT_HAS_INTERNAL_NSMAP
    #define XSLT_IS_RES_TREE_FRAG
    #define XSLT_IS_TEXT_NODE
    #define XSLT_ITEM_COMMON_FIELDS
    #define XSLT_ITEM_COMPATIBILITY_FIELDS
    #define XSLT_ITEM_NAVIGATION_FIELDS
    #define XSLT_ITEM_NSINSCOPE_FIELDS
    #define XSLT_MARK_RES_TREE_FRAG
    #define XSLT_MAX_SORT
    #define XSLT_PAT_NO_PRIORITY
    #define XSLT_REFACTORED_KEYCOMP
    #define XSLT_REFACTORED_VARS
    #define XSLT_REFACTORED_XPATHCOMP
    #define XSLT_RUNTIME_EXTRA
    #define XSLT_RUNTIME_EXTRA_FREE
    #define XSLT_RUNTIME_EXTRA_LST
    Structure xsltCompilerCtxt
    struct _xsltCompilerCtxt +
    Typedef xsltCompilerCtxt * xsltCompilerCtxtPtr
    +
    Structure xsltCompilerNodeInfo
    struct _xsltCompilerNodeInfo +
    Typedef xsltCompilerNodeInfo * xsltCompilerNodeInfoPtr
    +
    Structure xsltDecimalFormat
    struct _xsltDecimalFormat +
    Typedef xsltDecimalFormat * xsltDecimalFormatPtr
    +
    Structure xsltDocument
    struct _xsltDocument +
    Typedef xsltDocument * xsltDocumentPtr
    +
    Structure xsltEffectiveNs
    struct _xsltEffectiveNs +
    Typedef xsltEffectiveNs * xsltEffectiveNsPtr
    +
    Structure xsltElemPreComp
    struct _xsltElemPreComp +
    Typedef xsltElemPreComp * xsltElemPreCompPtr
    +
    Enum xsltErrorSeverityType
    +
    Structure xsltKeyDef
    struct _xsltKeyDef +
    Typedef xsltKeyDef * xsltKeyDefPtr
    +
    Structure xsltKeyTable
    struct _xsltKeyTable +
    Typedef xsltKeyTable * xsltKeyTablePtr
    +
    Structure xsltNsAlias
    struct _xsltNsAlias +
    Typedef xsltNsAlias * xsltNsAliasPtr
    +
    Structure xsltNsList
    struct _xsltNsList +
    Structure xsltNsListContainer
    struct _xsltNsListContainer +
    Typedef xsltNsListContainer * xsltNsListContainerPtr
    +
    Typedef xsltNsList * xsltNsListPtr
    +
    Structure xsltNsMap
    struct _xsltNsMap +
    Typedef xsltNsMap * xsltNsMapPtr
    +
    Enum xsltOutputType
    +
    Structure xsltPointerList
    struct _xsltPointerList +
    Typedef xsltPointerList * xsltPointerListPtr
    +
    Structure xsltPrincipalStylesheetData
    struct _xsltPrincipalStylesheetData +
    Typedef xsltPrincipalStylesheetData * xsltPrincipalStylesheetDataPtr
    +
    Structure xsltRuntimeExtra
    struct _xsltRuntimeExtra +
    Typedef xsltRuntimeExtra * xsltRuntimeExtraPtr
    +
    Structure xsltStackElem
    struct _xsltStackElem +
    Typedef xsltStackElem * xsltStackElemPtr
    +
    Structure xsltStyleBasicEmptyItem
    struct _xsltStyleBasicEmptyItem +The content of this structure is not made public by the API. +
    Typedef xsltStyleBasicEmptyItem * xsltStyleBasicEmptyItemPtr
    +
    Structure xsltStyleBasicExpressionItem
    struct _xsltStyleBasicExpressionItem +
    Typedef xsltStyleBasicExpressionItem * xsltStyleBasicExpressionItemPtr
    +
    Structure xsltStyleBasicItemVariable
    struct _xsltStyleBasicItemVariable +
    Typedef xsltStyleBasicItemVariable * xsltStyleBasicItemVariablePtr
    +
    Typedef xsltStyleBasicEmptyItem xsltStyleItemApplyImports
    +
    Typedef xsltStyleItemApplyImports * xsltStyleItemApplyImportsPtr
    +
    Structure xsltStyleItemApplyTemplates
    struct _xsltStyleItemApplyTemplates +
    Typedef xsltStyleItemApplyTemplates * xsltStyleItemApplyTemplatesPtr
    +
    Structure xsltStyleItemAttribute
    struct _xsltStyleItemAttribute +
    Typedef xsltStyleItemAttribute * xsltStyleItemAttributePtr
    +
    Structure xsltStyleItemCallTemplate
    struct _xsltStyleItemCallTemplate +
    Typedef xsltStyleItemCallTemplate * xsltStyleItemCallTemplatePtr
    +
    Typedef xsltStyleBasicEmptyItem xsltStyleItemChoose
    +
    Typedef xsltStyleItemChoose * xsltStyleItemChoosePtr
    +
    Typedef xsltStyleBasicEmptyItem xsltStyleItemComment
    +
    Typedef xsltStyleItemComment * xsltStyleItemCommentPtr
    +
    Structure xsltStyleItemCopy
    struct _xsltStyleItemCopy +
    Typedef xsltStyleBasicExpressionItem xsltStyleItemCopyOf
    +
    Typedef xsltStyleItemCopyOf * xsltStyleItemCopyOfPtr
    +
    Typedef xsltStyleItemCopy * xsltStyleItemCopyPtr
    +
    Structure xsltStyleItemDocument
    struct _xsltStyleItemDocument +
    Typedef xsltStyleItemDocument * xsltStyleItemDocumentPtr
    +
    Structure xsltStyleItemElement
    struct _xsltStyleItemElement +
    Typedef xsltStyleItemElement * xsltStyleItemElementPtr
    +
    Structure xsltStyleItemExtElement
    struct _xsltStyleItemExtElement +
    Typedef xsltStyleItemExtElement * xsltStyleItemExtElementPtr
    +
    Typedef xsltStyleBasicEmptyItem xsltStyleItemFallback
    +
    Typedef xsltStyleItemFallback * xsltStyleItemFallbackPtr
    +
    Typedef xsltStyleBasicExpressionItem xsltStyleItemForEach
    +
    Typedef xsltStyleItemForEach * xsltStyleItemForEachPtr
    +
    Structure xsltStyleItemIf
    struct _xsltStyleItemIf +
    Typedef xsltStyleItemIf * xsltStyleItemIfPtr
    +
    Structure xsltStyleItemInclude
    struct _xsltStyleItemInclude +
    Typedef xsltStyleItemInclude * xsltStyleItemIncludePtr
    +
    Structure xsltStyleItemLRElementInfo
    struct _xsltStyleItemLRElementInfo +
    Typedef xsltStyleItemLRElementInfo * xsltStyleItemLRElementInfoPtr
    +
    Structure xsltStyleItemMessage
    struct _xsltStyleItemMessage +
    Typedef xsltStyleItemMessage * xsltStyleItemMessagePtr
    +
    Structure xsltStyleItemNumber
    struct _xsltStyleItemNumber +
    Typedef xsltStyleItemNumber * xsltStyleItemNumberPtr
    +
    Structure xsltStyleItemOtherwise
    struct _xsltStyleItemOtherwise +The content of this structure is not made public by the API. +
    Typedef xsltStyleItemOtherwise * xsltStyleItemOtherwisePtr
    +
    Structure xsltStyleItemPI
    struct _xsltStyleItemPI +
    Typedef xsltStyleItemPI * xsltStyleItemPIPtr
    +
    Structure xsltStyleItemParam
    struct _xsltStyleItemParam +
    Typedef xsltStyleItemParam * xsltStyleItemParamPtr
    +
    Structure xsltStyleItemSort
    struct _xsltStyleItemSort +
    Typedef xsltStyleItemSort * xsltStyleItemSortPtr
    +
    Structure xsltStyleItemText
    struct _xsltStyleItemText +
    Typedef xsltStyleItemText * xsltStyleItemTextPtr
    +
    Structure xsltStyleItemUknown
    struct _xsltStyleItemUknown +The content of this structure is not made public by the API. +
    Typedef xsltStyleItemUknown * xsltStyleItemUknownPtr
    +
    Structure xsltStyleItemValueOf
    struct _xsltStyleItemValueOf +
    Typedef xsltStyleItemValueOf * xsltStyleItemValueOfPtr
    +
    Typedef xsltStyleBasicItemVariable xsltStyleItemVariable
    +
    Typedef xsltStyleItemVariable * xsltStyleItemVariablePtr
    +
    Structure xsltStyleItemWhen
    struct _xsltStyleItemWhen +
    Typedef xsltStyleItemWhen * xsltStyleItemWhenPtr
    +
    Typedef xsltStyleBasicItemVariable xsltStyleItemWithParam
    +
    Typedef xsltStyleItemWithParam * xsltStyleItemWithParamPtr
    +
    Structure xsltStylePreComp
    struct _xsltStylePreComp +
    Typedef xsltStylePreComp * xsltStylePreCompPtr
    +
    Enum xsltStyleType
    +
    Structure xsltStylesheet
    struct _xsltStylesheet +
    Typedef xsltStylesheet * xsltStylesheetPtr
    +
    Structure xsltTemplate
    struct _xsltTemplate +
    Typedef xsltTemplate * xsltTemplatePtr
    +
    Structure xsltTransformCache
    struct _xsltTransformCache +
    Typedef xsltTransformCache * xsltTransformCachePtr
    +
    Structure xsltTransformContext
    struct _xsltTransformContext +
    Typedef xsltTransformContext * xsltTransformContextPtr
    +
    Enum xsltTransformState
    +
    Structure xsltVarInfo
    struct _xsltVarInfo +
    Typedef xsltVarInfo * xsltVarInfoPtr
    +
    int	xsltAllocateExtra		(xsltStylesheetPtr style)
    +
    int	xsltAllocateExtraCtxt		(xsltTransformContextPtr ctxt)
    +
    void	xsltCompileAttr			(xsltStylesheetPtr style, 
    xmlAttrPtr attr)
    +
    xmlDocPtr	xsltCreateRVT		(xsltTransformContextPtr ctxt)
    +
    xsltDecimalFormatPtr	xsltDecimalFormatGetByName	(xsltStylesheetPtr style, 
    xmlChar * name)
    +
    Function type: xsltElemPreCompDeallocator
    +void	xsltElemPreCompDeallocator	(xsltElemPreCompPtr comp)
    +
    +
    xmlChar *	xsltEvalAVT		(xsltTransformContextPtr ctxt, 
    void * avt,
    xmlNodePtr node)
    +
    int	xsltExtensionInstructionResultFinalize	(xsltTransformContextPtr ctxt)
    +
    int	xsltExtensionInstructionResultRegister	(xsltTransformContextPtr ctxt, 
    xmlXPathObjectPtr obj)
    +
    xmlXPathError	xsltFormatNumberConversion	(xsltDecimalFormatPtr self, 
    xmlChar * format,
    double number,
    xmlChar ** result)
    +
    void	xsltFreeAVTList			(void * avt)
    +
    void	xsltFreeRVTs			(xsltTransformContextPtr ctxt)
    +
    void	xsltFreeStackElemList		(xsltStackElemPtr elem)
    +
    void	xsltFreeStylesheet		(xsltStylesheetPtr style)
    +
    int	xsltInitAllDocKeys		(xsltTransformContextPtr ctxt)
    +
    int	xsltInitCtxtKey			(xsltTransformContextPtr ctxt, 
    xsltDocumentPtr idoc,
    xsltKeyDefPtr keyDef)
    +
    int	xsltIsBlank			(xmlChar * str)
    +
    xsltStylesheetPtr	xsltLoadStylesheetPI	(xmlDocPtr doc)
    +
    xsltStylesheetPtr	xsltNewStylesheet	(void)
    +
    void	xsltNumberFormat		(xsltTransformContextPtr ctxt, 
    xsltNumberDataPtr data,
    xmlNodePtr node)
    +
    int	xsltParseAnyXSLTElem		(xsltCompilerCtxtPtr cctxt, 
    xmlNodePtr elem)
    +
    void	xsltParseSequenceConstructor	(xsltCompilerCtxtPtr cctxt, 
    xmlNodePtr cur)
    +
    xsltStylesheetPtr	xsltParseStylesheetDoc	(xmlDocPtr doc)
    +
    xsltStylesheetPtr	xsltParseStylesheetFile	(const xmlChar * filename)
    +
    xsltStylesheetPtr	xsltParseStylesheetImportedDoc	(xmlDocPtr doc, 
    xsltStylesheetPtr parentStyle)
    +
    void	xsltParseStylesheetOutput	(xsltStylesheetPtr style, 
    xmlNodePtr cur)
    +
    xsltStylesheetPtr	xsltParseStylesheetProcess	(xsltStylesheetPtr ret, 
    xmlDocPtr doc)
    +
    void	xsltParseTemplateContent	(xsltStylesheetPtr style, 
    xmlNodePtr templ)
    +
    int	xsltPointerListAddSize		(xsltPointerListPtr list, 
    void * item,
    int initialSize)
    +
    void	xsltPointerListClear		(xsltPointerListPtr list)
    +
    xsltPointerListPtr	xsltPointerListCreate	(int initialSize)
    +
    void	xsltPointerListFree		(xsltPointerListPtr list)
    +
    int	xsltRegisterLocalRVT		(xsltTransformContextPtr ctxt, 
    xmlDocPtr RVT)
    +
    int	xsltRegisterPersistRVT		(xsltTransformContextPtr ctxt, 
    xmlDocPtr RVT)
    +
    int	xsltRegisterTmpRVT		(xsltTransformContextPtr ctxt, 
    xmlDocPtr RVT)
    +
    void	xsltReleaseRVT			(xsltTransformContextPtr ctxt, 
    xmlDocPtr RVT)
    +
    int	xsltRestoreDocumentNamespaces	(xsltNsMapPtr ns, 
    xmlDocPtr doc)
    +
    Function type: xsltSortFunc
    +void	xsltSortFunc			(xsltTransformContextPtr ctxt, 
    xmlNodePtr * sorts,
    int nbsorts) +
    +
    Function type: xsltTransformFunction
    +void	xsltTransformFunction		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltElemPreCompPtr comp) +
    +
    void	xsltUninit			(void)
    +

    Description

    +

    Macro: CHECK_STOPPED

    #define CHECK_STOPPED

    Macro to check if the XSLT processing should be stopped. Will return from the function.

    +

    Macro: CHECK_STOPPED0

    #define CHECK_STOPPED0

    Macro to check if the XSLT processing should be stopped. Will return from the function with a 0 value.

    +

    Macro: CHECK_STOPPEDE

    #define CHECK_STOPPEDE

    Macro to check if the XSLT processing should be stopped. Will goto the error: label.

    +

    Macro: IS_XSLT_ATTR_FAST

    #define IS_XSLT_ATTR_FAST

    quick check for xslt namespace attribute

    +

    Macro: IS_XSLT_ELEM_FAST

    #define IS_XSLT_ELEM_FAST

    quick check whether this is an xslt element

    +

    Macro: XML_CAST_FPTR

    #define XML_CAST_FPTR

    Macro to do a casting from an object pointer to a function pointer without encountering a warning from gcc #define XML_CAST_FPTR(fptr) (*(void **)(&fptr)) This macro violated ISO C aliasing rules (gcc4 on s390 broke) so it is disabled now

    +

    Macro: XSLT_CCTXT

    #define XSLT_CCTXT

    get pointer to compiler context

    +

    Macro: XSLT_FAST_IF

    #define XSLT_FAST_IF

    Internal define to enable usage of xmlXPathCompiledEvalToBoolean() for XSLT "tests"; e.g. in <xsl:if test="/foo/bar">

    +

    Macro: XSLT_GET_INTERNAL_NSMAP

    #define XSLT_GET_INTERNAL_NSMAP

    get pointer to namespace map

    +

    Macro: XSLT_HAS_INTERNAL_NSMAP

    #define XSLT_HAS_INTERNAL_NSMAP

    check for namespace mapping

    +

    Macro: XSLT_IS_RES_TREE_FRAG

    #define XSLT_IS_RES_TREE_FRAG

    internal macro to test tree fragments

    +

    Macro: XSLT_IS_TEXT_NODE

    #define XSLT_IS_TEXT_NODE

    check if the argument is a text node

    +

    Macro: XSLT_ITEM_COMMON_FIELDS

    #define XSLT_ITEM_COMMON_FIELDS

    Common fields used for all items.

    +

    Macro: XSLT_ITEM_COMPATIBILITY_FIELDS

    #define XSLT_ITEM_COMPATIBILITY_FIELDS

    Fields for API compatibility to the structure _xsltElemPreComp which is used for extension functions. Note that @next is used for storage; it does not reflect a next sibling in the tree. TODO: Evaluate if we really need such a compatibility.

    +

    Macro: XSLT_ITEM_NAVIGATION_FIELDS

    #define XSLT_ITEM_NAVIGATION_FIELDS

    Currently empty. TODO: It is intended to hold navigational fields in the future.

    +

    Macro: XSLT_ITEM_NSINSCOPE_FIELDS

    #define XSLT_ITEM_NSINSCOPE_FIELDS

    The in-scope namespaces.

    +

    Macro: XSLT_MARK_RES_TREE_FRAG

    #define XSLT_MARK_RES_TREE_FRAG

    internal macro to set up tree fragments

    +

    Macro: XSLT_MAX_SORT

    #define XSLT_MAX_SORT

    Max number of specified xsl:sort on an element.

    +

    Macro: XSLT_PAT_NO_PRIORITY

    #define XSLT_PAT_NO_PRIORITY

    Specific value for pattern without priority expressed.

    +

    Macro: XSLT_REFACTORED_KEYCOMP

    #define XSLT_REFACTORED_KEYCOMP

    Internal define to enable on-demand xsl:key computation. That's the only mode now but the define is kept for compatibility

    +

    Macro: XSLT_REFACTORED_VARS

    #define XSLT_REFACTORED_VARS

    Internal define to enable the refactored variable part of libxslt

    +

    Macro: XSLT_REFACTORED_XPATHCOMP

    #define XSLT_REFACTORED_XPATHCOMP

    Internal define to enable the optimization of the compilation of XPath expressions.

    +

    Macro: XSLT_RUNTIME_EXTRA

    #define XSLT_RUNTIME_EXTRA

    Macro used to define extra information stored in the context

    +

    Macro: XSLT_RUNTIME_EXTRA_FREE

    #define XSLT_RUNTIME_EXTRA_FREE

    Macro used to free extra information stored in the context

    +

    Macro: XSLT_RUNTIME_EXTRA_LST

    #define XSLT_RUNTIME_EXTRA_LST

    Macro used to access extra information stored in the context

    +

    Structure xsltCompilerCtxt

    Structure xsltCompilerCtxt
    struct _xsltCompilerCtxt { + void * errorCtxt : * used for error/warning reports; e.g. X + xsltErrorSeverityType errSeverity + int warnings : TODO: number of warnings found at compi + int errors : TODO: number of errors found at compila + xmlDictPtr dict + xsltStylesheetPtr style + int simplified : whether this is a simplified stylesheet + int depth : Current depth of processing + xsltCompilerNodeInfoPtr inode + xsltCompilerNodeInfoPtr inodeList + xsltCompilerNodeInfoPtr inodeLast + xsltPointerListPtr tmpList : * The XSLT version as specified by the s + int isInclude + int hasForwardsCompat : whether forwards-compatible mode was us + int maxNodeInfos : TEMP TODO: just for the interest + int maxLREs : * In order to keep the old behaviour, ap + int strict + xsltPrincipalStylesheetDataPtr psData + xmlXPathContextPtr xpathCtxt + xsltStyleItemUknownPtr unknownItem + int hasNsAliases : Indicator if there was an xsl:namespace + xsltNsAliasPtr nsAliases + xsltVarInfoPtr ivars : Storage of local in-scope variables/par + xsltVarInfoPtr ivar : topmost local variable/param. +}

    Structure xsltCompilerNodeInfo

    Structure xsltCompilerNodeInfo
    struct _xsltCompilerNodeInfo { + xsltCompilerNodeInfoPtr next + xsltCompilerNodeInfoPtr prev + xmlNodePtr node + int depth + xsltTemplatePtr templ : The owning template + int category : XSLT element, LR-element or extension e + xsltStyleType type + xsltElemPreCompPtr item : The compiled information The current in + xsltNsListContainerPtr inScopeNs : The current excluded result namespaces + xsltPointerListPtr exclResultNs : The current extension instruction names + xsltPointerListPtr extElemNs : The current info for literal result ele + xsltStyleItemLRElementInfoPtr litResElemInfo : * Set to 1 if in-scope namespaces change + int nsChanged + int preserveWhitespace + int stripWhitespace + int isRoot : whether this is the stylesheet's root n + int forwardsCompat : whether forwards-compatible mode is ena + int extContentHandled : the type of the current child + xsltStyleType curChildType +}

    Structure xsltDecimalFormat

    Structure xsltDecimalFormat
    struct _xsltDecimalFormat { + struct _xsltDecimalFormat * next : chained list + xmlChar * name : Used for interpretation of pattern + xmlChar * digit + xmlChar * patternSeparator : May appear in result + xmlChar * minusSign + xmlChar * infinity + xmlChar * noNumber : Not-a-number Used for interpretation of + xmlChar * decimalPoint + xmlChar * grouping + xmlChar * percent + xmlChar * permille + xmlChar * zeroDigit +}

    Structure xsltDocument

    Structure xsltDocument
    struct _xsltDocument { + struct _xsltDocument * next : documents are kept in a chained list + int main : is this the main document + xmlDocPtr doc : the parsed document + void * keys : key tables storage + struct _xsltDocument * includes : subsidiary includes + int preproc : pre-processing already done + int nbKeysComputed +}

    Structure xsltEffectiveNs

    Structure xsltEffectiveNs
    struct _xsltEffectiveNs { + xsltEffectiveNsPtr nextInStore : storage next + xsltEffectiveNsPtr next : next item in the list + const xmlChar * prefix + const xmlChar * nsName : * Indicates if eclared on the literal re + int holdByElem +}

    Structure xsltElemPreComp

    Structure xsltElemPreComp
    struct _xsltElemPreComp { + xsltElemPreCompPtr next : next item in the global chained list ho + xsltStyleType type : type of the element + xsltTransformFunction func : handling function + xmlNodePtr inst : the node in the stylesheet's tree corre + xsltElemPreCompDeallocator free : the deallocator +}

    Enum xsltErrorSeverityType

    Enum xsltErrorSeverityType {
    +    XSLT_ERROR_SEVERITY_ERROR = 0
    +    XSLT_ERROR_SEVERITY_WARNING = 1
    +}
    +

    Structure xsltKeyDef

    Structure xsltKeyDef
    struct _xsltKeyDef { + struct _xsltKeyDef * next + xmlNodePtr inst + xmlChar * name + xmlChar * nameURI + xmlChar * match + xmlChar * use + xmlXPathCompExprPtr comp + xmlXPathCompExprPtr usecomp + xmlNsPtr * nsList : the namespaces in scope + int nsNr : the number of namespaces in scope +}

    Structure xsltKeyTable

    Structure xsltKeyTable
    struct _xsltKeyTable { + struct _xsltKeyTable * next + xmlChar * name + xmlChar * nameURI + xmlHashTablePtr keys +}

    Structure xsltNsAlias

    Structure xsltNsAlias
    struct _xsltNsAlias { + xsltNsAliasPtr next : next in the list + xmlNsPtr literalNs + xmlNsPtr targetNs + xmlDocPtr docOfTargetNs +}

    Structure xsltNsList

    Structure xsltNsList
    struct _xsltNsList { + xsltNsListPtr next : next in the list + xmlNsPtr ns +}

    Structure xsltNsListContainer

    Structure xsltNsListContainer
    struct _xsltNsListContainer { + xmlNsPtr * list + int totalNumber + int xpathNumber +}

    Structure xsltNsMap

    Structure xsltNsMap
    struct _xsltNsMap { + xsltNsMapPtr next : next in the list + xmlDocPtr doc + xmlNodePtr elem : the element holding the ns-decl + xmlNsPtr ns : the xmlNs structure holding the XML nam + const xmlChar * origNsName : the original XML namespace name + const xmlChar * newNsName : the mapped XML namespace name +}

    Enum xsltOutputType

    Enum xsltOutputType {
    +    XSLT_OUTPUT_XML = 0
    +    XSLT_OUTPUT_HTML = 1
    +    XSLT_OUTPUT_TEXT = 2
    +}
    +

    Structure xsltPointerList

    Structure xsltPointerList
    struct _xsltPointerList { + void ** items + int number + int size +}

    Structure xsltPrincipalStylesheetData

    Structure xsltPrincipalStylesheetData
    struct _xsltPrincipalStylesheetData { + xmlDictPtr namespaceDict : * Global list of in-scope namespaces. * + xsltPointerListPtr inScopeNamespaces : * Global list of information for [xsl:]e + xsltPointerListPtr exclResultNamespaces : * Global list of information for [xsl:]e + xsltPointerListPtr extElemNamespaces + xsltEffectiveNsPtr effectiveNs : * Namespace name map to get rid of strin + xsltNsMapPtr nsMap +}

    Structure xsltRuntimeExtra

    Structure xsltRuntimeExtra
    struct _xsltRuntimeExtra { + void * info : pointer to the extra data + xmlFreeFunc deallocate : pointer to the deallocation routine +}

    Structure xsltStackElem

    Structure xsltStackElem
    struct _xsltStackElem { + struct _xsltStackElem * next : chained list + xsltStylePreCompPtr comp : the compiled form + int computed : was the evaluation done + const xmlChar * name : the local part of the name QName + const xmlChar * nameURI : the URI part of the name QName + const xmlChar * select : the eval string + xmlNodePtr tree : the sequence constructor if no eval str + xmlXPathObjectPtr value : The value if computed + xmlDocPtr fragment : The Result Tree Fragments (needed for X + int level : the depth in the tree; -1 if persistent + xsltTransformContextPtr context : The transformation context; needed to c + int flags +}

    Structure xsltStyleBasicEmptyItem

    Structure xsltStyleBasicEmptyItem
    struct _xsltStyleBasicEmptyItem { +The content of this structure is not made public by the API. +}

    Structure xsltStyleBasicExpressionItem

    Structure xsltStyleBasicExpressionItem
    struct _xsltStyleBasicExpressionItem { + const xmlChar * select : TODO: Change this to "expression". + xmlXPathCompExprPtr comp : TODO: Change this to compExpr. +}

    Structure xsltStyleBasicItemVariable

    Structure xsltStyleBasicItemVariable
    struct _xsltStyleBasicItemVariable { + const xmlChar * select + xmlXPathCompExprPtr comp + const xmlChar * name + int has_name + const xmlChar * ns + int has_ns +}

    Structure xsltStyleItemApplyTemplates

    Structure xsltStyleItemApplyTemplates
    struct _xsltStyleItemApplyTemplates { + const xmlChar * mode : apply-templates + const xmlChar * modeURI : apply-templates + const xmlChar * select : sort, copy-of, value-of, apply-template + xmlXPathCompExprPtr comp : a precompiled XPath expression TODO: wi +}

    Structure xsltStyleItemAttribute

    Structure xsltStyleItemAttribute
    struct _xsltStyleItemAttribute { + const xmlChar * name + int has_name + const xmlChar * ns + const xmlChar * nsPrefix + int has_ns +}

    Structure xsltStyleItemCallTemplate

    Structure xsltStyleItemCallTemplate
    struct _xsltStyleItemCallTemplate { + xsltTemplatePtr templ : call-template + const xmlChar * name : element, attribute, pi + int has_name : element, attribute, pi + const xmlChar * ns : element + int has_ns : element TODO: with-params +}

    Structure xsltStyleItemCopy

    Structure xsltStyleItemCopy
    struct _xsltStyleItemCopy { + const xmlChar * use : copy, element + int has_use : copy, element +}

    Structure xsltStyleItemDocument

    Structure xsltStyleItemDocument
    struct _xsltStyleItemDocument { + int ver11 : assigned: in xsltDocumentComp; read: no + const xmlChar * filename : document URL + int has_filename +}

    Structure xsltStyleItemElement

    Structure xsltStyleItemElement
    struct _xsltStyleItemElement { + const xmlChar * use + int has_use + const xmlChar * name + int has_name + const xmlChar * ns + const xmlChar * nsPrefix + int has_ns +}

    Structure xsltStyleItemExtElement

    Structure xsltStyleItemExtElement
    struct _xsltStyleItemExtElement { + xsltElemPreCompPtr item +}

    Structure xsltStyleItemIf

    Structure xsltStyleItemIf
    struct _xsltStyleItemIf { + const xmlChar * test : if + xmlXPathCompExprPtr comp : a precompiled XPath expression +}

    Structure xsltStyleItemInclude

    Structure xsltStyleItemInclude
    struct _xsltStyleItemInclude { + xsltDocumentPtr include +}

    Structure xsltStyleItemLRElementInfo

    Structure xsltStyleItemLRElementInfo
    struct _xsltStyleItemLRElementInfo { + xsltEffectiveNsPtr effectiveNs +}

    Structure xsltStyleItemMessage

    Structure xsltStyleItemMessage
    struct _xsltStyleItemMessage { + int terminate +}

    Structure xsltStyleItemNumber

    Structure xsltStyleItemNumber
    struct _xsltStyleItemNumber { + xsltNumberData numdata : number +}

    Structure xsltStyleItemOtherwise

    Structure xsltStyleItemOtherwise
    struct _xsltStyleItemOtherwise { +The content of this structure is not made public by the API. +}

    Structure xsltStyleItemPI

    Structure xsltStyleItemPI
    struct _xsltStyleItemPI { + const xmlChar * name + int has_name +}

    Structure xsltStyleItemParam

    Structure xsltStyleItemParam
    struct _xsltStyleItemParam { + const xmlChar * select + xmlXPathCompExprPtr comp + const xmlChar * name + int has_name + const xmlChar * ns + int has_ns +}

    Structure xsltStyleItemSort

    Structure xsltStyleItemSort
    struct _xsltStyleItemSort { + const xmlChar * stype : sort + int has_stype : sort + int number : sort + const xmlChar * order : sort + int has_order : sort + int descending : sort + const xmlChar * lang : sort + int has_lang : sort + xsltLocale locale : sort + const xmlChar * case_order : sort + int lower_first : sort + const xmlChar * use + int has_use + const xmlChar * select : sort, copy-of, value-of, apply-template + xmlXPathCompExprPtr comp : a precompiled XPath expression +}

    Structure xsltStyleItemText

    Structure xsltStyleItemText
    struct _xsltStyleItemText { + int noescape : text +}

    Structure xsltStyleItemUknown

    Structure xsltStyleItemUknown
    struct _xsltStyleItemUknown { +The content of this structure is not made public by the API. +}

    Structure xsltStyleItemValueOf

    Structure xsltStyleItemValueOf
    struct _xsltStyleItemValueOf { + const xmlChar * select + xmlXPathCompExprPtr comp : a precompiled XPath expression + int noescape +}

    Structure xsltStyleItemWhen

    Structure xsltStyleItemWhen
    struct _xsltStyleItemWhen { + const xmlChar * test + xmlXPathCompExprPtr comp +}

    Structure xsltStylePreComp

    Structure xsltStylePreComp
    struct _xsltStylePreComp { + xsltElemPreCompPtr next : chained list + xsltStyleType type : type of the element + xsltTransformFunction func : handling function + xmlNodePtr inst : * Pre computed values. * + const xmlChar * stype : sort + int has_stype : sort + int number : sort + const xmlChar * order : sort + int has_order : sort + int descending : sort + const xmlChar * lang : sort + int has_lang : sort + xsltLocale locale : sort + const xmlChar * case_order : sort + int lower_first : sort + const xmlChar * use : copy, element + int has_use : copy, element + int noescape : text + const xmlChar * name : element, attribute, pi + int has_name : element, attribute, pi + const xmlChar * ns : element + int has_ns : element + const xmlChar * mode : apply-templates + const xmlChar * modeURI : apply-templates + const xmlChar * test : if + xsltTemplatePtr templ : call-template + const xmlChar * select : sort, copy-of, value-of, apply-template + int ver11 : document + const xmlChar * filename : document URL + int has_filename : document + xsltNumberData numdata : number + xmlXPathCompExprPtr comp : a precompiled XPath expression + xmlNsPtr * nsList : the namespaces in scope + int nsNr : the number of namespaces in scope +}

    Enum xsltStyleType

    Enum xsltStyleType {
    +    XSLT_FUNC_COPY = 1
    +    XSLT_FUNC_SORT = 2
    +    XSLT_FUNC_TEXT = 3
    +    XSLT_FUNC_ELEMENT = 4
    +    XSLT_FUNC_ATTRIBUTE = 5
    +    XSLT_FUNC_COMMENT = 6
    +    XSLT_FUNC_PI = 7
    +    XSLT_FUNC_COPYOF = 8
    +    XSLT_FUNC_VALUEOF = 9
    +    XSLT_FUNC_NUMBER = 10
    +    XSLT_FUNC_APPLYIMPORTS = 11
    +    XSLT_FUNC_CALLTEMPLATE = 12
    +    XSLT_FUNC_APPLYTEMPLATES = 13
    +    XSLT_FUNC_CHOOSE = 14
    +    XSLT_FUNC_IF = 15
    +    XSLT_FUNC_FOREACH = 16
    +    XSLT_FUNC_DOCUMENT = 17
    +    XSLT_FUNC_WITHPARAM = 18
    +    XSLT_FUNC_PARAM = 19
    +    XSLT_FUNC_VARIABLE = 20
    +    XSLT_FUNC_WHEN = 21
    +    XSLT_FUNC_EXTENSION = 22
    +    XSLT_FUNC_OTHERWISE = 23
    +    XSLT_FUNC_FALLBACK = 24
    +    XSLT_FUNC_MESSAGE = 25
    +    XSLT_FUNC_INCLUDE = 26
    +    XSLT_FUNC_ATTRSET = 27
    +    XSLT_FUNC_LITERAL_RESULT_ELEMENT = 28
    +    XSLT_FUNC_UNKOWN_FORWARDS_COMPAT = 29
    +}
    +

    Structure xsltStylesheet

    Structure xsltStylesheet
    struct _xsltStylesheet { + struct _xsltStylesheet * parent + struct _xsltStylesheet * next + struct _xsltStylesheet * imports + xsltDocumentPtr docList : * General data on the style sheet docume + xmlDocPtr doc : the parsed XML stylesheet + xmlHashTablePtr stripSpaces : the hash table of the strip-space and p + int stripAll : strip-space * (1) preserve-space * (-1) + xmlHashTablePtr cdataSection : * Global variable or parameters. * + xsltStackElemPtr variables : * Template descriptions. * + xsltTemplatePtr templates : the ordered list of templates + void * templatesHash : hash table or wherever compiled templat + void * rootMatch : template based on / + void * keyMatch : template based on key() + void * elemMatch : template based on * + void * attrMatch : template based on @* + void * parentMatch : template based on .. + void * textMatch : template based on text() + void * piMatch : template based on processing-instructio + void * commentMatch : * Namespace aliases. * NOTE: Not used in + xmlHashTablePtr nsAliases : * Attribute sets. * + xmlHashTablePtr attributeSets : * Namespaces. * TODO: Eliminate this. * + xmlHashTablePtr nsHash : the set of namespaces in use: ATTENTION + void * nsDefs : * Key definitions. * + void * keys : * Output related stuff. * + xmlChar * method : the output method + xmlChar * methodURI : associated namespace if any + xmlChar * version : version string + xmlChar * encoding : encoding string + int omitXmlDeclaration : * Number formatting. * + xsltDecimalFormatPtr decimalFormat + int standalone : standalone = "yes" | "no" + xmlChar * doctypePublic : doctype-public string + xmlChar * doctypeSystem : doctype-system string + int indent : should output being indented + xmlChar * mediaType : * Precomputed blocks. * + xsltElemPreCompPtr preComps : list of precomputed blocks + int warnings : number of warnings found at compilation + int errors : number of errors found at compilation + xmlChar * exclPrefix : last excluded prefixes + xmlChar ** exclPrefixTab : array of excluded prefixes + int exclPrefixNr : number of excluded prefixes in scope + int exclPrefixMax : size of the array + void * _private : * Extensions. * + xmlHashTablePtr extInfos : the extension data + int extrasNr : * For keeping track of nested includes * + xsltDocumentPtr includes : * dictionary: shared between stylesheet, + xmlDictPtr dict : * precompiled attribute value templates. + void * attVTs : * if namespace-alias has an alias for th + const xmlChar * defaultAlias : * bypass pre-processing (already done) ( + int nopreproc : * all document text strings were interna + int internalized : * Literal Result Element as Stylesheet c + int literal_result : * The principal stylesheet * + xsltStylesheetPtr principal : * Compilation context used during compil + xsltCompilerCtxtPtr compCtxt : TODO: Change this to (void *). + xsltPrincipalStylesheetDataPtr principalData : * Forwards-compatible processing * + int forwards_compatible +}

    Structure xsltTemplate

    Structure xsltTemplate
    struct _xsltTemplate { + struct _xsltTemplate * next : chained list sorted by priority + struct _xsltStylesheet * style : the containing stylesheet + xmlChar * match : the matching string + float priority : as given from the stylesheet, not compu + const xmlChar * name : the local part of the name QName + const xmlChar * nameURI : the URI part of the name QName + const xmlChar * mode : the local part of the mode QName + const xmlChar * modeURI : the URI part of the mode QName + xmlNodePtr content : the template replacement value + xmlNodePtr elem : * TODO: @inheritedNsNr and @inheritedNs + int inheritedNsNr : number of inherited namespaces + xmlNsPtr * inheritedNs : inherited non-excluded namespaces Profi + int nbCalls : the number of time the template was cal + unsigned long time : the time spent in this template + void * params : xsl:param instructions + int templNr : Nb of templates in the stack + int templMax : Size of the templtes stack + xsltTemplatePtr * templCalledTab : templates called + int * templCountTab : .. and how often +}

    Structure xsltTransformCache

    Structure xsltTransformCache
    struct _xsltTransformCache { + xmlDocPtr RVT + int nbRVT + xsltStackElemPtr stackItems + int nbStackItems + int dbgCachedRVTs + int dbgReusedRVTs + int dbgCachedVars + int dbgReusedVars +}

    Structure xsltTransformContext

    Structure xsltTransformContext
    struct _xsltTransformContext { + xsltStylesheetPtr style : the stylesheet used + xsltOutputType type : the type of output + xsltTemplatePtr templ : the current template + int templNr : Nb of templates in the stack + int templMax : Size of the templtes stack + xsltTemplatePtr * templTab : the template stack + xsltStackElemPtr vars : the current variable list + int varsNr : Nb of variable list in the stack + int varsMax : Size of the variable list stack + xsltStackElemPtr * varsTab : the variable list stack + int varsBase : * Extensions * + xmlHashTablePtr extFunctions : the extension functions + xmlHashTablePtr extElements : the extension elements + xmlHashTablePtr extInfos : the extension data + const xmlChar * mode : the current mode + const xmlChar * modeURI : the current mode URI + xsltDocumentPtr docList : the document list + xsltDocumentPtr document : the current source document; can be NUL + xmlNodePtr node : the current node being processed + xmlNodeSetPtr nodeList : the current node list xmlNodePtr curren + xmlDocPtr output : the resulting document + xmlNodePtr insert : the insertion node + xmlXPathContextPtr xpathCtxt : the XPath context + xsltTransformState state : * Global variables * + xmlHashTablePtr globalVars : the global variables and params + xmlNodePtr inst : the instruction in the stylesheet + int xinclude : should XInclude be processed + const char * outputFile : the output URI if known + int profile : is this run profiled + long prof : the current profiled value + int profNr : Nb of templates in the stack + int profMax : Size of the templtaes stack + long * profTab : the profile template stack + void * _private : user defined data + int extrasNr : the number of extras used + int extrasMax : the number of extras allocated + xsltRuntimeExtraPtr extras : extra per runtime informations + xsltDocumentPtr styleList : the stylesheet docs list + void * sec : the security preferences if any + xmlGenericErrorFunc error : a specific error handler + void * errctx : context for the error handler + xsltSortFunc sortfunc : * handling of temporary Result Value Tre + xmlDocPtr tmpRVT : list of RVT without persistance + xmlDocPtr persistRVT : list of persistant RVTs + int ctxtflags : * Speed optimization when coalescing tex + const xmlChar * lasttext : last text node content + unsigned int lasttsize : last text node size + unsigned int lasttuse : * Per Context Debugging * + int debugStatus : the context level debug status + unsigned long * traceCode : pointer to the variable holding the mas + int parserOptions : * dictionary: shared between stylesheet, + xmlDictPtr dict + xmlDocPtr tmpDoc : * all document text strings are internal + int internalized + int nbKeys + int hasTemplKeyPatterns + xsltTemplatePtr currentTemplateRule : the Current Template Rule + xmlNodePtr initialContextNode + xmlDocPtr initialContextDoc + xsltTransformCachePtr cache + void * contextVariable : the current variable item + xmlDocPtr localRVT : list of local tree fragments; will be f + xmlDocPtr localRVTBase + int keyInitLevel : Needed to catch recursive keys issues + int funcLevel : Needed to catch recursive functions iss + int maxTemplateDepth + int maxTemplateVars +}

    Enum xsltTransformState

    Enum xsltTransformState {
    +    XSLT_STATE_OK = 0
    +    XSLT_STATE_ERROR = 1
    +    XSLT_STATE_STOPPED = 2
    +}
    +

    Structure xsltVarInfo

    Structure xsltVarInfo
    struct _xsltVarInfo { + xsltVarInfoPtr next : next in the list + xsltVarInfoPtr prev + int depth : the depth in the tree + const xmlChar * name + const xmlChar * nsName +}

    Function: xsltAllocateExtra

    int	xsltAllocateExtra		(xsltStylesheetPtr style)
    +

    Allocate an extra runtime information slot statically while compiling the stylesheet and return its number

    +
    style:an XSLT stylesheet
    Returns:the number of the slot

    Function: xsltAllocateExtraCtxt

    int	xsltAllocateExtraCtxt		(xsltTransformContextPtr ctxt)
    +

    Allocate an extra runtime information slot at run-time and return its number This make sure there is a slot ready in the transformation context

    +
    ctxt:an XSLT transformation context
    Returns:the number of the slot

    Function: xsltCompileAttr

    void	xsltCompileAttr			(xsltStylesheetPtr style, 
    xmlAttrPtr attr)
    +

    Precompile an attribute in a stylesheet, basically it checks if it is an attrubute value template, and if yes establish some structures needed to process it at transformation time.

    +
    style:a XSLT process context
    attr:the attribute coming from the stylesheet.

    Function: xsltCreateRVT

    xmlDocPtr	xsltCreateRVT		(xsltTransformContextPtr ctxt)
    +

    Creates a Result Value Tree (the XSLT 1.0 term for this is "Result Tree Fragment")

    +
    ctxt:an XSLT transformation context
    Returns:the result value tree or NULL in case of API or internal errors.

    Function: xsltDecimalFormatGetByName

    xsltDecimalFormatPtr	xsltDecimalFormatGetByName	(xsltStylesheetPtr style, 
    xmlChar * name)
    +

    Find decimal-format by name

    +
    style:the XSLT stylesheet
    name:the decimal-format name to find
    Returns:the xsltDecimalFormatPtr

    Function type: xsltElemPreCompDeallocator

    Function type: xsltElemPreCompDeallocator
    +void	xsltElemPreCompDeallocator	(xsltElemPreCompPtr comp)
    +

    Deallocates an #xsltElemPreComp structure.

    comp:the #xsltElemPreComp to free up

    +

    Function: xsltEvalAVT

    xmlChar *	xsltEvalAVT		(xsltTransformContextPtr ctxt, 
    void * avt,
    xmlNodePtr node)
    +

    Process the given AVT, and return the new string value.

    +
    ctxt:the XSLT transformation context
    avt:the prevompiled attribute value template info
    node:the node hosting the attribute
    Returns:the computed string value or NULL, must be deallocated by the caller.

    Function: xsltExtensionInstructionResultFinalize

    int	xsltExtensionInstructionResultFinalize	(xsltTransformContextPtr ctxt)
    +

    Finalizes the data (e.g. result tree fragments) created within a value-returning process (e.g. EXSLT's function). Tree fragments marked as being returned by a function are set to normal state, which means that the fragment garbage collector will free them after the function-calling process exits.

    +
    ctxt:an XSLT transformation context
    Returns:0 in case of success and -1 in case of API or internal errors.

    Function: xsltExtensionInstructionResultRegister

    int	xsltExtensionInstructionResultRegister	(xsltTransformContextPtr ctxt, 
    xmlXPathObjectPtr obj)
    +

    Marks the result of a value-returning extension instruction in order to avoid it being garbage collected before the extension instruction exits. Note that one still has to additionally register any newly created tree fragments (via xsltCreateRVT()) with xsltRegisterLocalRVT().

    +
    ctxt:an XSLT transformation context
    obj:an XPath object to be inspected for result tree fragments
    Returns:0 in case of success and -1 in case of error.

    Function: xsltFormatNumberConversion

    xmlXPathError	xsltFormatNumberConversion	(xsltDecimalFormatPtr self, 
    xmlChar * format,
    double number,
    xmlChar ** result)
    +

    format-number() uses the JDK 1.1 DecimalFormat class: http://java.sun.com/products/jdk/1.1/docs/api/java.text.DecimalFormat.html Structure: pattern := subpattern{;subpattern} subpattern := {prefix}integer{.fraction}{suffix} prefix := '\\u0000'..'\\uFFFD' - specialCharacters suffix := '\\u0000'..'\\uFFFD' - specialCharacters integer := '#'* '0'* '0' fraction := '0'* '#'* Notation: X* 0 or more instances of X (X | Y) either X or Y. X..Y any character from X up to Y, inclusive. S - T characters in S, except those in T Special Characters: Symbol Meaning 0 a digit # a digit, zero shows as absent . placeholder for decimal separator , placeholder for grouping separator. ; separates formats. - default negative prefix. % multiply by 100 and show as percentage ? multiply by 1000 and show as per mille X any other characters can be used in the prefix or suffix ' used to quote special characters in a prefix or suffix.

    +
    self:the decimal format
    format:the format requested
    number:the value to format
    result:the place to ouput the result
    Returns:a possible XPath error

    Function: xsltFreeAVTList

    void	xsltFreeAVTList			(void * avt)
    +

    Free up the memory associated to the attribute value templates

    +
    avt:pointer to an list of AVT structures

    Function: xsltFreeRVTs

    void	xsltFreeRVTs			(xsltTransformContextPtr ctxt)
    +

    Frees all registered result value trees (Result Tree Fragments) of the transformation. Internal function; should not be called by user-code.

    +
    ctxt:an XSLT transformation context

    Function: xsltFreeStackElemList

    void	xsltFreeStackElemList		(xsltStackElemPtr elem)
    +

    Free up the memory allocated by @elem

    +
    elem:an XSLT stack element

    Function: xsltFreeStylesheet

    void	xsltFreeStylesheet		(xsltStylesheetPtr style)
    +

    Free up the memory allocated by @style

    +
    style:an XSLT stylesheet

    Function: xsltInitAllDocKeys

    int	xsltInitAllDocKeys		(xsltTransformContextPtr ctxt)
    +

    INTERNAL ROUTINE ONLY Check if any keys on the current document need to be computed

    +
    ctxt:transformation context
    Returns:0 in case of success, -1 in case of failure

    Function: xsltInitCtxtKey

    int	xsltInitCtxtKey			(xsltTransformContextPtr ctxt, 
    xsltDocumentPtr idoc,
    xsltKeyDefPtr keyDef)
    +

    Computes the key tables this key and for the current input document.

    +
    ctxt:an XSLT transformation context
    idoc:the document information (holds key values)
    keyDef:the key definition
    Returns:0 on success, -1 on error

    Function: xsltIsBlank

    int	xsltIsBlank			(xmlChar * str)
    +

    Check if a string is ignorable

    +
    str:a string
    Returns:1 if the string is NULL or made of blanks chars, 0 otherwise

    Function: xsltLoadStylesheetPI

    xsltStylesheetPtr	xsltLoadStylesheetPI	(xmlDocPtr doc)
    +

    This function tries to locate the stylesheet PI in the given document If found, and if contained within the document, it will extract that subtree to build the stylesheet to process @doc (doc itself will be modified). If found but referencing an external document it will attempt to load it and generate a stylesheet from it. In both cases, the resulting stylesheet and the document need to be freed once the transformation is done.

    +
    doc:a document to process
    Returns:a new XSLT stylesheet structure or NULL if not found.

    Function: xsltNewStylesheet

    xsltStylesheetPtr	xsltNewStylesheet	(void)
    +

    Create a new XSLT Stylesheet

    +
    Returns:the newly allocated xsltStylesheetPtr or NULL in case of error

    Function: xsltNumberFormat

    void	xsltNumberFormat		(xsltTransformContextPtr ctxt, 
    xsltNumberDataPtr data,
    xmlNodePtr node)
    +

    Convert one number.

    +
    ctxt:the XSLT transformation context
    data:the formatting informations
    node:the data to format

    Function: xsltParseAnyXSLTElem

    int	xsltParseAnyXSLTElem		(xsltCompilerCtxtPtr cctxt, 
    xmlNodePtr elem)
    +

    Parses, validates the content models and compiles XSLT instructions.

    +
    cctxt:the compilation context
    elem:the element node of the XSLT instruction
    Returns:0 if everything's fine; -1 on API or internal errors.

    Function: xsltParseSequenceConstructor

    void	xsltParseSequenceConstructor	(xsltCompilerCtxtPtr cctxt, 
    xmlNodePtr cur)
    +

    Parses a "template" content (or "sequence constructor" in XSLT 2.0 terms). This will additionally remove xsl:text elements from the tree.

    +
    cctxt:the compilation context
    cur:the start-node of the content to be parsed

    Function: xsltParseStylesheetDoc

    xsltStylesheetPtr	xsltParseStylesheetDoc	(xmlDocPtr doc)
    +

    parse an XSLT stylesheet, building the associated structures. doc is kept as a reference within the returned stylesheet, so changes to doc after the parsing will be reflected when the stylesheet is applied, and the doc is automatically freed when the stylesheet is closed.

    +
    doc:and xmlDoc parsed XML
    Returns:a new XSLT stylesheet structure.

    Function: xsltParseStylesheetFile

    xsltStylesheetPtr	xsltParseStylesheetFile	(const xmlChar * filename)
    +

    Load and parse an XSLT stylesheet

    +
    filename:the filename/URL to the stylesheet
    Returns:a new XSLT stylesheet structure.

    Function: xsltParseStylesheetImportedDoc

    xsltStylesheetPtr	xsltParseStylesheetImportedDoc	(xmlDocPtr doc, 
    xsltStylesheetPtr parentStyle)
    +

    parse an XSLT stylesheet building the associated structures except the processing not needed for imported documents.

    +
    doc:an xmlDoc parsed XML
    parentStyle:pointer to the parent stylesheet (if it exists)
    Returns:a new XSLT stylesheet structure.

    Function: xsltParseStylesheetOutput

    void	xsltParseStylesheetOutput	(xsltStylesheetPtr style, 
    xmlNodePtr cur)
    +

    parse an XSLT stylesheet output element and record information related to the stylesheet output

    +
    style:the XSLT stylesheet
    cur:the "output" element

    Function: xsltParseStylesheetProcess

    xsltStylesheetPtr	xsltParseStylesheetProcess	(xsltStylesheetPtr ret, 
    xmlDocPtr doc)
    +

    Parses an XSLT stylesheet, adding the associated structures. Called by: xsltParseStylesheetImportedDoc() (xslt.c) xsltParseStylesheetInclude() (imports.c)

    +
    ret:the XSLT stylesheet (the current stylesheet-level)
    doc:and xmlDoc parsed XML
    Returns:the value of the @style parameter if everything went right, NULL if something went amiss.

    Function: xsltParseTemplateContent

    void	xsltParseTemplateContent	(xsltStylesheetPtr style, 
    xmlNodePtr templ)
    +

    parse a template content-model Clean-up the template content from unwanted ignorable blank nodes and process xslt:text

    +
    style:the XSLT stylesheet
    templ:the container node (can be a document for literal results)

    Function: xsltPointerListAddSize

    int	xsltPointerListAddSize		(xsltPointerListPtr list, 
    void * item,
    int initialSize)
    +

    Adds an item to the list.

    +
    list:the pointer list structure
    item:the item to be stored
    initialSize:the initial size of the list
    Returns:the position of the added item in the list or -1 in case of an error.

    Function: xsltPointerListClear

    void	xsltPointerListClear		(xsltPointerListPtr list)
    +

    Resets the list, but does not free the allocated array and does not free the content of the list.

    +
    list:pointer to the list to be cleared

    Function: xsltPointerListCreate

    xsltPointerListPtr	xsltPointerListCreate	(int initialSize)
    +

    Creates an xsltPointerList structure.

    +
    initialSize:the initial size for the list
    Returns:a xsltPointerList structure or NULL in case of an error.

    Function: xsltPointerListFree

    void	xsltPointerListFree		(xsltPointerListPtr list)
    +

    Frees the xsltPointerList structure. This does not free the content of the list.

    +
    list:pointer to the list to be freed

    Function: xsltRegisterLocalRVT

    int	xsltRegisterLocalRVT		(xsltTransformContextPtr ctxt, 
    xmlDocPtr RVT)
    +

    Registers a result value tree (XSLT 1.0 term: Result Tree Fragment) in the RVT garbage collector. The fragment will be freed when the instruction which created the fragment exits.

    +
    ctxt:an XSLT transformation context
    RVT:a result value tree (Result Tree Fragment; xmlDocPtr)
    Returns:0 in case of success and -1 in case of API or internal errors.

    Function: xsltRegisterPersistRVT

    int	xsltRegisterPersistRVT		(xsltTransformContextPtr ctxt, 
    xmlDocPtr RVT)
    +

    Register the result value tree (XSLT 1.0 term: Result Tree Fragment) in the fragment garbage collector. The fragment will be freed when the transformation context is freed.

    +
    ctxt:an XSLT transformation context
    RVT:a result value tree (Result Tree Fragment)
    Returns:0 in case of success and -1 in case of error.

    Function: xsltRegisterTmpRVT

    int	xsltRegisterTmpRVT		(xsltTransformContextPtr ctxt, 
    xmlDocPtr RVT)
    +

    Registers the result value tree (XSLT 1.0 term: Result Tree Fragment) in the garbage collector. The fragment will be freed at the exit of the currently instantiated xsl:template. Obsolete; this function might produce massive memory overhead, since the fragment is only freed when the current xsl:template exits. Use xsltRegisterLocalRVT() instead.

    +
    ctxt:an XSLT transformation context
    RVT:a result value tree (Result Tree Fragment)
    Returns:0 in case of success and -1 in case of API or internal errors.

    Function: xsltReleaseRVT

    void	xsltReleaseRVT			(xsltTransformContextPtr ctxt, 
    xmlDocPtr RVT)
    +

    Either frees the RVT (which is an xmlDoc) or stores it in the context's cache for later reuse.

    +
    ctxt:an XSLT transformation context
    RVT:a result value tree (Result Tree Fragment)

    Function: xsltRestoreDocumentNamespaces

    int	xsltRestoreDocumentNamespaces	(xsltNsMapPtr ns, 
    xmlDocPtr doc)
    +

    Restore the namespaces for the document

    +
    ns:map of namespaces
    doc:the document
    Returns:0 in case of success, -1 in case of failure

    Function type: xsltSortFunc

    Function type: xsltSortFunc
    +void	xsltSortFunc			(xsltTransformContextPtr ctxt, 
    xmlNodePtr * sorts,
    int nbsorts) +

    Signature of the function to use during sorting

    ctxt:a transformation context
    sorts:the node-set to sort
    nbsorts:the number of sorts

    +

    Function type: xsltTransformFunction

    Function type: xsltTransformFunction
    +void	xsltTransformFunction		(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst,
    xsltElemPreCompPtr comp) +

    Signature of the function associated to elements part of the stylesheet language like xsl:if or xsl:apply-templates.

    ctxt:the XSLT transformation context
    node:the input node
    inst:the stylesheet node
    comp:the compiled information from the stylesheet

    +

    Function: xsltUninit

    void	xsltUninit			(void)
    +

    Uninitializes the processor.

    +

    Daniel Veillard

    diff --git a/doc/html/libxslt-xsltexports.html b/doc/html/libxslt-xsltexports.html new file mode 100644 index 0000000..19fdb41 --- /dev/null +++ b/doc/html/libxslt-xsltexports.html @@ -0,0 +1,16 @@ + + +Module xsltexports from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module xsltexports from libxslt

    API Menu
    Related links
    API Indexes

    macros for marking symbols as exportable/importable.

    Table of Contents

    #define LIBXSLT_PUBLIC
    #define XSLTCALL
    #define XSLTPUBFUN
    #define XSLTPUBVAR
    #define _REENTRANT

    Description

    +

    Macro: LIBXSLT_PUBLIC

    #define LIBXSLT_PUBLIC

    +

    Macro: XSLTCALL

    #define XSLTCALL

    +

    Macro: XSLTPUBFUN

    #define XSLTPUBFUN

    +

    Macro: XSLTPUBVAR

    #define XSLTPUBVAR

    +

    Macro: _REENTRANT

    #define _REENTRANT

    +

    Daniel Veillard

    diff --git a/doc/html/libxslt-xsltlocale.html b/doc/html/libxslt-xsltlocale.html new file mode 100644 index 0000000..01bb5f2 --- /dev/null +++ b/doc/html/libxslt-xsltlocale.html @@ -0,0 +1,29 @@ + + +Module xsltlocale from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module xsltlocale from libxslt

    API Menu
    Related links
    API Indexes

    Interfaces for locale handling. Needed for language dependent sorting.

    Table of Contents

    #define XSLT_LOCALE_NONE
    Typedef void * xsltLocale
    +
    Typedef xmlChar xsltLocaleChar
    +
    void	xsltFreeLocale			(xsltLocale locale)
    +
    void	xsltFreeLocales			(void)
    +
    int	xsltLocaleStrcmp		(xsltLocale locale, 
    const xsltLocaleChar * str1,
    const xsltLocaleChar * str2)
    +
    xsltLocale	xsltNewLocale		(const xmlChar * languageTag)
    +
    xsltLocaleChar *	xsltStrxfrm	(xsltLocale locale, 
    const xmlChar * string)
    +

    Description

    +

    Macro: XSLT_LOCALE_NONE

    #define XSLT_LOCALE_NONE

    Macro indicating that locale are not supported

    +

    Function: xsltFreeLocale

    void	xsltFreeLocale			(xsltLocale locale)
    +

    Frees a locale created with xsltNewLocale

    +
    locale:the locale to free

    Function: xsltFreeLocales

    void	xsltFreeLocales			(void)
    +

    Cleanup function for the locale support on shutdown

    +

    Function: xsltLocaleStrcmp

    int	xsltLocaleStrcmp		(xsltLocale locale, 
    const xsltLocaleChar * str1,
    const xsltLocaleChar * str2)
    +

    Compares two strings transformed with xsltStrxfrm

    +
    locale:a locale identifier
    str1:a string transformed with xsltStrxfrm
    str2:a string transformed with xsltStrxfrm
    Returns:a value < 0 if str1 sorts before str2, a value > 0 if str1 sorts after str2, 0 if str1 and str2 are equal wrt sorting

    Function: xsltNewLocale

    xsltLocale	xsltNewLocale		(const xmlChar * languageTag)
    +

    Creates a new locale of an opaque system dependent type based on the language tag.

    +
    languageTag:RFC 3066 language tag
    Returns:the locale or NULL on error or if no matching locale was found

    Function: xsltStrxfrm

    xsltLocaleChar *	xsltStrxfrm	(xsltLocale locale, 
    const xmlChar * string)
    +

    Transforms a string according to locale. The transformed string must then be compared with xsltLocaleStrcmp and freed with xmlFree.

    +
    locale:locale created with xsltNewLocale
    string:UTF-8 string to transform
    Returns:the transformed string or NULL on error

    Daniel Veillard

    diff --git a/doc/html/libxslt-xsltutils.html b/doc/html/libxslt-xsltutils.html new file mode 100644 index 0000000..155f050 --- /dev/null +++ b/doc/html/libxslt-xsltutils.html @@ -0,0 +1,182 @@ + + +Module xsltutils from libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Module xsltutils from libxslt

    API Menu
    Related links
    API Indexes

    interfaces for the utilities module of the XSLT engine. things like message handling, profiling, and other generally useful routines.

    Table of Contents

    #define IS_XSLT_ELEM
    #define IS_XSLT_NAME
    #define IS_XSLT_REAL_NODE
    #define XSLT_STRANGE
    #define XSLT_TIMESTAMP_TICS_PER_SEC
    #define XSLT_TODO
    #define XSLT_TRACE
    Enum xsltDebugStatusCodes
    +
    Enum xsltDebugTraceCodes
    +
    int	xslAddCall			(xsltTemplatePtr templ, 
    xmlNodePtr source)
    +
    void	xslDropCall			(void)
    +
    Function type: xsltAddCallCallback
    +int	xsltAddCallCallback		(xsltTemplatePtr templ, 
    xmlNodePtr source) +
    +
    void	xsltCalibrateAdjust		(long delta)
    +
    xmlXPathObjectPtr *	xsltComputeSortResult	(xsltTransformContextPtr ctxt, 
    xmlNodePtr sort)
    +
    xsltDebugTraceCodes	xsltDebugGetDefaultTrace	(void)
    +
    void	xsltDebugSetDefaultTrace	(xsltDebugTraceCodes val)
    +
    void	xsltDefaultSortFunction		(xsltTransformContextPtr ctxt, 
    xmlNodePtr * sorts,
    int nbsorts)
    +
    void	xsltDoSortFunction		(xsltTransformContextPtr ctxt, 
    xmlNodePtr * sorts,
    int nbsorts)
    +
    void	xsltDocumentSortFunction	(xmlNodeSetPtr list)
    +
    Function type: xsltDropCallCallback
    +void	xsltDropCallCallback		(void)
    +
    +
    const xmlChar *	xsltGetCNsProp		(xsltStylesheetPtr style, 
    xmlNodePtr node,
    const xmlChar * name,
    const xmlChar * nameSpace)
    +
    int	xsltGetDebuggerStatus		(void)
    +
    xmlChar *	xsltGetNsProp		(xmlNodePtr node, 
    const xmlChar * name,
    const xmlChar * nameSpace)
    +
    xmlDocPtr	xsltGetProfileInformation	(xsltTransformContextPtr ctxt)
    +
    const xmlChar *	xsltGetQNameURI		(xmlNodePtr node, 
    xmlChar ** name)
    +
    const xmlChar *	xsltGetQNameURI2	(xsltStylesheetPtr style, 
    xmlNodePtr node,
    const xmlChar ** name)
    +
    int	xsltGetUTF8Char			(const unsigned char * utf, 
    int * len)
    +
    Function type: xsltHandleDebuggerCallback
    +void	xsltHandleDebuggerCallback	(xmlNodePtr cur, 
    xmlNodePtr node,
    xsltTemplatePtr templ,
    xsltTransformContextPtr ctxt) +
    +
    void	xsltMessage			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst)
    +
    void	xsltPrintErrorContext		(xsltTransformContextPtr ctxt, 
    xsltStylesheetPtr style,
    xmlNodePtr node)
    +
    void	xsltSaveProfiling		(xsltTransformContextPtr ctxt, 
    FILE * output)
    +
    int	xsltSaveResultTo		(xmlOutputBufferPtr buf, 
    xmlDocPtr result,
    xsltStylesheetPtr style)
    +
    int	xsltSaveResultToFd		(int fd, 
    xmlDocPtr result,
    xsltStylesheetPtr style)
    +
    int	xsltSaveResultToFile		(FILE * file, 
    xmlDocPtr result,
    xsltStylesheetPtr style)
    +
    int	xsltSaveResultToFilename	(const char * URL, 
    xmlDocPtr result,
    xsltStylesheetPtr style,
    int compression)
    +
    int	xsltSaveResultToString		(xmlChar ** doc_txt_ptr, 
    int * doc_txt_len,
    xmlDocPtr result,
    xsltStylesheetPtr style)
    +
    int	xsltSetCtxtParseOptions		(xsltTransformContextPtr ctxt, 
    int options)
    +
    void	xsltSetCtxtSortFunc		(xsltTransformContextPtr ctxt, 
    xsltSortFunc handler)
    +
    int	xsltSetDebuggerCallbacks	(int no, 
    void * block)
    +
    void	xsltSetDebuggerStatus		(int value)
    +
    void	xsltSetGenericDebugFunc		(void * ctx, 
    xmlGenericErrorFunc handler)
    +
    void	xsltSetGenericErrorFunc		(void * ctx, 
    xmlGenericErrorFunc handler)
    +
    void	xsltSetSortFunc			(xsltSortFunc handler)
    +
    void	xsltSetTransformErrorFunc	(xsltTransformContextPtr ctxt, 
    void * ctx,
    xmlGenericErrorFunc handler)
    +
    const xmlChar *	xsltSplitQName		(xmlDictPtr dict, 
    const xmlChar * name,
    const xmlChar ** prefix)
    +
    long	xsltTimestamp			(void)
    +
    void	xsltTransformError		(xsltTransformContextPtr ctxt, 
    xsltStylesheetPtr style,
    xmlNodePtr node,
    const char * msg,
    ... ...)
    +
    xmlXPathCompExprPtr	xsltXPathCompile	(xsltStylesheetPtr style, 
    const xmlChar * str)
    +
    xmlXPathCompExprPtr	xsltXPathCompileFlags	(xsltStylesheetPtr style, 
    const xmlChar * str,
    int flags)
    +

    Description

    +

    Macro: IS_XSLT_ELEM

    #define IS_XSLT_ELEM

    Checks that the element pertains to XSLT namespace.

    +

    Macro: IS_XSLT_NAME

    #define IS_XSLT_NAME

    Checks the value of an element in XSLT namespace.

    +

    Macro: IS_XSLT_REAL_NODE

    #define IS_XSLT_REAL_NODE

    Check that a node is a 'real' one: document, element, text or attribute.

    +

    Macro: XSLT_STRANGE

    #define XSLT_STRANGE

    Macro to flag that a problem was detected internally.

    +

    Macro: XSLT_TIMESTAMP_TICS_PER_SEC

    #define XSLT_TIMESTAMP_TICS_PER_SEC

    Sampling precision for profiling

    +

    Macro: XSLT_TODO

    #define XSLT_TODO

    Macro to flag unimplemented blocks.

    +

    Macro: XSLT_TRACE

    #define XSLT_TRACE

    Control the type of xsl debugtrace messages emitted.

    +

    Enum xsltDebugStatusCodes

    Enum xsltDebugStatusCodes {
    +    XSLT_DEBUG_NONE = 0 : no debugging allowed
    +    XSLT_DEBUG_INIT = 1
    +    XSLT_DEBUG_STEP = 2
    +    XSLT_DEBUG_STEPOUT = 3
    +    XSLT_DEBUG_NEXT = 4
    +    XSLT_DEBUG_STOP = 5
    +    XSLT_DEBUG_CONT = 6
    +    XSLT_DEBUG_RUN = 7
    +    XSLT_DEBUG_RUN_RESTART = 8
    +    XSLT_DEBUG_QUIT = 9
    +}
    +

    Enum xsltDebugTraceCodes

    Enum xsltDebugTraceCodes {
    +    XSLT_TRACE_ALL = -1
    +    XSLT_TRACE_NONE = 0
    +    XSLT_TRACE_COPY_TEXT = 1
    +    XSLT_TRACE_PROCESS_NODE = 2
    +    XSLT_TRACE_APPLY_TEMPLATE = 4
    +    XSLT_TRACE_COPY = 8
    +    XSLT_TRACE_COMMENT = 16
    +    XSLT_TRACE_PI = 32
    +    XSLT_TRACE_COPY_OF = 64
    +    XSLT_TRACE_VALUE_OF = 128
    +    XSLT_TRACE_CALL_TEMPLATE = 256
    +    XSLT_TRACE_APPLY_TEMPLATES = 512
    +    XSLT_TRACE_CHOOSE = 1024
    +    XSLT_TRACE_IF = 2048
    +    XSLT_TRACE_FOR_EACH = 4096
    +    XSLT_TRACE_STRIP_SPACES = 8192
    +    XSLT_TRACE_TEMPLATES = 16384
    +    XSLT_TRACE_KEYS = 32768
    +    XSLT_TRACE_VARIABLES = 65536
    +}
    +

    Function: xslAddCall

    int	xslAddCall			(xsltTemplatePtr templ, 
    xmlNodePtr source)
    +

    Add template "call" to call stack

    +
    templ:current template being applied
    source:the source node being processed
    Returns:: 1 on sucess 0 otherwise an error may be printed if WITH_XSLT_DEBUG_BREAKPOINTS is defined

    Function: xslDropCall

    void	xslDropCall			(void)
    +

    Drop the topmost item off the call stack

    +

    Function type: xsltAddCallCallback

    Function type: xsltAddCallCallback
    +int	xsltAddCallCallback		(xsltTemplatePtr templ, 
    xmlNodePtr source) +

    templ:
    source:
    Returns:

    +

    Function: xsltCalibrateAdjust

    void	xsltCalibrateAdjust		(long delta)
    +

    Used for to correct the calibration for xsltTimestamp()

    +
    delta:a negative dealy value found

    Function: xsltComputeSortResult

    xmlXPathObjectPtr *	xsltComputeSortResult	(xsltTransformContextPtr ctxt, 
    xmlNodePtr sort)
    +

    reorder the current node list accordingly to the set of sorting requirement provided by the array of nodes.

    +
    ctxt:a XSLT process context
    sort:node list
    Returns:a ordered XPath nodeset or NULL in case of error.

    Function: xsltDebugGetDefaultTrace

    xsltDebugTraceCodes	xsltDebugGetDefaultTrace	(void)
    +

    Get the current default debug tracing level mask

    +
    Returns:the current default debug tracing level mask

    Function: xsltDebugSetDefaultTrace

    void	xsltDebugSetDefaultTrace	(xsltDebugTraceCodes val)
    +

    Set the default debug tracing level mask

    +
    val:tracing level mask

    Function: xsltDefaultSortFunction

    void	xsltDefaultSortFunction		(xsltTransformContextPtr ctxt, 
    xmlNodePtr * sorts,
    int nbsorts)
    +

    reorder the current node list accordingly to the set of sorting requirement provided by the arry of nodes.

    +
    ctxt:a XSLT process context
    sorts:array of sort nodes
    nbsorts:the number of sorts in the array

    Function: xsltDoSortFunction

    void	xsltDoSortFunction		(xsltTransformContextPtr ctxt, 
    xmlNodePtr * sorts,
    int nbsorts)
    +

    reorder the current node list accordingly to the set of sorting requirement provided by the arry of nodes. This is a wrapper function, the actual function used is specified using xsltSetCtxtSortFunc() to set the context specific sort function, or xsltSetSortFunc() to set the global sort function. If a sort function is set on the context, this will get called. Otherwise the global sort function is called.

    +
    ctxt:a XSLT process context
    sorts:array of sort nodes
    nbsorts:the number of sorts in the array

    Function: xsltDocumentSortFunction

    void	xsltDocumentSortFunction	(xmlNodeSetPtr list)
    +

    reorder the current node list @list accordingly to the document order This function is slow, obsolete and should not be used anymore.

    +
    list:the node set

    Function type: xsltDropCallCallback

    Function type: xsltDropCallCallback
    +void	xsltDropCallCallback		(void)
    +


    +

    Function: xsltGetCNsProp

    const xmlChar *	xsltGetCNsProp		(xsltStylesheetPtr style, 
    xmlNodePtr node,
    const xmlChar * name,
    const xmlChar * nameSpace)
    +

    Similar to xmlGetNsProp() but with a slightly different semantic Search and get the value of an attribute associated to a node This attribute has to be anchored in the namespace specified, or has no namespace and the element is in that namespace. This does the entity substitution. This function looks in DTD attribute declaration for #FIXED or default declaration values unless DTD use has been turned off.

    +
    style:the stylesheet
    node:the node
    name:the attribute name
    nameSpace:the URI of the namespace
    Returns:the attribute value or NULL if not found. The string is allocated in the stylesheet dictionary.

    Function: xsltGetDebuggerStatus

    int	xsltGetDebuggerStatus		(void)
    +

    Get xslDebugStatus.

    +
    Returns:the value of xslDebugStatus.

    Function: xsltGetNsProp

    xmlChar *	xsltGetNsProp		(xmlNodePtr node, 
    const xmlChar * name,
    const xmlChar * nameSpace)
    +

    Similar to xmlGetNsProp() but with a slightly different semantic Search and get the value of an attribute associated to a node This attribute has to be anchored in the namespace specified, or has no namespace and the element is in that namespace. This does the entity substitution. This function looks in DTD attribute declaration for #FIXED or default declaration values unless DTD use has been turned off.

    +
    node:the node
    name:the attribute name
    nameSpace:the URI of the namespace
    Returns:the attribute value or NULL if not found. It's up to the caller to free the memory.

    Function: xsltGetProfileInformation

    xmlDocPtr	xsltGetProfileInformation	(xsltTransformContextPtr ctxt)
    +

    This function should be called after the transformation completed to extract template processing profiling informations if availble. The informations are returned as an XML document tree like <?xml version="1.0"?> <profile> <template rank="1" match="*" name="" mode="" calls="6" time="48" average="8"/> <template rank="2" match="item2|item3" name="" mode="" calls="10" time="30" average="3"/> <template rank="3" match="item1" name="" mode="" calls="5" time="17" average="3"/> </profile> The caller will need to free up the returned tree with xmlFreeDoc()

    +
    ctxt:a transformation context
    Returns:the xmlDocPtr corresponding to the result or NULL if not available.

    Function: xsltGetQNameURI

    const xmlChar *	xsltGetQNameURI		(xmlNodePtr node, 
    xmlChar ** name)
    +

    This function analyzes @name, if the name contains a prefix, the function seaches the associated namespace in scope for it. It will also replace @name value with the NCName, the old value being freed. Errors in the prefix lookup are signalled by setting @name to NULL. NOTE: the namespace returned is a pointer to the place where it is defined and hence has the same lifespan as the document holding it.

    +
    node:the node holding the QName
    name:pointer to the initial QName value
    Returns:the namespace URI if there is a prefix, or NULL if @name is not prefixed.

    Function: xsltGetQNameURI2

    const xmlChar *	xsltGetQNameURI2	(xsltStylesheetPtr style, 
    xmlNodePtr node,
    const xmlChar ** name)
    +

    This function is similar to xsltGetQNameURI, but is used when @name is a dictionary entry.

    +
    style:stylesheet pointer
    node:the node holding the QName
    name:pointer to the initial QName value
    Returns:the namespace URI if there is a prefix, or NULL if @name is not prefixed.

    Function: xsltGetUTF8Char

    int	xsltGetUTF8Char			(const unsigned char * utf, 
    int * len)
    +

    Read one UTF8 Char from @utf Function copied from libxml2 xmlGetUTF8Char() ... to discard ultimately and use the original API

    +
    utf:a sequence of UTF-8 encoded bytes
    len:a pointer to @bytes len
    Returns:the char value or -1 in case of error and update @len with the number of bytes used

    Function type: xsltHandleDebuggerCallback

    Function type: xsltHandleDebuggerCallback
    +void	xsltHandleDebuggerCallback	(xmlNodePtr cur, 
    xmlNodePtr node,
    xsltTemplatePtr templ,
    xsltTransformContextPtr ctxt) +

    cur:
    node:
    templ:
    ctxt:

    +

    Function: xsltMessage

    void	xsltMessage			(xsltTransformContextPtr ctxt, 
    xmlNodePtr node,
    xmlNodePtr inst)
    +

    Process and xsl:message construct

    +
    ctxt:an XSLT processing context
    node:The current node
    inst:The node containing the message instruction

    Function: xsltPrintErrorContext

    void	xsltPrintErrorContext		(xsltTransformContextPtr ctxt, 
    xsltStylesheetPtr style,
    xmlNodePtr node)
    +

    Display the context of an error.

    +
    ctxt:the transformation context
    style:the stylesheet
    node:the current node being processed

    Function: xsltSaveProfiling

    void	xsltSaveProfiling		(xsltTransformContextPtr ctxt, 
    FILE * output)
    +

    Save the profiling informations on @output

    +
    ctxt:an XSLT context
    output:a FILE * for saving the informations

    Function: xsltSaveResultTo

    int	xsltSaveResultTo		(xmlOutputBufferPtr buf, 
    xmlDocPtr result,
    xsltStylesheetPtr style)
    +

    Save the result @result obtained by applying the @style stylesheet to an I/O output channel @buf

    +
    buf:an output buffer
    result:the result xmlDocPtr
    style:the stylesheet
    Returns:the number of byte written or -1 in case of failure.

    Function: xsltSaveResultToFd

    int	xsltSaveResultToFd		(int fd, 
    xmlDocPtr result,
    xsltStylesheetPtr style)
    +

    Save the result @result obtained by applying the @style stylesheet to an open file descriptor This does not close the descriptor.

    +
    fd:a file descriptor
    result:the result xmlDocPtr
    style:the stylesheet
    Returns:the number of bytes written or -1 in case of failure.

    Function: xsltSaveResultToFile

    int	xsltSaveResultToFile		(FILE * file, 
    xmlDocPtr result,
    xsltStylesheetPtr style)
    +

    Save the result @result obtained by applying the @style stylesheet to an open FILE * I/O. This does not close the FILE @file

    +
    file:a FILE * I/O
    result:the result xmlDocPtr
    style:the stylesheet
    Returns:the number of bytes written or -1 in case of failure.

    Function: xsltSaveResultToFilename

    int	xsltSaveResultToFilename	(const char * URL, 
    xmlDocPtr result,
    xsltStylesheetPtr style,
    int compression)
    +

    Save the result @result obtained by applying the @style stylesheet to a file or @URL

    +
    URL:a filename or URL
    result:the result xmlDocPtr
    style:the stylesheet
    compression:the compression factor (0 - 9 included)
    Returns:the number of byte written or -1 in case of failure.

    Function: xsltSaveResultToString

    int	xsltSaveResultToString		(xmlChar ** doc_txt_ptr, 
    int * doc_txt_len,
    xmlDocPtr result,
    xsltStylesheetPtr style)
    +

    Save the result @result obtained by applying the @style stylesheet to a new allocated string.

    +
    doc_txt_ptr:Memory pointer for allocated XML text
    doc_txt_len:Length of the generated XML text
    result:the result xmlDocPtr
    style:the stylesheet
    Returns:0 in case of success and -1 in case of error

    Function: xsltSetCtxtParseOptions

    int	xsltSetCtxtParseOptions		(xsltTransformContextPtr ctxt, 
    int options)
    +

    Change the default parser option passed by the XSLT engine to the parser when using document() loading.

    +
    ctxt:a XSLT process context
    options:a combination of libxml2 xmlParserOption
    Returns:the previous options or -1 in case of error

    Function: xsltSetCtxtSortFunc

    void	xsltSetCtxtSortFunc		(xsltTransformContextPtr ctxt, 
    xsltSortFunc handler)
    +

    Function to set the handler for XSLT sorting for the specified context. If the handler is NULL, then the global sort function will be called

    +
    ctxt:a XSLT process context
    handler:the new handler function

    Function: xsltSetDebuggerCallbacks

    int	xsltSetDebuggerCallbacks	(int no, 
    void * block)
    +

    This function allow to plug a debugger into the XSLT library @block points to a block of memory containing the address of @no callback routines.

    +
    no:number of callbacks
    block:the block of callbacks
    Returns:0 in case of success and -1 in case of error

    Function: xsltSetDebuggerStatus

    void	xsltSetDebuggerStatus		(int value)
    +

    This function sets the value of xslDebugStatus.

    +
    value:the value to be set

    Function: xsltSetGenericDebugFunc

    void	xsltSetGenericDebugFunc		(void * ctx, 
    xmlGenericErrorFunc handler)
    +

    Function to reset the handler and the error context for out of context error messages. This simply means that @handler will be called for subsequent error messages while not parsing or validating. And @ctx will be passed as first argument to @handler One can simply force messages to be emitted to another FILE * than stderr by setting @ctx to this file handle and @handler to NULL.

    +
    ctx:the new error handling context
    handler:the new handler function

    Function: xsltSetGenericErrorFunc

    void	xsltSetGenericErrorFunc		(void * ctx, 
    xmlGenericErrorFunc handler)
    +

    Function to reset the handler and the error context for out of context error messages. This simply means that @handler will be called for subsequent error messages while not parsing nor validating. And @ctx will be passed as first argument to @handler One can simply force messages to be emitted to another FILE * than stderr by setting @ctx to this file handle and @handler to NULL.

    +
    ctx:the new error handling context
    handler:the new handler function

    Function: xsltSetSortFunc

    void	xsltSetSortFunc			(xsltSortFunc handler)
    +

    Function to reset the global handler for XSLT sorting. If the handler is NULL, the default sort function will be used.

    +
    handler:the new handler function

    Function: xsltSetTransformErrorFunc

    void	xsltSetTransformErrorFunc	(xsltTransformContextPtr ctxt, 
    void * ctx,
    xmlGenericErrorFunc handler)
    +

    Function to reset the handler and the error context for out of context error messages specific to a given XSLT transromation. This simply means that @handler will be called for subsequent error messages while running the transformation.

    +
    ctxt:the XSLT transformation context
    ctx:the new error handling context
    handler:the new handler function

    Function: xsltSplitQName

    const xmlChar *	xsltSplitQName		(xmlDictPtr dict, 
    const xmlChar * name,
    const xmlChar ** prefix)
    +

    Split QNames into prefix and local names, both allocated from a dictionary.

    +
    dict:a dictionary
    name:the full QName
    prefix:the return value
    Returns:the localname or NULL in case of error.

    Function: xsltTimestamp

    long	xsltTimestamp			(void)
    +

    Used for gathering profiling data

    +
    Returns:the number of tenth of milliseconds since the beginning of the profiling

    Function: xsltTransformError

    void	xsltTransformError		(xsltTransformContextPtr ctxt, 
    xsltStylesheetPtr style,
    xmlNodePtr node,
    const char * msg,
    ... ...)
    +

    Display and format an error messages, gives file, line, position and extra parameters, will use the specific transformation context if available

    +
    ctxt:an XSLT transformation context
    style:the XSLT stylesheet used
    node:the current node in the stylesheet
    msg:the message to display/transmit
    ...:extra parameters for the message display

    Function: xsltXPathCompile

    xmlXPathCompExprPtr	xsltXPathCompile	(xsltStylesheetPtr style, 
    const xmlChar * str)
    +

    Compile an XPath expression

    +
    style:the stylesheet
    str:the XPath expression
    Returns:the xmlXPathCompExprPtr resulting from the compilation or NULL. the caller has to free the object.

    Function: xsltXPathCompileFlags

    xmlXPathCompExprPtr	xsltXPathCompileFlags	(xsltStylesheetPtr style, 
    const xmlChar * str,
    int flags)
    +

    Compile an XPath expression

    +
    style:the stylesheet
    str:the XPath expression
    flags:extra compilation flags to pass down to libxml2 XPath
    Returns:the xmlXPathCompExprPtr resulting from the compilation or NULL. the caller has to free the object.

    Daniel Veillard

    diff --git a/doc/html/right.png b/doc/html/right.png new file mode 100644 index 0000000..92832e3 Binary files /dev/null and b/doc/html/right.png differ diff --git a/doc/html/up.png b/doc/html/up.png new file mode 100644 index 0000000..85b3e2a Binary files /dev/null and b/doc/html/up.png differ diff --git a/doc/images/callouts/1.png b/doc/images/callouts/1.png new file mode 100644 index 0000000..7d47343 Binary files /dev/null and b/doc/images/callouts/1.png differ diff --git a/doc/images/callouts/10.png b/doc/images/callouts/10.png new file mode 100644 index 0000000..997bbc8 Binary files /dev/null and b/doc/images/callouts/10.png differ diff --git a/doc/images/callouts/2.png b/doc/images/callouts/2.png new file mode 100644 index 0000000..5d09341 Binary files /dev/null and b/doc/images/callouts/2.png differ diff --git a/doc/images/callouts/3.png b/doc/images/callouts/3.png new file mode 100644 index 0000000..ef7b700 Binary files /dev/null and b/doc/images/callouts/3.png differ diff --git a/doc/images/callouts/4.png b/doc/images/callouts/4.png new file mode 100644 index 0000000..adb8364 Binary files /dev/null and b/doc/images/callouts/4.png differ diff --git a/doc/images/callouts/5.png b/doc/images/callouts/5.png new file mode 100644 index 0000000..4d7eb46 Binary files /dev/null and b/doc/images/callouts/5.png differ diff --git a/doc/images/callouts/6.png b/doc/images/callouts/6.png new file mode 100644 index 0000000..0ba694a Binary files /dev/null and b/doc/images/callouts/6.png differ diff --git a/doc/images/callouts/7.png b/doc/images/callouts/7.png new file mode 100644 index 0000000..472e96f Binary files /dev/null and b/doc/images/callouts/7.png differ diff --git a/doc/images/callouts/8.png b/doc/images/callouts/8.png new file mode 100644 index 0000000..5e60973 Binary files /dev/null and b/doc/images/callouts/8.png differ diff --git a/doc/images/callouts/9.png b/doc/images/callouts/9.png new file mode 100644 index 0000000..a0676d2 Binary files /dev/null and b/doc/images/callouts/9.png differ diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 0000000..38781e0 --- /dev/null +++ b/doc/index.html @@ -0,0 +1,26 @@ + + + + + +libxslt
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    libxslt

    Main Menu
    Related links
    API Indexes

    Libxslt is the XSLT C library +developed for the GNOME project. XSLT itself is a an XML language to define +transformation for XML. Libxslt is based on libxml2 the XML C library developed for the +GNOME project. It also implements most of the EXSLT set of processor-portable extensions +functions and some of Saxon's evaluate and expressions extensions.

    People can either embed the library in their application or use xsltproc +the command line processing tool. This library is free software and can be +reused in commercial applications (see the intro)

    External documents:

    Logo designed by Marc Liyanage.

    Daniel Veillard

    + diff --git a/doc/index.py b/doc/index.py new file mode 100755 index 0000000..3cb3fec --- /dev/null +++ b/doc/index.py @@ -0,0 +1,1248 @@ +#!/usr/bin/python -u +# +# imports the API description and fills up a database with +# name relevance to modules, functions or web pages +# +# Operation needed: +# ================= +# +# install mysqld, the python wrappers for mysql and libxml2, start mysqld +# Change the root passwd of mysql: +# mysqladmin -u root password new_password +# Create the new database xmlsoft +# mysqladmin -p create xmlsoft +# Create a database user 'veillard' and give him passord access +# change veillard and abcde with the right user name and passwd +# mysql -p +# password: +# mysql> GRANT ALL PRIVILEGES ON xmlsoft TO veillard@localhost +# IDENTIFIED BY 'abcde' WITH GRANT OPTION; +# +# As the user check the access: +# mysql -p xmlsoft +# Enter password: +# Welcome to the MySQL monitor.... +# mysql> use xmlsoft +# Database changed +# mysql> quit +# Bye +# +# Then run the script in the doc subdir, it will create the XSLTsymbols and +# word tables and populate them with informations extracted from +# the libxml2-api.xml API description, and make then accessible read-only +# by nobody@loaclhost the user expected to be Apache's one +# +# On the Apache configuration, make sure you have php support enabled +# + +import MySQLdb +import libxml2 +import sys +import string +import os + +# +# We are not interested in parsing errors here +# +def callback(ctx, str): + return +libxml2.registerErrorHandler(callback, None) + +# +# The dictionary of tables required and the SQL command needed +# to create them +# +TABLES={ + "XSLTsymbols" : """CREATE TABLE XSLTsymbols ( + name varchar(255) BINARY NOT NULL, + module varchar(255) BINARY NOT NULL, + type varchar(25) NOT NULL, + descr varchar(255), + UNIQUE KEY name (name), + KEY module (module))""", + "XSLTwords" : """CREATE TABLE XSLTwords ( + name varchar(50) BINARY NOT NULL, + symbol varchar(255) BINARY NOT NULL, + relevance int, + KEY name (name), + KEY symbol (symbol), + UNIQUE KEY ID (name, symbol))""", + "XSLTwordsHTML" : """CREATE TABLE XSLTwordsHTML ( + name varchar(50) BINARY NOT NULL, + resource varchar(255) BINARY NOT NULL, + section varchar(255), + id varchar(50), + relevance int, + KEY name (name), + KEY resource (resource), + UNIQUE KEY ref (name, resource))""", + "XSLTwordsArchive" : """CREATE TABLE XSLTwordsArchive ( + name varchar(50) BINARY NOT NULL, + ID int(11) NOT NULL, + relevance int, + KEY name (name), + UNIQUE KEY ref (name, ID))""", + "XSLTpages" : """CREATE TABLE XSLTpages ( + resource varchar(255) BINARY NOT NULL, + title varchar(255) BINARY NOT NULL, + UNIQUE KEY name (resource))""", + "archives" : """CREATE TABLE archives ( + ID int(11) NOT NULL auto_increment, + resource varchar(255) BINARY NOT NULL, + title varchar(255) BINARY NOT NULL, + UNIQUE KEY id (ID,resource(255)), + INDEX (ID), + INDEX (resource))""", + "Queries" : """CREATE TABLE Queries ( + ID int(11) NOT NULL auto_increment, + Value varchar(50) NOT NULL, + Count int(11) NOT NULL, + UNIQUE KEY id (ID,Value(35)), + INDEX (ID))""", +} + +# +# The XML API description file to parse +# +API="libxslt-api.xml" +DB=None + +######################################################################### +# # +# MySQL database interfaces # +# # +######################################################################### +def createTable(db, name): + global TABLES + + if db == None: + return -1 + if name == None: + return -1 + c = db.cursor() + + ret = c.execute("DROP TABLE IF EXISTS %s" % (name)) + if ret == 1: + print "Removed table %s" % (name) + print "Creating table %s" % (name) + try: + ret = c.execute(TABLES[name]) + except: + print "Failed to create table %s" % (name) + return -1 + return ret + +def checkTables(db): + global TABLES + + if db == None: + return -1 + c = db.cursor() + nbtables = c.execute("show tables") + print "Found %d tables" % (nbtables) + tables = {} + i = 0 + while i < nbtables: + l = c.fetchone() + name = l[0] + tables[name] = {} + i = i + 1 + + for table in TABLES.keys(): + if not tables.has_key(table): + print "table %s missing" % (table) + createTable(db, table) + try: + ret = c.execute("SELECT count(*) from %s" % table); + row = c.fetchone() + print "Table %s contains %d records" % (table, row[0]) + except: + print "Troubles with table %s : repairing" % (table) + ret = c.execute("repair table %s" % table); + print "repairing returned %d" % (ret) + ret = c.execute("SELECT count(*) from %s" % table); + row = c.fetchone() + print "Table %s contains %d records" % (table, row[0]) + print "checkTables finished" + + # make sure apache can access the tables read-only + try: + ret = c.execute("GRANT SELECT ON xmlsoft.* TO nobody@localhost") + ret = c.execute("GRANT INSERT,SELECT,UPDATE ON xmlsoft.Queries TO nobody@localhost") + except: + pass + return 0 + +def openMySQL(db="xmlsoft", passwd=None): + global DB + + if passwd == None: + try: + passwd = os.environ["MySQL_PASS"] + except: + print "No password available, set environment MySQL_PASS" + sys.exit(1) + + DB = MySQLdb.connect(passwd=passwd, db=db) + if DB == None: + return -1 + ret = checkTables(DB) + return ret + +def updateWord(name, symbol, relevance): + global DB + + if DB == None: + openMySQL() + if DB == None: + return -1 + if name == None: + return -1 + if symbol == None: + return -1 + + c = DB.cursor() + try: + ret = c.execute( +"""INSERT INTO XSLTwords (name, symbol, relevance) VALUES ('%s','%s', %d)""" % + (name, symbol, relevance)) + except: + try: + ret = c.execute( + """UPDATE XSLTwords SET relevance = %d where name = '%s' and symbol = '%s'""" % + (relevance, name, symbol)) + except: + print "Update word (%s, %s, %s) failed command" % (name, symbol, relevance) + print "UPDATE XSLTwords SET relevance = %d where name = '%s' and symbol = '%s'" % (relevance, name, symbol) + print sys.exc_type, sys.exc_value + return -1 + + return ret + +def updateSymbol(name, module, type, desc): + global DB + + updateWord(name, name, 50) + if DB == None: + openMySQL() + if DB == None: + return -1 + if name == None: + return -1 + if module == None: + return -1 + if type == None: + return -1 + + try: + desc = string.replace(desc, "'", " ") + l = string.split(desc, ".") + desc = l[0] + desc = desc[0:99] + except: + desc = "" + + c = DB.cursor() + try: + ret = c.execute( +"""INSERT INTO XSLTsymbols (name, module, type, descr) VALUES ('%s','%s', '%s', '%s')""" % + (name, module, type, desc)) + except: + try: + ret = c.execute( +"""UPDATE XSLTsymbols SET module='%s', type='%s', descr='%s' where name='%s'""" % + (module, type, desc, name)) + except: + print "Update symbol (%s, %s, %s) failed command" % (name, module, type) + print """UPDATE XSLTsymbols SET module='%s', type='%s', descr='%s' where name='%s'""" % (module, type, desc, name) + print sys.exc_type, sys.exc_value + return -1 + + return ret + +def addFunction(name, module, desc = ""): + return updateSymbol(name, module, 'function', desc) + +def addMacro(name, module, desc = ""): + return updateSymbol(name, module, 'macro', desc) + +def addEnum(name, module, desc = ""): + return updateSymbol(name, module, 'enum', desc) + +def addStruct(name, module, desc = ""): + return updateSymbol(name, module, 'struct', desc) + +def addConst(name, module, desc = ""): + return updateSymbol(name, module, 'const', desc) + +def addType(name, module, desc = ""): + return updateSymbol(name, module, 'type', desc) + +def addFunctype(name, module, desc = ""): + return updateSymbol(name, module, 'functype', desc) + +def addPage(resource, title): + global DB + + if DB == None: + openMySQL() + if DB == None: + return -1 + if resource == None: + return -1 + + c = DB.cursor() + try: + ret = c.execute( + """INSERT INTO XSLTpages (resource, title) VALUES ('%s','%s')""" % + (resource, title)) + except: + try: + ret = c.execute( + """UPDATE XSLTpages SET title='%s' WHERE resource='%s'""" % + (title, resource)) + except: + print "Update symbol (%s, %s, %s) failed command" % (name, module, type) + print """UPDATE XSLTpages SET title='%s' WHERE resource='%s'""" % (title, resource) + print sys.exc_type, sys.exc_value + return -1 + + return ret + +def updateWordHTML(name, resource, desc, id, relevance): + global DB + + if DB == None: + openMySQL() + if DB == None: + return -1 + if name == None: + return -1 + if resource == None: + return -1 + if id == None: + id = "" + if desc == None: + desc = "" + else: + try: + desc = string.replace(desc, "'", " ") + desc = desc[0:99] + except: + desc = "" + + c = DB.cursor() + try: + ret = c.execute( +"""INSERT INTO XSLTwordsHTML (name, resource, section, id, relevance) VALUES ('%s','%s', '%s', '%s', '%d')""" % + (name, resource, desc, id, relevance)) + except: + try: + ret = c.execute( +"""UPDATE XSLTwordsHTML SET section='%s', id='%s', relevance='%d' where name='%s' and resource='%s'""" % + (desc, id, relevance, name, resource)) + except: + print "Update symbol (%s, %s, %d) failed command" % (name, resource, relevance) + print """UPDATE XSLTwordsHTML SET section='%s', id='%s', relevance='%d' where name='%s' and resource='%s'""" % (desc, id, relevance, name, resource) + print sys.exc_type, sys.exc_value + return -1 + + return ret + +def checkXMLMsgArchive(url): + global DB + + if DB == None: + openMySQL() + if DB == None: + return -1 + if url == None: + return -1 + + c = DB.cursor() + try: + ret = c.execute( + """SELECT ID FROM archives WHERE resource='%s'""" % (url)) + row = c.fetchone() + if row == None: + return -1 + except: + return -1 + + return row[0] + +def addXMLMsgArchive(url, title): + global DB + + if DB == None: + openMySQL() + if DB == None: + return -1 + if url == None: + return -1 + if title == None: + title = "" + else: + title = string.replace(title, "'", " ") + title = title[0:99] + + c = DB.cursor() + try: + cmd = """INSERT INTO archives (resource, title) VALUES ('%s','%s')""" % (url, title) + ret = c.execute(cmd) + cmd = """SELECT ID FROM archives WHERE resource='%s'""" % (url) + ret = c.execute(cmd) + row = c.fetchone() + if row == None: + print "addXMLMsgArchive failed to get the ID: %s" % (url) + return -1 + except: + print "addXMLMsgArchive failed command: %s" % (cmd) + return -1 + + return((int)(row[0])) + +def updateWordArchive(name, id, relevance): + global DB + + if DB == None: + openMySQL() + if DB == None: + return -1 + if name == None: + return -1 + if id == None: + return -1 + + c = DB.cursor() + try: + ret = c.execute( +"""INSERT INTO XSLTwordsArchive (name, id, relevance) VALUES ('%s', '%d', '%d')""" % + (name, id, relevance)) + except: + try: + ret = c.execute( +"""UPDATE XSLTwordsArchive SET relevance='%d' where name='%s' and ID='%d'""" % + (relevance, name, id)) + except: + print "Update word archive (%s, %d, %d) failed command" % (name, id, relevance) + print """UPDATE XSLTwordsArchive SET relevance='%d' where name='%s' and ID='%d'""" % (relevance, name, id) + print sys.exc_type, sys.exc_value + return -1 + + return ret + +######################################################################### +# # +# Word dictionary and analysis routines # +# # +######################################################################### + +# +# top 100 english word without the one len < 3 + own set +# +dropWords = { + 'the':0, 'this':0, 'can':0, 'man':0, 'had':0, 'him':0, 'only':0, + 'and':0, 'not':0, 'been':0, 'other':0, 'even':0, 'are':0, 'was':0, + 'new':0, 'most':0, 'but':0, 'when':0, 'some':0, 'made':0, 'from':0, + 'who':0, 'could':0, 'after':0, 'that':0, 'will':0, 'time':0, 'also':0, + 'have':0, 'more':0, 'these':0, 'did':0, 'was':0, 'two':0, 'many':0, + 'they':0, 'may':0, 'before':0, 'for':0, 'which':0, 'out':0, 'then':0, + 'must':0, 'one':0, 'through':0, 'with':0, 'you':0, 'said':0, + 'first':0, 'back':0, 'were':0, 'what':0, 'any':0, 'years':0, 'his':0, + 'her':0, 'where':0, 'all':0, 'its':0, 'now':0, 'much':0, 'she':0, + 'about':0, 'such':0, 'your':0, 'there':0, 'into':0, 'like':0, 'may':0, + 'would':0, 'than':0, 'our':0, 'well':0, 'their':0, 'them':0, 'over':0, + 'down':0, + 'net':0, 'www':0, 'bad':0, 'Okay':0, 'bin':0, 'cur':0, +} + +wordsDict = {} +wordsDictHTML = {} +wordsDictArchive = {} + +def cleanupWordsString(str): + str = string.replace(str, ".", " ") + str = string.replace(str, "!", " ") + str = string.replace(str, "?", " ") + str = string.replace(str, ",", " ") + str = string.replace(str, "'", " ") + str = string.replace(str, '"', " ") + str = string.replace(str, ";", " ") + str = string.replace(str, "(", " ") + str = string.replace(str, ")", " ") + str = string.replace(str, "{", " ") + str = string.replace(str, "}", " ") + str = string.replace(str, "<", " ") + str = string.replace(str, ">", " ") + str = string.replace(str, "=", " ") + str = string.replace(str, "/", " ") + str = string.replace(str, "*", " ") + str = string.replace(str, ":", " ") + str = string.replace(str, "#", " ") + str = string.replace(str, "\\", " ") + str = string.replace(str, "\n", " ") + str = string.replace(str, "\r", " ") + str = string.replace(str, "\xc2", " ") + str = string.replace(str, "\xa0", " ") + return str + +def cleanupDescrString(str): + str = string.replace(str, "'", " ") + str = string.replace(str, "\n", " ") + str = string.replace(str, "\r", " ") + str = string.replace(str, "\xc2", " ") + str = string.replace(str, "\xa0", " ") + l = string.split(str) + str = string.join(str) + return str + +def splitIdentifier(str): + ret = [] + while str != "": + cur = string.lower(str[0]) + str = str[1:] + if ((cur < 'a') or (cur > 'z')): + continue + while (str != "") and (str[0] >= 'A') and (str[0] <= 'Z'): + cur = cur + string.lower(str[0]) + str = str[1:] + while (str != "") and (str[0] >= 'a') and (str[0] <= 'z'): + cur = cur + str[0] + str = str[1:] + while (str != "") and (str[0] >= '0') and (str[0] <= '9'): + str = str[1:] + ret.append(cur) + return ret + +def addWord(word, module, symbol, relevance): + global wordsDict + + if word == None or len(word) < 3: + return -1 + if module == None or symbol == None: + return -1 + if dropWords.has_key(word): + return 0 + if ord(word[0]) > 0x80: + return 0 + + if wordsDict.has_key(word): + d = wordsDict[word] + if d == None: + return 0 + if len(d) > 500: + wordsDict[word] = None + return 0 + try: + relevance = relevance + d[(module, symbol)] + except: + pass + else: + wordsDict[word] = {} + wordsDict[word][(module, symbol)] = relevance + return relevance + +def addString(str, module, symbol, relevance): + if str == None or len(str) < 3: + return -1 + ret = 0 + str = cleanupWordsString(str) + l = string.split(str) + for word in l: + if len(word) > 2: + ret = ret + addWord(word, module, symbol, 5) + + return ret + +def addWordHTML(word, resource, id, section, relevance): + global wordsDictHTML + + if word == None or len(word) < 3: + return -1 + if resource == None or section == None: + return -1 + if dropWords.has_key(word): + return 0 + if ord(word[0]) > 0x80: + return 0 + + section = cleanupDescrString(section) + + if wordsDictHTML.has_key(word): + d = wordsDictHTML[word] + if d == None: + print "skipped %s" % (word) + return 0 + try: + (r,i,s) = d[resource] + if i != None: + id = i + if s != None: + section = s + relevance = relevance + r + except: + pass + else: + wordsDictHTML[word] = {} + d = wordsDictHTML[word]; + d[resource] = (relevance, id, section) + return relevance + +def addStringHTML(str, resource, id, section, relevance): + if str == None or len(str) < 3: + return -1 + ret = 0 + str = cleanupWordsString(str) + l = string.split(str) + for word in l: + if len(word) > 2: + try: + r = addWordHTML(word, resource, id, section, relevance) + if r < 0: + print "addWordHTML failed: %s %s" % (word, resource) + ret = ret + r + except: + print "addWordHTML failed: %s %s %d" % (word, resource, relevance) + print sys.exc_type, sys.exc_value + + return ret + +def addWordArchive(word, id, relevance): + global wordsDictArchive + + if word == None or len(word) < 3: + return -1 + if id == None or id == -1: + return -1 + if dropWords.has_key(word): + return 0 + if ord(word[0]) > 0x80: + return 0 + + if wordsDictArchive.has_key(word): + d = wordsDictArchive[word] + if d == None: + print "skipped %s" % (word) + return 0 + try: + r = d[id] + relevance = relevance + r + except: + pass + else: + wordsDictArchive[word] = {} + d = wordsDictArchive[word]; + d[id] = relevance + return relevance + +def addStringArchive(str, id, relevance): + if str == None or len(str) < 3: + return -1 + ret = 0 + str = cleanupWordsString(str) + l = string.split(str) + for word in l: + i = len(word) + if i > 2: + try: + r = addWordArchive(word, id, relevance) + if r < 0: + print "addWordArchive failed: %s %s" % (word, id) + else: + ret = ret + r + except: + print "addWordArchive failed: %s %s %d" % (word, id, relevance) + print sys.exc_type, sys.exc_value + return ret + +######################################################################### +# # +# XML API description analysis # +# # +######################################################################### + +def loadAPI(filename): + doc = libxml2.parseFile(filename) + print "loaded %s" % (filename) + return doc + +def foundExport(file, symbol): + if file == None: + return 0 + if symbol == None: + return 0 + addFunction(symbol, file) + l = splitIdentifier(symbol) + for word in l: + addWord(word, file, symbol, 10) + return 1 + +def analyzeAPIFile(top): + count = 0 + name = top.prop("name") + cur = top.children + while cur != None: + if cur.type == 'text': + cur = cur.next + continue + if cur.name == "exports": + count = count + foundExport(name, cur.prop("symbol")) + else: + print "unexpected element %s in API doc " % (name) + cur = cur.next + return count + +def analyzeAPIFiles(top): + count = 0 + cur = top.children + + while cur != None: + if cur.type == 'text': + cur = cur.next + continue + if cur.name == "file": + count = count + analyzeAPIFile(cur) + else: + print "unexpected element %s in API doc " % (cur.name) + cur = cur.next + return count + +def analyzeAPIEnum(top): + file = top.prop("file") + if file == None: + return 0 + symbol = top.prop("name") + if symbol == None: + return 0 + + addEnum(symbol, file) + l = splitIdentifier(symbol) + for word in l: + addWord(word, file, symbol, 10) + + return 1 + +def analyzeAPIConst(top): + file = top.prop("file") + if file == None: + return 0 + symbol = top.prop("name") + if symbol == None: + return 0 + + addConst(symbol, file) + l = splitIdentifier(symbol) + for word in l: + addWord(word, file, symbol, 10) + + return 1 + +def analyzeAPIType(top): + file = top.prop("file") + if file == None: + return 0 + symbol = top.prop("name") + if symbol == None: + return 0 + + addType(symbol, file) + l = splitIdentifier(symbol) + for word in l: + addWord(word, file, symbol, 10) + return 1 + +def analyzeAPIFunctype(top): + file = top.prop("file") + if file == None: + return 0 + symbol = top.prop("name") + if symbol == None: + return 0 + + addFunctype(symbol, file) + l = splitIdentifier(symbol) + for word in l: + addWord(word, file, symbol, 10) + return 1 + +def analyzeAPIStruct(top): + file = top.prop("file") + if file == None: + return 0 + symbol = top.prop("name") + if symbol == None: + return 0 + + addStruct(symbol, file) + l = splitIdentifier(symbol) + for word in l: + addWord(word, file, symbol, 10) + + info = top.prop("info") + if info != None: + info = string.replace(info, "'", " ") + info = string.strip(info) + l = string.split(info) + for word in l: + if len(word) > 2: + addWord(word, file, symbol, 5) + return 1 + +def analyzeAPIMacro(top): + file = top.prop("file") + if file == None: + return 0 + symbol = top.prop("name") + if symbol == None: + return 0 + symbol = string.replace(symbol, "'", " ") + symbol = string.strip(symbol) + + info = None + cur = top.children + while cur != None: + if cur.type == 'text': + cur = cur.next + continue + if cur.name == "info": + info = cur.content + break + cur = cur.next + + l = splitIdentifier(symbol) + for word in l: + addWord(word, file, symbol, 10) + + if info == None: + addMacro(symbol, file) + print "Macro %s description has no " % (symbol) + return 0 + + info = string.replace(info, "'", " ") + info = string.strip(info) + addMacro(symbol, file, info) + l = string.split(info) + for word in l: + if len(word) > 2: + addWord(word, file, symbol, 5) + return 1 + +def analyzeAPIFunction(top): + file = top.prop("file") + if file == None: + return 0 + symbol = top.prop("name") + if symbol == None: + return 0 + + symbol = string.replace(symbol, "'", " ") + symbol = string.strip(symbol) + info = None + cur = top.children + while cur != None: + if cur.type == 'text': + cur = cur.next + continue + if cur.name == "info": + info = cur.content + elif cur.name == "return": + rinfo = cur.prop("info") + if rinfo != None: + rinfo = string.replace(rinfo, "'", " ") + rinfo = string.strip(rinfo) + addString(rinfo, file, symbol, 7) + elif cur.name == "arg": + ainfo = cur.prop("info") + if ainfo != None: + ainfo = string.replace(ainfo, "'", " ") + ainfo = string.strip(ainfo) + addString(ainfo, file, symbol, 5) + name = cur.prop("name") + if name != None: + name = string.replace(name, "'", " ") + name = string.strip(name) + addWord(name, file, symbol, 7) + cur = cur.next + if info == None: + print "Function %s description has no " % (symbol) + addFunction(symbol, file, "") + else: + info = string.replace(info, "'", " ") + info = string.strip(info) + addFunction(symbol, file, info) + addString(info, file, symbol, 5) + + l = splitIdentifier(symbol) + for word in l: + addWord(word, file, symbol, 10) + + return 1 + +def analyzeAPISymbols(top): + count = 0 + cur = top.children + + while cur != None: + if cur.type == 'text': + cur = cur.next + continue + if cur.name == "macro": + count = count + analyzeAPIMacro(cur) + elif cur.name == "function": + count = count + analyzeAPIFunction(cur) + elif cur.name == "const": + count = count + analyzeAPIConst(cur) + elif cur.name == "typedef": + count = count + analyzeAPIType(cur) + elif cur.name == "struct": + count = count + analyzeAPIStruct(cur) + elif cur.name == "enum": + count = count + analyzeAPIEnum(cur) + elif cur.name == "functype": + count = count + analyzeAPIFunctype(cur) + else: + print "unexpected element %s in API doc " % (cur.name) + cur = cur.next + return count + +def analyzeAPI(doc): + count = 0 + if doc == None: + return -1 + root = doc.getRootElement() + if root.name != "api": + print "Unexpected root name" + return -1 + cur = root.children + while cur != None: + if cur.type == 'text': + cur = cur.next + continue + if cur.name == "files": + pass +# count = count + analyzeAPIFiles(cur) + elif cur.name == "symbols": + count = count + analyzeAPISymbols(cur) + else: + print "unexpected element %s in API doc" % (cur.name) + cur = cur.next + return count + +######################################################################### +# # +# Web pages parsing and analysis # +# # +######################################################################### + +import glob + +def analyzeHTMLText(doc, resource, p, section, id): + words = 0 + try: + content = p.content + words = words + addStringHTML(content, resource, id, section, 5) + except: + return -1 + return words + +def analyzeHTMLPara(doc, resource, p, section, id): + words = 0 + try: + content = p.content + words = words + addStringHTML(content, resource, id, section, 5) + except: + return -1 + return words + +def analyzeHTMLPre(doc, resource, p, section, id): + words = 0 + try: + content = p.content + words = words + addStringHTML(content, resource, id, section, 5) + except: + return -1 + return words + +def analyzeHTML(doc, resource, p, section, id): + words = 0 + try: + content = p.content + words = words + addStringHTML(content, resource, id, section, 5) + except: + return -1 + return words + +def analyzeHTML(doc, resource): + para = 0; + ctxt = doc.xpathNewContext() + try: + res = ctxt.xpathEval("//head/title") + title = res[0].content + except: + title = "Page %s" % (resource) + addPage(resource, title) + try: + items = ctxt.xpathEval("//h1 | //h2 | //h3 | //text()") + section = title + id = "" + for item in items: + if item.name == 'h1' or item.name == 'h2' or item.name == 'h3': + section = item.content + if item.prop("id"): + id = item.prop("id") + elif item.prop("name"): + id = item.prop("name") + elif item.type == 'text': + analyzeHTMLText(doc, resource, item, section, id) + para = para + 1 + elif item.name == 'p': + analyzeHTMLPara(doc, resource, item, section, id) + para = para + 1 + elif item.name == 'pre': + analyzeHTMLPre(doc, resource, item, section, id) + para = para + 1 + else: + print "Page %s, unexpected %s element" % (resource, item.name) + except: + print "Page %s: problem analyzing" % (resource) + print sys.exc_type, sys.exc_value + + return para + +def analyzeHTMLPages(): + ret = 0 + HTMLfiles = glob.glob("*.html") + glob.glob("tutorial/*.html") + for html in HTMLfiles: + if html[0:3] == "API": + continue + if html == "xslt.html": + continue + try: + doc = libxml2.htmlParseFile(html, None) + res = analyzeHTML(doc, html) + print "Parsed %s : %d paragraphs" % (html, res) + ret = ret + 1 + except: + print "could not parse %s" % (html) + return ret + +######################################################################### +# # +# Mail archives parsing and analysis # +# # +######################################################################### + +import time + +def getXMLDateArchive(t = None): + if t == None: + t = time.time() + T = time.gmtime(t) + month = time.strftime("%B", T) + year = T[0] + url = "http://mail.gnome.org/archives/xslt/%d-%s/date.html" % (year, month) + return url + +def scanXMLMsgArchive(url, title, force = 0): + if url == None or title == None: + return 0 + + ID = checkXMLMsgArchive(url) + if force == 0 and ID != -1: + return 0 + + if ID == -1: + ID = addXMLMsgArchive(url, title) + if ID == -1: + return 0 + + try: + print "Loading %s" % (url) + doc = libxml2.htmlParseFile(url, None); + except: + doc = None + if doc == None: + print "Failed to parse %s" % (url) + return 0 + + addStringArchive(title, ID, 20) + ctxt = doc.xpathNewContext() + texts = ctxt.xpathEval("//pre//text()") + for text in texts: + addStringArchive(text.content, ID, 5) + + return 1 + +def scanXMLDateArchive(t = None, force = 0): + global wordsDictArchive + + wordsDictArchive = {} + + url = getXMLDateArchive(t) + print "loading %s" % (url) + try: + doc = libxml2.htmlParseFile(url, None); + except: + doc = None + if doc == None: + print "Failed to parse %s" % (url) + return -1 + ctxt = doc.xpathNewContext() + anchors = ctxt.xpathEval("//a[@href]") + links = 0 + newmsg = 0 + for anchor in anchors: + href = anchor.prop("href") + if href == None or href[0:3] != "msg": + continue + try: + links = links + 1 + + msg = libxml2.buildURI(href, url) + title = anchor.content + if title != None and title[0:4] == 'Re: ': + title = title[4:] + if title != None and title[0:6] == '[xml] ': + title = title[6:] + if title != None and title[0:7] == '[xslt] ': + title = title[7:] + newmsg = newmsg + scanXMLMsgArchive(msg, title, force) + + except: + pass + + return newmsg + + +######################################################################### +# # +# Main code: open the DB, the API XML and analyze it # +# # +######################################################################### +try: + openMySQL() +except: + print "Failed to open the database" + print sys.exc_type, sys.exc_value + sys.exit(1) + +def analyzeArchives(t = None, force = 0): + global wordsDictArchive + + ret = scanXMLDateArchive(t, force) + print "Indexed %d words in %d archive pages" % (len(wordsDictArchive), ret) + + i = 0 + skipped = 0 + for word in wordsDictArchive.keys(): + refs = wordsDictArchive[word] + if refs == None: + skipped = skipped + 1 + continue; + for id in refs.keys(): + relevance = refs[id] + updateWordArchive(word, id, relevance) + i = i + 1 + + print "Found %d associations in HTML pages" % (i) + +def analyzeHTMLTop(): + global wordsDictHTML + + ret = analyzeHTMLPages() + print "Indexed %d words in %d HTML pages" % (len(wordsDictHTML), ret) + + i = 0 + skipped = 0 + for word in wordsDictHTML.keys(): + refs = wordsDictHTML[word] + if refs == None: + skipped = skipped + 1 + continue; + for resource in refs.keys(): + (relevance, id, section) = refs[resource] + updateWordHTML(word, resource, section, id, relevance) + i = i + 1 + + print "Found %d associations in HTML pages" % (i) + +def analyzeAPITop(): + global wordsDict + global API + + try: + doc = loadAPI(API) + ret = analyzeAPI(doc) + print "Analyzed %d blocs" % (ret) + doc.freeDoc() + except: + print "Failed to parse and analyze %s" % (API) + print sys.exc_type, sys.exc_value + sys.exit(1) + + print "Indexed %d words" % (len(wordsDict)) + i = 0 + skipped = 0 + for word in wordsDict.keys(): + refs = wordsDict[word] + if refs == None: + skipped = skipped + 1 + continue; + for (module, symbol) in refs.keys(): + updateWord(word, symbol, refs[(module, symbol)]) + i = i + 1 + + print "Found %d associations, skipped %d words" % (i, skipped) + +def usage(): + print "Usage index.py [--force] [--archive] [--archive-year year] [--archive-month month] [--API] [--docs]" + sys.exit(1) + +def main(): + args = sys.argv[1:] + force = 0 + if args: + i = 0 + while i < len(args): + if args[i] == '--force': + force = 1 + elif args[i] == '--archive': + analyzeArchives(None, force) + elif args[i] == '--archive-year': + i = i + 1; + year = args[i] + months = ["January" , "February", "March", "April", "May", + "June", "July", "August", "September", "October", + "November", "December"]; + for month in months: + try: + str = "%s-%s" % (year, month) + T = time.strptime(str, "%Y-%B") + t = time.mktime(T) + 3600 * 24 * 10; + analyzeArchives(t, force) + except: + print "Failed to index month archive:" + print sys.exc_type, sys.exc_value + elif args[i] == '--archive-month': + i = i + 1; + month = args[i] + try: + T = time.strptime(month, "%Y-%B") + t = time.mktime(T) + 3600 * 24 * 10; + analyzeArchives(t, force) + except: + print "Failed to index month archive:" + print sys.exc_type, sys.exc_value + elif args[i] == '--API': + analyzeAPITop() + elif args[i] == '--docs': + analyzeHTMLTop() + else: + usage() + i = i + 1 + else: + usage() + +if __name__ == "__main__": + main() diff --git a/doc/internals.html b/doc/internals.html new file mode 100644 index 0000000..fb51345 --- /dev/null +++ b/doc/internals.html @@ -0,0 +1,312 @@ + + +Library internals
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Library internals

    Main Menu
    Related links
    API Indexes

    Table of contents

    Introduction

    This document describes the processing of libxslt, the XSLT C library developed for the GNOME project.

    Note: this documentation is by definition incomplete and I am not good at +spelling, grammar, so patches and suggestions are really welcome.

    Basics

    XSLT is a transformation language. It takes an input document and a +stylesheet document and generates an output document:

    the XSLT processing model

    Libxslt is written in C. It relies on libxml, the XML C library for GNOME, for +the following operations:

      +
    • parsing files
    • +
    • building the in-memory DOM structure associated with the documents + handled
    • +
    • the XPath implementation
    • +
    • serializing back the result document to XML and HTML. (Text is handled + directly.)
    • +

    Keep it simple stupid

    Libxslt is not very specialized. It is built under the assumption that all +nodes from the source and output document can fit in the virtual memory of +the system. There is a big trade-off there. It is fine for reasonably sized +documents but may not be suitable for large sets of data. The gain is that it +can be used in a relatively versatile way. The input or output may never be +serialized, but the size of documents it can handle are limited by the size +of the memory available.

    More specialized memory handling approaches are possible, like building +the input tree from a serialization progressively as it is consumed, +factoring repetitive patterns, or even on-the-fly generation of the output as +the input is parsed but it is possible only for a limited subset of the +stylesheets. In general the implementation of libxslt follows the following +pattern:

      +
    • KISS (keep it simple stupid)
    • +
    • when there is a clear bottleneck optimize on top of this simple + framework and refine only as much as is needed to reach the expected + result
    • +

    The result is not that bad, clearly one can do a better job but more +specialized too. Most optimization like building the tree on-demand would +need serious changes to the libxml XPath framework. An easy step would be to +serialize the output directly (or call a set of SAX-like output handler to +keep this a flexible interface) and hence avoid the memory consumption of the +result.

    The libxml nodes

    DOM-like trees, as used and generated by libxml and libxslt, are +relatively complex. Most node types follow the given structure except a few +variations depending on the node type:

    description of a libxml node

    Nodes carry a name and the node type +indicates the kind of node it represents, the most common ones are:

      +
    • document nodes
    • +
    • element nodes
    • +
    • text nodes
    • +

    For the XSLT processing, entity nodes should not be generated (i.e. they +should be replaced by their content). Most nodes also contains the following +"navigation" information:

      +
    • the containing document
    • +
    • the parent node
    • +
    • the first children node
    • +
    • the last children node
    • +
    • the previous sibling
    • +
    • the following sibling (next)
    • +

    Elements nodes carries the list of attributes in the properties, an +attribute itself holds the navigation pointers and the children list (the +attribute value is not represented as a simple string to allow usage of +entities references).

    The ns points to the namespace declaration for the +namespace associated to the node, nsDef is the linked list +of namespace declaration present on element nodes.

    Most nodes also carry an _private pointer which can be +used by the application to hold specific data on this node.

    The XSLT processing steps

    There are a few steps which are clearly decoupled at the interface +level:

      +
    1. parse the stylesheet and generate a DOM tree
    2. +
    3. take the stylesheet tree and build a compiled version of it (the + compilation phase)
    4. +
    5. take the input and generate a DOM tree
    6. +
    7. process the stylesheet against the input tree and generate an output + tree
    8. +
    9. serialize the output tree
    10. +

    A few things should be noted here:

      +
    • the steps 1/ 3/ and 5/ are optional: the DOM representing the + stylesheet and input can be created by other means, not just by parsing + serialized XML documents, and similarly the result tree DOM can be + made available to other processeswithout being serialized. +
    • the stylesheet obtained at 2/ can be reused by multiple processing 4/ + (and this should also work in threaded programs)
    • +
    • the tree provided in 2/ should never be freed using xmlFreeDoc, but by + freeing the stylesheet.
    • +
    • the input tree created in step 3/ is not modified except the + _private field which may be used for labelling keys if used by the + stylesheet. It's not modified at all in step 4/ to allow parallel + processing using a shared precompiled stylesheet.
    • +

    The XSLT stylesheet compilation

    This is the second step described. It takes a stylesheet tree, and +"compiles" it. This associates to each node a structure stored in the +_private field and containing information computed in the stylesheet:

    a compiled XSLT stylesheet

    One xsltStylesheet structure is generated per document parsed for the +stylesheet. XSLT documents allow includes and imports of other documents, +imports are stored in the imports list (hence keeping the +tree hierarchy of includes which is very important for a proper XSLT +processing model) and includes are stored in the doclist +list. An imported stylesheet has a parent link to allow browsing of the +tree.

    The DOM tree associated to the document is stored in doc. +It is preprocessed to remove ignorable empty nodes and all the nodes in the +XSLT namespace are subject to precomputing. This usually consist of +extracting all the context information from the context tree (attributes, +namespaces, XPath expressions), and storing them in an xsltStylePreComp +structure associated to the _private field of the node.

    A couple of notable exceptions to this are XSLT template nodes (more on +this later) and attribute value templates. If they are actually templates, +the value cannot be computed at compilation time. (Some preprocessing could +be done like isolation and preparsing of the XPath subexpressions but it's +not done, yet.)

    The xsltStylePreComp structure also allows storing of the precompiled form +of an XPath expression that can be associated to an XSLT element (more on +this later).

    The XSLT template compilation

    A proper handling of templates lookup is one of the keys of fast XSLT +processing. (Given a node in the source document this is the process of +finding which templates should be applied to this node.) Libxslt follows the +hint suggested in the 5.2 +Patterns section of the XSLT Recommendation, i.e. it doesn't evaluate it +as an XPath expression but tokenizes it and compiles it as a set of rules to +be evaluated on a candidate node. There usually is an indication of the node +name in the last step of this evaluation and this is used as a key check for +the match. As a result libxslt builds a relatively more complex set of +structures for the templates:

    The templates related structure

    Let's describe a bit more closely what is built. First the xsltStylesheet +structure holds a pointer to the template hash table. All the XSLT patterns +compiled in this stylesheet are indexed by the value of the the target +element (or attribute, pi ...) name, so when a element or an attribute "foo" +needs to be processed the lookup is done using the name as a key.

    Each of the patterns is compiled into an xsltCompMatch +(i.e. an ''XSLT compiled match') structure. It holds +the set of rules based on the tokenization of the pattern stored in reverse +order (matching is easier this way).

    The xsltCompMatch are then stored in the hash table, the clash list is +itself sorted by priority of the template to implement "naturally" the XSLT +priority rules.

    Associated to the compiled pattern is the xsltTemplate itself containing +the information required for the processing of the pattern including, of +course, a pointer to the list of elements used for building the pattern +result.

    Last but not least a number of patterns do not fit in the hash table +because they are not associated to a name, this is the case for patterns +applying to the root, any element, any attributes, text nodes, pi nodes, keys +etc. Those are stored independently in the stylesheet structure as separate +linked lists of xsltCompMatch.

    The processing itself

    The processing is defined by the XSLT specification (the basis of the +algorithm is explained in the Introduction +section). Basically it works by taking the root of the input document +as the cureent node and applying the following algorithm:

      +
    1. Finding the template applying to current node. + This is a lookup in the template hash table, walking the hash list until + the node satisfies all the steps of the pattern, then checking the + appropriate global template(s) (i.e. templates applying to a node type) + to see if there isn't a higher priority rule to apply
    2. +
    3. If there is no template, apply the default rule (recurse on the + children as the current node)
    4. +
    5. else walk the content list of the selected templates, for each of them: +
        +
      • if the node is in the XSLT namespace then the node has a _private + field pointing to the preprocessed values, jump to the specific + code
      • +
      • if the node is in an extension namespace, look up the associated + behavior
      • +
      • otherwise copy the node.
      • +
      +

      The closure is usually done through the XSLT + apply-templatesconstruct, which invokes this process + recursively starting at step 1, to find the appropriate template + for the nodes selected by the 'select' attribute of the apply-templates + instruction (default: the children of the node currently being + processed)

      +
    6. +

    Note that large parts of the input tree may not be processed by a given +stylesheet and that conversely some may be processed multiple times. +(This often is the case when a Table of Contents is built).

    The module transform.c is the one implementing most of this +logic. xsltApplyStylesheet() is the entry point, it +allocates an xsltTransformContext containing the following:

      +
    • a pointer to the stylesheet being processed
    • +
    • a stack of templates
    • +
    • a stack of variables and parameters
    • +
    • an XPath context
    • +
    • the template mode
    • +
    • current document
    • +
    • current input node
    • +
    • current selected node list
    • +
    • the current insertion points in the output document
    • +
    • a couple of hash tables for extension elements and functions
    • +

    Then a new document gets allocated (HTML or XML depending on the type of +output), the user parameters and global variables and parameters are +evaluated. Then xsltProcessOneNode() which implements the +1-2-3 algorithm is called on the docuemnt node of the input. Step 1/ is +implemented by calling xsltGetTemplate(), step 2/ is +implemented by xsltDefaultProcessOneNode() and step 3/ is +implemented by xsltApplyOneTemplate().

    XPath expression compilation

    The XPath support is actually implemented in the libxml module (where it +is reused by the XPointer implementation). XPath is a relatively classic +expression language. The only uncommon feature is that it is working on XML +trees and hence has specific syntax and types to handle them.

    XPath expressions are compiled using xmlXPathCompile(). +It will take an expression string in input and generate a structure +containing the parsed expression tree, for example the expression:

    /doc/chapter[title='Introduction']

    will be compiled as

    Compiled Expression : 10 elements
    +  SORT
    +    COLLECT  'child' 'name' 'node' chapter
    +      COLLECT  'child' 'name' 'node' doc
    +        ROOT
    +      PREDICATE
    +        SORT
    +          EQUAL =
    +            COLLECT  'child' 'name' 'node' title
    +              NODE
    +            ELEM Object is a string : Introduction
    +              COLLECT  'child' 'name' 'node' title
    +                NODE

    This can be tested using the testXPath command (in the +libxml codebase) using the --tree option.

    Again, the KISS approach is used. No optimization is done. This could be +an interesting thing to add. Michael +Kay describes a lot of possible and interesting optimizations done in +Saxon which would be possible at this level. I'm unsure they would provide +much gain since the expressions tends to be relatively simple in general and +stylesheets are still hand generated. Optimizations at the interpretation +sounds likely to be more efficient.

    XPath interpretation

    The interpreter is implemented by xmlXPathCompiledEval() +which is the front-end to xmlXPathCompOpEval() the function +implementing the evaluation of the expression tree. This evaluation follows +the KISS approach again. It's recursive and calls +xmlXPathNodeCollectAndTest() to collect a set of nodes when +evaluating a COLLECT node.

    An evaluation is done within the framework of an XPath context stored in +an xmlXPathContext structure, in the framework of a +transformation the context is maintained within the XSLT context. Its content +follows the requirements from the XPath specification:

      +
    • the current document
    • +
    • the current node
    • +
    • a hash table of defined variables (but not used by XSLT, + which uses its own stack frame for variables, described below)
    • +
    • a hash table of defined functions
    • +
    • the proximity position (the place of the node in the current node + list)
    • +
    • the context size (the size of the current node list)
    • +
    • the array of namespace declarations in scope (there also is a namespace + hash table but it is not used in the XSLT transformation).
    • +

    For the purpose of XSLT an extra pointer has been added +allowing to retrieve the XSLT transformation context. When an XPath +evaluation is about to be performed, an XPath parser context is allocated +containing an XPath object stack (this is actually an XPath evaluation +context, this is a relic of the time where there was no separate parsing and +evaluation phase in the XPath implementation). Here is an overview of the set +of contexts associated to an XPath evaluation within an XSLT +transformation:

    The set of contexts associated

    Clearly this is a bit too complex and confusing and should be refactored +at the next set of binary incompatible releases of libxml. For example the +xmlXPathCtxt has a lot of unused parts and should probably be merged with +xmlXPathParserCtxt.

    Description of XPath Objects

    An XPath expression manipulates XPath objects. XPath defines the default +types boolean, numbers, strings and node sets. XSLT adds the result tree +fragment type which is basically an unmodifiable node set.

    Implementation-wise, libxml follows again a KISS approach, the +xmlXPathObject is a structure containing a type description and the various +possibilities. (Using an enum could have gained some bytes.) In the case of +node sets (or result tree fragments), it points to a separate xmlNodeSet +object which contains the list of pointers to the document nodes:

    An Node set object pointing to

    The XPath API (and +its 'internal' +part) includes a number of functions to create, copy, compare, convert or +free XPath objects.

    XPath functions

    All the XPath functions available to the interpreter are registered in the +function hash table linked from the XPath context. They all share the same +signature:

    void xmlXPathFunc (xmlXPathParserContextPtr ctxt, int nargs);

    The first argument is the XPath interpretation context, holding the +interpretation stack. The second argument defines the number of objects +passed on the stack for the function to consume (last argument is on top of +the stack).

    Basically an XPath function does the following:

      +
    • check nargs for proper handling of errors or functions + with variable numbers of parameters
    • +
    • pop the parameters from the stack using obj = + valuePop(ctxt);
    • +
    • do the function specific computation
    • +
    • push the result parameter on the stack using valuePush(ctxt, + res);
    • +
    • free up the input parameters with + xmlXPathFreeObject(obj);
    • +
    • return
    • +

    Sometime the work can be done directly by modifying in-situ the top object +on the stack ctxt->value.

    The XSLT variables stack frame

    Not to be confused with XPath object stack, this stack holds the XSLT +variables and parameters as they are defined through the recursive calls of +call-template, apply-templates and default templates. This is used to define +the scope of variables being called.

    This part seems to be one needing most work , first it is +done in a very inefficient way since the location of the variables and +parameters within the stylesheet tree is still done at run time (it really +should be done statically at compile time), and I am still unsure that my +understanding of the template variables and parameter scope is actually +right.

    This part of the documentation is still to be written once this part of +the code will be stable. TODO

    Extension support

    There is a separate document explaining how the +extension support works.

    Further reading

    Michael Kay wrote a +really interesting article on Saxon internals and the work he did on +performance issues. I wish I had read it before starting libxslt design (I +would probably have avoided a few mistakes and progressed faster). A lot of +the ideas in his papers should be implemented or at least tried in +libxslt.

    The libxml documentation, especially the I/O interfaces and the memory management.

    TODOs

    redesign the XSLT stack frame handling. Far too much work is done at +execution time. Similarly for the attribute value templates handling, at +least the embedded subexpressions ought to be precompiled.

    Allow output to be saved to a SAX like output (this notion of SAX like API +for output should be added directly to libxml).

    Implement and test some of the optimization explained by Michael Kay +especially:

      +
    • static slot allocation on the stack frame
    • +
    • specific boolean interpretation of an XPath expression
    • +
    • some of the sorting optimization
    • +
    • Lazy evaluation of location path. (this may require more changes but + sounds really interesting. XT does this too.)
    • +
    • Optimization of an expression tree (This could be done as a completely + independent module.)
    • +

    Error reporting, there is a lot of case where the XSLT specification +specify that a given construct is an error are not checked adequately by +libxslt. Basically one should do a complete pass on the XSLT spec again and +add all tests to the stylesheet compilation. Using the DTD provided in the +appendix and making direct checks using the libxml validation API sounds a +good idea too (though one should take care of not raising errors for +elements/attributes in different namespaces).

    Double check all the places where the stylesheet compiled form might be +modified at run time (extra removal of blanks nodes, hint on the +xsltCompMatch).

    Thanks:

    Thanks to Michael Sperberg-McQueen for + various fixes and clarifications on this document!

    Daniel Veillard

    diff --git a/doc/intro.html b/doc/intro.html new file mode 100644 index 0000000..0243ece --- /dev/null +++ b/doc/intro.html @@ -0,0 +1,24 @@ + + +Introduction
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Introduction

    Main Menu
    Related links
    API Indexes

    This document describes libxslt, +the XSLT C library developed for the +GNOME project.

    Here are some key points about libxslt:

      +
    • Libxslt is a C implementation
    • +
    • Libxslt is based on libxml for XML parsing, tree manipulation and XPath + support
    • +
    • It is written in plain C, making as few assumptions as possible, and + sticking closely to ANSI C/POSIX for easy embedding. Should works on + Linux/Unix/Windows.
    • +
    • This library is released under the MIT + Licence
    • +
    • Though not designed primarily with performances in mind, libxslt seems + to be a relatively fast processor.
    • +

    Daniel Veillard

    diff --git a/doc/libxslt-api.xml b/doc/libxslt-api.xml new file mode 100644 index 0000000..1cf7c89 --- /dev/null +++ b/doc/libxslt-api.xml @@ -0,0 +1,3201 @@ + + + + + interface for the XSLT attribute handling + this module handles the specificities of attribute and attribute groups processing. + Daniel Veillard + + + + + + + interface for the document handling + implements document loading and cache (multiple document() reference for the same resources must be equal. + Daniel Veillard + + + + + + + + + + + + + + + + + interface for the extension support + This provide the API needed for simple and module extension support. + Daniel Veillard + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + interface for the non-standard features + implement some extension outside the XSLT namespace but not EXSLT with is in a different library. + Daniel Veillard + + + + + + + + + + + + interface for the XSLT functions not from XPath + a set of extra functions coming from XSLT but not in XPath + Daniel Veillard and Bjorn Reese <breese@users.sourceforge.net> + + + + + + + + + + + + + + interface for the XSLT import support + macros and fuctions needed to implement and access the import tree + Daniel Veillard + + + + + + + + + + + interface for the key matching used in key() and template matches. + implementation of the key mechanims. + Daniel Veillard + + + + + + + + + interface for the XSLT namespace handling + set of function easing the processing and generation of namespace nodes in XSLT. + Daniel Veillard + + + + + + + + + + + Implementation of the XSLT number functions + Implementation of the XSLT number functions + Bjorn Reese <breese@users.sourceforge.net> and Daniel Veillard + + + + + + + + + + interface for the pattern matching used in template matches. + the implementation of the lookup of the right template for a given node must be really fast in order to keep decent performances. + Daniel Veillard + + + + + + + + + + + + + + precomputing stylesheets + this is the compilation phase, where most of the stylesheet is "compiled" into faster to use data. + Daniel Veillard + + + + + + + interface for the libxslt security framework + the libxslt security framework allow to restrict the access to new resources (file or URL) from the stylesheet at runtime. + Daniel Veillard + + + + + + + + + + + + + + + + + + + + + + + interface for the template processing + This set of routine encapsulates XPath calls and Attribute Value Templates evaluation. + Daniel Veillard + + + + + + + + + + + + + + the XSLT engine transformation part. + This module implements the bulk of the actual + Daniel Veillard + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + interface for the variable matching and lookup. + interface for the variable matching and lookup. + Daniel Veillard + + + + + + + + + + + + + + + + + + Interfaces, constants and types related to the XSLT engine + Interfaces, constants and types related to the XSLT engine + Daniel Veillard + + + + + + + + + + + + + + + internal data structures, constants and functions + Internal data structures, constants and functions used by the XSLT engine. They are not part of the API or ABI, i.e. they can change without prior notice, use carefully. + Daniel Veillard + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + macros for marking symbols as exportable/importable. + macros for marking symbols as exportable/importable. + Igor Zlatkovic <igor@zlatkovic.com> + + + + + + + + Locale handling + Interfaces for locale handling. Needed for language dependent sorting. + Nick Wellnhofer + + + + + + + + + + + set of utilities for the XSLT engine + interfaces for the utilities module of the XSLT engine. things like message handling, profiling, and other generally useful routines. + Daniel Veillard + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Macro to check if the XSLT processing should be stopped. Will return from the function. + + + Macro to check if the XSLT processing should be stopped. Will return from the function with a 0 value. + + + Macro to check if the XSLT processing should be stopped. Will goto the error: label. + + + quick check for xslt namespace attribute + + + Checks that the element pertains to XSLT namespace. + + + quick check whether this is an xslt element + + + Checks the value of an element in XSLT namespace. + + + Check that a node is a 'real' one: document, element, text or attribute. + + + + + check for bit 15 set + + + Special value for undefined namespace, internal + + + Macro to do a casting from an object pointer to a function pointer without encountering a warning from gcc #define XML_CAST_FPTR(fptr) (*(void **)(&fptr)) This macro violated ISO C aliasing rules (gcc4 on s390 broke) so it is disabled now + + + + + + + + + + get pointer to compiler context + + + The XSLT "vendor" URL for this processor. + + + The XSLT "vendor" string for this processor. + + + The default version of XSLT supported. + + + Internal define to enable usage of xmlXPathCompiledEvalToBoolean() for XSLT "tests"; e.g. in <xsl:if test="/foo/bar"> + + + A macro to import intergers from the stylesheet cascading order. + + + A macro to import pointers from the stylesheet cascading order. + + + get pointer to namespace map + + + check for namespace mapping + + + internal macro to test tree fragments + + + check if the argument is a text node + + + Common fields used for all items. + + + Fields for API compatibility to the structure _xsltElemPreComp which is used for extension functions. Note that @next is used for storage; it does not reflect a next sibling in the tree. TODO: Evaluate if we really need such a compatibility. + + + Currently empty. TODO: It is intended to hold navigational fields in the future. + + + The in-scope namespaces. + + + This is the libxslt namespace for specific extensions. + + + Macro indicating that locale are not supported + + + internal macro to set up tree fragments + + + Max number of specified xsl:sort on an element. + + + The XSLT specification namespace. + + + This is Norm's namespace for SAXON extensions. + + + The set of options to pass to an xmlReadxxx when loading files for XSLT consumption. + + + Specific value for pattern without priority expressed. + + + Internal define to enable on-demand xsl:key computation. That's the only mode now but the define is kept for compatibility + + + Internal define to enable the refactored variable part of libxslt + + + Internal define to enable the optimization of the compilation of XPath expressions. + + + Registering macro, not general purpose at all but used in different modules. + + + Registering macro, not general purpose at all but used in different modules. + + + Macro used to define extra information stored in the context + + + + + Macro used to free extra information stored in the context + + + + + Macro used to access extra information stored in the context + + + + + This is Michael Kay's Saxon processor namespace for extensions. + + + Macro to flag that a problem was detected internally. + + + Sampling precision for profiling + + + Macro to flag unimplemented blocks. + + + Control the type of xsl debugtrace messages emitted. + + + This is the Apache project XALAN processor namespace for extensions. + + + This is James Clark's XT processor namespace for extensions. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Add template "call" to call stack + + + + + + Drop the topmost item off the call stack + + + + If either cur or node are a breakpoint, or xslDebugStatus in state where debugging must occcur at this time then transfer control to the xslDebugBreak function + + + + + + + + + + + + + + add a key definition to a stylesheet + + + + + + + + + + Push an element list onto the stack. + + + + + + Register the XSLT pattern associated to @cur + + + + + + + + Allocate an extra runtime information slot statically while compiling the stylesheet and return its number + + + + + Allocate an extra runtime information slot at run-time and return its number This make sure there is a slot ready in the transformation context + + + + + Apply the xsl:use-attribute-sets. If @attrSets is NULL, then @inst will be used to exctract this value. If both, @attrSets and @inst, are NULL, then this will do nothing. + + + + + + + + Process the XSLT apply-imports element. + + + + + + + + Processes a sequence constructor on the current node in the source tree. @params are the already computed variable stack items; this function pushes them on the variable stack, and pops them before exiting; it's left to the caller to free or reuse @params afterwards. The initial states of the variable stack will always be restored before this function exits. NOTE that this does *not* initiate a new distinct variable scope; i.e. variables already on the stack are visible to the process. The caller's side needs to start a new variable scope if needed (e.g. in exsl:function). @templ is obsolete and not used anymore (e.g. <exslt:function> does not provide a @templ); a non-NULL @templ might raise an error in the future. BIG NOTE: This function is not intended to process the content of an xsl:template; it does not expect xsl:param instructions in @list and will report errors if found. Called by: - xsltEvalVariable() (variables.c) - exsltFuncFunctionFunction() (libexsl/functions.c) + + + + + + + + + Strip the unwanted ignorable spaces from the input tree + + + + + + Apply the stylesheet to the document NOTE: This may lead to a non-wellformed output XML wise ! + + + + + + + Apply the stylesheet to the document and allow the user to provide its own transformation context. + + + + + + + + + + Processes the XSLT 'apply-templates' instruction on the current node. + + + + + + + + Processes all attributes of a Literal Result Element. Attribute references are applied via xsl:use-attribute-set attributes. Copies all non XSLT-attributes over to the @target element and evaluates Attribute Value Templates. Called by xsltApplySequenceConstructor() (transform.c). + + + + + + + Process one attribute of a Literal Result Element (in the stylesheet). Evaluates Attribute Value Templates and copies the attribute over to the result element. This does *not* process attribute sets (xsl:use-attribute-set). + + + + + + + Process the given node and return the new string value. + + + + + + Process the given string, allowing to pass a namespace mapping context and return the new string value. Called by: - xsltAttrTemplateValueProcess() (templates.c) - xsltEvalAttrValueTemplate() (templates.c) QUESTION: Why is this function public? It is not used outside of templates.c. + + + + + + + Process the xslt attribute node on the source node + + + + + + + + Used for to correct the calibration for xsltTimestamp() + + + + + Processes the XSLT call-template instruction on the source node. + + + + + + + + Check if the given prefix is one of the declared extensions. This is intended to be called only at compile-time. Called by: xsltGetInheritedNsList() (xslt.c) xsltParseTemplateContent (xslt.c) + + + + + + Check if the given prefix is one of the declared extensions. This is intended to be called only at compile-time. Called by: xsltPrecomputeStylesheet() (xslt.c) xsltParseTemplateContent (xslt.c) + + + + + + Check if the resource is allowed to be read + + + + + + + Check if the resource is allowed to be written, if necessary makes some preliminary work like creating directories + + + + + + + Processes the xsl:choose instruction on the source node. + + + + + + + + Unregister all global variables set up by the XSLT library + + + + Cleanup the state of the templates used by the stylesheet and the ones it imports. + + + + + Process the xslt comment node on the source node + + + + + + + + Precompile an attribute in a stylesheet, basically it checks if it is an attrubute value template, and if yes establish some structures needed to process it at transformation time. + + + + + + Compile the XSLT pattern and generates a list of precompiled form suitable for fast matching. [1] Pattern ::= LocationPathPattern | Pattern '|' LocationPathPattern + + + + + + + + + reorder the current node list accordingly to the set of sorting requirement provided by the array of nodes. + + + + + + Execute the XSLT-copy instruction on the source node. + + + + + + + + Copies a namespace node (declaration). If @elem is not NULL, then the new namespace will be declared on @elem. + + + + + + + Do a copy of an namespace list. If @node is non-NULL the new namespaces are added automatically. This handles namespaces aliases. This function is intended only for *internal* use at transformation-time for copying ns-declarations of Literal Result Elements. Called by: xsltCopyTreeInternal() (transform.c) xsltShallowCopyElem() (transform.c) REVISIT: This function won't be used in the refactored code. + + + + + + + Process the XSLT copy-of instruction. + + + + + + + + Adds @string to a newly created or an existent text node child of @target. + + + + + + + + Creates a Result Value Tree (the XSLT 1.0 term for this is "Result Tree Fragment") + + + + + Process an debug node + + + + + + + + Dumps a list of the registered XSLT extension functions and elements + + + + + Get the current default debug tracing level mask + + + + Set the default debug tracing level mask + + + + + Find decimal-format by name + + + + + + reorder the current node list accordingly to the set of sorting requirement provided by the arry of nodes. + + + + + + + reorder the current node list accordingly to the set of sorting requirement provided by the arry of nodes. This is a wrapper function, the actual function used is specified using xsltSetCtxtSortFunc() to set the context specific sort function, or xsltSetSortFunc() to set the global sort function. If a sort function is set on the context, this will get called. Otherwise the global sort function is called. + + + + + + + An xsltDocLoaderFunc is a signature for a function which can be registered to load document not provided by the compilation or transformation API themselve, for example when an xsl:import, xsl:include is found at compilation time or when a document() call is made at runtime. + + + + + + + + + Pre process an XSLT-1.1 document element + + + + + + + Process an EXSLT/XSLT-1.1 document element + + + + + + + + Implement the document() XSLT function node-set document(object, node-set?) + + + + + + reorder the current node list @list accordingly to the document order This function is slow, obsolete and should not be used anymore. + + + + + + + + + Deallocates an #xsltElemPreComp structure. + + + + + Process the xslt element node on the source node + + + + + + + + Implement the element-available() XSLT function boolean element-available(string) + + + + + + Process the given AVT, and return the new string value. + + + + + + + Evaluate a attribute value template, i.e. the attribute value can contain expressions contained in curly braces ({}) and those are substituted by they computed value. + + + + + + + + Evaluates all global variables and parameters of a stylesheet. For internal use only. This is called at start of a transformation. + + + + + This is normally called from xsltEvalUserParams to process a single parameter from a list of parameters. The @value is evaluated as an XPath expression and the result is stored in the context's global variable/parameter hash table. To have a parameter treated literally (not as an XPath expression) use xsltQuoteUserParams (or xsltQuoteOneUserParam). For more details see description of xsltProcessOneUserParamInternal. + + + + + + + Check if an attribute value template has a static value, i.e. the attribute value does not contain expressions contained in curly braces ({}) + + + + + + + + + Processes the sequence constructor of the given instruction on @contextNode and converts the resulting tree to a string. This is needed by e.g. xsl:comment and xsl:processing-instruction. + + + + + + + Evaluate the global variables of a stylesheet. This needs to be done on parsed stylesheets before starting to apply transformations. Each of the parameters is evaluated as an XPath expression and stored in the global variables/parameter hash table. If you want your parameter used literally, use xsltQuoteUserParams. + + + + + + Process the expression using XPath and evaluate the result as an XPath predicate + + + + + + + + Process the expression using XPath and get a string + + + + + + Process the expression using XPath, allowing to pass a namespace mapping context and get a string + + + + + + + + Looks up an extension element. @ctxt can be NULL to search only in module elements. + + + + + + + A function called at initialization time of an XSLT extension module. + + + + + + Looks up an extension module element + + + + + + Looks up an extension module element pre-computation function + + + + + + Looks up an extension module function + + + + + + Looks up an extension module top-level element + + + + + + A function called at shutdown time of an XSLT extension module. + + + + + + + Finalizes the data (e.g. result tree fragments) created within a value-returning process (e.g. EXSLT's function). Tree fragments marked as being returned by a function are set to normal state, which means that the fragment garbage collector will free them after the function-calling process exits. + + + + + Marks the result of a value-returning extension instruction in order to avoid it being garbage collected before the extension instruction exits. Note that one still has to additionally register any newly created tree fragments (via xsltCreateRVT()) with xsltRegisterLocalRVT(). + + + + + + Try to find a document within the XSLT transformation context. This will not find document infos for temporary Result Tree Fragments. + + + + + + Find strip-space or preserve-space informations for an element respect the import precedence or the wildcards + + + + + + Finds the named template, apply import precedence rule. REVISIT TODO: We'll change the nameURI fields of templates to be in the string dict, so if the specified @nameURI is in the same dict, then use pointer comparison. Check if this can be done in a sane way. Maybe this function is not needed internally at transformation-time if we hard-wire the called templates to the caller. + + + + + + + Process the xslt for-each node on the source node + + + + + + + + format-number() uses the JDK 1.1 DecimalFormat class: http://java.sun.com/products/jdk/1.1/docs/api/java.text.DecimalFormat.html Structure: pattern := subpattern{;subpattern} subpattern := {prefix}integer{.fraction}{suffix} prefix := '\\u0000'..'\\uFFFD' - specialCharacters suffix := '\\u0000'..'\\uFFFD' - specialCharacters integer := '#'* '0'* '0' fraction := '0'* '#'* Notation: X* 0 or more instances of X (X | Y) either X or Y. X..Y any character from X up to Y, inclusive. S - T characters in S, except those in T Special Characters: Symbol Meaning 0 a digit # a digit, zero shows as absent . placeholder for decimal separator , placeholder for grouping separator. ; separates formats. - default negative prefix. % multiply by 100 and show as percentage ? multiply by 1000 and show as per mille X any other characters can be used in the prefix or suffix ' used to quote special characters in a prefix or suffix. + + + + + + + + Implement the format-number() XSLT function string format-number(number, string, string?) + + + + + + Free up the memory associated to the attribute value templates + + + + + Free up the memory used by attribute sets + + + + + Free up the memory allocated by all the elements of @comp + + + + + Free the XSLT extension data + + + + + Free the keys associated to a document + + + + + Free up all the space used by the loaded documents + + + + + Free up the memory used by XSLT extensions in a stylesheet + + + + + Free up the data associated to the global variables its value. + + + + + Free up the memory used by XSLT keys in a stylesheet + + + + + Frees a locale created with xsltNewLocale + + + + + Cleanup function for the locale support on shutdown + + + + Free up the memory used by namespaces aliases + + + + + Frees all registered result value trees (Result Tree Fragments) of the transformation. Internal function; should not be called by user-code. + + + + + Free up a security preference block + + + + + Free up the memory allocated by @elem + + + + + Frees the node-trees (and xsltDocument structures) of all stylesheet-modules of the stylesheet-level represented by the given @style. + + + + + Free up the memory allocated by all precomputed blocks + + + + + Free up the memory allocated by @style + + + + + Free up the memory used by xsltAddTemplate/xsltGetTemplate mechanism + + + + + Free up the memory allocated by @ctxt + + + + + Implement the function-available() XSLT function boolean function-available(string) + + + + + + Implement the node-set() XSLT function node-set node-set(result-tree) This function is available in libxslt, saxon or xt namespace. + + + + + + Implement the generate-id() XSLT function string generate-id(node-set?) + + + + + + Similar to xmlGetNsProp() but with a slightly different semantic Search and get the value of an attribute associated to a node This attribute has to be anchored in the namespace specified, or has no namespace and the element is in that namespace. This does the entity substitution. This function looks in DTD attribute declaration for #FIXED or default declaration values unless DTD use has been turned off. + + + + + + + + Get xslDebugStatus. + + + + Get the default security preference application-wide + + + + Retrieve the data associated to the extension module in this given transformation. + + + + + + looks up URI in extInfos of the stylesheet + + + + + + Looks up a key of the in current source doc (the document info on @ctxt->document). Computes the key if not already done for the current source doc. + + + + + + + + Find a matching (prefix and ns-name) ns-declaration for the requested @ns->prefix and @ns->href in the result tree. If none is found then a new ns-declaration will be added to @resultElem. If, in this case, the given prefix is already in use, then a ns-declaration with a modified ns-prefix be we created. Called by: - xsltCopyPropList() (*not* anymore) - xsltShallowCopyElement() - xsltCopyTreeInternal() (*not* anymore) - xsltApplySequenceConstructor() (*not* in the refactored code), - xsltElement() (*not* anymore) + + + + + + + + Similar to xmlGetNsProp() but with a slightly different semantic Search and get the value of an attribute associated to a node This attribute has to be anchored in the namespace specified, or has no namespace and the element is in that namespace. This does the entity substitution. This function looks in DTD attribute declaration for #FIXED or default declaration values unless DTD use has been turned off. + + + + + + + Obsolete. *Not* called by any Libxslt/Libexslt function. Exaclty the same as xsltGetNamespace(). + + + + + + + + This function should be called after the transformation completed to extract template processing profiling informations if availble. The informations are returned as an XML document tree like <?xml version="1.0"?> <profile> <template rank="1" match="*" name="" mode="" calls="6" time="48" average="8"/> <template rank="2" match="item2|item3" name="" mode="" calls="10" time="30" average="3"/> <template rank="3" match="item1" name="" mode="" calls="5" time="17" average="3"/> </profile> The caller will need to free up the returned tree with xmlFreeDoc() + + + + + This function analyzes @name, if the name contains a prefix, the function seaches the associated namespace in scope for it. It will also replace @name value with the NCName, the old value being freed. Errors in the prefix lookup are signalled by setting @name to NULL. NOTE: the namespace returned is a pointer to the place where it is defined and hence has the same lifespan as the document holding it. + + + + + + This function is similar to xsltGetQNameURI, but is used when @name is a dictionary entry. + + + + + + + Lookup the security option to get the callback checking function + + + + + + Find a matching (prefix and ns-name) ns-declaration for the requested @nsName and @nsPrefix in the result tree. If none is found then a new ns-declaration will be added to @resultElem. If, in this case, the given prefix is already in use, then a ns-declaration with a modified ns-prefix be we created. Note that this function's priority is to preserve ns-prefixes; it will only change a prefix if there's a namespace clash. If both @nsName and @nsPrefix are NULL, then this will try to "undeclare" a default namespace by declaring an xmlns="". + + + + + + + + + Finds the template applying to this node, if @style is non-NULL it means one needs to look for the next imported template in scope. + + + + + + + Read one UTF8 Char from @utf Function copied from libxml2 xmlGetUTF8Char() ... to discard ultimately and use the original API + + + + + + Provides the default state for XInclude processing + + + + + + + + + + + + Processes the xsl:if instruction on the source node. + + + + + + + + Initializes the processor (e.g. registers built-in extensions, etc.) + + + + INTERNAL ROUTINE ONLY Check if any keys on the current document need to be computed + + + + + Initialize the set of modules with registered stylesheet data + + + + + Computes the key tables this key and for the current input document. + + + + + + + Computes all the keys tables for the current input document. Should be done before global varibales are initialized. NOTE: Not used anymore in the refactored code. + + + + + + Initializes an existing #xsltElemPreComp structure. This is usefull when extending an #xsltElemPreComp to store precomputed data. This function MUST be called on any extension element precomputed data struct. + + + + + + + + + Initialize the global variables for extensions + + + + Check if a string is ignorable + + + + + Implement the key() XSLT function node-set key(string, object) + + + + + + Try to load a document (not a stylesheet) within the XSLT transformation context + + + + + + Try to load a stylesheet document within the XSLT transformation context + + + + + + This function tries to locate the stylesheet PI in the given document If found, and if contained within the document, it will extract that subtree to build the stylesheet to process @doc (doc itself will be modified). If found but referencing an external document it will attempt to load it and generate a stylesheet from it. In both cases, the resulting stylesheet and the document need to be freed once the transformation is done. + + + + + Pops all variable values at the given @depth from the stack. + + + + + + + Places the variable onto the local variable stack + + + + + + + Compares two strings transformed with xsltStrxfrm + + + + + + + + + + + + + + + + Process and xsl:message construct + + + + + + + Read the stylesheet-prefix and result-prefix attributes, register them as well as the corresponding namespace. + + + + + + Checks whether that stylesheet requires white-space stripping + + + + + Register a new document, apply key computations + + + + + + Creates and initializes an #xsltElemPreComp + + + + + + + Creates a new locale of an opaque system dependent type based on the language tag. + + + + + Create a new security preference block + + + + Register a new document, apply key computations + + + + + + Create a new XSLT Stylesheet + + + + Create a new XSLT TransformContext + + + + + + Find the next stylesheet in import precedence. + + + + + This is a hashtable scanner function to normalize the compiled steps of an imported stylesheet. + + + + + + + Process the xslt number node on the source node + + + + + + + + Convert one number. + + + + + + + Parses, validates the content models and compiles XSLT instructions. + + + + + + parse an XSLT transformation param declaration and record its value. + + + + + + Parses a global XSLT 'variable' declaration at compilation time and registers it + + + + + + Parses a "template" content (or "sequence constructor" in XSLT 2.0 terms). This will additionally remove xsl:text elements from the tree. + + + + + + parse an XSLT stylesheet attribute-set element + + + + + + Processes an xsl:with-param instruction at transformation time. The value is compute, but not recorded. NOTE that this is also called with an *xsl:param* element from exsltFuncFunctionFunction(). + + + + + + parse an XSLT stylesheet, building the associated structures. doc is kept as a reference within the returned stylesheet, so changes to doc after the parsing will be reflected when the stylesheet is applied, and the doc is automatically freed when the stylesheet is closed. + + + + + Load and parse an XSLT stylesheet + + + + + parse an XSLT stylesheet import element + + + + + + parse an XSLT stylesheet building the associated structures except the processing not needed for imported documents. + + + + + + parse an XSLT stylesheet include element + + + + + + parse an XSLT stylesheet output element and record information related to the stylesheet output + + + + + + Registers a local XSLT 'param' declaration at transformation time and evaluates its value. + + + + + + Parses an XSLT stylesheet, adding the associated structures. Called by: xsltParseStylesheetImportedDoc() (xslt.c) xsltParseStylesheetInclude() (imports.c) + + + + + + Registers a local XSLT 'variable' instruction at transformation time and evaluates its value. + + + + + + parse a template content-model Clean-up the template content from unwanted ignorable blank nodes and process xslt:text + + + + + + Adds an item to the list. + + + + + + + Resets the list, but does not free the allocated array and does not free the content of the list. + + + + + Creates an xsltPointerList structure. + + + + + Frees the xsltPointerList structure. This does not free the content of the list. + + + + + Precomputes an extension module element + + + + + + + + + + + + + Display the context of an error. + + + + + + + Process the source node. + + + + + + + Process the xslt processing-instruction node on the source node + + + + + + + + Apply the stylesheet to the document and dump the profiling to the given output. + + + + + + + + This is normally called from xsltQuoteUserParams to process a single parameter from a list of parameters. The @value is stored in the context's global variable/parameter hash table. + + + + + + + Similar to xsltEvalUserParams, but the values are treated literally and are * *not* evaluated as XPath expressions. This should be done on parsed stylesheets before starting to apply transformations. + + + + + + Registers all default XSLT elements in this context + + + + + Registers the built-in extensions + + + + Registers all default XSLT functions in this context + + + + + Registers an extension element + + + + + + + + Registers an extension function + + + + + + + + Register an XSLT extension module to the library. + + + + + + + Registers an extension module element. + + + + + + + + Register an XSLT extension module to the library. + + + + + + + + + Registers an extension module function. + + + + + + + Registers an extension module top-level element. + + + + + + + Registers an extension namespace This is called from xslt.c during compile-time. The given prefix is not needed. Called by: xsltParseExtElemPrefixes() (new function) xsltRegisterExtPrefix() (old function) + + + + + + + Registers the built-in extensions. This function is deprecated, use xsltRegisterAllExtras instead. + + + + + Registers a result value tree (XSLT 1.0 term: Result Tree Fragment) in the RVT garbage collector. The fragment will be freed when the instruction which created the fragment exits. + + + + + + Register the result value tree (XSLT 1.0 term: Result Tree Fragment) in the fragment garbage collector. The fragment will be freed when the transformation context is freed. + + + + + + Registers the test module + + + + Registers the result value tree (XSLT 1.0 term: Result Tree Fragment) in the garbage collector. The fragment will be freed at the exit of the currently instantiated xsl:template. Obsolete; this function might produce massive memory overhead, since the fragment is only freed when the current xsl:template exits. Use xsltRegisterLocalRVT() instead. + + + + + + Either frees the RVT (which is an xmlDoc) or stores it in the context's cache for later reuse. + + + + + + resolve the references between attribute sets. + + + + + Restore the namespaces for the document + + + + + + Apply the stylesheet to the document and generate the output according to @output @SAX and @IObuf. It's an error to specify both @SAX and @IObuf. NOTE: This may lead to a non-wellformed output XML wise ! NOTE: This may also result in multiple files being generated NOTE: using IObuf, the result encoding used will be the one used for creating the output buffer, use the following macro to read it from the stylesheet XSLT_GET_IMPORT_PTR(encoding, style, encoding) NOTE: using SAX, any encoding specified in the stylesheet will be lost since the interface uses only UTF8 + + + + + + + + + + Apply the stylesheet to the document and generate the output according to @output @SAX and @IObuf. It's an error to specify both @SAX and @IObuf. NOTE: This may lead to a non-wellformed output XML wise ! NOTE: This may also result in multiple files being generated NOTE: using IObuf, the result encoding used will be the one used for creating the output buffer, use the following macro to read it from the stylesheet XSLT_GET_IMPORT_PTR(encoding, style, encoding) NOTE: using SAX, any encoding specified in the stylesheet will be lost since the interface uses only UTF8 + + + + + + + + + + + + Save the profiling informations on @output + + + + + + Save the result @result obtained by applying the @style stylesheet to an I/O output channel @buf + + + + + + + Save the result @result obtained by applying the @style stylesheet to an open file descriptor This does not close the descriptor. + + + + + + + Save the result @result obtained by applying the @style stylesheet to an open FILE * I/O. This does not close the FILE @file + + + + + + + Save the result @result obtained by applying the @style stylesheet to a file or @URL + + + + + + + + Save the result @result obtained by applying the @style stylesheet to a new allocated string. + + + + + + + + Function used to always allow an operation + + + + + + + User provided function to check the value of a string like a file path or an URL ... + + + + + + + Function used to always forbid an operation + + + + + + + Change the default parser option passed by the XSLT engine to the parser when using document() loading. + + + + + + Set the security preference for a specific transformation + + + + + + Function to set the handler for XSLT sorting for the specified context. If the handler is NULL, then the global sort function will be called + + + + + + This function allow to plug a debugger into the XSLT library @block points to a block of memory containing the address of @no callback routines. + + + + + + This function sets the value of xslDebugStatus. + + + + + Set the default security preference application-wide + + + + + Function to reset the handler and the error context for out of context error messages. This simply means that @handler will be called for subsequent error messages while not parsing or validating. And @ctx will be passed as first argument to @handler One can simply force messages to be emitted to another FILE * than stderr by setting @ctx to this file handle and @handler to NULL. + + + + + + Function to reset the handler and the error context for out of context error messages. This simply means that @handler will be called for subsequent error messages while not parsing nor validating. And @ctx will be passed as first argument to @handler One can simply force messages to be emitted to another FILE * than stderr by setting @ctx to this file handle and @handler to NULL. + + + + + + Set the new function to load document, if NULL it resets it to the default function. + + + + + Update the security option to use the new callback checking function + + + + + + + Function to reset the global handler for XSLT sorting. If the handler is NULL, the default sort function will be used. + + + + + Function to reset the handler and the error context for out of context error messages specific to a given XSLT transromation. This simply means that @handler will be called for subsequent error messages while running the transformation. + + + + + + + Set whether XInclude should be processed on document being loaded by default + + + + + Shutdown the set of modules loaded + + + + + Shutdown the set of modules loaded + + + + + function attached to xsl:sort nodes, but this should not be called directly + + + + + + + + Signature of the function to use during sorting + + + + + + + Split QNames into prefix and local names, both allocated from a dictionary. + + + + + + + Transforms a string according to locale. The transformed string must then be compared with xsltLocaleStrcmp and freed with xmlFree. + + + + + + A function called at initialization time of an XSLT extension module. + + + + + + A function called at shutdown time of an XSLT extension module. + + + + + + + Retrieve the data associated to the extension module in this given stylesheet. Called by: xsltRegisterExtPrefix(), ( xsltExtElementPreCompTest(), xsltExtInitTest ) + + + + + + Precompute an XSLT stylesheet element + + + + + + Retrieve the data associated to the extension module in this given stylesheet. + + + + + + Implement the system-property() XSLT function object system-property(string) + + + + + + Obsolete. Don't use it. + + + + + + Test whether the node matches one of the patterns in the list + + + + + + + Process the xslt text node on the source node + + + + + + + + Used for gathering profiling data + + + + + + + + + + Display and format an error messages, gives file, line, position and extra parameters, will use the specific transformation context if available + + + + + + + + + Signature of the function associated to elements part of the stylesheet language like xsl:if or xsl:apply-templates. + + + + + + + + Uninitializes the processor. + + + + Implement the unparsed-entity-uri() XSLT function string unparsed-entity-uri(string) + + + + + + Unregister an XSLT extension module from the library. + + + + + Unregisters an extension module element + + + + + + Unregisters an extension module function + + + + + + Unregisters an extension module top-level element + + + + + + Process the xslt value-of node on the source node + + + + + + + + Search in the Variable array of the context for the given variable value. + + + + + + + Compile an XPath expression + + + + + + Compile an XPath expression + + + + + + + This is the entry point when a function is needed by the XPath interpretor. + + + + + + + Provides the XSLT transformation context from the XPath transformation context. This is useful when an XPath function in the extension module is called by the XPath interpreter and that the XSLT context is needed for example to retrieve the associated data pertaining to this XSLT transformation. + + + + + This is the entry point when a varibale is needed by the XPath interpretor. + + + + + + + diff --git a/doc/libxslt-decl.txt b/doc/libxslt-decl.txt new file mode 100644 index 0000000..423230e --- /dev/null +++ b/doc/libxslt-decl.txt @@ -0,0 +1,1449 @@ + +LIBXSLT_DOTTED_VERSION +#define LIBXSLT_DOTTED_VERSION "1.1.0" + + +LIBXSLT_VERSION +#define LIBXSLT_VERSION 10100 + + +LIBXSLT_VERSION_STRING +#define LIBXSLT_VERSION_STRING "10100" + + +WITH_XSLT_DEBUG +#define WITH_XSLT_DEBUG + + +DEBUG_MEMORY +#define DEBUG_MEMORY + + +DEBUG_MEMORY_LOCATION +#define DEBUG_MEMORY_LOCATION + + +XSLT_NEED_TRIO +#define XSLT_NEED_TRIO + + +XSLT_NEED_TRIO +#define XSLT_NEED_TRIO + + +WITH_DEBUGGER +#define WITH_DEBUGGER + + +ATTRIBUTE_UNUSED +#define ATTRIBUTE_UNUSED __attribute__((unused)) + + +ATTRIBUTE_UNUSED +#define ATTRIBUTE_UNUSED + + +LIBXSLT_PUBLIC +#define LIBXSLT_PUBLIC __declspec(dllimport) + + +LIBXSLT_PUBLIC +#define LIBXSLT_PUBLIC + + +XSLT_LIBXSLT_NAMESPACE +#define XSLT_LIBXSLT_NAMESPACE ((xmlChar *) "http://xmlsoft.org/XSLT/namespace") + + +XSLT_SAXON_NAMESPACE +#define XSLT_SAXON_NAMESPACE ((xmlChar *) "http://icl.com/saxon") + + +XSLT_XT_NAMESPACE +#define XSLT_XT_NAMESPACE ((xmlChar *) "http://www.jclark.com/xt") + + +XSLT_XALAN_NAMESPACE +#define XSLT_XALAN_NAMESPACE ((xmlChar *) \ + "org.apache.xalan.xslt.extensions.Redirect") + + +XSLT_NORM_SAXON_NAMESPACE +#define XSLT_NORM_SAXON_NAMESPACE ((xmlChar *) \ + "http://nwalsh.com/xslt/ext/com.nwalsh.saxon.CVS") + + +xsltStyleExtInitFunction +void * +xsltStylesheetPtr style, + const xmlChar *URI + + +xsltStyleExtShutdownFunction +void +xsltStylesheetPtr style, + const xmlChar *URI, + void *data + + +xsltExtInitFunction +void * +xsltTransformContextPtr ctxt, + const xmlChar *URI + + +xsltExtShutdownFunction +void +xsltTransformContextPtr ctxt, + const xmlChar *URI, + void *data + + +xsltTopLevelFunction +void +xsltStylesheetPtr style, + xmlNodePtr inst + + +XSLT_REGISTER_FUNCTION_LOOKUP +#define XSLT_REGISTER_FUNCTION_LOOKUP(ctxt) \ + xmlXPathRegisterFuncLookup((ctxt)->xpathCtxt, \ + (xmlXPathFuncLookupFunc) xsltXPathFunctionLookup, \ + (void *)(ctxt->xpathCtxt)); + + +XSLT_GET_IMPORT_PTR +#define XSLT_GET_IMPORT_PTR(res, style, name) { \ + xsltStylesheetPtr st = style; \ + res = NULL; \ + while (st != NULL) { \ + if (st->name != NULL) { res = st->name; break; } \ + st = xsltNextImport(st); \ + }} + + +XSLT_GET_IMPORT_INT +#define XSLT_GET_IMPORT_INT(res, style, name) { \ + xsltStylesheetPtr st = style; \ + res = -1; \ + while (st != NULL) { \ + if (st->name != -1) { res = st->name; break; } \ + st = xsltNextImport(st); \ + }} + + +LIBXSLT_PUBLIC +#define LIBXSLT_PUBLIC __declspec(dllimport) + + +LIBXSLT_PUBLIC +#define LIBXSLT_PUBLIC + + +xsltNumberData + + +xsltNumberDataPtr +typedef xsltNumberData *xsltNumberDataPtr; + + +xsltNumberData +struct xsltNumberData { + xmlChar *level; + xmlChar *count; + xmlChar *from; + xmlChar *value; + xmlChar *format; + int has_format; + int digitsPerGroup; + int groupingCharacter; + int groupingCharacterLen; + xmlDocPtr doc; + xmlNodePtr node; + + /* + * accelerators + */ +}; + + +xsltFormatNumberInfo + + +xsltFormatNumberInfoPtr +typedef xsltFormatNumberInfo *xsltFormatNumberInfoPtr; + + +xsltFormatNumberInfo +struct xsltFormatNumberInfo { + int integer_hash; /* Number of '#' in integer part */ + int integer_digits; /* Number of '0' in integer part */ + int frac_digits; /* Number of '0' in fractional part */ + int frac_hash; /* Number of '#' in fractional part */ + int group; /* Number of chars per display 'group' */ + int multiplier; /* Scaling for percent or permille */ + char add_decimal; /* Flag for whether decimal point appears in pattern */ + char is_multiplier_set; /* Flag to catch multiple occurences of percent/permille */ + char is_negative_pattern;/* Flag for processing -ve prefix/suffix */ +}; + + +xsltCompMatch + + +xsltCompMatchPtr +typedef xsltCompMatch *xsltCompMatchPtr; + + +xsltMatchPattern +int +xsltTransformContextPtr ctxt,xmlNodePtr node,const xmlChar *pattern,xmlDocPtr ctxtdoc,xmlNodePtr ctxtnode + + +xsltExtMarker +extern const xmlChar *xsltExtMarker; + + +XSLT_REGISTER_VARIABLE_LOOKUP +#define XSLT_REGISTER_VARIABLE_LOOKUP(ctxt) \ + xmlXPathRegisterVariableLookup((ctxt)->xpathCtxt, \ + xsltXPathVariableLookup, (void *)(ctxt)); \ + xsltRegisterAllFunctions((ctxt)->xpathCtxt); \ + xsltRegisterAllElement(ctxt); \ + (ctxt)->xpathCtxt->extra = ctxt + + +XSLT_DEFAULT_VERSION +#define XSLT_DEFAULT_VERSION "1.0" + + +XSLT_DEFAULT_VENDOR +#define XSLT_DEFAULT_VENDOR "libxslt" + + +XSLT_DEFAULT_URL +#define XSLT_DEFAULT_URL "http://xmlsoft.org/XSLT/" + + +XSLT_NAMESPACE +#define XSLT_NAMESPACE ((xmlChar *) "http://www.w3.org/1999/XSL/Transform") + + +XSLT_PARSE_OPTIONS +#define XSLT_PARSE_OPTIONS \ + XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_NOCDATA + + +xsltMaxDepth +extern int xsltMaxDepth; + + +xsltMaxVars +extern int xsltMaxVars; + + +xsltEngineVersion +extern const char *xsltEngineVersion; + + +xsltLibxsltVersion +extern const int xsltLibxsltVersion; + + +xsltLibxmlVersion +extern const int xsltLibxmlVersion; + + +XSLT_TODO +#define XSLT_TODO \ + xsltGenericError(xsltGenericErrorContext, \ + "Unimplemented block at %s:%d\n", \ + __FILE__, __LINE__); + + +XSLT_STRANGE +#define XSLT_STRANGE \ + xsltGenericError(xsltGenericErrorContext, \ + "Internal error at %s:%d\n", \ + __FILE__, __LINE__); + + +IS_XSLT_ELEM +#define IS_XSLT_ELEM(n) \ + (((n) != NULL) && ((n)->ns != NULL) && \ + (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE))) + + +IS_XSLT_NAME +#define IS_XSLT_NAME(n, val) \ + (xmlStrEqual((n)->name, (const xmlChar *) (val))) + + +IS_XSLT_REAL_NODE +#define IS_XSLT_REAL_NODE(n) \ + (((n) != NULL) && \ + (((n)->type == XML_ELEMENT_NODE) || \ + ((n)->type == XML_TEXT_NODE) || \ + ((n)->type == XML_ATTRIBUTE_NODE) || \ + ((n)->type == XML_DOCUMENT_NODE) || \ + ((n)->type == XML_HTML_DOCUMENT_NODE) || \ + ((n)->type == XML_PI_NODE))) + + +xsltDebugTraceCodes +typedef enum { + XSLT_TRACE_ALL = -1, + XSLT_TRACE_NONE = 0, + XSLT_TRACE_COPY_TEXT = 1<<0, + XSLT_TRACE_PROCESS_NODE = 1<<1, + XSLT_TRACE_APPLY_TEMPLATE = 1<<2, + XSLT_TRACE_COPY = 1<<3, + XSLT_TRACE_COMMENT = 1<<4, + XSLT_TRACE_PI = 1<<5, + XSLT_TRACE_COPY_OF = 1<<6, + XSLT_TRACE_VALUE_OF = 1<<7, + XSLT_TRACE_CALL_TEMPLATE = 1<<8, + XSLT_TRACE_APPLY_TEMPLATES = 1<<9, + XSLT_TRACE_CHOOSE = 1<<10, + XSLT_TRACE_IF = 1<<11, + XSLT_TRACE_FOR_EACH = 1<<12, + XSLT_TRACE_STRIP_SPACES = 1<<13, + XSLT_TRACE_TEMPLATES = 1<<14, + XSLT_TRACE_KEYS = 1<<15, + XSLT_TRACE_VARIABLES = 1<<16 +} xsltDebugTraceCodes; + + +XSLT_TRACE +#define XSLT_TRACE(ctxt,code,call) \ + if (ctxt->traceCode && (*(ctxt->traceCode) & code)) \ + call + + +xsltGenericError +extern xmlGenericErrorFunc xsltGenericError; + + +xsltGenericErrorContext +extern void *xsltGenericErrorContext; + + +xsltGenericDebug +extern xmlGenericErrorFunc xsltGenericDebug; + + +xsltGenericDebugContext +extern void *xsltGenericDebugContext; + + +XSLT_TIMESTAMP_TICS_PER_SEC +#define XSLT_TIMESTAMP_TICS_PER_SEC 100000l + + +xsltDebugStatusCodes +typedef enum { + XSLT_DEBUG_NONE = 0, /* no debugging allowed */ + XSLT_DEBUG_INIT, + XSLT_DEBUG_STEP, + XSLT_DEBUG_STEPOUT, + XSLT_DEBUG_NEXT, + XSLT_DEBUG_STOP, + XSLT_DEBUG_CONT, + XSLT_DEBUG_RUN, + XSLT_DEBUG_RUN_RESTART, + XSLT_DEBUG_QUIT +} xsltDebugStatusCodes; + + +xslDebugStatus +extern int xslDebugStatus; + + +xsltHandleDebuggerCallback +void +xmlNodePtr cur, xmlNodePtr node, + xsltTemplatePtr templ, xsltTransformContextPtr ctxt + + +xsltAddCallCallback +int +xsltTemplatePtr templ, xmlNodePtr source + + +xsltDropCallCallback +void +void + + +LIBXSLT_DOTTED_VERSION +#define LIBXSLT_DOTTED_VERSION "1.1.0" + + +LIBXSLT_VERSION +#define LIBXSLT_VERSION 10100 + + +LIBXSLT_VERSION_STRING +#define LIBXSLT_VERSION_STRING "10100" + + +WITH_XSLT_DEBUG +#define WITH_XSLT_DEBUG + + +DEBUG_MEMORY +#define DEBUG_MEMORY + + +DEBUG_MEMORY_LOCATION +#define DEBUG_MEMORY_LOCATION + + +ATTRIBUTE_UNUSED +#define ATTRIBUTE_UNUSED + + +TRIO_ERROR_CODE +#define TRIO_ERROR_CODE(x) ((-(x)) & 0x00FF) + + +TRIO_ERROR_POSITION +#define TRIO_ERROR_POSITION(x) ((-(x)) >> 8) + + +TRIO_ERROR_NAME +#define TRIO_ERROR_NAME(x) trio_strerror(x) + + +int)) +typedef int (*trio_outstream_t) TRIO_PROTO((trio_pointer_t, int)); + + +TRIO_PROTO((trio_pointer_t)) +typedef int (*trio_instream_t) TRIO_PROTO((trio_pointer_t)); + + +printf +# define printf trio_printf + + +vprintf +# define vprintf trio_vprintf + + +fprintf +# define fprintf trio_fprintf + + +vfprintf +# define vfprintf trio_vfprintf + + +sprintf +# define sprintf trio_sprintf + + +vsprintf +# define vsprintf trio_vsprintf + + +snprintf +# define snprintf trio_snprintf + + +vsnprintf +# define vsnprintf trio_vsnprintf + + +scanf +# define scanf trio_scanf + + +vscanf +# define vscanf trio_vscanf + + +fscanf +# define fscanf trio_fscanf + + +vfscanf +# define vfscanf trio_vfscanf + + +sscanf +# define sscanf trio_sscanf + + +vsscanf +# define vsscanf trio_vsscanf + + +dprintf +#define dprintf trio_dprintf + + +vdprintf +#define vdprintf trio_vdprintf + + +aprintf +#define aprintf trio_aprintf + + +vaprintf +#define vaprintf trio_vaprintf + + +asprintf +#define asprintf trio_asprintf + + +vasprintf +#define vasprintf trio_vasprintf + + +dscanf +#define dscanf trio_dscanf + + +vdscanf +#define vdscanf trio_vdscanf + + +XSLT_MAX_SORT +#define XSLT_MAX_SORT 15 + + +XSLT_PAT_NO_PRIORITY +#define XSLT_PAT_NO_PRIORITY -12345789 + + +xsltRuntimeExtra + + +xsltRuntimeExtraPtr +typedef xsltRuntimeExtra *xsltRuntimeExtraPtr; + + +xsltRuntimeExtra +struct xsltRuntimeExtra { + void *info; /* pointer to the extra data */ + xmlFreeFunc deallocate; /* pointer to the deallocation routine */ + void *val; /* data not needing deallocation */ +}; + + +XSLT_RUNTIME_EXTRA_LST +#define XSLT_RUNTIME_EXTRA_LST(ctxt, nr) (ctxt)->extras[(nr)].info + + +XSLT_RUNTIME_EXTRA_FREE +#define XSLT_RUNTIME_EXTRA_FREE(ctxt, nr) (ctxt)->extras[(nr)].deallocate + + +XSLT_RUNTIME_EXTRA +#define XSLT_RUNTIME_EXTRA(ctxt, nr) (ctxt)->extras[(nr)].val + + +xsltTemplate + + +xsltTemplatePtr +typedef xsltTemplate *xsltTemplatePtr; + + +xsltTemplate +struct xsltTemplate { + struct _xsltTemplate *next;/* chained list sorted by priority */ + struct _xsltStylesheet *style;/* the containing stylesheet */ + xmlChar *match; /* the matching string */ + float priority; /* as given from the stylesheet, not computed */ + xmlChar *name; /* the local part of the name QName */ + xmlChar *nameURI; /* the URI part of the name QName */ + xmlChar *mode; /* the local part of the mode QName */ + xmlChar *modeURI; /* the URI part of the mode QName */ + xmlNodePtr content; /* the template replacement value */ + xmlNodePtr elem; /* the source element */ + + int inheritedNsNr; /* number of inherited namespaces */ + xmlNsPtr *inheritedNs;/* inherited non-excluded namespaces */ + + /* Profiling informations */ + int nbCalls; /* the number of time the template was called */ + unsigned long time; /* the time spent in this template */ +}; + + +xsltDecimalFormat + + +xsltDecimalFormatPtr +typedef xsltDecimalFormat *xsltDecimalFormatPtr; + + +xsltDecimalFormat +struct xsltDecimalFormat { + struct _xsltDecimalFormat *next; /* chained list */ + xmlChar *name; + /* Used for interpretation of pattern */ + xmlChar *digit; + xmlChar *patternSeparator; + /* May appear in result */ + xmlChar *minusSign; + xmlChar *infinity; + xmlChar *noNumber; /* Not-a-number */ + /* Used for interpretation of pattern and may appear in result */ + xmlChar *decimalPoint; + xmlChar *grouping; + xmlChar *percent; + xmlChar *permille; + xmlChar *zeroDigit; +}; + + +xsltDocument + + +xsltDocumentPtr +typedef xsltDocument *xsltDocumentPtr; + + +xsltDocument +struct xsltDocument { + struct _xsltDocument *next; /* documents are kept in a chained list */ + int main; /* is this the main document */ + xmlDocPtr doc; /* the parsed document */ + void *keys; /* key tables storage */ + struct _xsltDocument *includes; /* subsidiary includes */ +}; + + +xsltTransformContext + + +xsltTransformContextPtr +typedef xsltTransformContext *xsltTransformContextPtr; + + +xsltElemPreComp + + +xsltElemPreCompPtr +typedef xsltElemPreComp *xsltElemPreCompPtr; + + +xsltTransformFunction +void +xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltElemPreCompPtr comp + + +xsltSortFunc +void +xsltTransformContextPtr ctxt, xmlNodePtr *sorts, + int nbsorts + + +xsltStyleType +typedef enum { + XSLT_FUNC_COPY=1, + XSLT_FUNC_SORT, + XSLT_FUNC_TEXT, + XSLT_FUNC_ELEMENT, + XSLT_FUNC_ATTRIBUTE, + XSLT_FUNC_COMMENT, + XSLT_FUNC_PI, + XSLT_FUNC_COPYOF, + XSLT_FUNC_VALUEOF, + XSLT_FUNC_NUMBER, + XSLT_FUNC_APPLYIMPORTS, + XSLT_FUNC_CALLTEMPLATE, + XSLT_FUNC_APPLYTEMPLATES, + XSLT_FUNC_CHOOSE, + XSLT_FUNC_IF, + XSLT_FUNC_FOREACH, + XSLT_FUNC_DOCUMENT, + XSLT_FUNC_WITHPARAM, + XSLT_FUNC_PARAM, + XSLT_FUNC_VARIABLE, + XSLT_FUNC_WHEN, + XSLT_FUNC_EXTENSION +} xsltStyleType; + + +xsltElemPreCompDeallocator +void +xsltElemPreCompPtr comp + + +xsltElemPreComp +struct xsltElemPreComp { + xsltElemPreCompPtr next; /* chained list */ + xsltStyleType type; /* type of the element */ + xsltTransformFunction func; /* handling function */ + xmlNodePtr inst; /* the instruction */ + + /* end of common part */ + xsltElemPreCompDeallocator free; /* the deallocator */ +}; + + +xsltStylePreComp + + +xsltStylePreCompPtr +typedef xsltStylePreComp *xsltStylePreCompPtr; + + +xsltStylePreComp +struct xsltStylePreComp { + xsltElemPreCompPtr next; /* chained list */ + xsltStyleType type; /* type of the element */ + xsltTransformFunction func; /* handling function */ + xmlNodePtr inst; /* the instruction */ + + /* + * Pre computed values. + */ + + xmlChar *stype; /* sort */ + int has_stype; /* sort */ + int number; /* sort */ + xmlChar *order; /* sort */ + int has_order; /* sort */ + int descending; /* sort */ + xmlChar *lang; /* sort */ + int has_lang; /* sort */ + xmlChar *case_order; /* sort */ + int lower_first; /* sort */ + + xmlChar *use; /* copy, element */ + int has_use; /* copy, element */ + + int noescape; /* text */ + + xmlChar *name; /* element, attribute, pi */ + int has_name; /* element, attribute, pi */ + xmlChar *ns; /* element */ + int has_ns; /* element */ + + xmlChar *mode; /* apply-templates */ + xmlChar *modeURI; /* apply-templates */ + + xmlChar *test; /* if */ + + xsltTemplatePtr templ; /* call-template */ + + xmlChar *select; /* sort, copy-of, value-of, apply-templates */ + + int ver11; /* document */ + xmlChar *filename; /* document URL */ + int has_filename; /* document */ + + xsltNumberData numdata; /* number */ + + xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ + xmlNsPtr *nsList; /* the namespaces in scope */ + int nsNr; /* the number of namespaces in scope */ +}; + + +xsltStackElem + + +xsltStackElemPtr +typedef xsltStackElem *xsltStackElemPtr; + + +xsltStackElem +struct xsltStackElem { + struct _xsltStackElem *next;/* chained list */ + xsltStylePreCompPtr comp; /* the compiled form */ + int computed; /* was the evaluation done */ + xmlChar *name; /* the local part of the name QName */ + xmlChar *nameURI; /* the URI part of the name QName */ + xmlChar *select; /* the eval string */ + xmlNodePtr tree; /* the tree if no eval string or the location */ + xmlXPathObjectPtr value; /* The value if computed */ +}; + + +xsltStylesheet + + +xsltStylesheetPtr +typedef xsltStylesheet *xsltStylesheetPtr; + + +xsltStylesheet +struct xsltStylesheet { + /* + * The stylesheet import relation is kept as a tree. + */ + struct _xsltStylesheet *parent; + struct _xsltStylesheet *next; + struct _xsltStylesheet *imports; + + xsltDocumentPtr docList; /* the include document list */ + + /* + * General data on the style sheet document. + */ + xmlDocPtr doc; /* the parsed XML stylesheet */ + xmlHashTablePtr stripSpaces;/* the hash table of the strip-space and + preserve space elements */ + int stripAll; /* strip-space * (1) preserve-space * (-1) */ + xmlHashTablePtr cdataSection;/* the hash table of the cdata-section */ + + /* + * Global variable or parameters. + */ + xsltStackElemPtr variables; /* linked list of param and variables */ + + /* + * Template descriptions. + */ + xsltTemplatePtr templates; /* the ordered list of templates */ + void *templatesHash; /* hash table or wherever compiled templates + informations are stored */ + void *rootMatch; /* template based on / */ + void *keyMatch; /* template based on key() */ + void *elemMatch; /* template based on * */ + void *attrMatch; /* template based on @* */ + void *parentMatch; /* template based on .. */ + void *textMatch; /* template based on text() */ + void *piMatch; /* template based on processing-instruction() */ + void *commentMatch; /* template based on comment() */ + + /* + * Namespace aliases. + */ + xmlHashTablePtr nsAliases; /* the namespace alias hash tables */ + + /* + * Attribute sets. + */ + xmlHashTablePtr attributeSets;/* the attribute sets hash tables */ + + /* + * Namespaces. + */ + xmlHashTablePtr nsHash; /* the set of namespaces in use */ + void *nsDefs; /* the namespaces defined */ + + /* + * Key definitions. + */ + void *keys; /* key definitions */ + + /* + * Output related stuff. + */ + xmlChar *method; /* the output method */ + xmlChar *methodURI; /* associated namespace if any */ + xmlChar *version; /* version string */ + xmlChar *encoding; /* encoding string */ + int omitXmlDeclaration; /* omit-xml-declaration = "yes" | "no" */ + + /* + * Number formatting. + */ + xsltDecimalFormatPtr decimalFormat; + int standalone; /* standalone = "yes" | "no" */ + xmlChar *doctypePublic; /* doctype-public string */ + xmlChar *doctypeSystem; /* doctype-system string */ + int indent; /* should output being indented */ + xmlChar *mediaType; /* media-type string */ + + /* + * Precomputed blocks. + */ + xsltElemPreCompPtr preComps;/* list of precomputed blocks */ + int warnings; /* number of warnings found at compilation */ + int errors; /* number of errors found at compilation */ + + xmlChar *exclPrefix; /* last excluded prefixes */ + xmlChar **exclPrefixTab; /* array of excluded prefixes */ + int exclPrefixNr; /* number of excluded prefixes in scope */ + int exclPrefixMax; /* size of the array */ + + void *_private; /* user defined data */ + + /* + * Extensions. + */ + xmlHashTablePtr extInfos; /* the extension data */ + int extrasNr; /* the number of extras required */ + + /* + * For keeping track of nested includes + */ + xsltDocumentPtr includes; /* points to last nested include */ +}; + + +xsltOutputType +typedef enum { + XSLT_OUTPUT_XML = 0, + XSLT_OUTPUT_HTML, + XSLT_OUTPUT_TEXT +} xsltOutputType; + + +xsltTransformState +typedef enum { + XSLT_STATE_OK = 0, + XSLT_STATE_ERROR, + XSLT_STATE_STOPPED +} xsltTransformState; + + +xsltTransformContext +struct xsltTransformContext { + xsltStylesheetPtr style; /* the stylesheet used */ + xsltOutputType type; /* the type of output */ + + xsltTemplatePtr templ; /* the current template */ + int templNr; /* Nb of templates in the stack */ + int templMax; /* Size of the templtes stack */ + xsltTemplatePtr *templTab; /* the template stack */ + + xsltStackElemPtr vars; /* the current variable list */ + int varsNr; /* Nb of variable list in the stack */ + int varsMax; /* Size of the variable list stack */ + xsltStackElemPtr *varsTab; /* the variable list stack */ + int varsBase; /* the var base for current templ */ + + /* + * Extensions + */ + xmlHashTablePtr extFunctions; /* the extension functions */ + xmlHashTablePtr extElements; /* the extension elements */ + xmlHashTablePtr extInfos; /* the extension data */ + + const xmlChar *mode; /* the current mode */ + const xmlChar *modeURI; /* the current mode URI */ + + xsltDocumentPtr docList; /* the document list */ + + xsltDocumentPtr document; /* the current document */ + xmlNodePtr node; /* the current node being processed */ + xmlNodeSetPtr nodeList; /* the current node list */ + /* xmlNodePtr current; the node */ + + xmlDocPtr output; /* the resulting document */ + xmlNodePtr insert; /* the insertion node */ + + xmlXPathContextPtr xpathCtxt; /* the XPath context */ + xsltTransformState state; /* the current state */ + + /* + * Global variables + */ + xmlHashTablePtr globalVars; /* the global variables and params */ + + xmlNodePtr inst; /* the instruction in the stylesheet */ + + int xinclude; /* should XInclude be processed */ + + const char * outputFile; /* the output URI if known */ + + int profile; /* is this run profiled */ + long prof; /* the current profiled value */ + int profNr; /* Nb of templates in the stack */ + int profMax; /* Size of the templtaes stack */ + long *profTab; /* the profile template stack */ + + void *_private; /* user defined data */ + + int extrasNr; /* the number of extras used */ + int extrasMax; /* the number of extras allocated */ + xsltRuntimeExtraPtr extras; /* extra per runtime informations */ + + xsltDocumentPtr styleList; /* the stylesheet docs list */ + void * sec; /* the security preferences if any */ + + xmlGenericErrorFunc error; /* a specific error handler */ + void * errctx; /* context for the error handler */ + + xsltSortFunc sortfunc; /* a ctxt specific sort routine */ + + /* + * handling of temporary Result Value Tree + */ + xmlDocPtr tmpRVT; /* list of RVT without persistance */ + xmlDocPtr persistRVT; /* list of persistant RVTs */ + int ctxtflags; /* context processing flags */ + + /* + * Speed optimization when coalescing text nodes + */ + const xmlChar *lasttext; /* last text node content */ + unsigned int lasttsize; /* last text node size */ + unsigned int lasttuse; /* last text node use */ + /* + * Per Context Debugging + */ + int debugStatus; /* the context level debug status */ + unsigned long* traceCode; /* pointer to the variable holding the mask */ +}; + + +CHECK_STOPPED +#define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return; + + +CHECK_STOPPEDE +#define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error; + + +CHECK_STOPPED0 +#define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0); + + +TRIO_COMPILER_GCC +# define TRIO_COMPILER_GCC + + +TRIO_COMPILER_SUNPRO +# define TRIO_COMPILER_SUNPRO + + +TRIO_COMPILER_SUNPRO +# define TRIO_COMPILER_SUNPRO + + +TRIO_COMPILER_XLC +# define TRIO_COMPILER_XLC + + +TRIO_COMPILER_XLC +# define TRIO_COMPILER_XLC /* Workaround for old xlc */ + + +TRIO_COMPILER_DECC +# define TRIO_COMPILER_DECC + + +TRIO_COMPILER_DECC +# define TRIO_COMPILER_DECC /* Workaround for old DEC C compilers */ + + +TRIO_COMPILER_MSVC +# define TRIO_COMPILER_MSVC + + +TRIO_COMPILER_BCB +# define TRIO_COMPILER_BCB + + +TRIO_PLATFORM_VMS +# define TRIO_PLATFORM_VMS + + +TRIO_PLATFORM_UNIX +# define TRIO_PLATFORM_UNIX + + +TRIO_PLATFORM_UNIX +# define TRIO_PLATFORM_UNIX + + +TRIO_PLATFORM_UNIX +# define TRIO_PLATFORM_UNIX + + +TRIO_PLATFORM_UNIX +# define TRIO_PLATFORM_UNIX + + +TRIO_PLATFORM_UNIX +# define TRIO_PLATFORM_UNIX + + +TRIO_PLATFORM_QNX +# define TRIO_PLATFORM_QNX + + +TRIO_PLATFORM_UNIX +# define TRIO_PLATFORM_UNIX + + +TRIO_PLATFORM_UNIX +# define TRIO_PLATFORM_UNIX + + +TRIO_PLATFORM_WIN32 +# define TRIO_PLATFORM_WIN32 + + +TRIO_PLATFORM_MPEIX +# define TRIO_PLATFORM_MPEIX + + +TRIO_PLATFORM_AIX +# define TRIO_PLATFORM_AIX + + +TRIO_PLATFORM_HPUX +# define TRIO_PLATFORM_HPUX + + +TRIO_PLATFORM_SOLARIS +# define TRIO_PLATFORM_SOLARIS + + +TRIO_PLATFORM_SUNOS +# define TRIO_PLATFORM_SUNOS + + +TRIO_COMPILER_SUPPORTS_C89 +# define TRIO_COMPILER_SUPPORTS_C89 + + +TRIO_COMPILER_SUPPORTS_C90 +# define TRIO_COMPILER_SUPPORTS_C90 + + +TRIO_COMPILER_SUPPORTS_C94 +# define TRIO_COMPILER_SUPPORTS_C94 + + +TRIO_COMPILER_SUPPORTS_C99 +# define TRIO_COMPILER_SUPPORTS_C99 + + +TRIO_COMPILER_SUPPORTS_C94 +# define TRIO_COMPILER_SUPPORTS_C94 + + +TRIO_COMPILER_SUPPORTS_UNIX95 +# define TRIO_COMPILER_SUPPORTS_UNIX95 + + +TRIO_COMPILER_SUPPORTS_UNIX98 +# define TRIO_COMPILER_SUPPORTS_UNIX98 + + +TRIO_COMPILER_SUPPORTS_UNIX01 +# define TRIO_COMPILER_SUPPORTS_UNIX01 + + +TRIO_PUBLIC +# define TRIO_PUBLIC + + +TRIO_PRIVATE +# define TRIO_PRIVATE static + + +TRIO_COMPILER_ANCIENT +# define TRIO_COMPILER_ANCIENT + + +TRIO_CONST +# define TRIO_CONST + + +TRIO_VOLATILE +# define TRIO_VOLATILE + + +TRIO_SIGNED +# define TRIO_SIGNED + + +trio_long_double_t +typedef double trio_long_double_t; + + +trio_pointer_t +typedef char * trio_pointer_t; + + +TRIO_SUFFIX_LONG +# define TRIO_SUFFIX_LONG(x) x + + +TRIO_PROTO +# define TRIO_PROTO(x) () + + +TRIO_NOARGS +# define TRIO_NOARGS + + +TRIO_ARGS1 +# define TRIO_ARGS1(list,a1) list a1; + + +TRIO_ARGS2 +# define TRIO_ARGS2(list,a1,a2) list a1; a2; + + +TRIO_ARGS3 +# define TRIO_ARGS3(list,a1,a2,a3) list a1; a2; a3; + + +TRIO_ARGS4 +# define TRIO_ARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4; + + +TRIO_ARGS5 +# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5; + + +TRIO_ARGS6 +# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) list a1; a2; a3; a4; a5; a6; + + +TRIO_VARGS2 +# define TRIO_VARGS2(list,a1,a2) list a1; a2 + + +TRIO_VARGS3 +# define TRIO_VARGS3(list,a1,a2,a3) list a1; a2; a3 + + +TRIO_VARGS4 +# define TRIO_VARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4 + + +TRIO_VARGS5 +# define TRIO_VARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5 + + +TRIO_VA_DECL +# define TRIO_VA_DECL va_dcl + + +TRIO_VA_START +# define TRIO_VA_START(x,y) va_start(x) + + +TRIO_VA_END +# define TRIO_VA_END(x) va_end(x) + + +TRIO_CONST +# define TRIO_CONST const + + +TRIO_VOLATILE +# define TRIO_VOLATILE volatile + + +TRIO_SIGNED +# define TRIO_SIGNED signed + + +trio_long_double_t +typedef long double trio_long_double_t; + + +trio_pointer_t +typedef void * trio_pointer_t; + + +TRIO_SUFFIX_LONG +# define TRIO_SUFFIX_LONG(x) x ## L + + +TRIO_PROTO +# define TRIO_PROTO(x) x + + +TRIO_NOARGS +# define TRIO_NOARGS void + + +TRIO_ARGS1 +# define TRIO_ARGS1(list,a1) (a1) + + +TRIO_ARGS2 +# define TRIO_ARGS2(list,a1,a2) (a1,a2) + + +TRIO_ARGS3 +# define TRIO_ARGS3(list,a1,a2,a3) (a1,a2,a3) + + +TRIO_ARGS4 +# define TRIO_ARGS4(list,a1,a2,a3,a4) (a1,a2,a3,a4) + + +TRIO_ARGS5 +# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) (a1,a2,a3,a4,a5) + + +TRIO_ARGS6 +# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) (a1,a2,a3,a4,a5,a6) + + +TRIO_VARGS2 +# define TRIO_VARGS2 TRIO_ARGS2 + + +TRIO_VARGS3 +# define TRIO_VARGS3 TRIO_ARGS3 + + +TRIO_VARGS4 +# define TRIO_VARGS4 TRIO_ARGS4 + + +TRIO_VARGS5 +# define TRIO_VARGS5 TRIO_ARGS5 + + +TRIO_VA_DECL +# define TRIO_VA_DECL ... + + +TRIO_VA_START +# define TRIO_VA_START(x,y) va_start(x,y) + + +TRIO_VA_END +# define TRIO_VA_END(x) va_end(x) + + +TRIO_INLINE +# define TRIO_INLINE inline + + +TRIO_INLINE +# define TRIO_INLINE __inline__ + + +TRIO_INLINE +# define TRIO_INLINE _inline + + +TRIO_INLINE +# define TRIO_INLINE __inline + + +TRIO_INLINE +# define TRIO_INLINE + + +TRIO_COMPILER_SUPPORTS_LL +# define TRIO_COMPILER_SUPPORTS_LL + + +xsltSecurityPrefs + + +xsltSecurityPrefsPtr +typedef xsltSecurityPrefs *xsltSecurityPrefsPtr; + + +xsltSecurityOption +typedef enum { + XSLT_SECPREF_READ_FILE = 1, + XSLT_SECPREF_WRITE_FILE, + XSLT_SECPREF_CREATE_DIRECTORY, + XSLT_SECPREF_READ_NETWORK, + XSLT_SECPREF_WRITE_NETWORK +} xsltSecurityOption; + + +xsltSecurityCheck +int +xsltSecurityPrefsPtr sec, + xsltTransformContextPtr ctxt, + const char *value + + +XSLTPUBFUN +#define XSLTPUBFUN + + +XSLTPUBVAR +#define XSLTPUBVAR extern + + +XSLTCALL +#define XSLTCALL + + +XSLTPUBFUN + #define XSLTPUBFUN __declspec(dllexport) + + +XSLTPUBVAR + #define XSLTPUBVAR __declspec(dllexport) + + +XSLTPUBFUN + #define XSLTPUBFUN + + +XSLTPUBVAR + #define XSLTPUBVAR __declspec(dllimport) extern + + +XSLTPUBVAR + #define XSLTPUBVAR extern + + +XSLTCALL + #define XSLTCALL __cdecl + + +XSLTPUBFUN + #define XSLTPUBFUN __declspec(dllexport) + + +XSLTPUBVAR + #define XSLTPUBVAR __declspec(dllexport) extern + + +XSLTPUBFUN + #define XSLTPUBFUN + + +XSLTPUBVAR + #define XSLTPUBVAR __declspec(dllimport) extern + + +XSLTPUBVAR + #define XSLTPUBVAR extern + + +XSLTCALL + #define XSLTCALL __cdecl + + +XSLTPUBFUN + #define XSLTPUBFUN __declspec(dllexport) + + +XSLTPUBVAR + #define XSLTPUBVAR __declspec(dllexport) + + +XSLTPUBFUN + #define XSLTPUBFUN + + +XSLTPUBVAR + #define XSLTPUBVAR __declspec(dllimport) extern + + +XSLTPUBVAR + #define XSLTPUBVAR + + +XSLTCALL + #define XSLTCALL __cdecl + + +LIBXSLT_PUBLIC +#define LIBXSLT_PUBLIC XSLTPUBVAR + diff --git a/doc/libxslt-refs.xml b/doc/libxslt-refs.xml new file mode 100644 index 0000000..3d2169f --- /dev/null +++ b/doc/libxslt-refs.xml @@ -0,0 +1,8634 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/libxslt.xml b/doc/libxslt.xml new file mode 100644 index 0000000..c350787 --- /dev/null +++ b/doc/libxslt.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + +]> + + + + GNOME XSLT Library Reference Manual + + + Daniel + Veillard + +
    + daniel@veillard.com +
    +
    +
    +
    + + 2001 + Daniel Veillard + + + + Permission is granted to make and distribute verbatim + copies of this manual provided the copyright notice and this + permission notice are preserved on all copies. + + Permission is granted to copy and distribute modified + versions of this manual under the conditions for verbatim + copying, provided also that the entire resulting derived work is + distributed under the terms of a permission notice identical to + this one. + + Permission is granted to copy and distribute translations + of this manual into another language, under the above conditions + for modified versions. + + + + This manual documents the interfaces of the libxslt + library and has some short notes to help get you up to speed + with using the library. + +
    + + + Libxslt Programming Notes + + Libxslt is an XSLT toolkit library, which allows you to transform + XML documents. It uses the XML parser, tree and XPath functionalities + of libxml2 + + + Libxslt Library Reference + + This section contains the API reference for libxslt. All + the public interfaces are documented here. This reference guide is + build by extracting comments from the code sources. + + &xslt; + &functions; + &pattern; + &templates; + &transform; + &xsltutils; + &attributes; + &imports; + &extensions; + &namespaces; + &variables; + &keys; + &xsltInternals; + &numbersInternals; + +
    + diff --git a/doc/libxslt.xsa b/doc/libxslt.xsa new file mode 100644 index 0000000..f6b8c2a --- /dev/null +++ b/doc/libxslt.xsa @@ -0,0 +1,37 @@ + + + + + Daniel Veillard + daniel@veillard.com + http://veillard.com/ + + + libxslt + 1.1.28 + Nov 21 2012 + http://xmlsoft.org/XSLT/ + - Portability: + Fix python build by using libxsltmod_la_CPPFLAGS instead of AM_CPPFLAGS (Alexandre Rostovtsev), + configure should be more careful with linker script (Igor Pashev), + add gcrypt library in LIBADD, not LDFLAGS, as recommended (Roumen Petrov) + + - Bug fixes: + Fix generate-id() to avoid generating the same ID (Stewart Brodie), + Fix crash with empty xsl:key/@match attribute (Nick Wellnhofer), + Crash when passing an uninitialized variable to document() (Nick Wellnhofer), + Add missing test docs to EXTRA_DIST (Nick Wellnhofer), + Fix regression: Default namespace not correctly used (Nick Wellnhofer) + + - Cleanups: + Remove xsltTransStorageAdd and xsltTransStorageRemove from symbols.xml (Daniel Veillard), + autogen.sh cleanup (Daniel Richard), + consistent use of xslt processor (Roumen Petrov), + Add object files in tests/plugins to .gitignore (Nick Wellnhofer), + Fix error on bug-165 regression test (Daniel Veillard), + Remove xsltTransStorageAdd and xsltTransStorageRemove (Daniel Veillard), + + + + + diff --git a/doc/newapi.xsl b/doc/newapi.xsl new file mode 100644 index 0000000..5664e71 --- /dev/null +++ b/doc/newapi.xsl @@ -0,0 +1,700 @@ + + + + + + + + + + + + + + + + libxslt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + API Menu + +
    + + +
    + +
    + + + + + +
    + + + + + + + +
    +
    + +
    +
    + +
    + + + + + + + +
    +
    + API Indexes +
    +
    + +
    + + + + + + + +
    +
    + Related links +
    +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +    #define 
    +    
    +
    + + +
    +    Variable 
    +    
    +      
    +    
    +     
    +    
    +    
    +    
    +
    +
    +    
    +
    + + + +
    +    
    +      
    +	Enum 
    +	
    +	
    +
    +      
    +      
    +	Typedef 
    +	
    +	  
    +	
    +	 
    +	
    +	
    +
    +      
    +    
    +    
    +
    + + + +

    Enum

    +
    +      Enum 
    +      
    +       {
    +
    +      
    +        
    +            
    +        
    +         = 
    +        
    +        
    +	   : 
    +	  
    +	    
    +	  
    +        
    +        
    +
    +      
    +      }
    +
    +    
    +
    + + +
    +    Structure 
    + + + + The content of this structure is not made public by the API. + + +
    +
    + + +

    Structure

    +
    +    Structure 
    + { + + + The content of this structure is not made public by the API. + + + + + + + + + + + : + + + + + + + + } +
    +
    + + + +

    Macro:

    +
    #define 
    +

    + + + +

    + +
    + + + + + + +
    +    
    +      
    +    
    +    	
    +    
    +    
    +      	
    +    
    +    
    +      	
    +    
    +    	(
    +    
    +      void
    +    
    +    
    +      
    +        
    +      
    +       
    +      
    +      
    +        , 
    + + + + + + + +
    +
    + ) +
    + +
    + + + + + + +
    +    Function type: 
    +    
    +    
    +
    +    
    +      
    +    
    +    	
    +    
    +    
    +      	
    +    
    +    
    +      	
    +    
    +    	(
    +    
    +      void
    +    
    +    
    +      
    +        
    +      
    +       
    +      
    +      
    +        , 
    + + + + + + + +
    +
    + ) + +
    + + +
    + + + + + + +

    + + Function type: + +

    +
    +    Function type: 
    +    
    +    
    +
    +    
    +      
    +    
    +    	
    +    
    +    
    +      	
    +    
    +    
    +      	
    +    
    +    	(
    +    
    +      void
    +    
    +    
    +      
    +        
    +      
    +       
    +      
    +      
    +        , 
    + + + + + + + +
    +
    + ) + +
    +

    + + + +

    + +
    + + + + + + + + + + + + +
    : + + + +
    Returns: + + + +
    +
    +
    + + +
    + + + + + + +

    Function:

    +
    +    
    +      
    +    
    +    	
    +    
    +    
    +      	
    +    
    +    
    +      	
    +    
    +    	(
    +    
    +      void
    +    
    +    
    +      
    +        
    +      
    +       
    +      
    +      
    +        , 
    + + + + + + + +
    +
    + )
    + + +
    +

    + + + +

    + + +
    + + + + + + + + + + + + +
    : + + + +
    Returns: + + + +
    +
    +
    + + + + + + + + + + + +

    This module is deprecated

    +
    + +

    +
    +
    + + + + Module from + + + + + +
    +

    Table of Contents

    + +

    Description

    + + + +
    +
    + +

    Table of Contents

    + + + + + + + + + + + + + + + +

    Description

    + + + + + + + + + + + + + + + + + +
    +
    +
    + + + + + +
    + + + +
  • + + : + +
  • +
    + + + + Reference Manual for + +

    Table of Contents

    +
      + +
    +
    + + + + + +
    + + + Processing library , output directory is + + + + + + + + + + + + +
    diff --git a/doc/news.html b/doc/news.html new file mode 100644 index 0000000..1c63bfb --- /dev/null +++ b/doc/news.html @@ -0,0 +1,923 @@ + + +News
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    News

    Main Menu
    Related links
    API Indexes

    See the git page +to get a description of the recent commits.

    Those are the public releases made:

    1.1.29: May 24 2016

      +
    • Security:
      + CVE-2015-7995 Fix for type confusion in preprocessing attributes (Daniel Veillard)
      +
    • + +
    • Documentation:
      +
    • + +
    • Portability:
      + Fix a portibility problem with previous commit (Eduard Sanou),
      + Fix MingW build (Nick Wellnhofer),
      + Correctly emulate snprintf on older MSVC versions (Nick Wellnhofer),
      + Add Python script to run some tests on Windows (Nick Wellnhofer),
      + Remove /OPT:NOWIN98 option (Nick Wellnhofer),
      + Visual Studio 14 CTP defines snprintf() (Daniel Veillard),
      + Use AC_PATH_TOOL to find libgcrypt-config and xml2-config (Micha¿ Górny),
      + Use $libdir for LIBXSLT_DEFAULT_PLUGINS_PATH (larryhaja),
      + Use mkdir macro also in case if mingw32. (Lars Kanis),
      + Add math library to executable link flags (Nick Wellnhofer),
      + Fix quoting of xlocale test program in configure.in (Nick Wellnhofer)
      +
    • + +
    • Bug Fixes:
      + Fix OOB heap read in xsltExtModuleRegisterDynamic (Nick Wellnhofer),
      + Remove CDATA markup from libxslt_tutorial.c (Nick Wellnhofer),
      + Remove generated headers from dist tarball (Nick Wellnhofer),
      + Mark XML file argument as repeatable (Nick Wellnhofer),
      + Keep timezone in date:add (Nick Wellnhofer),
      + Fix buffer overflow in exsltDateFormat (Nick Wellnhofer),
      + Fix saxon:line-number with namespace nodes (Nick Wellnhofer),
      + Fix dyn:map with namespace nodes (Nick Wellnhofer),
      + Fix error handling in Saxon extension functions (Nick Wellnhofer),
      + Fix double free in libexslt hash functions (Nick Wellnhofer),
      + Fix libxslt format warnings (David Kilzer),
      + Fix xsltNumberFormatGetMultipleLevel (Nick Wellnhofer),
      + Fix use-after-free in xsltDocumentFunctionLoadDocument (Nick Wellnhofer),
      + Always initialize EXSLT month and day to 1 (Nick Wellnhofer),
      + Fix possible NULL pointer deref in transform.c (mahendra.n),
      + Fix possible NULL pointer deref in xsltCopyTextString (Nick Wellnhofer),
      + Fix possible NULL pointer deref in libexslt/functions.c (Nick Wellnhofer),
      + Fix possible NULL pointer deref in xsltproc.c (mahendra.n),
      + Fix possible NULL pointer deref in preproc.c (mahendra.n),
      + Fix LIBXSLT_DEFAULT_PLUGINS_PATH in xsltconfig.h (Nick Wellnhofer),
      + Fix memory leak in xsltNumberFormat (Albert Astals Cid),
      + Error in doc/Makefile.am (Brice De Bruyne),
      + Detect attribute sets recursions in more cases (Daniel Veillard),
      + Check name vales for attribute-set elements (Daniel Veillard),
      + Fix hang with namespace-alias, fixes #700689 (Shaun McCance),
      + Fix str:align with UTF-8 strings (Nick Wellnhofer),
      + Fix for compiled XPath helpers (Nick Wellnhofer),
      + Check return value of exsltFuncNewFunctionData (Nick Wellnhofer),
      + Fix return value of xsltRegisterExtModuleElement (Nick Wellnhofer),
      + Call xmlNodeGetSpacePreserve with element node (Nick Wellnhofer),
      + Set namespaces before evaluating xsl:number (Nick Wellnhofer),
      + Make --maxvars option work (Per Hedeland),
      + Set correct context node when initializing xsl:keys (Nick Wellnhofer),
      + Fix for bug 436589 (Imran Azeezullah),
      + Memory leak in xsltCompileIdKeyPattern error path (Nick Wellnhofer),
      + Fix handling of UTF-8 strings in EXSLT crypto module (Nick Wellnhofer),
      + Fix certain patterns with predicates (Nick Wellnhofer),
      + Fix direct pattern matching (Nick Wellnhofer),
      + Fix str:padding to work with UTF-8 strings (Nick Wellnhofer),
      + EXSLT function str:replace() is broken as-is (Nick Wellnhofer),
      + Fix a couple of places where (f)printf parameters were broken (Daniel Veillard)
      +
    • + +
    • Improvements:
      + Add support timestamps from environment (Daniel Veillard),
      + Add missing tests to dist tarball (Nick Wellnhofer),
      + Improve error message in xsltAddTemplate and fix test (Nick Wellnhofer),
      + Allow REC tests with empty stdout (Nick Wellnhofer),
      + Fix GPL license in HTML files as well (Nick Wellnhofer),
      + Fix status message in EXSLT dynamic tests (Nick Wellnhofer),
      + Add public function macros to xsltlocale.h (Nick Wellnhofer),
      + Make valgrind tests work with libtool (Nick Wellnhofer),
      + Add a couple of xsl:number tests (Nick Wellnhofer),
      + Lower and upper bound for format token "i" (Nick Wellnhofer),
      + Lower bound for format token "a" (Nick Wellnhofer),
      + Handle negative xsl:number values (Nick Wellnhofer),
      + Round xsl:number values to nearest integer (Nick Wellnhofer),
      + Allow {URI}NCName syntax for user parameters (Nick Wellnhofer),
      + Fix endTimer parameter type (Nick Wellnhofer),
      + Fix error messages for unsupported methods (Nick Wellnhofer),
      + Replace sprintf with snprintf (David Kilzer),
      + Enforce two digit exponent under MSVC (Nick Wellnhofer),
      + Rework xsltNumberFormat to fix warning (Nick Wellnhofer),
      + Fix a couple of GPL licences found in the documentation (Daniel Veillard),
      + Use hash table to lookup named templates (Christian Ceelen),
      + Fix to reg tests post 737840 fix (Daniel Veillard),
      + Don't fail build the man page if xsltproc is not present (Daniel Veillard),
      + Re-adding xsltproc.1 (Daniel Veillard),
      + Fix time type in xsltSaveProfiling (Nick Wellnhofer),
      + Remove unused parameters (Nick Wellnhofer),
      + Suppress unused variable warning. (Nick Wellnhofer),
      + Remove unused variable in xsltGenerateIdFunction (Nick Wellnhofer),
      + Add test case for XPath function args in error case (Nick Wellnhofer),
      + Add comment about known-to-fail test (Nick Wellnhofer),
      + Adjust expected test output (Nick Wellnhofer),
      + Helper functions to evaluate compiled XPath expressions (Nick Wellnhofer),
      + Add tests for crypto:rc4 (Nick Wellnhofer),
      + Add first test case for EXSLT crypto module (Nick Wellnhofer),
      + Separate function for predicate matching in patterns (Nick Wellnhofer),
      + Initialize pseudo random number generator with current time or optional command line parameter (Nils Werner),
      + Adding doc update related to 1.1.28 (Daniel Veillard)
      +
    • + +
    • Cleanups:
      + Remove bogus test file (Nick Wellnhofer),
      + Add warning message to expected test output (Nick Wellnhofer)
      +
    • +

    1.1.28: Nov 21 2012

      +
    • Portability:
      + Fix python build by using libxsltmod_la_CPPFLAGS instead of AM_CPPFLAGS (Alexandre Rostovtsev),
      + configure should be more careful with linker script (Igor Pashev),
      + add gcrypt library in LIBADD, not LDFLAGS, as recommended (Roumen Petrov)
      +
    • + +
    • Bug fixes:
      + Fix generate-id() to avoid generating the same ID (Stewart Brodie),
      + Fix crash with empty xsl:key/@match attribute (Nick Wellnhofer),
      + Crash when passing an uninitialized variable to document() (Nick Wellnhofer),
      + Add missing test docs to EXTRA_DIST (Nick Wellnhofer),
      + Fix regression: Default namespace not correctly used (Nick Wellnhofer)
      +
    • + +
    • Cleanups:
      + Remove xsltTransStorageAdd and xsltTransStorageRemove from symbols.xml (Daniel Veillard),
      + autogen.sh cleanup (Daniel Richard),
      + consistent use of xslt processor (Roumen Petrov),
      + Add object files in tests/plugins to .gitignore (Nick Wellnhofer),
      + Fix error on bug-165 regression test (Daniel Veillard),
      + Remove xsltTransStorageAdd and xsltTransStorageRemove (Daniel Veillard),
      +
    • +

    1.1.27: Sep 12 2012

      +
    • Portability:
      + xincludestyle wasn't protected with LIBXML_XINCLUDE_ENABLED (Michael Bonfils),
      + Portability fix for testThreads.c (IlyaS),
      + FreeBSD portability fixes (Pedro F. Giffuni),
      + check for gmtime - on mingw* hosts will enable date-time function (Roumen Petrov),
      + use only native crypto-API for mingw* hosts (Roumen Petrov),
      + autogen: Only check for libtoolize (Colin Walters),
      + minimal mingw support (Roumen Petrov),
      + configure: acconfig.h is deprecated since autoconf-2.50 (Stefan Kost),
      + Fix a small out of tree compilation issue (Hao Hu),
      + Fix python generator to not use deprecated xmllib (Daniel Veillard),
      + link python module with python library (Frederic Crozat)
      +
    • + +
    • Documentation:
      + Tiny doc improvement (Daniel Veillard),
      + Various documentation fixes for docs on internals (C. M. Sperberg-McQueen)
      +
    • + +
    • Bug fixes:
      + Report errors on variable use in key (Daniel Veillard),
      + The XSLT namespace string is a constant one (Daniel Veillard),
      + Fix handling of names in xsl:attribute (Nick Wellnhofer),
      + Reserved namespaces in xsl:element and xsl:attribute (Nick Wellnhofer),
      + Null-terminate result string of cry:rc4_decrypt (Nick Wellnhofer),
      + EXSLT date normalization fix (James Muscat),
      + Exit after compilation of invalid func:result (Nick Wellnhofer),
      + Fix for EXSLT func:function (Nick Wellnhofer),
      + Rewrite EXSLT string:replace to be conformant (Nick Wellnhofer),
      + Avoid a heap use after free error (Chris Evans),
      + Fix a dictionary string usage (Chris Evans),
      + Output should not include extraneous newlines when indent is off (Laurence Rowe),
      + document('') fails to return stylesheets parsed from memory (Jason Viers),
      + xsltproc should return an error code if xinclude fails (Malcolm Purvis),
      + Forwards-compatible processing of unknown top level elements (Nick Wellnhofer),
      + Fix system-property with unknown namespace (Nick Wellnhofer),
      + Hardening of code checking node types in EXSLT (Daniel Veillard),
      + Hardening of code checking node types in various entry point (Daniel Veillard),
      + Cleanup of the pattern compilation code (Daniel Veillard),
      + Fix default template processing on namespace nodes (Daniel Veillard),
      + Fix a bug in selecting XSLT elements (Daniel Veillard),
      + Fixed bug #616839 (Daniel Mustieles),
      + Fix some case of pattern parsing errors (Abhishek Arya),
      + preproc: fix the build (Stefan Kost),
      + Fix a memory leak with xsl:number (Daniel Veillard),
      + Fix a problem with ESXLT date:add() with January (money_seshu Dronamraju),
      + Fix a memory leak if compiled with Windows locale support (Daniel Veillard),
      + Fix generate-id() to not expose object addresses (Daniel Veillard),
      + Fix curlies support in literals for non-compiled AVTs (Nick Wellnhofer),
      + Allow whitespace in xsl:variable with select (Nick Wellnhofer),
      + Small fixes to locale code (Nick Wellnhofer),
      + Fix bug 602515 (Nick Wellnhofer),
      + Fix popping of vars in xsltCompilerNodePop (Nick Wellnhofer),
      + Fix direct pattern matching bug (Nick Wellnhofer)
      +
    • + +
    • Improvements:
      + Add the saxon:systemId extension (Mike Hommey),
      + Add an append mode to document output (Daniel Veillard),
      + Add new tests to EXTRA_DIST (Nick Wellnhofer),
      + Test for bug #680920 (Nick Wellnhofer),
      + fix regresson in Various "make distcheck" and other fixes (Roumen Petrov),
      + Various "make distcheck" and other fixes (Daniel Richard G),
      + Fix portability to upcoming libxml2-2.9.0 (Daniel Veillard),
      + Adding --system flag support to autogen.sh (Daniel Veillard),
      + Allow per-context override of xsltMaxDepth, introduce xsltMaxVars (Jérôme Carretero),
      + autogen.sh: Honor NOCONFIGURE environment variable (Colin Walters),
      + configure: support silent automake rules if possible (Stefan Kost),
      + Precompile patterns in xsl:number (Nick Wellnhofer),
      + Fix some warnings in the refactored code (Nick Wellnhofer),
      + Adding new generated files (Daniel Veillard),
      + profiling: add callgraph report (Stefan Kost)
      +
    • + +
    • Cleanups:
      + Big space and tabs cleanup (Daniel Veillard),
      + Fix authors list (Daniel Veillard),
      + Cleanups some of the test makefiles (Daniel Richard),
      + Remove .cvsignore files which are not needed anymore (Daniel Veillard),
      + Cleanup some misplaced spaces and tabs (Daniel Veillard),
      + Augment list of ignored files (Daniel Veillard),
      + configure: remove checks for isinf and isnan as those are not used anyway (Stefan Kost),
      + Point to GIT for source code and a bit of cleanup (Daniel Veillard),
      + Get rid of specific build setup and STATIC_BINARIES (Daniel Veillard)
      +
    • +

    1.1.26: Sep 24 2009

      +
    • Improvement: + Add xsltProcessOneNode to exported symbols for lxml (Daniel Veillard) +
    • +
    • Bug fixes: + Fix an idness generation problem (Daniel Veillard), + 595612 Try to fix some locking problems (Daniel Veillard), + Fix a crash on misformed imported stylesheets (Daniel Veillard) +
    • +

    1.1.25: Sep 17 2009

      +
    • Features: + Add API versioning and various cleanups (Daniel Veillard), + xsl:sort lang support using the locale (Nick Wellnhofer and Roumen Petrov) +
    • +
    • Documentation: + Fix the download links for Solaris (Daniel Veillard), + Fix makefile and spec file to include doc in rpm (Daniel Veillard) +
    • +
    • Portability: + Make sure testThreads is linked with pthreads (Daniel Veillard), + Fix potential crash on debug of extensions Solaris (Ben Walton), + applied patch from Roumen Petrov for mingw cross compilation problems (Roumen Petrov), + patch from Richard Jones to build shared libs with MinGW cross-compiler (Richard Jones), + fix include path when compiling with MinGW (Roumen Petrov), + portability fixes ( Nick Wellnhofer and Roumen Petrov) +
    • +
    • Bug fixes: + Big fixes of pattern compilations (Nick Wellnhofer), + Fix uses of xmlAddChild for error handling (Daniel Veillard), + Detect deep recusion on function calls (Daniel Veillard), + Avoid an error in namespace generation (Martin), + Fix importing of encoding from included stylesheets (Nick Wellnhofer), + Fix problems with embedded stylesheets and namespaces (Martin), + QName parsing fix for patterns (Martin), + Crash compiling stylesheet with DTD (Martin), + Fix xsl:strip-space with namespace and wildcard (Nick Wellnhofer), + Fix a mutex deadlock on unregistered extensions (Nix), + 567192 xsltproc --output option ignore --xinclude (Joachim Breitner), + Fix redundant headers in list (Daniel Veillard), + 134754 Configure's --with-html-dir related fixes (Julio M. Merino Vidal), + 305913 a serious problem in extensions reentrancy (Daniel Veillard), + Fix an idness issue when building the tree (Daniel Veillard), + Fixed indexing error reported by Ron Burk on the mailing list. (William M. Brack), + prevent some unchecked pointer accesses (Jake Goulding), + fix for CVE-2008-2935 libexslt RC4 encryption/decryption functions Daniel (Daniel Veillard), + avoid a quadratic behaviour when hitting duplicates (Daniel Veillard), + 544829 fixed option --with-debugger (Arun Ragnavan), + 541965 fixed incorrect argument popping in exsltMathAtan2Function (William M. Brack), + fix problem with string check for element-available (Ron Burk), + 539741 added code to handle literal within an AVT (William M. Brack) +
    • +
    • Improvements: + Allow use of EXSLT outside XSLT (Martin), + Support Esperanto locale (Nick Wellnhofer), + Change how attributes are copied for id and speed (Daniel Veillard), + Add API versioning and various cleanups (Daniel Veillard), + Adding a test program to check thread reentrancy (Daniel Veillard), + big patch from finishing xsl:sort lang support (Roumen Petrov), + add xsl:sort lang support using the locale (Nick Wellnhofer) +
    • +
    • Cleanups: + Label xsltProcessOneNode as static (Daniel Veillard), + git setup (Daniel Veillard), + fixed typo detected by new libxml2 code (William M. Brack), + xsltExtFunctionLookup was defined but never implemented (Ralf Junker) +
    • +

    1.1.24: May 13 2008

      +
    • Documentation: man page fix (Vincent Lefevre).
    • +
    • Bug fixes: pattern bug fix, key initialization problems, exclusion of + unknown namespaced element on top of stylesheets, python generator + syntactic cleanup (Martin)
    • +

    1.1.23: Apr 8 2008

      +
    • Documentation: fix links for Cygwin DocBook setup (Philippe Bourcier), + xsltParseStylesheetDoc doc fix (Jason Viers), fix manpage default + maxdepth value
    • +
    • Bug fixes: python segfault (Daniel Gryniewicz), week-in-year bug fix + (Maurice van der Pot), fix python iterator problem (William Brack), + avoid garbage collection problems on str:tokenize and str:split + and function results (William Brack and Peter Pawlowski) + superfluous re-generation of keys (William Brack), remove superfluous + code in xsltExtInitTest (Tony Graham), func:result segfault fix + (William Brack), timezone offset problem (Peter Pawlowski),
    • +
    • Portability fixes: old gcrypt support fix (Brent Cowgill), Python + portability patch (Stephane Bidoul), VS 2008 fix (Rob Richard)
    • +

    1.1.22: Aug 23 2007

      +
    • Bug fixes: RVT cleanup problems (William Brack), exclude-result-prefix + bug (William Brack), stylesheet compilation error handling (Rob Richards). +
    • +
    • Portability fixes: improve build with VS2005 (Rob Richards), + fixing build on AIX (Bjorn Wiberg), fix the security file checks on + Windows (Roland Schwarz and Rob Richards).
    • +
    • Improvement: add an --encoding option to xsltproc (Drazen Kacar).
    • +

    1.1.21: Jun 12 2007

      +
    • Bug fixes: out of memory allocation errors (William Brack), + namespace problem on compound predicates (William Brack), + python space/tab inconsistencies (Andreas Hanke), hook xsl:message + to per transformation error callbacks (Shaun McCance), + cached RVT problem (William Brack), XPath context maintainance + on choose (William Brack), memory leaks in the math module (William + Brack), exclude-result-prefix induced namespace problem (William + Brack)
    • +
    • Build: configure setup for TRIO_REPLACE_STDIO (William Brack) +
    • Documentation: updated after change from CVs to SVN (William Brack)
    • +

    1.1.20: Jan 17 2007

      +
    • Portability fixes: strict aliasing fix (Marcus Meissner), BSD portability + patches (Roland Illig)
    • +
    • Bug fixes: Result Value Tree handling fix (William Brack), function + parameters fix (William), uninitialized variable (Kjartan Maraas), + empty text node handling (William), plugin support and test fixes (William), + fragment support fixes (William)
    • +
    • Improvements: python stylesheet compare and transform context + access (Nic Ferrier), EXSLT string replace support (Joel Reed), + xsltproc better low level error handling (Mike Hommey and William)
    • +

    1.1.19: Nov 29 2006

      +
    • Bug fixes: entities within attributes (William Brack), Python detection + problem (Joseph Sacco), in-scope namespace bug (Mike Hommey), Result + value tree caching bug (William Brack)
    • +

    1.1.18: Oct 26 2006

      +
    • portability and build fixes: DESTDIR problem, build paths in python + shared lib, compile when libxml2 doesn't support XInclude (Gary Coady).
    • +
    • bug fixes: a number of namespace related bugs (Kasimier Buchcik), + parameters bugs (Kasimier Buchcik), proximity position in predicates + of match patterns (Kasimier), exslt-node-set troubles with strings + (Kasimier), CDATA serialization, Python floats and booleans XPath + conversions, XInclude support fixes, RVT cleanup problem (William Brack + and Kasimier), attribute checking in stylesheets (Kasimier), xsltForEach + context problem (Kasimier), security check should pass full URLs (Shane + Corgatelli), security cleanup patch (Mikhail Zabaluev), some python + accessor for stylesheet were broken, memory errors when compiling + stylesheets (Mike Hommey), EXSLT current date end-of-month problem + (William Brack).
    • +
    • improvements: refactoring of namespace handling, value-of impleemntation + and template internal processing (Kasimier Buchcik), new xsltproc + flag to apply Xinclude to stylesheets.
    • +
    • documentation: xsltproc man pages (Daniel Leidert), tests updates + (William Brack), various typo fixes (Daniel Leidert), comments on + versions macros (Peter Breitenlohner).
    • +

    1.1.17: Jun 6 2006

      +
    • portability fixes: python detection
    • +
    • bug fixes: some regression tests, attribute/namespaces output (Kasimier + Buchcik), problem in mixed xsl:value-of and xsl:text uses (Kasimier)
    • +
    • improvements: internal refactoring (Kasimier Buchcik), use of the XPath + object cache in libxml2-2.6.25 (Kasimier)
    • +

    1.1.16: May 01 2006

      +
    • portability fixes: EXSLT date/time on Solaris and IRIX (Albert Chin), + HP-UX build (Albert Chin), +
    • build fixes: Python detection(Joseph Sacco), plugin configurei + (Joel Reed)
    • +
    • bug fixes: pattern compilation fix(William Brack), EXSLT date/time + fix (Thomas Broyer), EXSLT function bug, potential loop on variable + eval, startup race (Christopher Palmer), debug statement left in python + (Nic Ferrier), various cleanup based on Coverity reports), error on + Out of memory condition (Charles Hardin), various namespace prefixes + fixes (Kasimier Buchcik),
    • +
    • improvement: speed up sortingi, start of internals refactoring (Kasimier + Buchcik)
    • +
    • documentation: man page fixes and updates (Daniel Leidert) +

    1.1.15: Sep 04 2005

      +
    • build fixes: Windows build cleanups and updates (Igor Zlatkovic), + remove jhbuild warnings
    • +
    • bug fixes: negative number formatting (William Brack), number + formatting per mille definition (William Brack), XInclude default values + (William), text copy bugs (William), bug related to xmlXPathContext size, + reuse libxml2 memory management for text nodes, dictionary text bug, + forbid variables in match (needs libxml2-2.6.21)
    • +
    • improvements: EXSLT dyn:map (Mark Vakoc),
    • +
    • documentation: EXSLT date and time functions namespace in man (Jonathan + Wakely)
    • +

    1.1.14: Apr 02 2005

      +
    • bug fixes: text node on stylesheet document without a dictionary + (William Brack), more checking of XSLT syntax, calling xsltInit() + multiple times, mode values interning raised by Mark Vakoc, bug in + pattern matching with ancestors, bug in patterna matching with cascading + select, xinclude and document() problem, build outside of source tree + (Mike Castle)
    • +
    • improvement: added a --nodict mode to xsltproc to check problems for + docuemtns without dictionaries
    • +

    1.1.13: Mar 13 2005

      +
    • build fixes: 64bits cleanup (William Brack), python 2.4 test (William), + LIBXSLT_VERSION_EXTRA on Windows (William), Windows makefiles fixes (Joel + Reed), libgcrypt-devel requires for RPM spec.
    • +
    • bug fixes: exslt day-of-week-in-month (Sal Paradise), xsl:call-template + should not change the current template rule (William Brack), evaluation + of global variables (William Brack), RVT's in XPath predicates (William), + namespace URI on template names (Mark Vakoc), stat() for Windows patch + (Aleksey Gurtovoy), pattern expression fixes (William Brack), out of + memory detection misses (William), parserOptions propagation (William), + exclude-result-prefixes fix (William), // patten fix (William).
    • +
    • extensions: module support (Joel Reed), dictionary based speedups + trying to get rid of xmlStrEqual as much as possible.
    • +
    • documentation: added Wiki (Joel Reed)
    • +

    1.1.12: Oct 29 2004

      +
    • build fixes: warnings removal (William).
    • +
    • bug fixes: attribute document pointer fix (Mark Vakoc), exslt date + negative periods (William Brack), generated tree structure fixes, + namespace lookup fix, use reentrant gmtime_r (William Brack), + exslt:funtion namespace fix (William), potential NULL pointer reference + (Dennis Dams, William), force string interning on generated + documents.
    • +
    • documentation: update of the second tutorial (Panagiotis Louridas), add + exslt doc in rpm packages, fix the xsltproc man page.
    • +

    1.1.11: Sep 29 2004

      +
    • bug fixes: xsl:include problems (William Brack), UTF8 number pattern + (William), date-time validation (William), namespace fix (William), + various Exslt date fixes (William), error callback fixes, leak with + namespaced global variable, attempt to fix a weird problem #153137
    • +
    • improvements: exslt:date-sum tests (Derek Poon)
    • +
    • documentation: second tutorial by Panagiotis Lourida
    • +

    1.1.10: Aug 31 2004

      +
    • build fix: NUL in c file blocking compilation on Solaris, Windows build + (Igor Zlatkovic)
    • +
    • fix: key initialization problem (William Brack)
    • +
    • documentation: fixed missing man page description for --path
    • +

    1.1.9: Aug 22 2004

      +
    • build fixes: missing tests (William Brack), Python dependancies, Python + on 64bits boxes, --with-crypto flag (Rob Richards),
    • +
    • fixes: RVT key handling (William), Python binding (William and Sitsofe + Wheeler), key and XPath troubles (William), template priority on imports + (William), str:tokenize with empty strings (William), #default namespace + alias behaviour (William), doc ordering missing for main document + (William), 64bit bug (Andreas Schwab)
    • +
    • improvements: EXSLT date:sum added (Joel Reed), hook for document + loading for David Hyatt, xsltproc --nodtdattr to avoid defaulting DTD + attributes, extend xsltproc --version with CVS stamp (William).
    • +
    • Documentation: web page problem reported by Oliver Stoeneberg
    • +

    1.1.8: July 5 2004

      +
    • build fixes: Windows runtime options (Oliver Stoeneberg), Windows + binary package layout (Igor Zlatkovic), libgcrypt version test and link + (William)
    • +
    • documentation: fix libxslt namespace name in doc (William)
    • +
    • bug fixes: undefined namespace message (William Brack), search engine + (William), multiple namespace fixups (William), namespace fix for key + evaluation (William), Python memory debug bindings,
    • +
    • improvements: crypto extensions for exslt (Joel Reed, William)
    • +

    1.1.7: May 17 2004

      +
    • build fix: warning about localtime_r on Solaris
    • +
    • bug fix: UTF8 string tokenize (William Brack), subtle memory + corruption, linefeed after comment at document level (William), + disable-output-escaping problem (William), pattern compilation in deep + imported stylesheets (William), namespace extension prefix bug, + libxslt.m4 bug (Edward Rudd), namespace lookup for attribute, namespaced + DOCTYPE name
    • +

    1.1.6: Apr 18 2004

      +
    • 2 bug fixes about keys fixed one by Mark Vakoc
    • +

    1.1.5: Mar 23 2004

      +
    • performance: use dictionary lookup for variables
    • +
    • remove use of _private from source documents
    • +
    • cleanup of "make tests" output
    • +
    • bugfixes: AVT in local variables, use localtime_r to avoid thread + troubles (William), dictionary handling bug (William), limited number of + stubstitutions in AVT (William), tokenize fix for UTF-8 (William), + superfluous namespace (William), xsltproc error code on + <xsl:message> halt, OpenVMS fix, dictionary reference counting + change.
    • +

    1.1.4: Feb 23 2004

      +
    • bugfixes: attributes without doc (Mariano Suárez-Alvarez), problem with + Yelp, extension problem
    • +
    • display extension modules (Steve Little)
    • +
    • Windows compilation patch (Mark Vadoc), Mingw (Mikhail Grushinskiy)
    • +

    1.1.3: Feb 16 2004

      +
    • Rewrote the Attribute Value Template code, new XPath compilation + interfaces, dictionary reuses for XSLT with potential for serious + performance improvements.
    • +
    • bug fixes: portability (William Brack), key() in node-set() results + (William), comment before doctype (William), math and node-set() problems + (William), cdata element and default namespace (William), behaviour on + unknown XSLT elements (Stefan Kost), priority of "//foo" patterns + (William), xsl:element and xsl:attribute QName check (William), comments + with -- (William), attribute namespace (William), check for ?> in PI + (William)
    • +
    • Documentations: cleanup (John Fleck and William)
    • +
    • Python: patch for OS-X (Gianni Ceccarelli), enums export (Stephane + bidoul)
    • +

    1.1.2: Dec 24 2003

      +
    • Documentation fixes (John Fleck, William Brack), EXSLT documentation + (William Brack)
    • +
    • Windows compilation fixes for MSVC and Mingw (Igor Zlatkovic)
    • +
    • Bug fixes: exslt:date returning NULL strings (William Brack), + namespaces output (William Brack), key and namespace definition problem, + passing options down to the document() parser, xsl:number fixes (William + Brack)
    • +

    1.1.1: Dec 10 2003

      +
    • code cleanup (William Brack)
    • +
    • Windows: Makefile improvements (Igor Zlatkovic)
    • +
    • documentation improvements: William Brack, libexslt man page (Jonathan + Wakely)
    • +
    • param in EXSLT functions (Shaun McCance)
    • +
    • XSLT debugging improvements (Mark Vakoc)
    • +
    • bug fixes: number formatting (Bjorn Reese), exslt:tokenize (William + Brack), key selector parsing with | reported by Oleg Paraschenko, + xsl:element with computed namespaces (William Brack), xslt:import/include + recursion detection (William Brack), exslt:function used in keys (William + Brack), bug when CDATA_SECTION are foun in the tree (William Brack), + entities handling when using XInclude.
    • +

    1.1.0: Nov 4 2003

      +
    • Removed DocBook SGML broken support
    • +
    • fix xsl:key to work with PIs
    • +
    • Makefile and build improvement (Graham Wilson), build cleanup (William + Brack), macro fix (Justin Fletcher), build outside of source tree (Roumen + Petrov)
    • +
    • xsltproc option display fix (Alexey Efimov), --load-trace (Crutcher + Dunnavant)
    • +
    • Python: never use stdout for error
    • +
    • extension memory error fix (Karl Eichwalder)
    • +
    • header path fixes (Steve Ball)
    • +
    • added saxon:line-number() to libexslt (Brett Kail)
    • +
    • Fix some tortuous template problems when using predicates (William + Brack)
    • +
    • Debugger status patch (Kasimier Buchcik)
    • +
    • Use new libxml2-2.6.x APIs for faster processing
    • +
    • Make sure xsl:sort is empty
    • +
    • Fixed a bug in default processing of attributes
    • +
    • Removes the deprecated breakpoint library
    • +
    • detect invalid names on templates (William Brack)
    • +
    • fix exslt:document (and similar) base handling problem
    • +

    1.0.33: Sep 12 2003

    This is a bugfix only release

      +
    • error message missing argument (William Brack)
    • +
    • mode not cascaded in template fallbacks (William Brack)
    • +
    • catch redefinition of parameter/variables (William Brack)
    • +
    • multiple keys with same namespace name (William Brack)
    • +
    • patch for compilation using MingW on Windows (Mikhail Grushinskiy)
    • +
    • header export macros for Windows (Igor Zlatkovic)
    • +
    • cdata-section-elements handling of namespaced names
    • +
    • compilation without libxml2 XPointer support (Mark Vadoc)
    • +
    • apply-templates crash (William Brack)
    • +
    • bug with imported templates (William Brack)
    • +
    • imported attribute-sets merging bug (DocBook) (William Brack)
    • +

    1.0.32: Aug 9 2003

      +
    • bugfixes: xsltSaveResultToFile() python binding (Chris Jaeger), EXSLT + function (William Brack), RVT for globals (William Brack), EXSLT date + (William Brack), +

      speed of large text output, xsl:copy with attributes, strip-space and + namespaces prefix, fix for --path xsltproc option, EXST:tokenize (Shaun + McCance), EXSLT:seconds (William Brack), sort with multiple keys (William + Brack), checking of { and } for attribute value templates (William + Brack)

      +
    • +
    • Python bindings for extension elements (Sean Treadway)
    • +
    • EXSLT:split added (Shaun McCance)
    • +
    • portability fixes for HP-UX/Solaris/IRIX (William Brack)
    • +
    • doc cleanup
    • +

    1.0.31: Jul 6 2003

      +
    • bugfixes: xsl:copy on namespace nodes, AVT for xsl:sort order, fix for + the debugger (Keith Isdale), output filename limitation, trio.h and + triodef.h added (Albert Chin), EXSLT node-set (Peter Breitenlohner), + xsltChoose and whitespace (Igor Zlatkovic), +

      stylesheet compilation (Igor Zlatkovic), NaN and sort (William Brack), + RVT bug introduced in 1.0.30

      +
    • +
    • avoid generating &quot; (fix in libxml2-2.5.8)
    • +
    • fix 64bit cleaness problem and compilation troubles introduced in + 1.0.30
    • +
    • Windows makefile generation (Igor Zlatkovic)
    • +
    • HP-UX portability fix
    • +

    1.0.30: May 4 2003

      +
    • Fixes and new APIs to handle Result Value Trees and avoid leaks
    • +
    • Fixes for: EXSLT math pow() function (Charles Bozeman), global + parameter and global variables mismatch, a segfault on pattern + compilation errors, namespace copy in xsl:copy-of, python generator + problem, OpenVMS trio update, premature call to xsltFreeStackElem (Igor), + current node when templates applies to attributes
    • +

    1.0.29: Apr 1 2003

      +
    • performance improvements especially for large flat documents
    • +
    • bug fixes: Result Value Tree handling, XML IDs, keys(), extra namespace + declarations with xsl:elements.
    • +
    • portability: python and trio fixes (Albert Chin), python on Solaris + (Ben Phillips)
    • +

    1.0.28: Mar 24 2003

      +
    • fixed node() in patterns semantic.
    • +
    • fixed a memory access problem in format-number()
    • +
    • fixed stack overflow in recursive global variable or params
    • +
    • cleaned up Result Value Tree handling, and fixed a couple of old bugs + in the process
    • +

    1.0.27: Feb 24 2003

      +
    • bug fixes: spurious xmlns:nsX="" generation, serialization bug (in + libxml2), a namespace copy problem, errors in the RPM spec prereqs
    • +
    • Windows path canonicalization and document cache fix (Igor)
    • +

    1.0.26: Feb 10 2003

      +
    • Fixed 3 serious bugs in document() and stylesheet compilation which + could lead to a crash
    • +

    1.0.25: Feb 5 2003

      +
    • Bug fix: double-free for standalone stylesheets introduced in 1.0.24, C + syntax pbm, 3 bugs reported by Eric van der Vlist
    • +
    • Some XPath and XInclude related problems were actually fixed in + libxml2-2.5.2
    • +
    • Documentation: emphasize taht --docbook is not for XML docs.
    • +

    1.0.24: Jan 14 2003

      +
    • bug fixes: imported global varables, python bindings (Stéphane Bidoul), + EXSLT memory leak (Charles Bozeman), namespace generation on + xsl:attribute, space handling with imports (Daniel Stodden), + extension-element-prefixes (Josh Parsons), comments within xsl:text (Matt + Sergeant), superfluous xmlns generation, XInclude related bug for + numbering, EXSLT strings (Alexey Efimov), attribute-sets computation on + imports, extension module init and shutdown callbacks not called
    • +
    • HP-UX portability (Alexey Efimov), Windows makefiles (Igor and Stephane + Bidoul), VMS makefile updates (Craig A. Berry)
    • +
    • adds xsltGetProfileInformation() (Michael Rothwell)
    • +
    • fix the API generation scripts
    • +
    • API to provide the sorting routines (Richard Jinks)
    • +
    • added XML description of the EXSLT API
    • +
    • added ESXLT URI (un)escaping (Jörg Walter)
    • +
    • Some memory leaks have been found and fixed
    • +
    • document() now support fragment identifiers in URIs
    • +

    1.0.23: Nov 17 2002

      +
    • Windows build cleanup (Igor)
    • +
    • Unix build and RPM packaging cleanup
    • +
    • Improvement of the python bindings: extension functions and activating + EXSLT
    • +
    • various bug fixes: number formatting, portability for bounded string + functions, CData nodes, key(), @*[...] patterns
    • +
    • Documentation improvements (John Fleck)
    • +
    • added libxslt.m4 (Thomas Schraitle)
    • +

    1.0.22: Oct 18 2002

      +
    • Updates on the Windows Makefiles
    • +
    • Added a security module, and a related set of new options to + xsltproc
    • +
    • Allowed per transformation error handler.
    • +
    • Fixed a few bugs: node() semantic, URI escaping, media-type, attribute + lists
    • +

    1.0.21: Sep 26 2002

      +
    • Bug fixes: match="node()", date:difference() (Igor and Charlie + Bozeman), disable-output-escaping
    • +
    • Python bindings: style.saveResultToString() from Ralf Mattes
    • +
    • Logos from Marc Liyanage
    • +
    • Mem leak fix from Nathan Myers
    • +
    • Makefile: DESTDIR fix from Christophe Merlet, AMD x86_64 (Mandrake), + Windows (Igor), Python detection
    • +
    • Documentation improvements: John Fleck
    • +

    1.0.20: Aug 23 2002

      +
    • Windows makefile updates (Igor) and x86-64 (Frederic Crozat)
    • +
    • fixed HTML meta tag saving for Mac/IE users
    • +
    • possible leak patches from Nathan Myers
    • +
    • try to handle document('') as best as possible depending in the + cases
    • +
    • Fixed the DocBook stylesheets handling problem
    • +
    • Fixed a few XSLT reported errors
    • +

    1.0.19: July 6 2002

      +
    • EXSLT: dynamic functions and date support bug fixes (Mark Vakoc)
    • +
    • xsl:number fix: Richard Jinks
    • +
    • xsl:format-numbers fix: Ken Neighbors
    • +
    • document('') fix: bug pointed by Eric van der Vlist
    • +
    • xsl:message with terminate="yes" fixes: William Brack
    • +
    • xsl:sort order support added: Ken Neighbors
    • +
    • a few other bug fixes, some of them requiring the latest version of + libxml2
    • +

    1.0.18: May 27 2002

      +
    • a number of bug fixes: attributes, extra namespace declarations + (DocBook), xsl:include crash (Igor), documentation (Christian Cornelssen, + Charles Bozeman and Geert Kloosterman), element-available (Richard + Jinks)
    • +
    • xsltproc can now list teh registered extensions thanks to Mark + Vakoc
    • +
    • there is a new API to save directly to a string + xsltSaveResultToString() by Morus Walter
    • +
    • specific error registration function for the python API
    • +

    1.0.17: April 29 2002

      +
    • cleanup in code, XSLT debugger support and Makefiles for Windows by + Igor
    • +
    • a C++ portability fix by Mark Vakoc
    • +
    • EXSLT date improvement and regression tests by Charles Bozeman
    • +
    • attempt to fix a bug in xsltProcessUserParamInternal
    • +

    1.0.16: April 15 2002

      +
    • Bug fixes: strip-space, URL in HTML output, error when xsltproc can't + save
    • +
    • portability fixes: OSF/1, IEEE on alphas, Windows, Python bindings
    • +

    1.0.15: Mar 25 2002

      +
    • Bugfixes: XPath, python Makefile, recursive attribute sets, @foo[..] + templates
    • +
    • Debug of memory alocation with valgind
    • +
    • serious profiling leading to significant improvement for DocBook + processing
    • +
    • revamp of the Windows build
    • +

    1.0.14: Mar 18 2002

      +
    • Improvement in the XPath engine (libxml2-2.4.18)
    • +
    • Nasty bug fix related to exslt:node-set
    • +
    • Fixed the python Makefiles, cleanup of doc comments, Windows + portability fixes
    • +

    1.0.13: Mar 8 2002

      +
    • a number of bug fixes including "namespace node have no parents"
    • +
    • Improvement of the Python bindings
    • +
    • Charles Bozeman provided fixes and regression tests for exslt date + functions.
    • +

    1.0.12: Feb 11 2002

      +
    • Fixed the makefiles especially the python module ones
    • +
    • half a dozen bugs fixes including 2 old ones
    • +

    1.0.11: Feb 8 2002

      +
    • Change of Licence to the MIT + Licence
    • +
    • Added a beta version of the Python bindings, including support to + extend the engine with functions written in Python
    • +
    • A number of bug fixes
    • +
    • Charlie Bozeman provided more EXSLT functions
    • +
    • Portability fixes
    • +

    1.0.10: Jan 14 2002

      +
    • Windows fixes for Win32 from Igor
    • +
    • Fixed the Solaris compilation trouble (Albert)
    • +
    • Documentation changes and updates: John Fleck
    • +
    • Added a stringparam option to avoid escaping hell at the shell + level
    • +
    • A few bug fixes
    • +

    1.0.9: Dec 7 2001

      +
    • Makefile patches from Peter Williams
    • +
    • attempt to fix the compilation problem associated to prelinking
    • +
    • obsoleted libxsltbreakpoint now deprecated and frozen to 1.0.8 API
    • +
    • xsltproc return codes are now significant, John Fleck updated the + documentation
    • +
    • patch to allow as much as 40 steps in patterns (Marc Tardif), should be + made dynamic really
    • +
    • fixed a bug raised by Nik Clayton when using doctypes with HTML + output
    • +
    • patches from Keith Isdale to interface with xsltdebugger
    • +

    1.0.8: Nov 26 2001

      +
    • fixed an annoying header problem, removed a few bugs and some code + cleanup
    • +
    • patches for Windows and update of Windows Makefiles by Igor
    • +
    • OpenVMS port instructions from John A Fotheringham
    • +
    • fixed some Makefiles annoyance and libraries prelinking + information
    • +

    1.0.7: Nov 10 2001

      +
    • remove a compilation problem with LIBXSLT_PUBLIC
    • +
    • Finishing the integration steps for Keith Isdale debugger
    • +
    • fixes the handling of indent="no" on HTML output
    • +
    • fixes on the configure script and RPM spec file
    • +

    1.0.6: Oct 30 2001

      +
    • bug fixes on number formatting (Thomas), date/time functions (Bruce + Miller)
    • +
    • update of the Windows Makefiles (Igor)
    • +
    • fixed DOCTYPE generation rules for HTML output (me)
    • +

    1.0.5: Oct 10 2001

      +
    • some portability fixes, including Windows makefile updates from + Igor
    • +
    • fixed a dozen bugs on XSLT and EXSLT (me and Thomas Broyer)
    • +
    • support for Saxon's evaluate and expressions extensions added (initial + contribution from Darren Graves)
    • +
    • better handling of XPath evaluation errors
    • +

    1.0.4: Sep 12 2001

      +
    • Documentation updates from John fleck
    • +
    • bug fixes (DocBook FO generation should be fixed) and portability + improvements
    • +
    • Thomas Broyer improved the existing EXSLT support and added String, + Time and Date core functions support
    • +

    1.0.3: Aug 23 2001

      +
    • XML Catalog support see the doc
    • +
    • New NaN/Infinity floating point code
    • +
    • A few bug fixes
    • +

    1.0.2: Aug 15 2001

      +
    • lot of bug fixes, increased the testsuite
    • +
    • a large chunk of EXSLT is implemented
    • +
    • improvements on the extension framework
    • +
    • documentation improvements
    • +
    • Windows MSC projects files should be up-to-date
    • +
    • handle attributes inherited from the DTD by default
    • +

    1.0.1: July 24 2001

      +
    • initial EXSLT framework
    • +
    • better error reporting
    • +
    • fixed the profiler on Windows
    • +
    • bug fixes
    • +

    1.0.0: July 10 2001

      +
    • a lot of cleanup, a lot of regression tests added or fixed
    • +
    • added a documentation for writing + extensions
    • +
    • fixed some variable evaluation problems (with William)
    • +
    • added profiling of stylesheet execution accessible as the xsltproc + --profile option
    • +
    • fixed element-available() and the implementation of the various + chunking methods present, Norm Walsh provided a lot of feedback
    • +
    • exclude-result-prefixes and namespaces output should now work as + expected
    • +
    • added support of embedded stylesheet as described in section 2.7 of the + spec
    • +

    0.14.0: July 5 2001

      +
    • lot of bug fixes, and code cleanup
    • +
    • completion of the little XSLT-1.0 features left unimplemented
    • +
    • Added and implemented the extension API suggested by Thomas Broyer
    • +
    • the Windows MSC environment should be complete
    • +
    • tested and optimized with a really large document (DocBook Definitive + Guide) libxml/libxslt should really be faster on serious workloads
    • +

    0.13.0: June 26 2001

      +
    • lots of cleanups
    • +
    • fixed a C++ compilation problem
    • +
    • couple of fixes to xsltSaveTo()
    • +
    • try to fix Docbook-xslt-1.4 and chunking, updated the regression test + with them
    • +
    • fixed pattern compilation and priorities problems
    • +
    • Patches for Windows and MSC project mostly contributed by Yon Derek
    • +
    • update to the Tutorial by John Fleck
    • +
    • William fixed bugs in templates and for-each functions
    • +
    • added a new interface xsltRunStylesheet() for a more flexible output + (incomplete), added -o option to xsltproc
    • +

    0.12.0: June 18 2001

      +
    • fixed a dozen of bugs reported
    • +
    • HTML generation should be quite better (requires libxml-2.3.11 upgrade + too)
    • +
    • William fixed some problems with document()
    • +
    • Fix namespace nodes selection and copy (requires libxml-2.3.11 upgrade + too)
    • +
    • John Fleck added a + tutorial
    • +
    • Fixes for namespace handling when evaluating variables
    • +
    • XInclude global flag added to process XInclude on document() if + requested
    • +
    • made xsltproc --version more detailed
    • +

    0.11.0: June 1 2001

    Mostly a bug fix release.

      +
    • integration of catalogs from xsltproc
    • +
    • added --version to xsltproc for bug reporting
    • +
    • fixed errors when handling ID in external parsed entities
    • +
    • document() should hopefully work correctly but ...
    • +
    • fixed bug with PI and comments processing
    • +
    • William fixed the XPath string functions when using unicode
    • +

    0.10.0: May 19 2001

      +
    • cleanups to make stylesheet read-only (not 100% complete)
    • +
    • fixed URI resolution in document()
    • +
    • force all XPath expression to be compiled at stylesheet parsing time, + even if unused ...
    • +
    • Fixed HTML default output detection
    • +
    • Fixed double attribute generation #54446
    • +
    • Fixed {{ handling in attributes #54451
    • +
    • More tests and speedups for DocBook document transformations
    • +
    • Fixed a really bad race like bug in xsltCopyTreeList()
    • +
    • added a documentation on the libxslt internals
    • +
    • William Brack and Bjorn Reese improved format-number()
    • +
    • Fixed multiple sort, it should really work now
    • +
    • added a --docbook option for SGML DocBook input (hackish)
    • +
    • a number of other bug fixes and regression test added as people were + submitting them
    • +

    0.9.0: May 3 2001

      +
    • lot of various bugfixes, extended the regression suite
    • +
    • xsltproc should work with multiple params
    • +
    • added an option to use xsltproc with HTML input
    • +
    • improved the stylesheet compilation, processing of complex stylesheets + should be faster
    • +
    • using the same stylesheet for concurrent processing on multithreaded + programs should work now
    • +
    • fixed another batch of namespace handling problems
    • +
    • Implemented multiple level of sorting
    • +

    0.8.0: Apr 22 2001

      +
    • fixed ansidecl.h problem
    • +
    • fixed unparsed-entity-uri() and generate-id()
    • +
    • sort semantic fixes and priority prob from William M. Brack
    • +
    • fixed namespace handling problems in XPath expression computations + (requires libxml-2.3.7)
    • +
    • fixes to current() and key()
    • +
    • other, smaller fixes, lots of testing with N Walsh DocBook HTML + stylesheets
    • +

    0.7.0: Apr 10 2001

      +
    • cleanup using stricter compiler flags
    • +
    • command line parameter passing
    • +
    • fix to xsltApplyTemplates from William M. Brack
    • +
    • added the XSLTMark in the regression tests as well as document()
    • +

    0.6.0: Mar 22 2001

      +
    • another beta
    • +
    • requires 2.3.5, which provide XPath expression compilation support
    • +
    • document() extension should function properly
    • +
    • fixed a number or reported bugs
    • +

    0.5.0: Mar 10 2001

      +
    • fifth beta
    • +
    • some optimization work, for the moment 2 XSLT transform cannot use the + same stylesheet at the same time (to be fixed)
    • +
    • fixed problems with handling of tree results
    • +
    • fixed a reported strip-spaces problem
    • +
    • added more reported/fixed bugs to the test suite
    • +
    • incorporated William M. Brack fix for imports and global variables as + well as patch for with-param support in apply-templates
    • +
    • a bug fix on for-each
    • +

    0.4.0: Mar 1 2001

      +
    • fourth beta test, released at the same time of libxml2-2.3.3
    • +
    • bug fixes
    • +
    • some optimization
    • +
    • started implement extension support, not finished
    • +
    • implemented but not tested multiple file output
    • +

    0.3.0: Feb 24 2001

      +
    • third beta test, released at the same time of libxml2-2.3.2
    • +
    • lot of bug fixes
    • +
    • some optimization
    • +
    • added DocBook XSL based testsuite
    • +

    0.2.0: Feb 15 2001

      +
    • second beta version, released at the same time as libxml2-2.3.1
    • +
    • getting close to feature completion, lot of bug fixes, some in the HTML + and XPath support of libxml
    • +
    • start becoming usable for real work. This version can now regenerate + the XML 2e HTML from the original XML sources and the associated + stylesheets (in section I of the XML + REC)
    • +
    • Still misses extension element/function/prefixes support. Support of + key() and document() is not complete
    • +

    0.1.0: Feb 8 2001

      +
    • first beta version, released at the same time as libxml2-2.3.0
    • +
    • lots of bug fixes, first "testing" version, but incomplete
    • +

    0.0.1: Jan 25 2001

      +
    • first alpha version released at the same time as libxml2-2.2.12
    • +
    • Framework in place, should work on simple examples, but far from being + feature complete
    • +

    Daniel Veillard

    diff --git a/doc/news.xsl b/doc/news.xsl new file mode 100644 index 0000000..4ec2bc5 --- /dev/null +++ b/doc/news.xsl @@ -0,0 +1,44 @@ + + + + + + + NEWS file for libxslt + + Note that this is automatically generated from the news webpage at: + http://xmlsoft.org/XSLT/news.html + + + + + + + + + : + + + + + + + + + - + + + + + + + at + + + + + + + diff --git a/doc/node.fig b/doc/node.fig new file mode 100644 index 0000000..aaed2d4 --- /dev/null +++ b/doc/node.fig @@ -0,0 +1,91 @@ +#FIG 3.2 +Landscape +Center +Inches +Letter +100.00 +Single +-2 +1200 2 +6 825 6675 2925 7350 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 4 + 825 6975 825 6675 2925 6675 2925 6975 +2 1 3 1 0 7 50 0 -1 3.000 0 0 -1 0 0 2 + 825 7050 825 7350 +2 1 3 1 0 7 50 0 -1 3.000 0 0 -1 0 0 2 + 2925 7050 2925 7350 +-6 +6 4500 6675 6600 7350 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 4 + 4500 6975 4500 6675 6600 6675 6600 6975 +2 1 3 1 0 7 50 0 -1 3.000 0 0 -1 0 0 2 + 4500 7050 4500 7350 +2 1 3 1 0 7 50 0 -1 3.000 0 0 -1 0 0 2 + 6600 7050 6600 7350 +-6 +6 1275 150 3375 825 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 4 + 1275 525 1275 825 3375 825 3375 525 +2 1 3 1 0 7 50 0 -1 3.000 0 0 -1 0 0 2 + 1275 450 1275 150 +2 1 3 1 0 7 50 0 -1 3.000 0 0 -1 0 0 2 + 3375 450 3375 150 +-6 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 2400 2025 4500 2025 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 2400 2400 4500 2400 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 2400 3150 4500 3150 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 2400 3525 4500 3525 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 2400 3900 4500 3900 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 2400 4275 4500 4275 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 2400 4650 4500 4650 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 2400 2775 4500 2775 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 2400 5025 4500 5025 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 4 + 975 1575 1725 1575 1725 5625 1125 5625 +2 1 3 1 0 7 50 0 -1 3.000 0 0 -1 0 0 2 + 600 1575 900 1575 +2 1 3 1 0 7 50 0 -1 3.000 0 0 -1 0 0 2 + 750 5625 1050 5625 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 4 + 5925 1575 5175 1575 5175 5625 5775 5625 +2 1 3 1 0 7 50 0 -1 3.000 0 0 -1 0 0 2 + 6300 1575 6000 1575 +2 1 3 1 0 7 50 0 -1 3.000 0 0 -1 0 0 2 + 6150 5625 5850 5625 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 2400 1575 4500 1575 4500 5625 2400 5625 2400 1575 +2 1 0 3 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 3.00 180.00 360.00 + 2700 3300 1725 3300 +2 1 0 3 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 3.00 180.00 360.00 + 3975 2925 5175 2925 +2 1 0 3 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 3.00 180.00 360.00 + 2700 2625 2700 825 +2 1 0 3 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 3.00 180.00 360.00 + 2700 3750 1575 6675 +2 1 0 3 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 3.00 180.00 360.00 + 3975 4125 5475 6675 +4 0 0 50 0 0 18 0.0000 4 255 915 2850 1875 _private\001 +4 0 0 50 0 0 18 0.0000 4 225 465 2850 2250 type\001 +4 0 0 50 0 0 18 0.0000 4 135 255 2850 4500 ns\001 +4 0 0 50 0 0 18 0.0000 4 255 1125 2850 4875 properties\001 +4 0 0 50 0 0 18 0.0000 4 165 855 2850 5325 content\001 +4 0 0 50 0 0 18 0.0000 4 30 180 2850 5550 ...\001 +4 0 0 50 0 0 18 0.0000 4 195 495 2850 3375 prev\001 +4 0 0 50 0 0 18 0.0000 4 195 390 2850 4200 last\001 +4 0 0 50 0 0 18 0.0000 4 165 495 2850 3000 next\001 +4 0 0 50 0 0 18 0.0000 4 195 930 2850 3825 children\001 +4 0 0 50 0 0 18 0.0000 4 225 720 2850 2625 parent\001 diff --git a/doc/node.gif b/doc/node.gif new file mode 100644 index 0000000..158e921 Binary files /dev/null and b/doc/node.gif differ diff --git a/doc/object.fig b/doc/object.fig new file mode 100644 index 0000000..2955bbd --- /dev/null +++ b/doc/object.fig @@ -0,0 +1,90 @@ +#FIG 3.2 +Landscape +Center +Inches +Letter +100.00 +Single +-2 +1200 2 +6 5700 1950 6525 3450 +2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 + 5700 1950 6525 1950 6525 3450 5700 3450 5700 1950 +2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 + 5700 2250 6525 2250 +2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 + 5700 2550 6525 2550 +2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 + 5700 2850 6525 2850 +2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 + 5700 3150 6525 3150 +-6 +2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 + 450 1875 2100 1875 +2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 + 450 1275 2100 1275 +2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 + 450 1575 2100 1575 +2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 + 450 2175 2100 2175 +2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 + 450 975 2100 975 2100 3300 450 3300 450 975 +2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 + 450 2550 2100 2550 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 1950 1425 3525 1425 +2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 + 3525 1500 4800 1500 +2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 + 3525 1800 4800 1800 +2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 + 3525 1200 4800 1200 4800 2100 3525 2100 3525 1200 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 4725 1950 5700 1950 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 6150 2100 7050 1875 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 6150 2400 8025 2025 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 6150 2700 7650 2700 +2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 + 8025 825 8475 825 8475 1275 8025 1275 8025 825 +2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 + 8475 2400 8925 2400 8925 2850 8475 2850 8475 2400 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 2 + 8250 1275 8250 1650 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 2 + 8025 1275 7500 1650 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 2 + 8250 2100 7875 2400 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 2 + 8325 2100 8550 2400 +2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 + 9000 1650 9450 1650 9450 2100 9000 2100 9000 1650 +2 2 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 5 + 9225 2400 9675 2400 9675 2850 9225 2850 9225 2400 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 2 + 9225 2100 9375 2400 +2 1 0 2 0 7 50 0 -1 6.000 0 0 -1 0 0 2 + 8475 1275 9150 1650 +2 2 0 2 1 1 50 0 20 6.000 0 0 7 0 0 5 + 8025 1650 8475 1650 8475 2100 8025 2100 8025 1650 +2 2 0 2 1 1 50 0 20 6.000 0 0 7 0 0 5 + 7650 2400 8100 2400 8100 2850 7650 2850 7650 2400 +2 2 0 2 1 1 50 0 20 6.000 0 0 7 0 0 5 + 7050 1650 7500 1650 7500 2100 7050 2100 7050 1650 +4 0 0 50 0 0 18 0.0000 4 255 1875 375 825 xmlXPathObject\001 +4 0 0 50 0 0 18 0.0000 4 225 465 675 1200 type\001 +4 0 0 50 0 0 18 0.0000 4 195 1185 675 1500 nodesetval\001 +4 0 0 50 0 0 18 0.0000 4 195 810 675 1800 boolval\001 +4 0 0 50 0 0 18 0.0000 4 195 840 675 2115 floatval\001 +4 0 0 50 0 0 18 0.0000 4 255 975 675 2430 stringval\001 +4 0 0 50 0 0 18 0.0000 4 195 840 3750 1425 nodeNr\001 +4 0 0 50 0 0 18 0.0000 4 195 1035 3750 1740 nodeMax\001 +4 0 0 50 0 0 18 0.0000 4 195 975 3750 2055 nodeTab\001 +4 0 -1 50 0 0 18 0.0000 4 195 1380 3450 1050 xmlNodeSet\001 diff --git a/doc/object.gif b/doc/object.gif new file mode 100644 index 0000000..f8cc295 Binary files /dev/null and b/doc/object.gif differ diff --git a/doc/processing.fig b/doc/processing.fig new file mode 100644 index 0000000..b2c214e --- /dev/null +++ b/doc/processing.fig @@ -0,0 +1,137 @@ +#FIG 3.2 +Landscape +Center +Inches +Letter +100.00 +Single +-2 +1200 2 +6 5850 225 9675 4500 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 7050 450 7575 450 7575 975 7050 975 7050 450 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 6225 1275 6750 1275 6750 1800 6225 1800 6225 1275 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 6225 2175 6750 2175 6750 2700 6225 2700 6225 2175 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 7350 2175 7875 2175 7875 2700 7350 2700 7350 2175 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 8550 1350 9075 1350 9075 1875 8550 1875 8550 1350 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 7350 975 6750 1275 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 6525 1800 6525 2175 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 6750 1575 8550 1575 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 6750 2475 7350 2475 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 7650 2700 7650 3225 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 8175 3225 8700 3225 8700 3750 8175 3750 8175 3225 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 7425 3225 7950 3225 7950 3750 7425 3750 7425 3225 +3 1 0 1 0 7 50 0 -1 0.000 0 0 0 10 + 7650 225 6675 300 6075 1050 5850 2400 6150 3525 7800 4500 + 9375 4200 9675 2400 9375 1050 8400 375 + 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 + 1.000 1.000 +4 0 0 50 0 0 18 0.0000 4 195 720 6150 3075 html:a\001 +4 0 0 50 0 0 18 0.0000 4 195 705 8475 2250 TEXT\001 +4 0 0 50 0 0 18 0.0000 4 195 705 8100 4125 TEXT\001 +-6 +2 3 0 2 0 7 50 0 -1 0.000 0 0 0 0 0 7 + 4875 2400 5180 1878 4880 1353 4275 1350 3970 1872 4270 2397 + 4875 2400 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 1425 600 1950 600 1950 1125 1425 1125 1425 600 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 450 1650 975 1650 975 2175 450 2175 450 1650 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 1500 1650 2025 1650 2025 2175 1500 2175 1500 1650 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 450 2775 975 2775 975 3300 450 3300 450 2775 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 1500 2775 2025 2775 2025 3300 1500 3300 1500 2775 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 2550 2775 3075 2775 3075 3300 2550 3300 2550 2775 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 1725 1125 975 1650 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 975 1875 1500 1875 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 750 2175 750 2775 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 1800 2175 1800 2775 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 2025 3075 2550 3075 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 5175 6525 5700 6525 5700 7050 5175 7050 5175 6525 +2 2 0 1 1 1 50 0 20 0.000 0 0 -1 0 0 5 + 4800 3900 5325 3900 5325 4425 4800 4425 4800 3900 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 4800 4425 4425 4875 +2 2 0 1 1 1 50 0 20 0.000 0 0 -1 0 0 5 + 3225 5625 3750 5625 3750 6150 3225 6150 3225 5625 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 4125 6525 4650 6525 4650 7050 4125 7050 4125 6525 +2 2 0 1 1 1 50 0 20 0.000 0 0 -1 0 0 5 + 3075 6525 3600 6525 3600 7050 3075 7050 3075 6525 +2 2 0 1 1 1 50 0 20 0.000 0 0 -1 0 0 5 + 5175 5625 5700 5625 5700 6150 5175 6150 5175 5625 +2 2 0 1 1 1 50 0 20 0.000 0 0 -1 0 0 5 + 4200 4875 4725 4875 4725 5400 4200 5400 4200 4875 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 4200 5400 3750 5625 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 3450 6150 3300 6525 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 3750 5925 5175 5925 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 3600 6750 4125 6750 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 5475 6150 5475 6525 +2 1 0 3 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 3.00 180.00 360.00 + 4650 3675 4650 2400 +2 1 0 3 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 3.00 180.00 360.00 + 5175 1875 6150 1875 +2 1 0 3 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 3.00 180.00 360.00 + 2625 1875 3975 1875 +3 1 0 1 0 7 50 0 -1 0.000 0 0 0 10 + 1650 300 825 525 225 1350 150 2850 675 3825 2325 3975 + 3375 3450 3675 2325 2625 975 2025 300 + 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 + 1.000 1.000 +3 1 0 1 0 7 50 0 -1 0.000 0 0 0 10 + 4725 3300 3600 3600 2700 4350 2475 5550 2625 7275 4275 7875 + 6000 7725 7200 6375 6675 4575 5775 3525 + 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 + 1.000 1.000 +4 0 0 50 0 0 18 0.0000 4 255 1470 3225 4200 xsl:stylesheet\001 +4 0 0 50 0 0 18 0.0000 4 255 1350 4800 5175 xsl:template\001 +4 0 0 50 0 0 18 0.0000 4 195 720 4125 6450 html:a\001 +4 0 0 50 0 0 18 0.0000 4 195 705 5400 7350 TEXT\001 +4 0 0 50 0 0 20 0.0000 4 285 2115 3525 1200 XSLT Processing\001 +4 0 0 50 0 0 18 0.0000 4 255 1140 1350 5250 Stylesheet\001 +4 0 0 50 0 0 18 0.0000 4 195 1935 4575 525 Result Document\001 +4 0 0 50 0 0 18 0.0000 4 195 1995 2250 525 Source Document\001 diff --git a/doc/processing.gif b/doc/processing.gif new file mode 100644 index 0000000..5533f89 Binary files /dev/null and b/doc/processing.gif differ diff --git a/doc/python.html b/doc/python.html new file mode 100644 index 0000000..50fc1fb --- /dev/null +++ b/doc/python.html @@ -0,0 +1,173 @@ + + +Python and bindings
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Python and bindings

    Main Menu
    Related links
    API Indexes

    There is a number of language bindings and wrappers available for libxml2, +the list below is not exhaustive. Please contact the xml-bindings@gnome.org +(archives) in +order to get updates to this list or to discuss the specific topic of libxml2 +or libxslt wrappers or bindings:

    The libxslt Python module depends on the libxml2 Python module.

    The distribution includes a set of Python bindings, which are guaranteed to +be maintained as part of the library in the future, though the Python +interface have not yet reached the completeness of the C API.

    Stéphane Bidoul +maintains a Windows port +of the Python bindings.

    Note to people interested in building bindings, the API is formalized as +an XML API description file which allows to +automate a large part of the Python bindings, this includes function +descriptions, enums, structures, typedefs, etc... The Python script used to +build the bindings is python/generator.py in the source distribution.

    To install the Python bindings there are 2 options:

    The distribution includes a set of examples and regression tests for the +python bindings in the python/tests directory. Here are some +excepts from those tests:

    basic.py:

    This is a basic test of XSLT interfaces: loading a stylesheet and a +document, transforming the document and saving the result.

    import libxml2
    +import libxslt
    +
    +styledoc = libxml2.parseFile("test.xsl")
    +style = libxslt.parseStylesheetDoc(styledoc)
    +doc = libxml2.parseFile("test.xml")
    +result = style.applyStylesheet(doc, None)
    +style.saveResultToFilename("foo", result, 0)
    +style.freeStylesheet()
    +doc.freeDoc()
    +result.freeDoc()

    The Python module is called libxslt, you will also need the libxml2 module +for the operations on XML trees. Let's have a look at the objects manipulated +in that example and how is the processing done:

      +
    • styledoc : is a libxml2 document tree. It is obtained by + parsing the XML file "test.xsl" containing the stylesheet.
    • +
    • style : this is a precompiled stylesheet ready to be used + by the following transformations (note the plural form, multiple + transformations can resuse the same stylesheet).
    • +
    • doc : this is the document to apply the transformation to. + In this case it is simply generated by parsing it from a file but any + other processing is possible as long as one get a libxml2 Doc. Note that + HTML tree are suitable for XSLT processing in libxslt. This is actually + how this page is generated !
    • +
    • result : this is a document generated by applying the + stylesheet to the document. Note that some of the stylesheet information + may be related to the serialization of that document and as in this + example a specific saveResultToFilename() method of the stylesheet should + be used to save it to a file (in that case to "foo").
    • +

    Also note the need to explicitely deallocate documents with freeDoc() +except for the stylesheet document which is freed when its compiled form is +garbage collected.

    extfunc.py:

    This one is a far more complex test. It shows how to modify the behaviour +of an XSLT transformation by passing parameters and how to extend the XSLT +engine with functions defined in python:

    import libxml2
    +import libxslt
    +import string
    +
    +nodeName = None
    +def f(ctx, str):
    +    global nodeName
    +
    +    #
    +    # Small check to verify the context is correcly accessed
    +    #
    +    try:
    +        pctxt = libxslt.xpathParserContext(_obj=ctx)
    +        ctxt = pctxt.context()
    +        tctxt = ctxt.transformContext()
    +        nodeName = tctxt.insertNode().name
    +    except:
    +        pass
    +
    +    return string.upper(str)
    +
    +libxslt.registerExtModuleFunction("foo", "http://example.com/foo", f)

    This code defines and register an extension function. Note that the +function can be bound to any name (foo) and how the binding is also +associated to a namespace name "http://example.com/foo". From an XSLT point +of view the function just returns an upper case version of the string passed +as a parameter. But the first part of the function also read some contextual +information from the current XSLT processing environement, in that case it +looks for the current insertion node in the resulting output (either the +resulting document or the Result Value Tree being generated), and saves it to +a global variable for checking that the access actually worked.

    For more information on the xpathParserContext and transformContext +objects check the libray internals description. +The pctxt is actually an object from a class derived from the +libxml2.xpathParserContext() with just a couple more properties including the +possibility to look up the XSLT transformation context from the XPath +context.

    styledoc = libxml2.parseDoc("""
    +<xsl:stylesheet version='1.0'
    +  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
    +  xmlns:foo='http://example.com/foo'
    +  xsl:exclude-result-prefixes='foo'>
    +
    +  <xsl:param name='bar'>failure</xsl:param>
    +  <xsl:template match='/'>
    +    <article><xsl:value-of select='foo:foo($bar)'/></article>
    +  </xsl:template>
    +</xsl:stylesheet>
    +""")

    Here is a simple example of how to read an XML document from a python +string with libxml2. Note how this stylesheet:

      +
    • Uses a global parameter bar
    • +
    • Reference the extension function f
    • +
    • how the Namespace name "http://example.com/foo" has to be bound to a + prefix
    • +
    • how that prefix is excluded from the output
    • +
    • how the function is called from the select
    • +
    style = libxslt.parseStylesheetDoc(styledoc)
    +doc = libxml2.parseDoc("<doc/>")
    +result = style.applyStylesheet(doc, { "bar": "'success'" })
    +style.freeStylesheet()
    +doc.freeDoc()

    that part is identical, to the basic example except that the +transformation is passed a dictionary of parameters. Note that the string +passed "success" had to be quoted, otherwise it is interpreted as an XPath +query for the childs of root named "success".

    root = result.children
    +if root.name != "article":
    +    print "Unexpected root node name"
    +    sys.exit(1)
    +if root.content != "SUCCESS":
    +    print "Unexpected root node content, extension function failed"
    +    sys.exit(1)
    +if nodeName != 'article':
    +    print "The function callback failed to access its context"
    +    sys.exit(1)
    +
    +result.freeDoc()

    That part just verifies that the transformation worked, that the parameter +got properly passed to the engine, that the function f() got called and that +it properly accessed the context to find the name of the insertion node.

    pyxsltproc.py:

    this module is a bit too long to be described there but it is basically a +rewrite of the xsltproc command line interface of libxslt in Python. It +provides nearly all the functionalities of xsltproc and can be used as a base +module to write Python customized XSLT processors. One of the thing to notice +are:

    libxml2.lineNumbersDefault(1)
    +libxml2.substituteEntitiesDefault(1)

    those two calls in the main() function are needed to force the libxml2 +processor to generate DOM trees compliant with the XPath data model.

    Daniel Veillard

    diff --git a/doc/redhat.gif b/doc/redhat.gif new file mode 100644 index 0000000..eff3d73 Binary files /dev/null and b/doc/redhat.gif differ diff --git a/doc/search.php b/doc/search.php new file mode 100644 index 0000000..9deb2ce --- /dev/null +++ b/doc/search.php @@ -0,0 +1,346 @@ + +Search engine
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Search engine

    Main Menu
    Related links
    API Indexes
    + +Search the documentation on XMLSoft.org"; + } + if ($scope == NULL) + $scope = "any"; + $scope = ltrim ($scope); + if ($scope == "") + $scope = "any"; + +?> +

    The search service indexes the libxml2 and libxslt APIs and documentation as well as the xml@gnome.org and xslt@gnome.org mailing-list archives. To use it simply provide a set of keywords: +

    +

    + + + +
    + $rb) ? -1 : 1; + } + if (($query) && (strlen($query) <= 50)) { + $link = mysql_connect ("localhost", "nobody"); + if (!$link) { + echo "

    Could not connect to the database: ", mysql_error(); + } else { + mysql_select_db("xmlsoft", $link); + $list = explode (" ", $query); + $results = array(); + $number = 0; + for ($number = 0;$number < count($list);$number++) { + + $word = $list[$number]; + if (($scope == 'any') || ($scope == 'XML') || + ($scope == 'API') || ($scope == 'XMLAPI')) { + list($result, $j) = queryWord($word); + if ($j > 0) { + for ($i = 0; $i < $j; $i++) { + $relevance = mysql_result($result, $i, 0); + $name = mysql_result($result, $i, 1); + $type = mysql_result($result, $i, 2); + $module = mysql_result($result, $i, 3); + $desc = mysql_result($result, $i, 4); + if (array_key_exists($name, $results)) { + list($r,$t,$m,$d,$w,$u) = $results[$name]; + $results[$name] = array(($r + $relevance) * 2, + $t,$m,$d,$w,$u); + } else { + $id = strtoupper($name); +// $m = strtolower($module); + $m = $module; + $url = "../html/libxml-$m.html#$id"; + $results[$name] = array($relevance,$type, + $module, $desc, $name, $url); + } + } + mysql_free_result($result); + } + } + if (($scope == 'any') || ($scope == 'XSLT') || + ($scope == 'API') || ($scope == 'XSLTAPI')) { + list($result, $j) = XSLTqueryWord($word); + if ($j > 0) { + for ($i = 0; $i < $j; $i++) { + $relevance = mysql_result($result, $i, 0); + $name = mysql_result($result, $i, 1); + $type = mysql_result($result, $i, 2); + $module = mysql_result($result, $i, 3); + $desc = mysql_result($result, $i, 4); + if (array_key_exists($name, $results)) { + list($r,$t,$m,$d,$w,$u) = $results[$name]; + $results[$name] = array(($r + $relevance) * 2, + $t,$m,$d,$w,$u); + } else { + $id = strtoupper($name); +// $m = strtolower($module); + $m = $module; + $url = "html/libxslt-$m.html#$id"; + $results[$name] = array($relevance,$type, + $module, $desc, $name, $url); + } + } + mysql_free_result($result); + } + } + if (($scope == 'any') || ($scope == 'XML') || + ($scope == 'DOCS') || ($scope == 'XMLDOC')) { + list($result, $k) = queryHTMLWord($word); + if ($k > 0) { + for ($i = 0; $i < $k; $i++) { + $relevance = mysql_result($result, $i, 0); + $name = mysql_result($result, $i, 1); + $id = mysql_result($result, $i, 2); + $module = mysql_result($result, $i, 3); + $desc = mysql_result($result, $i, 4); + $url = $module; + if ($id != "") { + $url = $url + "#$id"; + } + $results["$name _html_ $number _ $i"] = + array($relevance, "XML docs", + $module, $desc, $name, $url); + } + mysql_free_result($result); + } + } + if (($scope == 'any') || ($scope == 'XSLT') || + ($scope == 'DOCS') || ($scope == 'XSLTDOC')) { + list($result, $k) = XSLTqueryHTMLWord($word); + if ($k > 0) { + for ($i = 0; $i < $k; $i++) { + $relevance = mysql_result($result, $i, 0); + $name = mysql_result($result, $i, 1); + $id = mysql_result($result, $i, 2); + $module = mysql_result($result, $i, 3); + $desc = mysql_result($result, $i, 4); + $url = "$module"; + if ($id != "") { + $url = $url + "#$id"; + } + $results["$name xslthtml $number _ $i "] = + array($relevance, "XSLT docs", + $module, $desc, $name, $url); + } + mysql_free_result($result); + } + } + if (($scope == 'any') || ($scope == 'XML') || + ($scope == 'LISTS') || ($scope == 'XMLLIST')) { + list($result, $j) = queryArchiveWord($word); + if ($j > 0) { + for ($i = 0; $i < $j; $i++) { + $relevance = mysql_result($result, $i, 0); + $name = mysql_result($result, $i, 1); + $type = mysql_result($result, $i, 2); + $url = mysql_result($result, $i, 3); + $desc = mysql_result($result, $i, 4); + if (array_key_exists($url, $results)) { + list($r,$t,$m,$d,$w,$u) = $results[$url]; + $results[$name] = array(($r + $relevance) * 2, + $t,$m,$d,$w,$u); + } else { + $id = strtoupper($name); +// $m = strtolower($module); + $m = $module; + $u = str_replace( + "http://mail.gnome.org/archives/xml/", "", $url); + $results[$url] = array($relevance,$type, + $u, $desc, $name, $url); + } + } + mysql_free_result($result); + } + } + if (($scope == 'any') || ($scope == 'XSLT') || + ($scope == 'LISTS') || ($scope == 'XSLTLIST')) { + list($result, $j) = XSLTqueryArchiveWord($word); + if ($j > 0) { + for ($i = 0; $i < $j; $i++) { + $relevance = mysql_result($result, $i, 0); + $name = mysql_result($result, $i, 1); + $type = mysql_result($result, $i, 2); + $url = mysql_result($result, $i, 3); + $desc = mysql_result($result, $i, 4); + if (array_key_exists($url, $results)) { + list($r,$t,$m,$d,$w,$u) = $results[$url]; + $results[$name] = array(($r + $relevance) * 2, + $t,$m,$d,$w,$u); + } else { + $id = strtoupper($name); +// $m = strtolower($module); + $m = $module; + $u = str_replace( + "http://mail.gnome.org/archives/xslt/", "", $url); + $results[$url] = array($relevance,$type, + $u, $desc, $name, $url); + } + } + mysql_free_result($result); + } + } + if (($j <= 0) && ($k <= 0)) { + echo "

    No result found for $word\n"; + } + } + mysql_close($link); + $nb = count($results); + echo "

    Found $nb results for query $query

    \n"; + usort($results, "resSort"); + + if ($nb > 0) { + printf("\n"); + printf("\n"); + $i = 0; + while (list ($name, $val) = each ($results)) { + list($r,$t,$m,$d,$s,$u) = $val; + $m = str_replace("<", "<", $m); + $s = str_replace("<", "<", $s); + $d = str_replace("<", "<", $d); + echo ""; + $i = $i + 1; + if ($i > 75) + break; + } + printf("
    QualitySymbolTypemoduleDescription
    $r$s$t$m$d
    \n"); + } + } + } +?> + +

    Daniel Veillard

    diff --git a/doc/search.php.inc b/doc/search.php.inc new file mode 100644 index 0000000..f9db689 --- /dev/null +++ b/doc/search.php.inc @@ -0,0 +1,333 @@ +Search the documentation on XMLSoft.org"; + } + if ($scope == NULL) + $scope = "any"; + $scope = ltrim ($scope); + if ($scope == "") + $scope = "any"; + +?> +

    The search service indexes the libxml2 and libxslt APIs and documentation as well as the xml@gnome.org and xslt@gnome.org mailing-list archives. To use it simply provide a set of keywords: +

    +

    + + + +
    + $rb) ? -1 : 1; + } + if (($query) && (strlen($query) <= 50)) { + $link = mysql_connect ("localhost", "nobody"); + if (!$link) { + echo "

    Could not connect to the database: ", mysql_error(); + } else { + mysql_select_db("xmlsoft", $link); + $list = explode (" ", $query); + $results = array(); + $number = 0; + for ($number = 0;$number < count($list);$number++) { + + $word = $list[$number]; + if (($scope == 'any') || ($scope == 'XML') || + ($scope == 'API') || ($scope == 'XMLAPI')) { + list($result, $j) = queryWord($word); + if ($j > 0) { + for ($i = 0; $i < $j; $i++) { + $relevance = mysql_result($result, $i, 0); + $name = mysql_result($result, $i, 1); + $type = mysql_result($result, $i, 2); + $module = mysql_result($result, $i, 3); + $desc = mysql_result($result, $i, 4); + if (array_key_exists($name, $results)) { + list($r,$t,$m,$d,$w,$u) = $results[$name]; + $results[$name] = array(($r + $relevance) * 2, + $t,$m,$d,$w,$u); + } else { + $id = strtoupper($name); +// $m = strtolower($module); + $m = $module; + $url = "../html/libxml-$m.html#$id"; + $results[$name] = array($relevance,$type, + $module, $desc, $name, $url); + } + } + mysql_free_result($result); + } + } + if (($scope == 'any') || ($scope == 'XSLT') || + ($scope == 'API') || ($scope == 'XSLTAPI')) { + list($result, $j) = XSLTqueryWord($word); + if ($j > 0) { + for ($i = 0; $i < $j; $i++) { + $relevance = mysql_result($result, $i, 0); + $name = mysql_result($result, $i, 1); + $type = mysql_result($result, $i, 2); + $module = mysql_result($result, $i, 3); + $desc = mysql_result($result, $i, 4); + if (array_key_exists($name, $results)) { + list($r,$t,$m,$d,$w,$u) = $results[$name]; + $results[$name] = array(($r + $relevance) * 2, + $t,$m,$d,$w,$u); + } else { + $id = strtoupper($name); +// $m = strtolower($module); + $m = $module; + $url = "html/libxslt-$m.html#$id"; + $results[$name] = array($relevance,$type, + $module, $desc, $name, $url); + } + } + mysql_free_result($result); + } + } + if (($scope == 'any') || ($scope == 'XML') || + ($scope == 'DOCS') || ($scope == 'XMLDOC')) { + list($result, $k) = queryHTMLWord($word); + if ($k > 0) { + for ($i = 0; $i < $k; $i++) { + $relevance = mysql_result($result, $i, 0); + $name = mysql_result($result, $i, 1); + $id = mysql_result($result, $i, 2); + $module = mysql_result($result, $i, 3); + $desc = mysql_result($result, $i, 4); + $url = $module; + if ($id != "") { + $url = $url + "#$id"; + } + $results["$name _html_ $number _ $i"] = + array($relevance, "XML docs", + $module, $desc, $name, $url); + } + mysql_free_result($result); + } + } + if (($scope == 'any') || ($scope == 'XSLT') || + ($scope == 'DOCS') || ($scope == 'XSLTDOC')) { + list($result, $k) = XSLTqueryHTMLWord($word); + if ($k > 0) { + for ($i = 0; $i < $k; $i++) { + $relevance = mysql_result($result, $i, 0); + $name = mysql_result($result, $i, 1); + $id = mysql_result($result, $i, 2); + $module = mysql_result($result, $i, 3); + $desc = mysql_result($result, $i, 4); + $url = "$module"; + if ($id != "") { + $url = $url + "#$id"; + } + $results["$name xslthtml $number _ $i "] = + array($relevance, "XSLT docs", + $module, $desc, $name, $url); + } + mysql_free_result($result); + } + } + if (($scope == 'any') || ($scope == 'XML') || + ($scope == 'LISTS') || ($scope == 'XMLLIST')) { + list($result, $j) = queryArchiveWord($word); + if ($j > 0) { + for ($i = 0; $i < $j; $i++) { + $relevance = mysql_result($result, $i, 0); + $name = mysql_result($result, $i, 1); + $type = mysql_result($result, $i, 2); + $url = mysql_result($result, $i, 3); + $desc = mysql_result($result, $i, 4); + if (array_key_exists($url, $results)) { + list($r,$t,$m,$d,$w,$u) = $results[$url]; + $results[$name] = array(($r + $relevance) * 2, + $t,$m,$d,$w,$u); + } else { + $id = strtoupper($name); +// $m = strtolower($module); + $m = $module; + $u = str_replace( + "http://mail.gnome.org/archives/xml/", "", $url); + $results[$url] = array($relevance,$type, + $u, $desc, $name, $url); + } + } + mysql_free_result($result); + } + } + if (($scope == 'any') || ($scope == 'XSLT') || + ($scope == 'LISTS') || ($scope == 'XSLTLIST')) { + list($result, $j) = XSLTqueryArchiveWord($word); + if ($j > 0) { + for ($i = 0; $i < $j; $i++) { + $relevance = mysql_result($result, $i, 0); + $name = mysql_result($result, $i, 1); + $type = mysql_result($result, $i, 2); + $url = mysql_result($result, $i, 3); + $desc = mysql_result($result, $i, 4); + if (array_key_exists($url, $results)) { + list($r,$t,$m,$d,$w,$u) = $results[$url]; + $results[$name] = array(($r + $relevance) * 2, + $t,$m,$d,$w,$u); + } else { + $id = strtoupper($name); +// $m = strtolower($module); + $m = $module; + $u = str_replace( + "http://mail.gnome.org/archives/xslt/", "", $url); + $results[$url] = array($relevance,$type, + $u, $desc, $name, $url); + } + } + mysql_free_result($result); + } + } + if (($j <= 0) && ($k <= 0)) { + echo "

    No result found for $word\n"; + } + } + mysql_close($link); + $nb = count($results); + echo "

    Found $nb results for query $query

    \n"; + usort($results, "resSort"); + + if ($nb > 0) { + printf("\n"); + printf("\n"); + $i = 0; + while (list ($name, $val) = each ($results)) { + list($r,$t,$m,$d,$s,$u) = $val; + $m = str_replace("<", "<", $m); + $s = str_replace("<", "<", $s); + $d = str_replace("<", "<", $d); + echo ""; + $i = $i + 1; + if ($i > 75) + break; + } + printf("
    QualitySymbolTypemoduleDescription
    $r$s$t$m$d
    \n"); + } + } + } +?> diff --git a/doc/search.templ b/doc/search.templ new file mode 100644 index 0000000..c46dbab --- /dev/null +++ b/doc/search.templ @@ -0,0 +1,11 @@ + + +Search engine
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    Search engine

    Main Menu
    Related links
    API Indexes
    Insert point for php code

    Daniel Veillard

    diff --git a/doc/search.xml b/doc/search.xml new file mode 100644 index 0000000..1d499f3 --- /dev/null +++ b/doc/search.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/site.xsl b/doc/site.xsl new file mode 100644 index 0000000..28b5388 --- /dev/null +++ b/doc/site.xsl @@ -0,0 +1,464 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + intro.html + + + docs.html + + + bugs.html + + + help.html + + + help.html + + + downloads.html + + + news.html + + + contribs.html + + + xsltproc2.html + + + API.html + + + extensions.html + + + internals.html + + + docbook.html + + + FAQ.html + + + python.html + + + unknown.html + + + + + + + + + +
    + + +
    + +
    + + + + + + + + + + + + + + +
    + + + + + + + +
    +
    + +
    +
    + +
    + + + + + + + +
    +
    + Related links +
    +
    + +
    + + + + + + + +
    +
    + API Indexes +
    +
    + +
    +
    +
    + + + + <xsl:apply-templates/> + + + + + + + + + + + + + + + + + + + + + +
    + Action against software patents + + GNOME2 Logo + W3C logo + Red Hat Logo +
    + Made with Libxslt Logo +
    +
    + + + + +
    + + + + +
    + + + + + + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + +
    + + + + + + +
    + + + + +
    + + + + +
    + +

    Daniel Veillard

    +
    +
    +
    +
    +
    + + +
    +
    diff --git a/doc/smallfootonly.gif b/doc/smallfootonly.gif new file mode 100644 index 0000000..ddbb9ee Binary files /dev/null and b/doc/smallfootonly.gif differ diff --git a/doc/stylesheet.fig b/doc/stylesheet.fig new file mode 100644 index 0000000..4f900e9 --- /dev/null +++ b/doc/stylesheet.fig @@ -0,0 +1,104 @@ +#FIG 3.2 +Landscape +Center +Inches +Letter +100.00 +Single +-2 +1200 2 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 2400 3075 2925 3075 2925 3600 2400 3600 2400 3075 +2 2 0 1 1 1 50 0 20 0.000 0 0 -1 0 0 5 + 2025 450 2550 450 2550 975 2025 975 2025 450 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 5400 375 7050 375 7050 3225 5400 3225 5400 375 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 5400 750 7050 750 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 5400 1125 7050 1125 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 5400 1500 7050 1500 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 5400 1875 7050 1875 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 5400 2250 7050 2250 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 2025 975 1650 1425 +2 2 0 1 1 1 50 0 20 0.000 0 0 -1 0 0 5 + 450 2175 975 2175 975 2700 450 2700 450 2175 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 1350 3075 1875 3075 1875 3600 1350 3600 1350 3075 +2 2 0 1 1 1 50 0 20 0.000 0 0 -1 0 0 5 + 300 3075 825 3075 825 3600 300 3600 300 3075 +2 2 0 1 1 1 50 0 20 0.000 0 0 -1 0 0 5 + 2400 2175 2925 2175 2925 2700 2400 2700 2400 2175 +2 2 0 1 1 1 50 0 20 0.000 0 0 -1 0 0 5 + 1425 1425 1950 1425 1950 1950 1425 1950 1425 1425 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 1425 1950 975 2175 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 675 2700 525 3075 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 975 2475 2400 2475 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 825 3300 1350 3300 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 2700 2700 2700 3075 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 5550 2025 2550 450 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 2100 5025 3750 5025 3750 7425 2100 7425 2100 5025 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 600 3600 2475 5025 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 5400 2850 7050 2850 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 6225 3150 3750 5025 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 2100 5325 3750 5325 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 2100 5625 3750 5625 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 2100 5925 3750 5925 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 2250 5775 450 3600 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 3 + 5250 5025 4575 5025 4575 6300 +2 1 3 1 0 7 50 0 -1 3.000 0 0 -1 0 0 2 + 5325 5025 5550 5025 +2 1 3 1 0 7 50 0 -1 3.000 0 0 -1 0 0 2 + 4575 6375 4575 6600 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 3150 5175 4575 5175 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 2925 2700 5100 5025 +4 0 0 50 0 0 18 0.0000 4 225 720 5700 675 parent\001 +4 0 0 50 0 0 18 0.0000 4 165 495 5700 1050 next\001 +4 0 0 50 0 0 18 0.0000 4 255 870 5700 1425 imports\001 +4 0 0 50 0 0 18 0.0000 4 195 735 5700 1800 doclist\001 +4 0 0 50 0 0 18 0.0000 4 195 390 5700 2175 doc\001 +4 0 0 50 0 0 18 0.0000 4 255 1470 450 750 xsl:stylesheet\001 +4 0 0 50 0 0 18 0.0000 4 255 1350 2025 1725 xsl:template\001 +4 0 0 50 0 0 18 0.0000 4 255 1140 5700 3075 preComps\001 +4 0 0 50 0 0 18 0.0000 4 165 495 2475 5250 next\001 +4 0 0 50 0 0 18 0.0000 4 225 465 2475 5550 type\001 +4 0 0 50 0 0 18 0.0000 4 195 420 2475 5850 inst\001 +4 0 0 50 0 0 18 0.0000 4 255 915 1350 4050 _private\001 +4 0 0 50 0 0 18 0.0000 4 195 720 1350 3000 html:a\001 +4 0 0 50 0 0 18 0.0000 4 195 705 2625 3900 TEXT\001 +4 0 0 50 0 0 18 0.0000 4 255 915 3375 3000 _private\001 +4 0 0 50 0 0 18 0.0000 4 255 2010 4050 6900 xsltStylePreComp\001 +4 0 0 50 0 0 18 0.0000 4 255 1455 3900 600 xslStylesheet\001 diff --git a/doc/stylesheet.gif b/doc/stylesheet.gif new file mode 100644 index 0000000..5250d66 Binary files /dev/null and b/doc/stylesheet.gif differ diff --git a/doc/symbols.xml b/doc/symbols.xml new file mode 100644 index 0000000..e1bbb38 --- /dev/null +++ b/doc/symbols.xml @@ -0,0 +1,317 @@ + + + + xsltApplyAttributeSet + xsltFreeAttributeSetsHashes + xsltParseStylesheetAttributeSet + xsltFindDocument + xsltFreeDocuments + xsltFreeStyleDocuments + xsltLoadDocument + xsltLoadStyleDocument + xsltNewDocument + xsltNewStyleDocument + xsltCheckExtPrefix + xsltExtElementLookup + xsltExtModuleElementLookup + xsltExtModuleFunctionLookup + xsltExtModuleTopLevelLookup + xsltFreeCtxtExts + xsltFreeExts + xsltGetExtData + xsltInitCtxtExts + xsltInitElemPreComp + xsltNewElemPreComp + xsltPreComputeExtModuleElement + xsltRegisterExtElement + xsltRegisterExtFunction + xsltRegisterExtModuleElement + xsltRegisterExtModuleFull + xsltRegisterExtModuleFunction + xsltRegisterExtModule + xsltRegisterExtModuleTopLevel + xsltRegisterExtPrefix + xsltRegisterTestModule + xsltShutdownCtxtExts + xsltShutdownExts + xsltStyleGetExtData + xsltUnregisterExtModuleElement + xsltUnregisterExtModuleFunction + xsltUnregisterExtModule + xsltUnregisterExtModuleTopLevel + xsltDebug + xsltFunctionNodeSet + xsltRegisterAllExtras + xsltRegisterExtras + xsltDocumentFunction + xsltElementAvailableFunction + xsltFormatNumberFunction + xsltFunctionAvailableFunction + xsltGenerateIdFunction + xsltKeyFunction + xsltRegisterAllFunctions + xsltSystemPropertyFunction + xsltUnparsedEntityURIFunction + xsltXPathFunctionLookup + xsltFindElemSpaceHandling + xsltFindTemplate + xsltNeedElemSpaceHandling + xsltNextImport + xsltParseStylesheetImport + xsltParseStylesheetInclude + xsltAddKey + xsltFreeDocumentKeys + xsltFreeKeys + xsltGetKey + xsltInitCtxtKeys + xsltCopyNamespaceList + xsltCopyNamespace + xsltFreeNamespaceAliasHashes + xsltGetNamespace + xsltGetSpecialNamespace + xsltNamespaceAlias + xsltAddTemplate + xsltCleanupTemplates + xsltCompilePattern + xsltFreeCompMatchList + xsltFreeTemplateHashes + xsltGetTemplate + xsltMatchPattern + xsltTestCompMatchList + xsltDocumentComp + xsltFreeStylePreComps + xsltStylePreCompute + xsltAttrListTemplateProcess + xsltAttrTemplateProcess + xsltAttrTemplateValueProcess + xsltEvalAttrValueTemplate + xsltEvalStaticAttrValueTemplate + xsltEvalTemplateString + xsltEvalXPathPredicate + xsltEvalXPathString + xsltTemplateProcess + xslHandleDebugger + xsltApplyImports + xsltApplyOneTemplate + xsltApplyStripSpaces + xsltApplyStylesheet + xsltApplyStylesheetUser + xsltApplyTemplates + xsltAttribute + xsltCallTemplate + xsltChoose + xsltComment + xsltCopyOf + xsltCopy + xsltDocumentElem + xsltElement + xsltForEach + xsltFreeTransformContext + xsltGetXIncludeDefault + xsltIf + xsltNewTransformContext + xsltNumber + xsltProcessingInstruction + xsltProfileStylesheet + xsltRegisterAllElement + xsltRunStylesheet + xsltSetXIncludeDefault + xsltSort + xsltText + xsltValueOf + xsltAddStackElemList + xsltEvalGlobalVariables + xsltEvalOneUserParam + xsltEvalUserParams + xsltFreeGlobalVariables + xsltParseGlobalParam + xsltParseGlobalVariable + xsltParseStylesheetCallerParam + xsltParseStylesheetParam + xsltParseStylesheetVariable + xsltQuoteOneUserParam + xsltQuoteUserParams + xsltVariableLookup + xsltXPathVariableLookup + xsltDecimalFormatGetByName + xsltFormatNumberConversion + xsltFreeStackElemList + xsltFreeStylesheet + xsltIsBlank + xsltLoadStylesheetPI + xsltNewStylesheet + xsltNumberFormat + xsltParseStylesheetDoc + xsltParseStylesheetFile + xsltParseStylesheetOutput + xsltParseStylesheetProcess + xsltParseTemplateContent + xslAddCall + xslDropCall + xsltCalibrateAdjust + xsltDocumentSortFunction + xsltDoSortFunction + xsltGetNsProp + xsltGetQNameURI + xsltMessage + xsltPrintErrorContext + xsltSaveProfiling + xsltSaveResultToFd + xsltSaveResultToFilename + xsltSaveResultToFile + xsltSaveResultTo + xsltSetDebuggerCallbacks + xsltSetGenericDebugFunc + xsltSetGenericErrorFunc + xsltTimestamp + xsltCleanupGlobals + + + xsltAllocateExtraCtxt + xsltAllocateExtra + + + xsltExtModuleElementPreComputeLookup + xsltXPathGetTransformContext + + + xsltResolveStylesheetAttributeSet + + + xsltRunStylesheetUser + + + xsltDebugDumpExtensions + xsltSaveResultToString + + + xsltAttrTemplateValueProcessNode + xsltCheckRead + xsltCheckWrite + xsltEvalXPathStringNs + xsltFreeSecurityPrefs + xsltGetDefaultSecurityPrefs + xsltGetSecurityPrefs + xsltNewSecurityPrefs + xsltSecurityAllow + xsltSecurityForbid + xsltSetCtxtSecurityPrefs + xsltSetDefaultSecurityPrefs + xsltSetSecurityPrefs + xsltSetTransformErrorFunc + xsltTransformError + + + xslDebugStatus + xsltComputeSortResult + xsltDefaultSortFunction + xsltEngineVersion + xsltExtMarker + xsltGenericDebugContext + xsltGenericDebug + xsltGenericErrorContext + xsltGenericError + xsltGetProfileInformation + xsltGetUTF8Char + xsltLibxmlVersion + xsltLibxsltVersion + xsltMaxDepth + xsltMaxVars + xsltParseStylesheetImportedDoc + xsltSetCtxtSortFunc + xsltSetSortFunc + + + xsltCreateRVT + xsltFreeRVTs + xsltRegisterPersistRVT + xsltRegisterTmpRVT + + + xsltCopyTextString + xsltGetExtInfo + + + xsltNormalizeCompSteps + + + xsltGetDebuggerStatus + xsltSetDebuggerStatus + + + xsltDebugGetDefaultTrace + xsltDebugSetDefaultTrace + + + xsltSetCtxtParseOptions + + + xsltCompileAttr + xsltEvalAVT + xsltFreeAVTList + xsltGetCNsProp + xsltSplitQName + xsltXPathCompile + + + xsltGetQNameURI2 + + + xsltGetPlainNamespace + + + xsltDocDefaultLoader + xsltSetLoaderFunc + + + xsltConstNamespaceNameXSLT + xsltExtensionInstructionResultFinalize + xsltExtensionInstructionResultRegister + xsltInitCtxtKey + xsltInit + xsltParseAnyXSLTElem + xsltParseSequenceConstructor + xsltPointerListAddSize + xsltPointerListClear + xsltPointerListCreate + xsltPointerListFree + xsltRegisterLocalRVT + xsltReleaseRVT + xsltRestoreDocumentNamespaces + xsltStyleStylesheetLevelGetExtData + xsltTransStorageAdd + xsltTransStorageRemove + xsltUninit + xsltXSLTAttrMarker + + + xsltLocalVariablePop + xsltLocalVariablePush + + + xsltInitAllDocKeys + + + xsltCheckExtURI + + + xsltFreeLocale + xsltLocaleStrcmp + xsltNewLocale + xsltStrxfrm + xsltInitGlobals + + + + xsltProcessOneNode + + + xsltFreeLocales + xsltXPathCompileFlags + + diff --git a/doc/syms.xsl b/doc/syms.xsl new file mode 100644 index 0000000..3965e90 --- /dev/null +++ b/doc/syms.xsl @@ -0,0 +1,99 @@ + + + + + + + + # +# Officially exported symbols, for which header +# file definitions are installed in /usr/include/libxslt +# +# Automatically generated from symbols.xml and syms.xsl +# +# Versions here are *fixed* to match the libxslt version +# at which the symbol was introduced. This ensures that +# a new client app requiring symbol foo() can't accidentally +# run with old libxslt.so not providing foo() - the global +# soname version info can't enforce this since we never +# change the soname +# + + + + + + + + LIBXML2_ + + { + global: + + + + +# + + + + + + + + + } + + LIBXML2_ + + + ; + + + + + + + + + + # + + ; removed in + + + + + + + + + + Failed to find definition in libxslt-api.xml: + + + + + + + ; + + # variable + + + # + + + + + + + + + + + + diff --git a/doc/templates.fig b/doc/templates.fig new file mode 100644 index 0000000..874a19a --- /dev/null +++ b/doc/templates.fig @@ -0,0 +1,138 @@ +#FIG 3.2 +Landscape +Center +Inches +Letter +100.00 +Single +-2 +1200 2 +6 3225 5700 4200 7200 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 3 + 3900 5700 3225 5700 3225 6825 +2 1 3 1 0 7 50 0 -1 3.000 0 0 -1 0 0 2 + 3975 5700 4200 5700 +2 1 3 1 0 7 50 0 -1 3.000 0 0 -1 0 0 2 + 3225 6900 3225 7200 +-6 +6 3150 2475 4125 3975 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 3 + 3825 2475 3150 2475 3150 3600 +2 1 3 1 0 7 50 0 -1 3.000 0 0 -1 0 0 2 + 3900 2475 4125 2475 +2 1 3 1 0 7 50 0 -1 3.000 0 0 -1 0 0 2 + 3150 3675 3150 3975 +-6 +2 2 0 1 1 1 50 0 20 0.000 0 0 -1 0 0 5 + 3900 6975 4425 6975 4425 7500 3900 7500 3900 6975 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 2175 5850 5400 3075 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 2175 7650 4050 6975 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 2175 7950 3750 8250 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 5400 750 7050 750 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 5400 1050 7050 1050 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 5400 1350 7050 1350 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 5400 1650 7050 1650 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 5400 1950 7050 1950 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 5400 2250 7050 2250 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 5475 900 2250 900 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 1350 1125 1350 2475 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 750 5700 2400 5700 2400 8100 750 8100 750 5700 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 750 6000 2400 6000 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 750 7500 2400 7500 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 750 7800 2400 7800 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 750 6300 2400 6300 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 1800 6150 3225 6150 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 750 6600 2400 6600 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 750 6900 2400 6900 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 750 7200 2400 7200 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 675 2475 2325 2475 2325 4200 675 4200 675 2475 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 675 2775 2325 2775 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 675 3075 2325 3075 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 675 3900 2325 3900 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 675 3525 2325 3525 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 1875 2625 3150 2625 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 2100 4050 2100 5700 +2 4 0 1 0 7 50 0 -1 0.000 0 0 7 0 0 5 + 2175 1800 2175 525 675 525 675 1800 2175 1800 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 3675 8250 4125 8250 4125 8700 3675 8700 3675 8250 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 4575 8250 5025 8250 5025 8700 4575 8700 4575 8250 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 4200 7500 3900 8250 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 4125 8475 4575 8475 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 3900 8700 3900 9375 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 3675 9375 4125 9375 4125 9825 3675 9825 3675 9375 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 5400 750 7050 750 7050 3600 5400 3600 5400 750 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 5400 3225 7050 3225 +2 1 0 2 0 7 50 0 -1 0.000 0 0 -1 1 0 2 + 1 1 2.00 120.00 240.00 + 5550 3450 2400 5775 +4 0 0 50 0 0 18 0.0000 4 255 1350 4125 6750 xsl:template\001 +4 0 0 50 0 0 18 0.0000 4 255 1545 5475 975 templateHash\001 +4 0 0 50 0 0 18 0.0000 4 255 1350 750 1050 hash(name)\001 +4 0 0 50 0 0 18 0.0000 4 195 540 1275 7725 elem\001 +4 0 0 50 0 0 18 0.0000 4 165 855 1200 8025 content\001 +4 0 0 50 0 0 18 0.0000 4 255 510 1125 5925 style\001 +4 0 0 50 0 0 18 0.0000 4 165 495 1125 6225 next\001 +4 0 0 50 0 0 18 0.0000 4 255 840 1125 6525 priority\001 +4 0 0 50 0 0 18 0.0000 4 135 615 1125 6825 name\001 +4 0 0 50 0 0 18 0.0000 4 195 615 1125 7140 mode\001 +4 0 0 50 0 0 18 0.0000 4 255 975 975 4125 template\001 +4 0 0 50 0 0 18 0.0000 4 255 735 1200 3375 steps[]\001 +4 0 0 50 0 0 18 0.0000 4 165 495 1200 2700 next\001 +4 0 0 50 0 0 18 0.0000 4 195 615 1200 3000 mode\001 +4 0 0 50 0 0 18 0.0000 4 255 1470 300 5550 xsltTemplate\001 +4 0 0 50 0 0 18 0.0000 4 255 1800 1650 2325 xsltCompMatch\001 +4 0 0 50 0 0 18 0.0000 4 255 2250 900 375 Template hash table\001 +4 0 0 50 0 0 18 0.0000 4 255 1455 5700 525 xslStylesheet\001 +4 0 0 50 0 0 18 0.0000 4 255 2805 4650 7950 Stylesheet document tree\001 +4 0 0 50 0 0 18 0.0000 4 195 1185 5550 1575 rootMatch\001 +4 0 0 50 0 0 18 0.0000 4 255 1095 5550 1875 keyMatch\001 +4 0 0 50 0 0 18 0.0000 4 195 1260 5550 2175 elemMatch\001 +4 0 0 50 0 0 18 0.0000 4 195 1125 5550 2490 attrMatch\001 +4 0 0 50 0 0 18 0.0000 4 30 180 5550 2805 ...\001 +4 0 0 50 0 0 18 0.0000 4 255 1080 5625 3525 templates\001 diff --git a/doc/templates.gif b/doc/templates.gif new file mode 100644 index 0000000..39b3c49 Binary files /dev/null and b/doc/templates.gif differ diff --git a/doc/tutorial/libxslt_tutorial.c b/doc/tutorial/libxslt_tutorial.c new file mode 100644 index 0000000..6b5d5c8 --- /dev/null +++ b/doc/tutorial/libxslt_tutorial.c @@ -0,0 +1,84 @@ +/* + * libxslt_tutorial.c: demo program for the XSL Transformation 1.0 engine + * + * based on xsltproc.c, by Daniel.Veillard@imag.fr + * by John Fleck + * + * See Copyright for the status of this software. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +extern int xmlLoadExtDtdDefaultValue; + +static void usage(const char *name) { + printf("Usage: %s [options] stylesheet file [file ...]\n", name); + printf(" --param name value : pass a (parameter,value) pair\n"); + +} + +int +main(int argc, char **argv) { + int i; + const char *params[16 + 1]; + int nbparams = 0; + xsltStylesheetPtr cur = NULL; + xmlDocPtr doc, res; + + if (argc <= 1) { + usage(argv[0]); + return(1); + } + + + for (i = 1; i < argc; i++) { + if (argv[i][0] != '-') + break; + if ((!strcmp(argv[i], "-param")) || + (!strcmp(argv[i], "--param"))) { + i++; + params[nbparams++] = argv[i++]; + params[nbparams++] = argv[i]; + if (nbparams >= 16) { + fprintf(stderr, "too many params\n"); + return (1); + } + } else { + fprintf(stderr, "Unknown option %s\n", argv[i]); + usage(argv[0]); + return (1); + } + } + + params[nbparams] = NULL; + xmlSubstituteEntitiesDefault(1); + xmlLoadExtDtdDefaultValue = 1; + cur = xsltParseStylesheetFile((const xmlChar *)argv[i]); + i++; + doc = xmlParseFile(argv[i]); + res = xsltApplyStylesheet(cur, doc, params); + xsltSaveResultToFile(stdout, res, cur); + + xsltFreeStylesheet(cur); + xmlFreeDoc(res); + xmlFreeDoc(doc); + + xsltCleanupGlobals(); + xmlCleanupParser(); + return(0); + +} diff --git a/doc/tutorial/libxslttutorial.html b/doc/tutorial/libxslttutorial.html new file mode 100644 index 0000000..4172858 --- /dev/null +++ b/doc/tutorial/libxslttutorial.html @@ -0,0 +1,425 @@ + + + + +libxslt Tutorial + + +
    +
    +

    +libxslt Tutorial

    +

    John Fleck

    +

    + This is version 0.4 of the libxslt Tutorial +

    +
    +

    Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation + License, Version 1.1 or any later version + published by the Free Software Foundation with no Invariant + Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of + the license can be found here.

    +
    +
    + +
    +

    +Abstract +

    +

    A tutorial on building a simple application using the + libxslt library to perform + XSLT transformations to convert an + XML file into HTML.

    +
    +
    +

    +Introduction

    +

    The Extensible Markup Language (XML) is a World + Wide Web Consortium standard for the exchange of structured data in text + form. Its popularity stems from its universality. Any computer can + read a text file. With the proper tools, any computer can read any other + computer's XML files. +

    +

    One of the most important of those tools is XSLT: + Extensible Stylesheet Language Transformations. XSLT + is a declarative language that allows you to + translate your XML into arbitrary text output + using a stylesheet. libxslt provides the + functions to perform the transformation. +

    +

    libxslt is a free C language library + written by Daniel Veillard for the GNOME project + allowing you to write programs that perform XSLT + transformations. + +

    +

    +Note

    +

    + While libxslt was written + under the auspices of the GNOME project, it does not + depend on any GNOME libraries. None are used in the + example in this tutorial. +

    +
    + +

    +

    This tutorial illustrates a simple program that reads an + XML file, applies a stylesheet and saves the resulting + output. This is not a program you would want to create + yourself. xsltproc, which is included with the + libxslt package, does the same thing and is + more robust and full-featured. The program written for this tutorial is a + stripped-down version of xsltproc designed to + illustrate the functionality of libxslt. +

    +

    The full code for xsltproc is in + xsltproc.c in the libxslt + distribution. It also is available on the + web. +

    +

    References: +

    + +

    +
    +
    +

    +Primary Functions

    + +

    To transform an XML file, you must perform three + functions: +

      +
    1. +parse the input file

    2. +
    3. +parse the stylesheet

    4. +
    5. +apply the stylesheet

    6. +
    +

    +
    +

    +Preparing to Parse

    +

    Before you can begin parsing input files or stylesheets, there are + several steps you need to take to set up entity handling. These steps are + not unique to libxslt. Any + libxml2 program that parses + XML files would need to take similar steps. +

    +

    First, you need set up some libxml + housekeeping. Pass the integer value 1 to the + xmlSubstituteEntitiesDefault function, which tells + the libxml2 parser to substitute entities as + it parses your file. (Passing 0 causes + libxml2 to not perform entity substitution.) +

    +

    Second, set xmlLoadExtDtdDefaultValue equal to + 1. This tells libxml + to load external entity subsets. If you do not do this and your + input file includes entities through external subsets, you will get + errors.

    +
    +
    +

    +Parse the Stylesheet

    +

    Parsing the stylesheet takes a single function call, which takes a + variable of type xmlChar: +

    +	  cur = xsltParseStylesheetFile((const xmlChar *)argv[i]);
    +	
    + In this case, I cast the stylesheet file name, passed in as a + command line argument, to xmlChar. The return value + is of type xsltStylesheetPtr, a struct in memory + that contains the stylesheet tree and other information about the + stylesheet. It can be manipulated directly, but for this example you + will not need to. +

    +
    +
    +

    +Parse the Input File

    +

    Parsing the input file takes a single function call: +

    +doc = xmlParseFile(argv[i]);
    +	
    + It returns an xmlDocPtr, a struct in memory that + contains the document tree. It can be manipulated directly, but for this + example you will not need to. +

    +
    +
    +

    +Applying the Stylesheet

    +

    Now that you have trees representing the document and the stylesheet + in memory, apply the stylesheet to the document. The + function that does this is xsltApplyStylesheet: +

    +res = xsltApplyStylesheet(cur, doc, params);
    +	
    + The function takes an xsltStylesheetPtr and an + xmlDocPtr, the values returned by the previous two functions. The third + variable, params can be used to pass + XSLT parameters to the stylesheet. It is a + NULL-terminated array of name/value pairs of const char's. +

    +
    +
    +

    +Saving the result

    +

    libxslt includes a family of functions to use in + saving the resulting output. For this example, + xsltSaveResultToFile is used, and the results are + saved to stdout: + +

    +xsltSaveResultToFile(stdout, res, cur);
    +	
    + +
    +

    +Note

    +

    libxml also contains output + functions, such as xmlSaveFile, which can be + used here. However, output-related information contained in the + stylesheet, such as a declaration of the encoding to be used, will + be lost if one of the libxslt save + functions is not used.

    +
    +

    +
    +
    +

    +Parameters

    +

    + In XSLT, parameters may be used as a way to pass + additional information to a + stylesheet. libxslt accepts + XSLT parameters as one of the values passed to + xsltApplyStylesheet. +

    +

    + In the tutorial example and in xsltproc, + on which the tutorial example is based, parameters to be passed take the + form of key-value pairs. The program collects them from command line + arguments, inserting them in the array params, then + passes them to the function. The final element in the array is set to + NULL. + +

    +

    +Note

    +

    + If a parameter being passed is a string rather than an + XSLT node, it must be escaped. For the tutorial + program, that would be done as follows: + tutorial]$ ./libxslt_tutorial --param rootid "'asect1'" + stylesheet.xsl filename.xml +

    +
    +

    +
    +
    +

    +Cleanup

    +

    After you are finished, libxslt and + libxml provide functions for deallocating + memory. +

    +

    + +

    +	  xsltFreeStylesheet(cur);1
    +	  xmlFreeDoc(res);2
    +	  xmlFreeDoc(doc);3
    +	  xsltCleanupGlobals();4
    +	  xmlCleanupParser();5
    +
    +	  
    + +
    + + + + + + + + + + + + + + + + + + + + + +
    +1

    Free the memory used by your stylesheet.

    +2

    Free the memory used by the results document.

    +3

    Free the memory used by your original document.

    +4

    Free memory used by libxslt global + variables

    +5

    Free memory used by the XML parser

    +
    +

    +
    +
    +
    +

    +A. The Code

    +

    +libxslt_tutorial.c +

    +/*
    + * libxslt_tutorial.c: demo program for the XSL Transformation 1.0 engine
    + *
    + * based on xsltproc.c, by Daniel.Veillard@imag.fr
    + * by John Fleck 
    + *
    + * See the file Copyright for the status of this software.
    + *
    + */ 
    +
    +#include <string.h>
    +#include <libxml/xmlmemory.h>
    +#include <libxml/debugXML.h>
    +#include <libxml/HTMLtree.h>
    +#include <libxml/xmlIO.h>
    +#include <libxml/DOCBparser.h>
    +#include <libxml/xinclude.h>
    +#include <libxml/catalog.h>
    +#include <libxslt/xslt.h>
    +#include <libxslt/xsltInternals.h>
    +#include <libxslt/transform.h>
    +#include <libxslt/xsltutils.h>
    +
    +
    +
    +extern int xmlLoadExtDtdDefaultValue;
    +
    +static void usage(const char *name) {
    +    printf("Usage: %s [options] stylesheet file [file ...]\n", name);
    +    printf("      --param name value : pass a (parameter,value) pair\n");
    +
    +}
    +
    +int
    +main(int argc, char **argv) {
    +	int i;
    +	const char *params[16 + 1];
    +	int nbparams = 0;
    +	xsltStylesheetPtr cur = NULL;
    +	xmlDocPtr doc, res;
    +
    +	if (argc <= 1) {
    +		usage(argv[0]);
    +		return(1);
    +	}
    +	
    +
    + for (i = 1; i < argc; i++) {
    +        if (argv[i][0] != '-')
    +            break;
    +	if ((!strcmp(argv[i], "-param")) ||
    +                   (!strcmp(argv[i], "--param"))) {
    +		i++;
    +		params[nbparams++] = argv[i++];
    +		params[nbparams++] = argv[i];
    +		if (nbparams >= 16) {
    +			fprintf(stderr, "too many params\n");
    +			return (1);
    +		}
    +        }  else {
    +            fprintf(stderr, "Unknown option %s\n", argv[i]);
    +            usage(argv[0]);
    +            return (1);
    +        }
    +    }
    +
    +	params[nbparams] = NULL;
    +	xmlSubstituteEntitiesDefault(1);
    +	xmlLoadExtDtdDefaultValue = 1;
    +	cur = xsltParseStylesheetFile((const xmlChar *)argv[i]);
    +	i++;
    +	doc = xmlParseFile(argv[i]);
    +	res = xsltApplyStylesheet(cur, doc, params);
    +	xsltSaveResultToFile(stdout, res, cur);
    +
    +	xsltFreeStylesheet(cur);
    +	xmlFreeDoc(res);
    +	xmlFreeDoc(doc);
    +
    +        xsltCleanupGlobals();
    +        xmlCleanupParser();
    +	return(0);
    +
    +}
    +
    +
    + +

    +
    +
    + diff --git a/doc/tutorial/libxslttutorial.xml b/doc/tutorial/libxslttutorial.xml new file mode 100644 index 0000000..9ef3a4d --- /dev/null +++ b/doc/tutorial/libxslttutorial.xml @@ -0,0 +1,288 @@ + + +]> +
    + + libxslt Tutorial + + 2001 + John Fleck + + + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation + License, Version 1.1 or any later version + published by the Free Software Foundation with no Invariant + Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of + the license can be found here. + + + + John + Fleck + + + This is version 0.4 of the libxslt Tutorial + + + + A tutorial on building a simple application using the + libxslt library to perform + XSLT transformations to convert an + XML file into HTML. + + + Introduction + + The Extensible Markup Language (XML) is a World + Wide Web Consortium standard for the exchange of structured data in text + form. Its popularity stems from its universality. Any computer can + read a text file. With the proper tools, any computer can read any other + computer's XML files. + + + One of the most important of those tools is XSLT: + Extensible Stylesheet Language Transformations. XSLT + is a declarative language that allows you to + translate your XML into arbitrary text output + using a stylesheet. libxslt provides the + functions to perform the transformation. + + + libxslt is a free C language library + written by Daniel Veillard for the GNOME project + allowing you to write programs that perform XSLT + transformations. + + + + While libxslt was written + under the auspices of the GNOME project, it does not + depend on any GNOME libraries. None are used in the + example in this tutorial. + + + + + + This tutorial illustrates a simple program that reads an + XML file, applies a stylesheet and saves the resulting + output. This is not a program you would want to create + yourself. xsltproc, which is included with the + libxslt package, does the same thing and is + more robust and full-featured. The program written for this tutorial is a + stripped-down version of xsltproc designed to + illustrate the functionality of libxslt. + + The full code for xsltproc is in + xsltproc.c in the libxslt + distribution. It also is available on the + web. + + + References: + + + W3C XML page + + + W3C + XSL page. + + + libxslt + + + + + + + + Primary Functions + To transform an XML file, you must perform three + functions: + + + parse the input file + + + parse the stylesheet + + + apply the stylesheet + + + + + Preparing to Parse + Before you can begin parsing input files or stylesheets, there are + several steps you need to take to set up entity handling. These steps are + not unique to libxslt. Any + libxml2 program that parses + XML files would need to take similar steps. + + First, you need set up some libxml + housekeeping. Pass the integer value 1 to the + xmlSubstituteEntitiesDefault function, which tells + the libxml2 parser to substitute entities as + it parses your file. (Passing 0 causes + libxml2 to not perform entity substitution.) + + + Second, set xmlLoadExtDtdDefaultValue equal to + 1. This tells libxml + to load external entity subsets. If you do not do this and your + input file includes entities through external subsets, you will get + errors. + + + Parse the Stylesheet + Parsing the stylesheet takes a single function call, which takes a + variable of type xmlChar: + + cur = xsltParseStylesheetFile((const xmlChar *)argv[i]); + + In this case, I cast the stylesheet file name, passed in as a + command line argument, to xmlChar. The return value + is of type xsltStylesheetPtr, a struct in memory + that contains the stylesheet tree and other information about the + stylesheet. It can be manipulated directly, but for this example you + will not need to. + + + + + Parse the Input File + Parsing the input file takes a single function call: + +doc = xmlParseFile(argv[i]); + + It returns an xmlDocPtr, a struct in memory that + contains the document tree. It can be manipulated directly, but for this + example you will not need to. + + + + + Applying the Stylesheet + Now that you have trees representing the document and the stylesheet + in memory, apply the stylesheet to the document. The + function that does this is xsltApplyStylesheet: + +res = xsltApplyStylesheet(cur, doc, params); + + The function takes an xsltStylesheetPtr and an + xmlDocPtr, the values returned by the previous two functions. The third + variable, params can be used to pass + XSLT parameters to the stylesheet. It is a + NULL-terminated array of name/value pairs of const char's. + + + + + Saving the result + libxslt includes a family of functions to use in + saving the resulting output. For this example, + xsltSaveResultToFile is used, and the results are + saved to stdout: + + +xsltSaveResultToFile(stdout, res, cur); + + + + libxml also contains output + functions, such as xmlSaveFile, which can be + used here. However, output-related information contained in the + stylesheet, such as a declaration of the encoding to be used, will + be lost if one of the libxslt save + functions is not used. + + + + + + Parameters + + In XSLT, parameters may be used as a way to pass + additional information to a + stylesheet. libxslt accepts + XSLT parameters as one of the values passed to + xsltApplyStylesheet. + + + + In the tutorial example and in xsltproc, + on which the tutorial example is based, parameters to be passed take the + form of key-value pairs. The program collects them from command line + arguments, inserting them in the array params, then + passes them to the function. The final element in the array is set to + NULL. + + + + If a parameter being passed is a string rather than an + XSLT node, it must be escaped. For the tutorial + program, that would be done as follows: + tutorial]$ ./libxslt_tutorial --param rootid "'asect1'" + stylesheet.xsl filename.xml + + + + + + + + Cleanup + After you are finished, libxslt and + libxml provide functions for deallocating + memory. + + + + + + xsltFreeStylesheet(cur); + xmlFreeDoc(res); + xmlFreeDoc(doc); + xsltCleanupGlobals(); + xmlCleanupParser(); + + + + + + Free the memory used by your stylesheet. + + + Free the memory used by the results document. + + + Free the memory used by your original document. + + + Free memory used by libxslt global + variables + + + Free memory used by the XML parser + + + + + + + + + The Code + libxslt_tutorial.c + &CODE; + + + +
    diff --git a/doc/tutorial2/libxslt_pipes.c b/doc/tutorial2/libxslt_pipes.c new file mode 100644 index 0000000..44056c1 --- /dev/null +++ b/doc/tutorial2/libxslt_pipes.c @@ -0,0 +1,127 @@ +/* + * libxslt_pipes.c: a program for performing a series of XSLT + * transformations + * + * Writen by Panos Louridas, based on libxslt_tutorial.c by John Fleck. + * + * See Copyright for the status of this software. + * + */ + +#include +#include +#include + +#include +#include + +extern int xmlLoadExtDtdDefaultValue; + +static void usage(const char *name) { + printf("Usage: %s [options] stylesheet [stylesheet ...] file [file ...]\n", + name); + printf(" --out file: send output to file\n"); + printf(" --param name value: pass a (parameter,value) pair\n"); +} + +int main(int argc, char **argv) { + int arg_indx; + const char *params[16 + 1]; + int params_indx = 0; + int stylesheet_indx = 0; + int file_indx = 0; + int i, j, k; + FILE *output_file = stdout; + xsltStylesheetPtr *stylesheets = + (xsltStylesheetPtr *) calloc(argc, sizeof(xsltStylesheetPtr)); + xmlDocPtr *files = (xmlDocPtr *) calloc(argc, sizeof(xmlDocPtr)); + xmlDocPtr doc, res; + int return_value = 0; + + if (argc <= 1) { + usage(argv[0]); + return_value = 1; + goto finish; + } + + /* Collect arguments */ + for (arg_indx = 1; arg_indx < argc; arg_indx++) { + if (argv[arg_indx][0] != '-') + break; + if ((!strcmp(argv[arg_indx], "-param")) + || (!strcmp(argv[arg_indx], "--param"))) { + arg_indx++; + params[params_indx++] = argv[arg_indx++]; + params[params_indx++] = argv[arg_indx]; + if (params_indx >= 16) { + fprintf(stderr, "too many params\n"); + return_value = 1; + goto finish; + } + } else if ((!strcmp(argv[arg_indx], "-o")) + || (!strcmp(argv[arg_indx], "--out"))) { + arg_indx++; + output_file = fopen(argv[arg_indx], "w"); + } else { + fprintf(stderr, "Unknown option %s\n", argv[arg_indx]); + usage(argv[0]); + return_value = 1; + goto finish; + } + } + params[params_indx] = 0; + + /* Collect and parse stylesheets and files to be transformed */ + for (; arg_indx < argc; arg_indx++) { + char *argument = + (char *) malloc(sizeof(char) * (strlen(argv[arg_indx]) + 1)); + strcpy(argument, argv[arg_indx]); + if (strtok(argument, ".")) { + char *suffix = strtok(0, "."); + if (suffix && !strcmp(suffix, "xsl")) { + stylesheets[stylesheet_indx++] = + xsltParseStylesheetFile((const xmlChar *)argv[arg_indx]);; + } else { + files[file_indx++] = xmlParseFile(argv[arg_indx]); + } + } else { + files[file_indx++] = xmlParseFile(argv[arg_indx]); + } + free(argument); + } + + xmlSubstituteEntitiesDefault(1); + xmlLoadExtDtdDefaultValue = 1; + + /* Process files */ + for (i = 0; files[i]; i++) { + doc = files[i]; + res = doc; + for (j = 0; stylesheets[j]; j++) { + res = xsltApplyStylesheet(stylesheets[j], doc, params); + xmlFreeDoc(doc); + doc = res; + } + + if (stylesheets[0]) { + xsltSaveResultToFile(output_file, res, stylesheets[j-1]); + } else { + xmlDocDump(output_file, res); + } + xmlFreeDoc(res); + } + + fclose(output_file); + + for (k = 0; stylesheets[k]; k++) { + xsltFreeStylesheet(stylesheets[k]); + } + + xsltCleanupGlobals(); + xmlCleanupParser(); + + finish: + free(stylesheets); + free(files); + return(return_value); +} diff --git a/doc/tutorial2/libxslt_pipes.html b/doc/tutorial2/libxslt_pipes.html new file mode 100644 index 0000000..2a0110a --- /dev/null +++ b/doc/tutorial2/libxslt_pipes.html @@ -0,0 +1,612 @@ +libxslt: An Extended Tutorial

    libxslt: An Extended Tutorial

    Panos Louridas

    Permission is hereby granted, free of charge, to + any person obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software + without restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software + is furnished to do so, subject to the following conditions: +

    The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


    Introduction

    The Extensible Stylesheet Language Transformations (XSLT) +specification defines an XML template language for transforming XML +documents. An XSLT engine reads an XSLT file and an XML document and +transforms the document accordingly.

    We want to perform a series of XSLT transformations to a series +of documents. An obvious solution is to use the operating system's +pipe mechanism and start a series of transformation processes, each +one taking as input the output of the previous transformation. It +would be interesting, though, and perhaps more efficient if we could +do our job within a single process.

    libxslt is a library for doing XSLT transformations. It is built +on libxml, which is a library for handling XML documents. libxml and +libxslt are used by the GNOME project. Although developed in the +*NIX world, both libxml and libxslt have been +ported to the MS-Windows platform. In principle an application using +libxslt should be easily portable between the two systems. In +practice, however, there arise various wrinkles. These do not have +anything to do with libxml or libxslt per se, but rather with the +different compilation and linking procedures of each system.

    The presented solution is an extension of John +Fleck's libxslt tutorial, but the present tutorial tries to be +self-contained. It develops a minimal libxslt application +(libxslt_pipes) that can perform a series of transformations to a +series of files in a pipe-like manner. An invocation might be:

    + + libxslt_pipes --out results.xml foo.xsl bar.xsl doc1.xml doc2.xml + +

    The foo.xsl stylesheet will be applied to + doc1.xml and the bar.xsl +stylesheet will be applied to the resulting document; then the two +stylesheets will be applied in the same sequence to +bar.xsl. The results are sent to +results.xml (if no output is specified they are +sent to standard output).

    The application is compiled in both *NIX +systems and MS-Windows, where by *NIX systems we +mean Linux, BSD, and other members of the +family. The gcc suite is used in the *NIX platform +and the Microsoft compiler and linker are used in the +MS-Windows platform.

    Setting the Scene

    +We need to include the necessary libraries: + +

    +  
    +  #include <stdio.h>
    +  #include <string.h>
    +  #include <stdlib.h>
    +  
    +  #include <libxslt/transform.h>
    +  #include <libxslt/xsltutils.h>
    +  
    +

    +

    The first group of include directives includes general C +libraries. The libraries we need to make libxslt work are in the +second group. The transform.h header file +declares the API that does the bulk of the actual processing. The +xsltutils.h header file declares the API for some +generic utility functions of the XSLT engine; among other things, +saving to a file, which is what we need it for.

    +If our input files contain entities through external subsets, we need +to tell libxslt to load them. The global variable +xmlLoadExtDtdDefaultValue, defined in +libxml/globals.h, is responsible for that. As the +variable is defined outside our program we must specify external +linkage: +

    +    extern int xmlLoadExtDtdDefaultValue;
    +  

    +

    +The program is called from the command line. We anticipate that the +user may not call it the right way, so we define a function for +describing its usage: +

    +  static void usage(const char *name) {
    +      printf("Usage: %s [options] stylesheet [stylesheet ...] file [file ...]\n",
    +          name);
    +      printf("      --out file: send output to file\n");
    +      printf("      --param name value: pass a (parameter,value) pair\n");
    +  }
    +

    +

    Program Start

    We need to define a few variables that are used throughout the +program: +

    +    int main(int argc, char **argv) {
    +        int arg_indx;
    +	const char *params[16 + 1];
    +	int params_indx = 0;
    +	int stylesheet_indx = 0;
    +	int file_indx = 0;
    +	int i, j, k;
    +	FILE *output_file = stdout;
    +	xsltStylesheetPtr *stylesheets = 
    +	    (xsltStylesheetPtr *) calloc(argc, sizeof(xsltStylesheetPtr));
    +	    xmlDocPtr *files = (xmlDocPtr *) calloc(argc, sizeof(xmlDocPtr));
    +	int return_value = 0;
    +

    +

    The arg_indx integer is an index used to +iterate over the program arguments. The params +string array is used to collect the XSLT parameters. In XSLT, +additional information may be passed to the processor via +parameters. The user of the program specifies these in key-value pairs +in the command line following the --param +command line argument. We accept up to 8 such key-value pairs, which +we track with the params_indx integer. libxslt +expects the parameters array to be null-terminated, so we have to +allocate one extra place (16 + 1) for it. The +file_indx is an index to iterate over the files to +be processed. The i, j, +k integers are additional indices for iteration +purposes, and return_value is the value the program +returns to the operating system. We expect the result of the +transformation to be the standard output in most cases, but the user +may wish otherwise via the --out command line +option, so we need to keep track of the situation with the +output_file file pointer.

    In libxslt, XSLT stylesheets are internally stored in +xsltStylesheet structures; similarly, in +libxml XML documents are stored in xmlDoc +structures. xsltStylesheetPtr and xmlDocPtr +are simply typedefs of pointers to them. The user may specify any +number of stylesheets that will be applied to the documents one after +the other. To save time we parse the stylesheets and the documents as +we read them from the command line and keep the parsed representation +of them. The parsed results are kept in arrays. These are dynamically +allocated and sized to the number of arguments; this wastes some +space, but not much (the size of xmlStyleSheetPtr and +xmlDocPtr is the size of a pointer) and simplifies code +later on. The array memory is allocated with +calloc to ensure contents are initialised to +zero. +

    Arguments Collection

    If the program gets no arguments at all, we print the usage +description, set the program return value to 1 and exit. Instead of +returning directly we go to (literally) to the end of the program text +where some housekeeping takes place.

    +

    +  
    +    if (argc <= 1) {
    +        usage(argv[0]);
    +        return_value = 1;
    +        goto finish;
    +    }
    +        
    +    /* Collect arguments */
    +    for (arg_indx = 1; arg_indx < argc; arg_indx++) {
    +        if (argv[arg_indx][0] != '-')
    +            break;
    +        if ((!strcmp(argv[arg_indx], "-param"))
    +                || (!strcmp(argv[arg_indx], "--param"))) {
    +            arg_indx++;
    +            params[params_indx++] = argv[arg_indx++];
    +            params[params_indx++] = argv[arg_indx];
    +            if (params_indx >= 16) {
    +                fprintf(stderr, "too many params\n");
    +                return_value = 1;
    +                goto finish;
    +            }
    +        }  else if ((!strcmp(argv[arg_indx], "-o"))
    +                || (!strcmp(argv[arg_indx], "--out"))) {
    +            arg_indx++;
    +            output_file = fopen(argv[arg_indx], "w");
    +        } else {
    +            fprintf(stderr, "Unknown option %s\n", argv[arg_indx]);
    +            usage(argv[0]);
    +            return_value = 1;
    +            goto finish;
    +        }
    +    }
    +    params[params_indx] = 0;
    +    
    +

    +

    If the user passes arguments we have to collect them. This is a +matter of iterating over the program argument list while we encounter +arguments starting with a dash. The XSLT parameters are put into the +params array and the output_file +is set to the user request, if any. After processing all the parameter +key-value pairs we set the last element of the params +array to null. +

    Parsing

    The rest of the argument list is taken to be stylesheets and +files to be transformed. Stylesheets are identified by their suffix, +which is expected to be xsl (case sensitive). All other files are +assumed to be XML documents, regardless of suffix.

    +

    +  
    +    /* Collect and parse stylesheets and files to be transformed */
    +    for (; arg_indx < argc; arg_indx++) {
    +        char *argument =
    +            (char *) malloc(sizeof(char) * (strlen(argv[arg_indx]) + 1));
    +        strcpy(argument, argv[arg_indx]);
    +        if (strtok(argument, ".")) {
    +            char *suffix = strtok(0, ".");
    +            if (suffix && !strcmp(suffix, "xsl")) {
    +                stylesheets[stylesheet_indx++] =
    +                    xsltParseStylesheetFile((const xmlChar *)argv[arg_indx]);;
    +            } else {
    +                files[file_indx++] = xmlParseFile(argv[arg_indx]);
    +            }
    +        } else {
    +            files[file_indx++] = xmlParseFile(argv[arg_indx]);
    +        }
    +        free(argument);
    +    }
    +  
    +

    +

    Stylesheets are parsed using the +xsltParseStylesheetFile +function. xsltParseStylesheetFile takes as +argument a pointer to an xmlChar, a typedef of an +unsigned char; in effect, the filename of the stylesheet. The +resulting xsltStylesheetPtr is placed in the +stylesheets array. In the same vein, XML files are +parsed using the xmlParseFile function that takes +as argument the file's name; the resulting xmlDocPtr is +placed in the files array. +

    File Processing

    All stylesheets are applied to each file one after the +other. Stylesheets are applied with the +xsltApplyStylesheet function that takes as +argument the stylesheet to be applied, the file to be transformed and +any parameters we have collected. The in-memory representation of an +XML document takes space, which we free using the +xmlFreeDoc function. The file is then saved to the +specified output.

    +

    +  
    +    /* Process files */
    +    for (i = 0; files[i]; i++) {
    +        doc = files[i];
    +        res = doc;
    +        for (j = 0; stylesheets[j]; j++) {
    +            res = xsltApplyStylesheet(stylesheets[j], doc, params);
    +            xmlFreeDoc(doc);
    +            doc = res;
    +        }
    +
    +        if (stylesheets[0]) {
    +            xsltSaveResultToFile(output_file, res, stylesheets[j-1]);
    +        } else {
    +            xmlDocDump(output_file, res);
    +        }
    +        xmlFreeDoc(res);
    +    }
    +
    +    fclose(output_file);
    +
    +    for (k = 0; stylesheets[k]; k++) {
    +        xsltFreeStylesheet(stylesheets[k]);
    +    }
    +
    +    xsltCleanupGlobals();
    +    xmlCleanupParser();
    +
    + finish:
    +    free(stylesheets);
    +    free(files);
    +    return(return_value);
    +    
    +

    +

    To output an XML document we have in memory we use the +xlstSaveResultToFile function, where we specify +the destination, the document and the stylesheet that has been applied +to it. The stylesheet is required so that output-related information +contained in the stylesheet, such as the encoding to be used, is used +in output. If no transformation has taken place, which will happen +when the user specifies no stylesheets at all in the command line, we +use the xmlDocDump libxml function that saves the +source document to the file without further ado.

    As parsed stylesheets take up space in memory, we take care to +free that memory after use with a call to +xmlFreeStyleSheet. When all work is done, we +clean up all global variables used by the XSLT library using +xsltCleanupGlobals. Likewise, all global memory +allocated for the XML parser is reclaimed by a call to +xmlCleanupParser. Before returning we deallocate +the memory allocated for the holding the pointers to the XML documents +and stylesheets.

    *NIX Compiling and Linking

    Compiling and linking in a *NIX environment +is easy, as the required libraries are almost certain to be already in +place (remember that libxml and libxslt are used by the GNOME project, +so they are present in most installations). The program can be +dynamically linked so that its footprint is minimized, or statically +linked, so that it stands by itself, carrying all required code.

    For dynamic linking the following one liner will do:

    +gcc -o libxslt_pipes -Wall -I/usr/include/libxml2 -lxslt +-lxml2 -L/usr/lib libxslt_pipes.c +

    We assume that the necessary header files are in /usr/include/libxml2 and that the +required libraries (libxslt.so, +libxml2.so) are in /usr/lib.

    In general, a program may need to link to additional libraries, +depending on the processing it actually performs. A good way to start +is to use the xslt-config script. The +--help option displays usage +information. Running

    + + xslt-config --cflags + +

    we get compile flags, while running

    + + xslt-config --libs + +

    we get the library settings for the linker.

    For static linking we must list more libraries than we did for +dynamic linking, as the libraries on which the libxsl and libxslt +libraries depend are also needed. Using xslt-config +on a particular installation we create the following one-liner:

    + +gcc -o libxslt_pipes -Wall -I/usr/include/libxml2 libxslt_pipes.c +-static -L/usr/lib -lxslt -lxml2 -lz -lpthread -lm + +

    If we get warnings to the effect that some function in +statically linked applications requires at runtime the shared +libraries used from the glibc version used for linking, that means +that the binary is not completely static. Although we statically +linked against the GNU C runtime library glibc, glibc uses external +libraries to perform some of its functions. Same version libraries +must be present on the system we want the application to run. One way +to avoid this it to use an alternative C runtime, for example uClibc, which requires obtaining +and building a uClibc toolchain first (if the reason for trying to get +a statically linked version of the program is to embed it somewhere, +using uClibc might be a good idea anyway). +

    MS-Windows Compiling and +Linking

    Compiling and linking in MS-Windows requires +some attention. First, the MS-Windows ports must be +downloaded and installed in the programming workstation. The ports are +available in Igor +Zlatković's site. We need the ports for iconv, zlib, libxml, +and libxslt. In contrast to *NIX environments, we +cannot assume that the libraries needed will be present in other +computers where the program will be used. One solution is to +distribute the program along with the necessary dynamic +libraries. Another solution is to statically link the program so that +only a single executable file will have to be distributed.

    We assume that we have decompressed the downloaded ports and +have placed the required contents of their include directories in an include directory in our file system. The +required contents include everything apart from the libexslt directory of the libxslt port, +as we are not using EXLST (an initiative to provide extensions to +XSLT) in this project. In order to compile the program we have to make +sure that all necessary header files are included. When using the +Microsoft compiler this translates to adding the required +/I switches in the command line. If using a Visual +Studio product the same effect is attained by specifying additional +include directories in the compilation options. In the end, if the +headers have been copied in C:\include the command line must contain +/I"C:\include" /I"C:\include\libslt" +/I"C:\include\libxml".

    This being a C program, it needs to be compiled against an +implementation of the C libraries. Microsoft provides various +implementations. The ports, however, have been compiled against the +msvcrt.dll implementation, so it is wise to use +the same runtime in our project, lest we wish to come against +unexpected runtime crashes. The msvcrt.dll is a +multi-threaded implementation and is specified by giving +/MD as a compiler option. Unfortunately, the +correspondence between the /MD switch and +msvcrt.dll breaks after version 6 of the +Microsoft compiler. In version 7 and later (i.e., Visual Studio .NET), +/MD links against a different DLL; in version 7.1 +this is msvcrt71.dll. The end result of this bit +of esoterica is that if you try to dynamically link your application +with a compiler whose version is greater than 6, your program is +likely to crash unexpectedly. Alternatively, you may wish to compile +all iconv, zlib, libxml and libxslt yourself, using the new runtime +library. This is not a tall order, and some details are given +below.

    There are three kinds of libraries in MS-Windows. Dynamically +Linked Libraries (DLLs), like msvcrt.dll we met +above, are used for dynamic linking; an application links to them at +runtime, so the application does not include the code contained in +them. Static libraries are used for static linking; an application +adds the libraries' code to its own code at link time. Import +libraries are used when building an application that uses DLLs. For +the application to be built, the linker must somehow find the +definitions of the functions that will be provided in runtime by the +DLLs, otherwise it will complain about unresolved references. Import +libraries contain function stubs that, for each DLL function we want +to call, know where to look for it in the DLL. In essence, in order to +use a DLL we must link against its corresponding import library. DLLs +have a .dll suffix; static and import libraries +both have a .lib suffix. In the MS-Windows ports +of libxml and libxslt static libraries are distinguished by their name +ending in _a.lib, while in the zlib port the +import library is zdll.lib and the static library +is zlib.lib. In what follows we assume we have a +lib directory in our filesystem +where we place the libraries we need for linking.

    If we want to link dynamically we must make sure the lib directory contains +iconv.lib, libxslt.lib, +libxml2.lib, and +zdll.lib. When using the Microsoft linker this +translates to adding the required /LIBPATH +switch and the necessary libraries in the command line. In Visual +Studio we must specify an additional library directory for lib and put the necessary libraries in +the additional dependencies. In the end, the command line must include +/LIBPATH:"C:\lib" "lib\iconv.lib" "lib\libxslt.lib" +"lib\libxml2.lib" "lib\zdll.lib", provided the libraries' +directory is C:\lib. In order +for the resulting executable to run, the ports DLLs must be present; +one way is to place all DLLs contained in the ports in the home +directory of our application, and make sure they are distributed +together.

    If we want to link statically we must make sure the lib directory contains +iconv_a.lib, libxslt_a.lib, +libxml2_a.lib, and +zlib.lib. Adding lib as a library directory and putting +the necessary libraries in the additional dependencies, we get a +command line that should include /LIBPATH:"C:\lib" +"lib\iconv_a.lib" "lib\libxslt_a.lib" "lib\libxml2_a.lib" +"lib\zlib.lib". The resulting executable is much bigger +than if we linked dynamically; it is, however, self-contained and can +be distributed more easily, in theory at least. In practice, however, +the executable is not completely static. We saw that the ports are +compiled against msvcrt.dll, so the program does +require that DLL at runtime. Moreover, since when using a version of +Microsoft developer tools with a version number greater than 6, we are +no longer using msvcrt.dll, but another runtime +like msvcrt71.dll, and we then need that DLL. In +contrast to msvcrt.dll it may not be present on +the target computer, so we may have to copy it along.

    Building the Ports in +MS-Windows

    The source code of the ports is readily available on the web, +one has to check the ports sites. Each port can be built without +problems in an MS-Windows environment using Microsoft development +tools. The necessary command line tools (compiler, linker, +nmake) must be available. This means running a +batch file called vcvars32.bat that comes with +Visual Studio (its exact location in the directory tree may vary +depending on the version of Visual Studio, but a file search will find +it anyway). Makefiles for the Microsoft tools are found in all +ports. They are distinguished by their suffix, e.g., +Makefile.msvc or +Makefile.msc. To build zlib it suffices to run +nmake against Makefile.msc +(i.e., with the /F option); similarly, to build +iconv it suffices to run nmake +against Makefile.msvc. Building libxml and +libxslt requires an extra configuration step; we must run the +configure.js configuration script with the +cscript command. configure.js +is found in the win32 directory +in the distributions. It is written in JScript, Microsoft's +implementation of the ECMA 262 language specification (ECMAScript +Edition 3), a JavaScript offspring. The configuration string takes a +number of parameters detailing our environment and needs; +cscript configure.js help documents +them.

    It is wise to read all documentation files in the source +distributions before starting; moreover, pay attention to the +dependencies between the ports. If we configure libxml and libxslt to +use iconv and zlib we must build these two first and make sure their +headers and libraries can be found by the compiler and the +linker when building libxml and libxslt.

    zlib, iconv and All That

    We saw that libxml and libxslt depend on various other +libraries, for instance zlib, iconv, and so forth. Taking a look into +them gives us clues on the capabilities of libxml and libxslt.

    zlib is a free general +purpose lossless data compression library. It is a venerable +workhorse; more than 500 applications +(both commercial and open source) seem to use the library. libxml uses +zlib so that it can read from or write to compressed files +directly. The xmlParseFile function can +transparently parse a compressed document to produce an +xmlDoc. If we want to create a compressed +document with libxml we can use an +xmlTextWriterPtr (obtained through +xmlNewTextWriterDoc), or another related +structure from libxml/xmlwriter.h, with +compression enabled.

    XML allows documents to use a variety of different character +encodings. iconv is a free +library for converting between different character encodings. libxml +provides a set of default converters for some encodings: UTF-8, UTF-16 +(little endian and big endian), ISO-8859-1, ASCII, and HTML (a +specific handler for the conversion of UTF-8 to ASCII with HTML +predefined entities like &copy; for the copyright sign). However, +when compiled with iconv support, libxml and libxslt can handle the +full range of encodings provided by iconv; these should cover most +needs.

    libxml and libxslt can be used in multi-threaded +applications. In MS-Windows they are linked against +MSVCRT.DLL (or one of its descendants, as we saw +above). In *NIX the pthreads +(POSIX threads) library is used.

    The Complete Program

    +The complete program listing is given below. The program is also +available online. +

    +

    +/*
    + * libxslt_pipes.c: a program for performing a series of XSLT
    + * transformations
    + *
    + * Writen by Panos Louridas, based on libxslt_tutorial.c by John Fleck.
    + *
    + * See the file Copyright for the status of this software.
    + *
    + */ 
    +
    +#include <stdio.h>
    +#include <string.h>
    +#include <stdlib.h>
    +
    +#include <libxslt/transform.h>
    +#include <libxslt/xsltutils.h>
    +
    +extern int xmlLoadExtDtdDefaultValue;
    +
    +static void usage(const char *name) {
    +    printf("Usage: %s [options] stylesheet [stylesheet ...] file [file ...]\n",
    +            name);
    +    printf("      --out file: send output to file\n");
    +    printf("      --param name value: pass a (parameter,value) pair\n");
    +}
    +
    +int main(int argc, char **argv) {
    +    int arg_indx;
    +    const char *params[16 + 1];
    +    int params_indx = 0;
    +    int stylesheet_indx = 0;
    +    int file_indx = 0;
    +    int i, j, k;
    +    FILE *output_file = stdout;
    +    xsltStylesheetPtr *stylesheets = 
    +        (xsltStylesheetPtr *) calloc(argc, sizeof(xsltStylesheetPtr));
    +    xmlDocPtr *files = (xmlDocPtr *) calloc(argc, sizeof(xmlDocPtr));
    +    xmlDocPtr doc, res;
    +    int return_value = 0;
    +        
    +    if (argc <= 1) {
    +        usage(argv[0]);
    +        return_value = 1;
    +        goto finish;
    +    }
    +        
    +    /* Collect arguments */
    +    for (arg_indx = 1; arg_indx < argc; arg_indx++) {
    +        if (argv[arg_indx][0] != '-')
    +            break;
    +        if ((!strcmp(argv[arg_indx], "-param"))
    +                || (!strcmp(argv[arg_indx], "--param"))) {
    +            arg_indx++;
    +            params[params_indx++] = argv[arg_indx++];
    +            params[params_indx++] = argv[arg_indx];
    +            if (params_indx >= 16) {
    +                fprintf(stderr, "too many params\n");
    +                return_value = 1;
    +                goto finish;
    +            }
    +        }  else if ((!strcmp(argv[arg_indx], "-o"))
    +                || (!strcmp(argv[arg_indx], "--out"))) {
    +            arg_indx++;
    +            output_file = fopen(argv[arg_indx], "w");
    +        } else {
    +            fprintf(stderr, "Unknown option %s\n", argv[arg_indx]);
    +            usage(argv[0]);
    +            return_value = 1;
    +            goto finish;
    +        }
    +    }
    +    params[params_indx] = 0;
    +
    +    /* Collect and parse stylesheets and files to be transformed */
    +    for (; arg_indx < argc; arg_indx++) {
    +        char *argument =
    +            (char *) malloc(sizeof(char) * (strlen(argv[arg_indx]) + 1));
    +        strcpy(argument, argv[arg_indx]);
    +        if (strtok(argument, ".")) {
    +            char *suffix = strtok(0, ".");
    +            if (suffix && !strcmp(suffix, "xsl")) {
    +                stylesheets[stylesheet_indx++] =
    +                    xsltParseStylesheetFile((const xmlChar *)argv[arg_indx]);;
    +            } else {
    +                files[file_indx++] = xmlParseFile(argv[arg_indx]);
    +            }
    +        } else {
    +            files[file_indx++] = xmlParseFile(argv[arg_indx]);
    +        }
    +        free(argument);
    +    }
    +
    +    xmlSubstituteEntitiesDefault(1);
    +    xmlLoadExtDtdDefaultValue = 1;
    +
    +    /* Process files */
    +    for (i = 0; files[i]; i++) {
    +        doc = files[i];
    +        res = doc;
    +        for (j = 0; stylesheets[j]; j++) {
    +            res = xsltApplyStylesheet(stylesheets[j], doc, params);
    +            xmlFreeDoc(doc);
    +            doc = res;
    +        }
    +
    +        if (stylesheets[0]) {
    +            xsltSaveResultToFile(output_file, res, stylesheets[j-1]);
    +        } else {
    +            xmlDocDump(output_file, res);
    +        }
    +        xmlFreeDoc(res);
    +    }
    +
    +    fclose(output_file);
    +
    +    for (k = 0; stylesheets[k]; k++) {
    +        xsltFreeStylesheet(stylesheets[k]);
    +    }
    +
    +    xsltCleanupGlobals();
    +    xmlCleanupParser();
    +
    + finish:
    +    free(stylesheets);
    +    free(files);
    +    return(return_value);
    +}
    +
    +

    +

    diff --git a/doc/tutorial2/libxslt_pipes.xml b/doc/tutorial2/libxslt_pipes.xml new file mode 100644 index 0000000..9a672a9 --- /dev/null +++ b/doc/tutorial2/libxslt_pipes.xml @@ -0,0 +1,661 @@ + + + +
    + + PanosLouridas + + 2004 + Panagiotis Louridas + + + Permission is hereby granted, free of charge, to + any person obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software + without restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software + is furnished to do so, subject to the following conditions: + + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + + +libxslt: An Extended Tutorial + +Introduction + +The Extensible Stylesheet Language Transformations (XSLT) +specification defines an XML template language for transforming XML +documents. An XSLT engine reads an XSLT file and an XML document and +transforms the document accordingly. + +We want to perform a series of XSLT transformations to a series +of documents. An obvious solution is to use the operating system's +pipe mechanism and start a series of transformation processes, each +one taking as input the output of the previous transformation. It +would be interesting, though, and perhaps more efficient if we could +do our job within a single process. + +libxslt is a library for doing XSLT transformations. It is built +on libxml, which is a library for handling XML documents. libxml and +libxslt are used by the GNOME project. Although developed in the +*NIX world, both libxml and libxslt have been +ported to the MS-Windows platform. In principle an application using +libxslt should be easily portable between the two systems. In +practice, however, there arise various wrinkles. These do not have +anything to do with libxml or libxslt per se, but rather with the +different compilation and linking procedures of each system. + +The presented solution is an extension of John +Fleck's libxslt tutorial, but the present tutorial tries to be +self-contained. It develops a minimal libxslt application +(libxslt_pipes) that can perform a series of transformations to a +series of files in a pipe-like manner. An invocation might be: + + + + libxslt_pipes --out results.xml foo.xsl bar.xsl doc1.xml doc2.xml + + + +The foo.xsl stylesheet will be applied to + doc1.xml and the bar.xsl +stylesheet will be applied to the resulting document; then the two +stylesheets will be applied in the same sequence to +bar.xsl. The results are sent to +results.xml (if no output is specified they are +sent to standard output). + +The application is compiled in both *NIX +systems and MS-Windows, where by *NIX systems we +mean Linux, BSD, and other members of the +family. The gcc suite is used in the *NIX platform +and the Microsoft compiler and linker are used in the +MS-Windows platform. + + + +Setting the Scene + + +We need to include the necessary libraries: + + + + #include + #include + + #include + #include + ]]> + + + +The first group of include directives includes general C +libraries. The libraries we need to make libxslt work are in the +second group. The transform.h header file +declares the API that does the bulk of the actual processing. The +xsltutils.h header file declares the API for some +generic utility functions of the XSLT engine; among other things, +saving to a file, which is what we need it for. + + +If our input files contain entities through external subsets, we need +to tell libxslt to load them. The global variable +xmlLoadExtDtdDefaultValue, defined in +libxml/globals.h, is responsible for that. As the +variable is defined outside our program we must specify external +linkage: + + extern int xmlLoadExtDtdDefaultValue; + + + + +The program is called from the command line. We anticipate that the +user may not call it the right way, so we define a function for +describing its usage: + + static void usage(const char *name) { + printf("Usage: %s [options] stylesheet [stylesheet ...] file [file ...]\n", + name); + printf(" --out file: send output to file\n"); + printf(" --param name value: pass a (parameter,value) pair\n"); + } + + + + +Program Start + +We need to define a few variables that are used throughout the +program: + + int main(int argc, char **argv) { + int arg_indx; + const char *params[16 + 1]; + int params_indx = 0; + int stylesheet_indx = 0; + int file_indx = 0; + int i, j, k; + FILE *output_file = stdout; + xsltStylesheetPtr *stylesheets = + (xsltStylesheetPtr *) calloc(argc, sizeof(xsltStylesheetPtr)); + xmlDocPtr *files = (xmlDocPtr *) calloc(argc, sizeof(xmlDocPtr)); + int return_value = 0; + + + +The arg_indx integer is an index used to +iterate over the program arguments. The params +string array is used to collect the XSLT parameters. In XSLT, +additional information may be passed to the processor via +parameters. The user of the program specifies these in key-value pairs +in the command line following the --param +command line argument. We accept up to 8 such key-value pairs, which +we track with the params_indx integer. libxslt +expects the parameters array to be null-terminated, so we have to +allocate one extra place (16 + 1) for it. The +file_indx is an index to iterate over the files to +be processed. The i, j, +k integers are additional indices for iteration +purposes, and return_value is the value the program +returns to the operating system. We expect the result of the +transformation to be the standard output in most cases, but the user +may wish otherwise via the command line +option, so we need to keep track of the situation with the +output_file file pointer. + +In libxslt, XSLT stylesheets are internally stored in +xsltStylesheet structures; similarly, in +libxml XML documents are stored in xmlDoc +structures. xsltStylesheetPtr and xmlDocPtr +are simply typedefs of pointers to them. The user may specify any +number of stylesheets that will be applied to the documents one after +the other. To save time we parse the stylesheets and the documents as +we read them from the command line and keep the parsed representation +of them. The parsed results are kept in arrays. These are dynamically +allocated and sized to the number of arguments; this wastes some +space, but not much (the size of xmlStyleSheetPtr and +xmlDocPtr is the size of a pointer) and simplifies code +later on. The array memory is allocated with +calloc to ensure contents are initialised to +zero. + + + + +Arguments Collection + +If the program gets no arguments at all, we print the usage +description, set the program return value to 1 and exit. Instead of +returning directly we go to (literally) to the end of the program text +where some housekeeping takes place. + + + + = 16) { + fprintf(stderr, "too many params\n"); + return_value = 1; + goto finish; + } + } else if ((!strcmp(argv[arg_indx], "-o")) + || (!strcmp(argv[arg_indx], "--out"))) { + arg_indx++; + output_file = fopen(argv[arg_indx], "w"); + } else { + fprintf(stderr, "Unknown option %s\n", argv[arg_indx]); + usage(argv[0]); + return_value = 1; + goto finish; + } + } + params[params_indx] = 0; + ]]> + + + +If the user passes arguments we have to collect them. This is a +matter of iterating over the program argument list while we encounter +arguments starting with a dash. The XSLT parameters are put into the +params array and the output_file +is set to the user request, if any. After processing all the parameter +key-value pairs we set the last element of the params +array to null. + + + +Parsing + +The rest of the argument list is taken to be stylesheets and +files to be transformed. Stylesheets are identified by their suffix, +which is expected to be xsl (case sensitive). All other files are +assumed to be XML documents, regardless of suffix. + + + + + + + +Stylesheets are parsed using the +xsltParseStylesheetFile +function. xsltParseStylesheetFile takes as +argument a pointer to an xmlChar, a typedef of an +unsigned char; in effect, the filename of the stylesheet. The +resulting xsltStylesheetPtr is placed in the +stylesheets array. In the same vein, XML files are +parsed using the xmlParseFile function that takes +as argument the file's name; the resulting xmlDocPtr is +placed in the files array. + + + + +File Processing + +All stylesheets are applied to each file one after the +other. Stylesheets are applied with the +xsltApplyStylesheet function that takes as +argument the stylesheet to be applied, the file to be transformed and +any parameters we have collected. The in-memory representation of an +XML document takes space, which we free using the +xmlFreeDoc function. The file is then saved to the +specified output. + + + + + + + +To output an XML document we have in memory we use the +xlstSaveResultToFile function, where we specify +the destination, the document and the stylesheet that has been applied +to it. The stylesheet is required so that output-related information +contained in the stylesheet, such as the encoding to be used, is used +in output. If no transformation has taken place, which will happen +when the user specifies no stylesheets at all in the command line, we +use the xmlDocDump libxml function that saves the +source document to the file without further ado. + +As parsed stylesheets take up space in memory, we take care to +free that memory after use with a call to +xmlFreeStyleSheet. When all work is done, we +clean up all global variables used by the XSLT library using +xsltCleanupGlobals. Likewise, all global memory +allocated for the XML parser is reclaimed by a call to +xmlCleanupParser. Before returning we deallocate +the memory allocated for the holding the pointers to the XML documents +and stylesheets. + + + +*NIX Compiling and Linking + +Compiling and linking in a *NIX environment +is easy, as the required libraries are almost certain to be already in +place (remember that libxml and libxslt are used by the GNOME project, +so they are present in most installations). The program can be +dynamically linked so that its footprint is minimized, or statically +linked, so that it stands by itself, carrying all required code. + +For dynamic linking the following one liner will do: + + +gcc -o libxslt_pipes -Wall -I/usr/include/libxml2 -lxslt +-lxml2 -L/usr/lib libxslt_pipes.c + + +We assume that the necessary header files are in /usr/include/libxml2 and that the +required libraries (libxslt.so, +libxml2.so) are in /usr/lib. + +In general, a program may need to link to additional libraries, +depending on the processing it actually performs. A good way to start +is to use the xslt-config script. The + option displays usage +information. Running + + + + xslt-config --cflags + + + +we get compile flags, while running + + + + xslt-config --libs + + + +we get the library settings for the linker. + +For static linking we must list more libraries than we did for +dynamic linking, as the libraries on which the libxsl and libxslt +libraries depend are also needed. Using xslt-config +on a particular installation we create the following one-liner: + + + +gcc -o libxslt_pipes -Wall -I/usr/include/libxml2 libxslt_pipes.c +-static -L/usr/lib -lxslt -lxml2 -lz -lpthread -lm + + + +If we get warnings to the effect that some function in +statically linked applications requires at runtime the shared +libraries used from the glibc version used for linking, that means +that the binary is not completely static. Although we statically +linked against the GNU C runtime library glibc, glibc uses external +libraries to perform some of its functions. Same version libraries +must be present on the system we want the application to run. One way +to avoid this it to use an alternative C runtime, for example uClibc, which requires obtaining +and building a uClibc toolchain first (if the reason for trying to get +a statically linked version of the program is to embed it somewhere, +using uClibc might be a good idea anyway). + + + + +MS-Windows Compiling and +Linking + +Compiling and linking in MS-Windows requires +some attention. First, the MS-Windows ports must be +downloaded and installed in the programming workstation. The ports are +available in Igor +Zlatkoviæ's site. We need the ports for iconv, zlib, libxml, +and libxslt. In contrast to *NIX environments, we +cannot assume that the libraries needed will be present in other +computers where the program will be used. One solution is to +distribute the program along with the necessary dynamic +libraries. Another solution is to statically link the program so that +only a single executable file will have to be distributed. + +We assume that we have decompressed the downloaded ports and +have placed the required contents of their include directories in an include directory in our file system. The +required contents include everything apart from the libexslt directory of the libxslt port, +as we are not using EXLST (an initiative to provide extensions to +XSLT) in this project. In order to compile the program we have to make +sure that all necessary header files are included. When using the +Microsoft compiler this translates to adding the required + switches in the command line. If using a Visual +Studio product the same effect is attained by specifying additional +include directories in the compilation options. In the end, if the +headers have been copied in C:\include the command line must contain +. + +This being a C program, it needs to be compiled against an +implementation of the C libraries. Microsoft provides various +implementations. The ports, however, have been compiled against the +msvcrt.dll implementation, so it is wise to use +the same runtime in our project, lest we wish to come against +unexpected runtime crashes. The msvcrt.dll is a +multi-threaded implementation and is specified by giving + as a compiler option. Unfortunately, the +correspondence between the switch and +msvcrt.dll breaks after version 6 of the +Microsoft compiler. In version 7 and later (i.e., Visual Studio .NET), + links against a different DLL; in version 7.1 +this is msvcrt71.dll. The end result of this bit +of esoterica is that if you try to dynamically link your application +with a compiler whose version is greater than 6, your program is +likely to crash unexpectedly. Alternatively, you may wish to compile +all iconv, zlib, libxml and libxslt yourself, using the new runtime +library. This is not a tall order, and some details are given +below. + +There are three kinds of libraries in MS-Windows. Dynamically +Linked Libraries (DLLs), like msvcrt.dll we met +above, are used for dynamic linking; an application links to them at +runtime, so the application does not include the code contained in +them. Static libraries are used for static linking; an application +adds the libraries' code to its own code at link time. Import +libraries are used when building an application that uses DLLs. For +the application to be built, the linker must somehow find the +definitions of the functions that will be provided in runtime by the +DLLs, otherwise it will complain about unresolved references. Import +libraries contain function stubs that, for each DLL function we want +to call, know where to look for it in the DLL. In essence, in order to +use a DLL we must link against its corresponding import library. DLLs +have a .dll suffix; static and import libraries +both have a .lib suffix. In the MS-Windows ports +of libxml and libxslt static libraries are distinguished by their name +ending in _a.lib, while in the zlib port the +import library is zdll.lib and the static library +is zlib.lib. In what follows we assume we have a +lib directory in our filesystem +where we place the libraries we need for linking. + +If we want to link dynamically we must make sure the lib directory contains +iconv.lib, libxslt.lib, +libxml2.lib, and +zdll.lib. When using the Microsoft linker this +translates to adding the required +switch and the necessary libraries in the command line. In Visual +Studio we must specify an additional library directory for lib and put the necessary libraries in +the additional dependencies. In the end, the command line must include +, provided the libraries' +directory is C:\lib. In order +for the resulting executable to run, the ports DLLs must be present; +one way is to place all DLLs contained in the ports in the home +directory of our application, and make sure they are distributed +together. + +If we want to link statically we must make sure the lib directory contains +iconv_a.lib, libxslt_a.lib, +libxml2_a.lib, and +zlib.lib. Adding lib as a library directory and putting +the necessary libraries in the additional dependencies, we get a +command line that should include . The resulting executable is much bigger +than if we linked dynamically; it is, however, self-contained and can +be distributed more easily, in theory at least. In practice, however, +the executable is not completely static. We saw that the ports are +compiled against msvcrt.dll, so the program does +require that DLL at runtime. Moreover, since when using a version of +Microsoft developer tools with a version number greater than 6, we are +no longer using msvcrt.dll, but another runtime +like msvcrt71.dll, and we then need that DLL. In +contrast to msvcrt.dll it may not be present on +the target computer, so we may have to copy it along. + +Building the Ports in +MS-Windows + +The source code of the ports is readily available on the web, +one has to check the ports sites. Each port can be built without +problems in an MS-Windows environment using Microsoft development +tools. The necessary command line tools (compiler, linker, +nmake) must be available. This means running a +batch file called vcvars32.bat that comes with +Visual Studio (its exact location in the directory tree may vary +depending on the version of Visual Studio, but a file search will find +it anyway). Makefiles for the Microsoft tools are found in all +ports. They are distinguished by their suffix, e.g., +Makefile.msvc or +Makefile.msc. To build zlib it suffices to run +nmake against Makefile.msc +(i.e., with the option); similarly, to build +iconv it suffices to run nmake +against Makefile.msvc. Building libxml and +libxslt requires an extra configuration step; we must run the +configure.js configuration script with the +cscript command. configure.js +is found in the win32 directory +in the distributions. It is written in JScript, Microsoft's +implementation of the ECMA 262 language specification (ECMAScript +Edition 3), a JavaScript offspring. The configuration string takes a +number of parameters detailing our environment and needs; +cscript configure.js help documents +them. + +It is wise to read all documentation files in the source +distributions before starting; moreover, pay attention to the +dependencies between the ports. If we configure libxml and libxslt to +use iconv and zlib we must build these two first and make sure their +headers and libraries can be found by the compiler and the +linker when building libxml and libxslt. + + + + + +zlib, iconv and All That + +We saw that libxml and libxslt depend on various other +libraries, for instance zlib, iconv, and so forth. Taking a look into +them gives us clues on the capabilities of libxml and libxslt. + +zlib is a free general +purpose lossless data compression library. It is a venerable +workhorse; more than 500 applications +(both commercial and open source) seem to use the library. libxml uses +zlib so that it can read from or write to compressed files +directly. The xmlParseFile function can +transparently parse a compressed document to produce an +xmlDoc. If we want to create a compressed +document with libxml we can use an +xmlTextWriterPtr (obtained through +xmlNewTextWriterDoc), or another related +structure from libxml/xmlwriter.h, with +compression enabled. + +XML allows documents to use a variety of different character +encodings. iconv is a free +library for converting between different character encodings. libxml +provides a set of default converters for some encodings: UTF-8, UTF-16 +(little endian and big endian), ISO-8859-1, ASCII, and HTML (a +specific handler for the conversion of UTF-8 to ASCII with HTML +predefined entities like &copy; for the copyright sign). However, +when compiled with iconv support, libxml and libxslt can handle the +full range of encodings provided by iconv; these should cover most +needs. + +libxml and libxslt can be used in multi-threaded +applications. In MS-Windows they are linked against +MSVCRT.DLL (or one of its descendants, as we saw +above). In *NIX the pthreads +(POSIX threads) library is used. + + + +The Complete Program + + +The complete program listing is given below. The program is also +available online. + + + + + + + + + + +
    diff --git a/doc/w3c.png b/doc/w3c.png new file mode 100644 index 0000000..c541c20 Binary files /dev/null and b/doc/w3c.png differ diff --git a/doc/xsa.xsl b/doc/xsa.xsl new file mode 100644 index 0000000..343ef34 --- /dev/null +++ b/doc/xsa.xsl @@ -0,0 +1,54 @@ + + + + + + + + + Daniel Veillard + daniel@veillard.com + http://veillard.com/ + + + libxslt + + + http://xmlsoft.org/XSLT/ + + + + + + + + + + + + + + + - + + + + + + + at + + + + + + + diff --git a/doc/xslt.html b/doc/xslt.html new file mode 100644 index 0000000..e1139cd --- /dev/null +++ b/doc/xslt.html @@ -0,0 +1,2771 @@ + + + + The XSLT C library for GNOME + + + + +

    The XSLT C library for GNOME

    + +

    libxslt

    + +

    Libxslt is the XSLT C library +developed for the GNOME project. XSLT itself is a an XML language to define +transformation for XML. Libxslt is based on libxml2 the XML C library developed for the +GNOME project. It also implements most of the EXSLT set of processor-portable extensions +functions and some of Saxon's evaluate and expressions extensions.

    + +

    People can either embed the library in their application or use xsltproc +the command line processing tool. This library is free software and can be +reused in commercial applications (see the intro)

    + +

    External documents:

    + + +

    + +

    Logo designed by Marc Liyanage.

    + +

    Introduction

    + +

    This document describes libxslt, +the XSLT C library developed for the +GNOME project.

    + +

    Here are some key points about libxslt:

    +
      +
    • Libxslt is a C implementation
    • +
    • Libxslt is based on libxml for XML parsing, tree manipulation and XPath + support
    • +
    • It is written in plain C, making as few assumptions as possible, and + sticking closely to ANSI C/POSIX for easy embedding. Should works on + Linux/Unix/Windows.
    • +
    • This library is released under the MIT + Licence
    • +
    • Though not designed primarily with performances in mind, libxslt seems + to be a relatively fast processor.
    • +
    + +

    Documentation

    + +

    There are some on-line resources about using libxslt:

    +
      +
    1. Check the API + documentation automatically extracted from code comments (using the + program apibuild.py, developed for libxml, together with the xsl script + 'newapi.xsl' and the libxslt xsltproc program).
    2. +
    3. Look at the mailing-list + archive.
    4. +
    5. Of course since libxslt is based on libxml, it's a good idea to at + least read libxml description
    6. +
    + +

    Reporting bugs and getting help

    + +

    If you need help with the XSLT language itself, here are a number of +useful resources:

    + + +

    Well, bugs or missing features are always possible, and I will make a +point of fixing them in a timely fashion. The best way to report a bug is to +use the GNOME bug +tracking database (make sure to use the "libxslt" module name). Before +filing a bug, check the list of existing +libxslt bugs to make sure it hasn't already been filed. I look at reports +there regularly and it's good to have a reminder when a bug is still open. Be +sure to specify that the bug is for the package libxslt.

    + +

    For small problems you can try to get help on IRC, the #xml channel on +irc.gnome.org (port 6667) usually have a few person subscribed which may help +(but there is no guarantee and if a real issue is raised it should go on the +mailing-list for archival).

    + +

    There is also a mailing-list xslt@gnome.org for libxslt, with an on-line archive. To subscribe +to this list, please visit the associated Web page +and follow the instructions.

    + +

    Alternatively, you can just send the bug to the xslt@gnome.org list, if it's really libxslt +related I will approve it.. Please do not send me mail directly especially +for portability problem, it makes things really harder to track and in some +cases I'm not the best person to answer a given question, ask the list +instead. Do not send code, I won't debug it (but patches are +really appreciated!).

    + +

    Please note that with the current amount of virus and SPAM, sending mail +to the list without being subscribed won't work. There is *far too many +bounces* (in the order of a thousand a day !) I cannot approve them manually +anymore. If your mail to the list bounced waiting for administrator approval, +it is LOST ! Repost it and fix the problem triggering the error. Also please +note that emails with +a legal warning asking to not copy or redistribute freely the information +they contain are NOT acceptable for the mailing-list, +such mail will as much as possible be discarded automatically, and are less +likely to be answered if they made it to the list, DO NOT +post to the list from an email address where such legal requirements are +automatically added, get private paying support if you can't share +information.

    + +

    Check the following too before +posting:

    +
      +
    • use the search engine to get information + related to your problem.
    • +
    • make sure you are using a recent + version, and that the problem still shows up in those
    • +
    • check the list + archives to see if the problem was reported already, in this case + there is probably a fix available, similarly check the registered + open bugs
    • +
    • make sure you can reproduce the bug with xsltproc, a very useful thing + to do is run the transformation with -v argument and redirect the + standard error to a file, then search in this file for the transformation + logs just preceding the possible problem
    • +
    • Please send the command showing the error as well as the input and + stylesheet (as an attachment)
    • +
    + +

    Then send the bug with associated information to reproduce it to the xslt@gnome.org list; if it's really libxslt +related I will approve it. Please do not send mail to me directly, it makes +things really hard to track and in some cases I am not the best person to +answer a given question, ask on the list.

    + +

    To be really clear about support:

    +
      +
    • Support or help request MUST be sent to + the list or on bugzilla in case of problems, so that the Question + and Answers can be shared publicly. Failing to do so carries the implicit + message "I want free support but I don't want to share the benefits with + others" and is not welcome. I will automatically Carbon-Copy the + xslt@gnome.org mailing list for any technical reply made about libxml2 or + libxslt.
    • +
    • There is no guarantee for support, + if your question remains unanswered after a week, repost it, making sure + you gave all the detail needed and the information requested.
    • +
    • Failing to provide information as requested or double checking first + for prior feedback also carries the implicit message "the time of the + library maintainers is less valuable than my time" and might not be + welcome.
    • +
    + +

    Of course, bugs reports with a suggested patch for fixing them will +probably be processed faster.

    + +

    If you're looking for help, a quick look at the list archive may actually +provide the answer, I usually send source samples when answering libxslt +usage questions. The auto-generated documentation is +not as polished as I would like (I need to learn more about Docbook), but +it's a good starting point.

    + +

    How to help

    + +

    You can help the project in various ways, the best thing to do first is to +subscribe to the mailing-list as explained before, check the archives and the GNOME bug +database::

    +
      +
    1. provide patches when you find problems
    2. +
    3. provide the diffs when you port libxslt to a new platform. They may not + be integrated in all cases but help pinpointing portability problems + and
    4. +
    5. provide documentation fixes (either as patches to the code comments or + as HTML diffs).
    6. +
    7. provide new documentations pieces (translations, examples, etc ...)
    8. +
    9. Check the TODO file and try to close one of the items
    10. +
    11. take one of the points raised in the archive or the bug database and + provide a fix. Get in touch with me + before to avoid synchronization problems and check that the suggested + fix will fit in nicely :-)
    12. +
    + +

    Downloads

    + +

    The latest versions of libxslt can be found on the xmlsoft.org server. (NOTE that +you need the libxml2, +libxml2-devel, +libxslt and libxslt-devel +packages installed to compile applications using libxslt.) Igor Zlatkovic is now the maintainer of +the Windows port, he provides +binaries. CSW provides +Solaris binaries, and +Steve Ball provides Mac Os X +binaries.

    + +

    Snapshot:

    + + +

    Contribs:

    + +

    I do accept external contributions, especially if compiling on another +platform, get in touch with me to upload the package. I will keep them in the +contrib directory

    + +

    Libxslt is also available from GIT:

    +
      +
    • See libxslt Git web. + To checkout a local tree use:

      +
      git clone git://git.gnome.org/libxslt
      +
    • +
    • The libxml2 module is also present + there
    • +
    + + +

    FAQ

    +
      +
    1. Troubles compiling or linking programs using libxslt +

      Usually the problem comes from the fact that the compiler doesn't get + the right compilation or linking flags. There is a small shell script + xslt-config which is installed as part of libxslt usual + install process which provides those flags. Use

      +

      xslt-config --cflags

      +

      to get the compilation flags and

      +

      xslt-config --libs

      +

      to get the linker flags. Usually this is done directly from the + Makefile as:

      +

      CFLAGS=`xslt-config --cflags`

      +

      LIBS=`xslt-config --libs`

      +

      Note also that if you use the EXSLT extensions from the program then + you should prepend -lexslt to the LIBS options

      +
    2. +
    3. passing parameters on the xsltproc command line doesn't work +

      xsltproc --param test alpha foo.xsl foo.xml

      +

      the param does not get passed and ends up as ""

      +

      In a nutshell do a double escaping at the shell prompt:

      +

      xsltproc --param test "'alpha'" foo.xsl foo.xml

      +

      i.e. the string value is surrounded by " and ' then terminated by ' + and ". Libxslt interpret the parameter values as XPath expressions, so + the string ->alpha<- is intepreted as the node set + matching this string. You really want ->'alpha'<- to + be passed to the processor. And to allow this you need to escape the + quotes at the shell level using ->"'alpha'"<- .

      +

      or use

      +

      xsltproc --stringparam test alpha foo.xsl foo.xml

      +
    4. +
    5. Is there C++ bindings ? +

      Yes for example xmlwrapp , see the related pages about bindings

      +
    6. +
    + +

    News

    + +

    See the git page +to get a description of the recent commits.

    + +

    Those are the public releases made:

    + +

    1.1.29: May 24 2016

    +
      +
    • Security:
      + CVE-2015-7995 Fix for type confusion in preprocessing attributes (Daniel Veillard)
      +
    • + +
    • Documentation:
      +
    • + +
    • Portability:
      + Fix a portibility problem with previous commit (Eduard Sanou),
      + Fix MingW build (Nick Wellnhofer),
      + Correctly emulate snprintf on older MSVC versions (Nick Wellnhofer),
      + Add Python script to run some tests on Windows (Nick Wellnhofer),
      + Remove /OPT:NOWIN98 option (Nick Wellnhofer),
      + Visual Studio 14 CTP defines snprintf() (Daniel Veillard),
      + Use AC_PATH_TOOL to find libgcrypt-config and xml2-config (Micha¿ Górny),
      + Use $libdir for LIBXSLT_DEFAULT_PLUGINS_PATH (larryhaja),
      + Use mkdir macro also in case if mingw32. (Lars Kanis),
      + Add math library to executable link flags (Nick Wellnhofer),
      + Fix quoting of xlocale test program in configure.in (Nick Wellnhofer)
      +
    • + +
    • Bug Fixes:
      + Fix OOB heap read in xsltExtModuleRegisterDynamic (Nick Wellnhofer),
      + Remove CDATA markup from libxslt_tutorial.c (Nick Wellnhofer),
      + Remove generated headers from dist tarball (Nick Wellnhofer),
      + Mark XML file argument as repeatable (Nick Wellnhofer),
      + Keep timezone in date:add (Nick Wellnhofer),
      + Fix buffer overflow in exsltDateFormat (Nick Wellnhofer),
      + Fix saxon:line-number with namespace nodes (Nick Wellnhofer),
      + Fix dyn:map with namespace nodes (Nick Wellnhofer),
      + Fix error handling in Saxon extension functions (Nick Wellnhofer),
      + Fix double free in libexslt hash functions (Nick Wellnhofer),
      + Fix libxslt format warnings (David Kilzer),
      + Fix xsltNumberFormatGetMultipleLevel (Nick Wellnhofer),
      + Fix use-after-free in xsltDocumentFunctionLoadDocument (Nick Wellnhofer),
      + Always initialize EXSLT month and day to 1 (Nick Wellnhofer),
      + Fix possible NULL pointer deref in transform.c (mahendra.n),
      + Fix possible NULL pointer deref in xsltCopyTextString (Nick Wellnhofer),
      + Fix possible NULL pointer deref in libexslt/functions.c (Nick Wellnhofer),
      + Fix possible NULL pointer deref in xsltproc.c (mahendra.n),
      + Fix possible NULL pointer deref in preproc.c (mahendra.n),
      + Fix LIBXSLT_DEFAULT_PLUGINS_PATH in xsltconfig.h (Nick Wellnhofer),
      + Fix memory leak in xsltNumberFormat (Albert Astals Cid),
      + Error in doc/Makefile.am (Brice De Bruyne),
      + Detect attribute sets recursions in more cases (Daniel Veillard),
      + Check name vales for attribute-set elements (Daniel Veillard),
      + Fix hang with namespace-alias, fixes #700689 (Shaun McCance),
      + Fix str:align with UTF-8 strings (Nick Wellnhofer),
      + Fix for compiled XPath helpers (Nick Wellnhofer),
      + Check return value of exsltFuncNewFunctionData (Nick Wellnhofer),
      + Fix return value of xsltRegisterExtModuleElement (Nick Wellnhofer),
      + Call xmlNodeGetSpacePreserve with element node (Nick Wellnhofer),
      + Set namespaces before evaluating xsl:number (Nick Wellnhofer),
      + Make --maxvars option work (Per Hedeland),
      + Set correct context node when initializing xsl:keys (Nick Wellnhofer),
      + Fix for bug 436589 (Imran Azeezullah),
      + Memory leak in xsltCompileIdKeyPattern error path (Nick Wellnhofer),
      + Fix handling of UTF-8 strings in EXSLT crypto module (Nick Wellnhofer),
      + Fix certain patterns with predicates (Nick Wellnhofer),
      + Fix direct pattern matching (Nick Wellnhofer),
      + Fix str:padding to work with UTF-8 strings (Nick Wellnhofer),
      + EXSLT function str:replace() is broken as-is (Nick Wellnhofer),
      + Fix a couple of places where (f)printf parameters were broken (Daniel Veillard)
      +
    • + +
    • Improvements:
      + Add support timestamps from environment (Daniel Veillard),
      + Add missing tests to dist tarball (Nick Wellnhofer),
      + Improve error message in xsltAddTemplate and fix test (Nick Wellnhofer),
      + Allow REC tests with empty stdout (Nick Wellnhofer),
      + Fix GPL license in HTML files as well (Nick Wellnhofer),
      + Fix status message in EXSLT dynamic tests (Nick Wellnhofer),
      + Add public function macros to xsltlocale.h (Nick Wellnhofer),
      + Make valgrind tests work with libtool (Nick Wellnhofer),
      + Add a couple of xsl:number tests (Nick Wellnhofer),
      + Lower and upper bound for format token "i" (Nick Wellnhofer),
      + Lower bound for format token "a" (Nick Wellnhofer),
      + Handle negative xsl:number values (Nick Wellnhofer),
      + Round xsl:number values to nearest integer (Nick Wellnhofer),
      + Allow {URI}NCName syntax for user parameters (Nick Wellnhofer),
      + Fix endTimer parameter type (Nick Wellnhofer),
      + Fix error messages for unsupported methods (Nick Wellnhofer),
      + Replace sprintf with snprintf (David Kilzer),
      + Enforce two digit exponent under MSVC (Nick Wellnhofer),
      + Rework xsltNumberFormat to fix warning (Nick Wellnhofer),
      + Fix a couple of GPL licences found in the documentation (Daniel Veillard),
      + Use hash table to lookup named templates (Christian Ceelen),
      + Fix to reg tests post 737840 fix (Daniel Veillard),
      + Don't fail build the man page if xsltproc is not present (Daniel Veillard),
      + Re-adding xsltproc.1 (Daniel Veillard),
      + Fix time type in xsltSaveProfiling (Nick Wellnhofer),
      + Remove unused parameters (Nick Wellnhofer),
      + Suppress unused variable warning. (Nick Wellnhofer),
      + Remove unused variable in xsltGenerateIdFunction (Nick Wellnhofer),
      + Add test case for XPath function args in error case (Nick Wellnhofer),
      + Add comment about known-to-fail test (Nick Wellnhofer),
      + Adjust expected test output (Nick Wellnhofer),
      + Helper functions to evaluate compiled XPath expressions (Nick Wellnhofer),
      + Add tests for crypto:rc4 (Nick Wellnhofer),
      + Add first test case for EXSLT crypto module (Nick Wellnhofer),
      + Separate function for predicate matching in patterns (Nick Wellnhofer),
      + Initialize pseudo random number generator with current time or optional command line parameter (Nils Werner),
      + Adding doc update related to 1.1.28 (Daniel Veillard)
      +
    • + +
    • Cleanups:
      + Remove bogus test file (Nick Wellnhofer),
      + Add warning message to expected test output (Nick Wellnhofer)
      +
    • +
    +

    1.1.28: Nov 21 2012

    +
      +
    • Portability:
      + Fix python build by using libxsltmod_la_CPPFLAGS instead of AM_CPPFLAGS (Alexandre Rostovtsev),
      + configure should be more careful with linker script (Igor Pashev),
      + add gcrypt library in LIBADD, not LDFLAGS, as recommended (Roumen Petrov)
      +
    • + +
    • Bug fixes:
      + Fix generate-id() to avoid generating the same ID (Stewart Brodie),
      + Fix crash with empty xsl:key/@match attribute (Nick Wellnhofer),
      + Crash when passing an uninitialized variable to document() (Nick Wellnhofer),
      + Add missing test docs to EXTRA_DIST (Nick Wellnhofer),
      + Fix regression: Default namespace not correctly used (Nick Wellnhofer)
      +
    • + +
    • Cleanups:
      + Remove xsltTransStorageAdd and xsltTransStorageRemove from symbols.xml (Daniel Veillard),
      + autogen.sh cleanup (Daniel Richard),
      + consistent use of xslt processor (Roumen Petrov),
      + Add object files in tests/plugins to .gitignore (Nick Wellnhofer),
      + Fix error on bug-165 regression test (Daniel Veillard),
      + Remove xsltTransStorageAdd and xsltTransStorageRemove (Daniel Veillard),
      +
    • +
    +

    1.1.27: Sep 12 2012

    +
      +
    • Portability:
      + xincludestyle wasn't protected with LIBXML_XINCLUDE_ENABLED (Michael Bonfils),
      + Portability fix for testThreads.c (IlyaS),
      + FreeBSD portability fixes (Pedro F. Giffuni),
      + check for gmtime - on mingw* hosts will enable date-time function (Roumen Petrov),
      + use only native crypto-API for mingw* hosts (Roumen Petrov),
      + autogen: Only check for libtoolize (Colin Walters),
      + minimal mingw support (Roumen Petrov),
      + configure: acconfig.h is deprecated since autoconf-2.50 (Stefan Kost),
      + Fix a small out of tree compilation issue (Hao Hu),
      + Fix python generator to not use deprecated xmllib (Daniel Veillard),
      + link python module with python library (Frederic Crozat)
      +
    • + +
    • Documentation:
      + Tiny doc improvement (Daniel Veillard),
      + Various documentation fixes for docs on internals (C. M. Sperberg-McQueen)
      +
    • + +
    • Bug fixes:
      + Report errors on variable use in key (Daniel Veillard),
      + The XSLT namespace string is a constant one (Daniel Veillard),
      + Fix handling of names in xsl:attribute (Nick Wellnhofer),
      + Reserved namespaces in xsl:element and xsl:attribute (Nick Wellnhofer),
      + Null-terminate result string of cry:rc4_decrypt (Nick Wellnhofer),
      + EXSLT date normalization fix (James Muscat),
      + Exit after compilation of invalid func:result (Nick Wellnhofer),
      + Fix for EXSLT func:function (Nick Wellnhofer),
      + Rewrite EXSLT string:replace to be conformant (Nick Wellnhofer),
      + Avoid a heap use after free error (Chris Evans),
      + Fix a dictionary string usage (Chris Evans),
      + Output should not include extraneous newlines when indent is off (Laurence Rowe),
      + document('') fails to return stylesheets parsed from memory (Jason Viers),
      + xsltproc should return an error code if xinclude fails (Malcolm Purvis),
      + Forwards-compatible processing of unknown top level elements (Nick Wellnhofer),
      + Fix system-property with unknown namespace (Nick Wellnhofer),
      + Hardening of code checking node types in EXSLT (Daniel Veillard),
      + Hardening of code checking node types in various entry point (Daniel Veillard),
      + Cleanup of the pattern compilation code (Daniel Veillard),
      + Fix default template processing on namespace nodes (Daniel Veillard),
      + Fix a bug in selecting XSLT elements (Daniel Veillard),
      + Fixed bug #616839 (Daniel Mustieles),
      + Fix some case of pattern parsing errors (Abhishek Arya),
      + preproc: fix the build (Stefan Kost),
      + Fix a memory leak with xsl:number (Daniel Veillard),
      + Fix a problem with ESXLT date:add() with January (money_seshu Dronamraju),
      + Fix a memory leak if compiled with Windows locale support (Daniel Veillard),
      + Fix generate-id() to not expose object addresses (Daniel Veillard),
      + Fix curlies support in literals for non-compiled AVTs (Nick Wellnhofer),
      + Allow whitespace in xsl:variable with select (Nick Wellnhofer),
      + Small fixes to locale code (Nick Wellnhofer),
      + Fix bug 602515 (Nick Wellnhofer),
      + Fix popping of vars in xsltCompilerNodePop (Nick Wellnhofer),
      + Fix direct pattern matching bug (Nick Wellnhofer)
      +
    • + +
    • Improvements:
      + Add the saxon:systemId extension (Mike Hommey),
      + Add an append mode to document output (Daniel Veillard),
      + Add new tests to EXTRA_DIST (Nick Wellnhofer),
      + Test for bug #680920 (Nick Wellnhofer),
      + fix regresson in Various "make distcheck" and other fixes (Roumen Petrov),
      + Various "make distcheck" and other fixes (Daniel Richard G),
      + Fix portability to upcoming libxml2-2.9.0 (Daniel Veillard),
      + Adding --system flag support to autogen.sh (Daniel Veillard),
      + Allow per-context override of xsltMaxDepth, introduce xsltMaxVars (Jérôme Carretero),
      + autogen.sh: Honor NOCONFIGURE environment variable (Colin Walters),
      + configure: support silent automake rules if possible (Stefan Kost),
      + Precompile patterns in xsl:number (Nick Wellnhofer),
      + Fix some warnings in the refactored code (Nick Wellnhofer),
      + Adding new generated files (Daniel Veillard),
      + profiling: add callgraph report (Stefan Kost)
      +
    • + +
    • Cleanups:
      + Big space and tabs cleanup (Daniel Veillard),
      + Fix authors list (Daniel Veillard),
      + Cleanups some of the test makefiles (Daniel Richard),
      + Remove .cvsignore files which are not needed anymore (Daniel Veillard),
      + Cleanup some misplaced spaces and tabs (Daniel Veillard),
      + Augment list of ignored files (Daniel Veillard),
      + configure: remove checks for isinf and isnan as those are not used anyway (Stefan Kost),
      + Point to GIT for source code and a bit of cleanup (Daniel Veillard),
      + Get rid of specific build setup and STATIC_BINARIES (Daniel Veillard)
      +
    • +
    +

    1.1.26: Sep 24 2009

    +
      +
    • Improvement: + Add xsltProcessOneNode to exported symbols for lxml (Daniel Veillard) +
    • +
    • Bug fixes: + Fix an idness generation problem (Daniel Veillard), + 595612 Try to fix some locking problems (Daniel Veillard), + Fix a crash on misformed imported stylesheets (Daniel Veillard) +
    • +
    +

    1.1.25: Sep 17 2009

    +
      +
    • Features: + Add API versioning and various cleanups (Daniel Veillard), + xsl:sort lang support using the locale (Nick Wellnhofer and Roumen Petrov) +
    • +
    • Documentation: + Fix the download links for Solaris (Daniel Veillard), + Fix makefile and spec file to include doc in rpm (Daniel Veillard) +
    • +
    • Portability: + Make sure testThreads is linked with pthreads (Daniel Veillard), + Fix potential crash on debug of extensions Solaris (Ben Walton), + applied patch from Roumen Petrov for mingw cross compilation problems (Roumen Petrov), + patch from Richard Jones to build shared libs with MinGW cross-compiler (Richard Jones), + fix include path when compiling with MinGW (Roumen Petrov), + portability fixes ( Nick Wellnhofer and Roumen Petrov) +
    • +
    • Bug fixes: + Big fixes of pattern compilations (Nick Wellnhofer), + Fix uses of xmlAddChild for error handling (Daniel Veillard), + Detect deep recusion on function calls (Daniel Veillard), + Avoid an error in namespace generation (Martin), + Fix importing of encoding from included stylesheets (Nick Wellnhofer), + Fix problems with embedded stylesheets and namespaces (Martin), + QName parsing fix for patterns (Martin), + Crash compiling stylesheet with DTD (Martin), + Fix xsl:strip-space with namespace and wildcard (Nick Wellnhofer), + Fix a mutex deadlock on unregistered extensions (Nix), + 567192 xsltproc --output option ignore --xinclude (Joachim Breitner), + Fix redundant headers in list (Daniel Veillard), + 134754 Configure's --with-html-dir related fixes (Julio M. Merino Vidal), + 305913 a serious problem in extensions reentrancy (Daniel Veillard), + Fix an idness issue when building the tree (Daniel Veillard), + Fixed indexing error reported by Ron Burk on the mailing list. (William M. Brack), + prevent some unchecked pointer accesses (Jake Goulding), + fix for CVE-2008-2935 libexslt RC4 encryption/decryption functions Daniel (Daniel Veillard), + avoid a quadratic behaviour when hitting duplicates (Daniel Veillard), + 544829 fixed option --with-debugger (Arun Ragnavan), + 541965 fixed incorrect argument popping in exsltMathAtan2Function (William M. Brack), + fix problem with string check for element-available (Ron Burk), + 539741 added code to handle literal within an AVT (William M. Brack) +
    • +
    • Improvements: + Allow use of EXSLT outside XSLT (Martin), + Support Esperanto locale (Nick Wellnhofer), + Change how attributes are copied for id and speed (Daniel Veillard), + Add API versioning and various cleanups (Daniel Veillard), + Adding a test program to check thread reentrancy (Daniel Veillard), + big patch from finishing xsl:sort lang support (Roumen Petrov), + add xsl:sort lang support using the locale (Nick Wellnhofer) +
    • +
    • Cleanups: + Label xsltProcessOneNode as static (Daniel Veillard), + git setup (Daniel Veillard), + fixed typo detected by new libxml2 code (William M. Brack), + xsltExtFunctionLookup was defined but never implemented (Ralf Junker) +
    • +
    +

    1.1.24: May 13 2008

    +
      +
    • Documentation: man page fix (Vincent Lefevre).
    • +
    • Bug fixes: pattern bug fix, key initialization problems, exclusion of + unknown namespaced element on top of stylesheets, python generator + syntactic cleanup (Martin)
    • +
    +

    1.1.23: Apr 8 2008

    +
      +
    • Documentation: fix links for Cygwin DocBook setup (Philippe Bourcier), + xsltParseStylesheetDoc doc fix (Jason Viers), fix manpage default + maxdepth value
    • +
    • Bug fixes: python segfault (Daniel Gryniewicz), week-in-year bug fix + (Maurice van der Pot), fix python iterator problem (William Brack), + avoid garbage collection problems on str:tokenize and str:split + and function results (William Brack and Peter Pawlowski) + superfluous re-generation of keys (William Brack), remove superfluous + code in xsltExtInitTest (Tony Graham), func:result segfault fix + (William Brack), timezone offset problem (Peter Pawlowski),
    • +
    • Portability fixes: old gcrypt support fix (Brent Cowgill), Python + portability patch (Stephane Bidoul), VS 2008 fix (Rob Richard)
    • +
    +

    1.1.22: Aug 23 2007

    +
      +
    • Bug fixes: RVT cleanup problems (William Brack), exclude-result-prefix + bug (William Brack), stylesheet compilation error handling (Rob Richards). +
    • +
    • Portability fixes: improve build with VS2005 (Rob Richards), + fixing build on AIX (Bjorn Wiberg), fix the security file checks on + Windows (Roland Schwarz and Rob Richards).
    • +
    • Improvement: add an --encoding option to xsltproc (Drazen Kacar).
    • +
    +

    1.1.21: Jun 12 2007

    +
      +
    • Bug fixes: out of memory allocation errors (William Brack), + namespace problem on compound predicates (William Brack), + python space/tab inconsistencies (Andreas Hanke), hook xsl:message + to per transformation error callbacks (Shaun McCance), + cached RVT problem (William Brack), XPath context maintainance + on choose (William Brack), memory leaks in the math module (William + Brack), exclude-result-prefix induced namespace problem (William + Brack)
    • +
    • Build: configure setup for TRIO_REPLACE_STDIO (William Brack) +
    • Documentation: updated after change from CVs to SVN (William Brack)
    • +
    +

    1.1.20: Jan 17 2007

    +
      +
    • Portability fixes: strict aliasing fix (Marcus Meissner), BSD portability + patches (Roland Illig)
    • +
    • Bug fixes: Result Value Tree handling fix (William Brack), function + parameters fix (William), uninitialized variable (Kjartan Maraas), + empty text node handling (William), plugin support and test fixes (William), + fragment support fixes (William)
    • +
    • Improvements: python stylesheet compare and transform context + access (Nic Ferrier), EXSLT string replace support (Joel Reed), + xsltproc better low level error handling (Mike Hommey and William)
    • +
    +

    1.1.19: Nov 29 2006

    +
      +
    • Bug fixes: entities within attributes (William Brack), Python detection + problem (Joseph Sacco), in-scope namespace bug (Mike Hommey), Result + value tree caching bug (William Brack)
    • +
    +

    1.1.18: Oct 26 2006

    +
      +
    • portability and build fixes: DESTDIR problem, build paths in python + shared lib, compile when libxml2 doesn't support XInclude (Gary Coady).
    • +
    • bug fixes: a number of namespace related bugs (Kasimier Buchcik), + parameters bugs (Kasimier Buchcik), proximity position in predicates + of match patterns (Kasimier), exslt-node-set troubles with strings + (Kasimier), CDATA serialization, Python floats and booleans XPath + conversions, XInclude support fixes, RVT cleanup problem (William Brack + and Kasimier), attribute checking in stylesheets (Kasimier), xsltForEach + context problem (Kasimier), security check should pass full URLs (Shane + Corgatelli), security cleanup patch (Mikhail Zabaluev), some python + accessor for stylesheet were broken, memory errors when compiling + stylesheets (Mike Hommey), EXSLT current date end-of-month problem + (William Brack).
    • +
    • improvements: refactoring of namespace handling, value-of impleemntation + and template internal processing (Kasimier Buchcik), new xsltproc + flag to apply Xinclude to stylesheets.
    • +
    • documentation: xsltproc man pages (Daniel Leidert), tests updates + (William Brack), various typo fixes (Daniel Leidert), comments on + versions macros (Peter Breitenlohner).
    • +
    +

    1.1.17: Jun 6 2006

    +
      +
    • portability fixes: python detection
    • +
    • bug fixes: some regression tests, attribute/namespaces output (Kasimier + Buchcik), problem in mixed xsl:value-of and xsl:text uses (Kasimier)
    • +
    • improvements: internal refactoring (Kasimier Buchcik), use of the XPath + object cache in libxml2-2.6.25 (Kasimier)
    • +
    + +

    1.1.16: May 01 2006

    +
      +
    • portability fixes: EXSLT date/time on Solaris and IRIX (Albert Chin), + HP-UX build (Albert Chin), +
    • build fixes: Python detection(Joseph Sacco), plugin configurei + (Joel Reed)
    • +
    • bug fixes: pattern compilation fix(William Brack), EXSLT date/time + fix (Thomas Broyer), EXSLT function bug, potential loop on variable + eval, startup race (Christopher Palmer), debug statement left in python + (Nic Ferrier), various cleanup based on Coverity reports), error on + Out of memory condition (Charles Hardin), various namespace prefixes + fixes (Kasimier Buchcik),
    • +
    • improvement: speed up sortingi, start of internals refactoring (Kasimier + Buchcik)
    • +
    • documentation: man page fixes and updates (Daniel Leidert) +
    + +

    1.1.15: Sep 04 2005

    +
      +
    • build fixes: Windows build cleanups and updates (Igor Zlatkovic), + remove jhbuild warnings
    • +
    • bug fixes: negative number formatting (William Brack), number + formatting per mille definition (William Brack), XInclude default values + (William), text copy bugs (William), bug related to xmlXPathContext size, + reuse libxml2 memory management for text nodes, dictionary text bug, + forbid variables in match (needs libxml2-2.6.21)
    • +
    • improvements: EXSLT dyn:map (Mark Vakoc),
    • +
    • documentation: EXSLT date and time functions namespace in man (Jonathan + Wakely)
    • +
    + +

    1.1.14: Apr 02 2005

    +
      +
    • bug fixes: text node on stylesheet document without a dictionary + (William Brack), more checking of XSLT syntax, calling xsltInit() + multiple times, mode values interning raised by Mark Vakoc, bug in + pattern matching with ancestors, bug in patterna matching with cascading + select, xinclude and document() problem, build outside of source tree + (Mike Castle)
    • +
    • improvement: added a --nodict mode to xsltproc to check problems for + docuemtns without dictionaries
    • +
    + +

    1.1.13: Mar 13 2005

    +
      +
    • build fixes: 64bits cleanup (William Brack), python 2.4 test (William), + LIBXSLT_VERSION_EXTRA on Windows (William), Windows makefiles fixes (Joel + Reed), libgcrypt-devel requires for RPM spec.
    • +
    • bug fixes: exslt day-of-week-in-month (Sal Paradise), xsl:call-template + should not change the current template rule (William Brack), evaluation + of global variables (William Brack), RVT's in XPath predicates (William), + namespace URI on template names (Mark Vakoc), stat() for Windows patch + (Aleksey Gurtovoy), pattern expression fixes (William Brack), out of + memory detection misses (William), parserOptions propagation (William), + exclude-result-prefixes fix (William), // patten fix (William).
    • +
    • extensions: module support (Joel Reed), dictionary based speedups + trying to get rid of xmlStrEqual as much as possible.
    • +
    • documentation: added Wiki (Joel Reed)
    • +
    + +

    1.1.12: Oct 29 2004

    +
      +
    • build fixes: warnings removal (William).
    • +
    • bug fixes: attribute document pointer fix (Mark Vakoc), exslt date + negative periods (William Brack), generated tree structure fixes, + namespace lookup fix, use reentrant gmtime_r (William Brack), + exslt:funtion namespace fix (William), potential NULL pointer reference + (Dennis Dams, William), force string interning on generated + documents.
    • +
    • documentation: update of the second tutorial (Panagiotis Louridas), add + exslt doc in rpm packages, fix the xsltproc man page.
    • +
    + +

    1.1.11: Sep 29 2004

    +
      +
    • bug fixes: xsl:include problems (William Brack), UTF8 number pattern + (William), date-time validation (William), namespace fix (William), + various Exslt date fixes (William), error callback fixes, leak with + namespaced global variable, attempt to fix a weird problem #153137
    • +
    • improvements: exslt:date-sum tests (Derek Poon)
    • +
    • documentation: second tutorial by Panagiotis Lourida
    • +
    + +

    1.1.10: Aug 31 2004

    +
      +
    • build fix: NUL in c file blocking compilation on Solaris, Windows build + (Igor Zlatkovic)
    • +
    • fix: key initialization problem (William Brack)
    • +
    • documentation: fixed missing man page description for --path
    • +
    + +

    1.1.9: Aug 22 2004

    +
      +
    • build fixes: missing tests (William Brack), Python dependancies, Python + on 64bits boxes, --with-crypto flag (Rob Richards),
    • +
    • fixes: RVT key handling (William), Python binding (William and Sitsofe + Wheeler), key and XPath troubles (William), template priority on imports + (William), str:tokenize with empty strings (William), #default namespace + alias behaviour (William), doc ordering missing for main document + (William), 64bit bug (Andreas Schwab)
    • +
    • improvements: EXSLT date:sum added (Joel Reed), hook for document + loading for David Hyatt, xsltproc --nodtdattr to avoid defaulting DTD + attributes, extend xsltproc --version with CVS stamp (William).
    • +
    • Documentation: web page problem reported by Oliver Stoeneberg
    • +
    + +

    1.1.8: July 5 2004

    +
      +
    • build fixes: Windows runtime options (Oliver Stoeneberg), Windows + binary package layout (Igor Zlatkovic), libgcrypt version test and link + (William)
    • +
    • documentation: fix libxslt namespace name in doc (William)
    • +
    • bug fixes: undefined namespace message (William Brack), search engine + (William), multiple namespace fixups (William), namespace fix for key + evaluation (William), Python memory debug bindings,
    • +
    • improvements: crypto extensions for exslt (Joel Reed, William)
    • +
    + +

    1.1.7: May 17 2004

    +
      +
    • build fix: warning about localtime_r on Solaris
    • +
    • bug fix: UTF8 string tokenize (William Brack), subtle memory + corruption, linefeed after comment at document level (William), + disable-output-escaping problem (William), pattern compilation in deep + imported stylesheets (William), namespace extension prefix bug, + libxslt.m4 bug (Edward Rudd), namespace lookup for attribute, namespaced + DOCTYPE name
    • +
    + +

    1.1.6: Apr 18 2004

    +
      +
    • 2 bug fixes about keys fixed one by Mark Vakoc
    • +
    + +

    1.1.5: Mar 23 2004

    +
      +
    • performance: use dictionary lookup for variables
    • +
    • remove use of _private from source documents
    • +
    • cleanup of "make tests" output
    • +
    • bugfixes: AVT in local variables, use localtime_r to avoid thread + troubles (William), dictionary handling bug (William), limited number of + stubstitutions in AVT (William), tokenize fix for UTF-8 (William), + superfluous namespace (William), xsltproc error code on + <xsl:message> halt, OpenVMS fix, dictionary reference counting + change.
    • +
    + +

    1.1.4: Feb 23 2004

    +
      +
    • bugfixes: attributes without doc (Mariano Suárez-Alvarez), problem with + Yelp, extension problem
    • +
    • display extension modules (Steve Little)
    • +
    • Windows compilation patch (Mark Vadoc), Mingw (Mikhail Grushinskiy)
    • +
    + +

    1.1.3: Feb 16 2004

    +
      +
    • Rewrote the Attribute Value Template code, new XPath compilation + interfaces, dictionary reuses for XSLT with potential for serious + performance improvements.
    • +
    • bug fixes: portability (William Brack), key() in node-set() results + (William), comment before doctype (William), math and node-set() problems + (William), cdata element and default namespace (William), behaviour on + unknown XSLT elements (Stefan Kost), priority of "//foo" patterns + (William), xsl:element and xsl:attribute QName check (William), comments + with -- (William), attribute namespace (William), check for ?> in PI + (William)
    • +
    • Documentations: cleanup (John Fleck and William)
    • +
    • Python: patch for OS-X (Gianni Ceccarelli), enums export (Stephane + bidoul)
    • +
    + +

    1.1.2: Dec 24 2003

    +
      +
    • Documentation fixes (John Fleck, William Brack), EXSLT documentation + (William Brack)
    • +
    • Windows compilation fixes for MSVC and Mingw (Igor Zlatkovic)
    • +
    • Bug fixes: exslt:date returning NULL strings (William Brack), + namespaces output (William Brack), key and namespace definition problem, + passing options down to the document() parser, xsl:number fixes (William + Brack)
    • +
    + +

    1.1.1: Dec 10 2003

    +
      +
    • code cleanup (William Brack)
    • +
    • Windows: Makefile improvements (Igor Zlatkovic)
    • +
    • documentation improvements: William Brack, libexslt man page (Jonathan + Wakely)
    • +
    • param in EXSLT functions (Shaun McCance)
    • +
    • XSLT debugging improvements (Mark Vakoc)
    • +
    • bug fixes: number formatting (Bjorn Reese), exslt:tokenize (William + Brack), key selector parsing with | reported by Oleg Paraschenko, + xsl:element with computed namespaces (William Brack), xslt:import/include + recursion detection (William Brack), exslt:function used in keys (William + Brack), bug when CDATA_SECTION are foun in the tree (William Brack), + entities handling when using XInclude.
    • +
    + +

    1.1.0: Nov 4 2003

    +
      +
    • Removed DocBook SGML broken support
    • +
    • fix xsl:key to work with PIs
    • +
    • Makefile and build improvement (Graham Wilson), build cleanup (William + Brack), macro fix (Justin Fletcher), build outside of source tree (Roumen + Petrov)
    • +
    • xsltproc option display fix (Alexey Efimov), --load-trace (Crutcher + Dunnavant)
    • +
    • Python: never use stdout for error
    • +
    • extension memory error fix (Karl Eichwalder)
    • +
    • header path fixes (Steve Ball)
    • +
    • added saxon:line-number() to libexslt (Brett Kail)
    • +
    • Fix some tortuous template problems when using predicates (William + Brack)
    • +
    • Debugger status patch (Kasimier Buchcik)
    • +
    • Use new libxml2-2.6.x APIs for faster processing
    • +
    • Make sure xsl:sort is empty
    • +
    • Fixed a bug in default processing of attributes
    • +
    • Removes the deprecated breakpoint library
    • +
    • detect invalid names on templates (William Brack)
    • +
    • fix exslt:document (and similar) base handling problem
    • +
    + +

    1.0.33: Sep 12 2003

    + +

    This is a bugfix only release

    +
      +
    • error message missing argument (William Brack)
    • +
    • mode not cascaded in template fallbacks (William Brack)
    • +
    • catch redefinition of parameter/variables (William Brack)
    • +
    • multiple keys with same namespace name (William Brack)
    • +
    • patch for compilation using MingW on Windows (Mikhail Grushinskiy)
    • +
    • header export macros for Windows (Igor Zlatkovic)
    • +
    • cdata-section-elements handling of namespaced names
    • +
    • compilation without libxml2 XPointer support (Mark Vadoc)
    • +
    • apply-templates crash (William Brack)
    • +
    • bug with imported templates (William Brack)
    • +
    • imported attribute-sets merging bug (DocBook) (William Brack)
    • +
    + +

    1.0.32: Aug 9 2003

    +
      +
    • bugfixes: xsltSaveResultToFile() python binding (Chris Jaeger), EXSLT + function (William Brack), RVT for globals (William Brack), EXSLT date + (William Brack), +

      speed of large text output, xsl:copy with attributes, strip-space and + namespaces prefix, fix for --path xsltproc option, EXST:tokenize (Shaun + McCance), EXSLT:seconds (William Brack), sort with multiple keys (William + Brack), checking of { and } for attribute value templates (William + Brack)

      +
    • +
    • Python bindings for extension elements (Sean Treadway)
    • +
    • EXSLT:split added (Shaun McCance)
    • +
    • portability fixes for HP-UX/Solaris/IRIX (William Brack)
    • +
    • doc cleanup
    • +
    + +

    1.0.31: Jul 6 2003

    +
      +
    • bugfixes: xsl:copy on namespace nodes, AVT for xsl:sort order, fix for + the debugger (Keith Isdale), output filename limitation, trio.h and + triodef.h added (Albert Chin), EXSLT node-set (Peter Breitenlohner), + xsltChoose and whitespace (Igor Zlatkovic), +

      stylesheet compilation (Igor Zlatkovic), NaN and sort (William Brack), + RVT bug introduced in 1.0.30

      +
    • +
    • avoid generating &quot; (fix in libxml2-2.5.8)
    • +
    • fix 64bit cleaness problem and compilation troubles introduced in + 1.0.30
    • +
    • Windows makefile generation (Igor Zlatkovic)
    • +
    • HP-UX portability fix
    • +
    + +

    1.0.30: May 4 2003

    +
      +
    • Fixes and new APIs to handle Result Value Trees and avoid leaks
    • +
    • Fixes for: EXSLT math pow() function (Charles Bozeman), global + parameter and global variables mismatch, a segfault on pattern + compilation errors, namespace copy in xsl:copy-of, python generator + problem, OpenVMS trio update, premature call to xsltFreeStackElem (Igor), + current node when templates applies to attributes
    • +
    + +

    1.0.29: Apr 1 2003

    +
      +
    • performance improvements especially for large flat documents
    • +
    • bug fixes: Result Value Tree handling, XML IDs, keys(), extra namespace + declarations with xsl:elements.
    • +
    • portability: python and trio fixes (Albert Chin), python on Solaris + (Ben Phillips)
    • +
    + +

    1.0.28: Mar 24 2003

    +
      +
    • fixed node() in patterns semantic.
    • +
    • fixed a memory access problem in format-number()
    • +
    • fixed stack overflow in recursive global variable or params
    • +
    • cleaned up Result Value Tree handling, and fixed a couple of old bugs + in the process
    • +
    + +

    1.0.27: Feb 24 2003

    +
      +
    • bug fixes: spurious xmlns:nsX="" generation, serialization bug (in + libxml2), a namespace copy problem, errors in the RPM spec prereqs
    • +
    • Windows path canonicalization and document cache fix (Igor)
    • +
    + +

    1.0.26: Feb 10 2003

    +
      +
    • Fixed 3 serious bugs in document() and stylesheet compilation which + could lead to a crash
    • +
    + +

    1.0.25: Feb 5 2003

    +
      +
    • Bug fix: double-free for standalone stylesheets introduced in 1.0.24, C + syntax pbm, 3 bugs reported by Eric van der Vlist
    • +
    • Some XPath and XInclude related problems were actually fixed in + libxml2-2.5.2
    • +
    • Documentation: emphasize taht --docbook is not for XML docs.
    • +
    + +

    1.0.24: Jan 14 2003

    +
      +
    • bug fixes: imported global varables, python bindings (Stéphane Bidoul), + EXSLT memory leak (Charles Bozeman), namespace generation on + xsl:attribute, space handling with imports (Daniel Stodden), + extension-element-prefixes (Josh Parsons), comments within xsl:text (Matt + Sergeant), superfluous xmlns generation, XInclude related bug for + numbering, EXSLT strings (Alexey Efimov), attribute-sets computation on + imports, extension module init and shutdown callbacks not called
    • +
    • HP-UX portability (Alexey Efimov), Windows makefiles (Igor and Stephane + Bidoul), VMS makefile updates (Craig A. Berry)
    • +
    • adds xsltGetProfileInformation() (Michael Rothwell)
    • +
    • fix the API generation scripts
    • +
    • API to provide the sorting routines (Richard Jinks)
    • +
    • added XML description of the EXSLT API
    • +
    • added ESXLT URI (un)escaping (Jörg Walter)
    • +
    • Some memory leaks have been found and fixed
    • +
    • document() now support fragment identifiers in URIs
    • +
    + +

    1.0.23: Nov 17 2002

    +
      +
    • Windows build cleanup (Igor)
    • +
    • Unix build and RPM packaging cleanup
    • +
    • Improvement of the python bindings: extension functions and activating + EXSLT
    • +
    • various bug fixes: number formatting, portability for bounded string + functions, CData nodes, key(), @*[...] patterns
    • +
    • Documentation improvements (John Fleck)
    • +
    • added libxslt.m4 (Thomas Schraitle)
    • +
    + +

    1.0.22: Oct 18 2002

    +
      +
    • Updates on the Windows Makefiles
    • +
    • Added a security module, and a related set of new options to + xsltproc
    • +
    • Allowed per transformation error handler.
    • +
    • Fixed a few bugs: node() semantic, URI escaping, media-type, attribute + lists
    • +
    + +

    1.0.21: Sep 26 2002

    +
      +
    • Bug fixes: match="node()", date:difference() (Igor and Charlie + Bozeman), disable-output-escaping
    • +
    • Python bindings: style.saveResultToString() from Ralf Mattes
    • +
    • Logos from Marc Liyanage
    • +
    • Mem leak fix from Nathan Myers
    • +
    • Makefile: DESTDIR fix from Christophe Merlet, AMD x86_64 (Mandrake), + Windows (Igor), Python detection
    • +
    • Documentation improvements: John Fleck
    • +
    + +

    1.0.20: Aug 23 2002

    +
      +
    • Windows makefile updates (Igor) and x86-64 (Frederic Crozat)
    • +
    • fixed HTML meta tag saving for Mac/IE users
    • +
    • possible leak patches from Nathan Myers
    • +
    • try to handle document('') as best as possible depending in the + cases
    • +
    • Fixed the DocBook stylesheets handling problem
    • +
    • Fixed a few XSLT reported errors
    • +
    + +

    1.0.19: July 6 2002

    +
      +
    • EXSLT: dynamic functions and date support bug fixes (Mark Vakoc)
    • +
    • xsl:number fix: Richard Jinks
    • +
    • xsl:format-numbers fix: Ken Neighbors
    • +
    • document('') fix: bug pointed by Eric van der Vlist
    • +
    • xsl:message with terminate="yes" fixes: William Brack
    • +
    • xsl:sort order support added: Ken Neighbors
    • +
    • a few other bug fixes, some of them requiring the latest version of + libxml2
    • +
    + +

    1.0.18: May 27 2002

    +
      +
    • a number of bug fixes: attributes, extra namespace declarations + (DocBook), xsl:include crash (Igor), documentation (Christian Cornelssen, + Charles Bozeman and Geert Kloosterman), element-available (Richard + Jinks)
    • +
    • xsltproc can now list teh registered extensions thanks to Mark + Vakoc
    • +
    • there is a new API to save directly to a string + xsltSaveResultToString() by Morus Walter
    • +
    • specific error registration function for the python API
    • +
    + +

    1.0.17: April 29 2002

    +
      +
    • cleanup in code, XSLT debugger support and Makefiles for Windows by + Igor
    • +
    • a C++ portability fix by Mark Vakoc
    • +
    • EXSLT date improvement and regression tests by Charles Bozeman
    • +
    • attempt to fix a bug in xsltProcessUserParamInternal
    • +
    + +

    1.0.16: April 15 2002

    +
      +
    • Bug fixes: strip-space, URL in HTML output, error when xsltproc can't + save
    • +
    • portability fixes: OSF/1, IEEE on alphas, Windows, Python bindings
    • +
    + +

    1.0.15: Mar 25 2002

    +
      +
    • Bugfixes: XPath, python Makefile, recursive attribute sets, @foo[..] + templates
    • +
    • Debug of memory alocation with valgind
    • +
    • serious profiling leading to significant improvement for DocBook + processing
    • +
    • revamp of the Windows build
    • +
    + +

    1.0.14: Mar 18 2002

    +
      +
    • Improvement in the XPath engine (libxml2-2.4.18)
    • +
    • Nasty bug fix related to exslt:node-set
    • +
    • Fixed the python Makefiles, cleanup of doc comments, Windows + portability fixes
    • +
    + +

    1.0.13: Mar 8 2002

    +
      +
    • a number of bug fixes including "namespace node have no parents"
    • +
    • Improvement of the Python bindings
    • +
    • Charles Bozeman provided fixes and regression tests for exslt date + functions.
    • +
    + +

    1.0.12: Feb 11 2002

    +
      +
    • Fixed the makefiles especially the python module ones
    • +
    • half a dozen bugs fixes including 2 old ones
    • +
    + +

    1.0.11: Feb 8 2002

    +
      +
    • Change of Licence to the MIT + Licence
    • +
    • Added a beta version of the Python bindings, including support to + extend the engine with functions written in Python
    • +
    • A number of bug fixes
    • +
    • Charlie Bozeman provided more EXSLT functions
    • +
    • Portability fixes
    • +
    + +

    1.0.10: Jan 14 2002

    +
      +
    • Windows fixes for Win32 from Igor
    • +
    • Fixed the Solaris compilation trouble (Albert)
    • +
    • Documentation changes and updates: John Fleck
    • +
    • Added a stringparam option to avoid escaping hell at the shell + level
    • +
    • A few bug fixes
    • +
    + +

    1.0.9: Dec 7 2001

    +
      +
    • Makefile patches from Peter Williams
    • +
    • attempt to fix the compilation problem associated to prelinking
    • +
    • obsoleted libxsltbreakpoint now deprecated and frozen to 1.0.8 API
    • +
    • xsltproc return codes are now significant, John Fleck updated the + documentation
    • +
    • patch to allow as much as 40 steps in patterns (Marc Tardif), should be + made dynamic really
    • +
    • fixed a bug raised by Nik Clayton when using doctypes with HTML + output
    • +
    • patches from Keith Isdale to interface with xsltdebugger
    • +
    + +

    1.0.8: Nov 26 2001

    +
      +
    • fixed an annoying header problem, removed a few bugs and some code + cleanup
    • +
    • patches for Windows and update of Windows Makefiles by Igor
    • +
    • OpenVMS port instructions from John A Fotheringham
    • +
    • fixed some Makefiles annoyance and libraries prelinking + information
    • +
    + +

    1.0.7: Nov 10 2001

    +
      +
    • remove a compilation problem with LIBXSLT_PUBLIC
    • +
    • Finishing the integration steps for Keith Isdale debugger
    • +
    • fixes the handling of indent="no" on HTML output
    • +
    • fixes on the configure script and RPM spec file
    • +
    + +

    1.0.6: Oct 30 2001

    +
      +
    • bug fixes on number formatting (Thomas), date/time functions (Bruce + Miller)
    • +
    • update of the Windows Makefiles (Igor)
    • +
    • fixed DOCTYPE generation rules for HTML output (me)
    • +
    + +

    1.0.5: Oct 10 2001

    +
      +
    • some portability fixes, including Windows makefile updates from + Igor
    • +
    • fixed a dozen bugs on XSLT and EXSLT (me and Thomas Broyer)
    • +
    • support for Saxon's evaluate and expressions extensions added (initial + contribution from Darren Graves)
    • +
    • better handling of XPath evaluation errors
    • +
    + +

    1.0.4: Sep 12 2001

    +
      +
    • Documentation updates from John fleck
    • +
    • bug fixes (DocBook FO generation should be fixed) and portability + improvements
    • +
    • Thomas Broyer improved the existing EXSLT support and added String, + Time and Date core functions support
    • +
    + +

    1.0.3: Aug 23 2001

    +
      +
    • XML Catalog support see the doc
    • +
    • New NaN/Infinity floating point code
    • +
    • A few bug fixes
    • +
    + +

    1.0.2: Aug 15 2001

    +
      +
    • lot of bug fixes, increased the testsuite
    • +
    • a large chunk of EXSLT is implemented
    • +
    • improvements on the extension framework
    • +
    • documentation improvements
    • +
    • Windows MSC projects files should be up-to-date
    • +
    • handle attributes inherited from the DTD by default
    • +
    + +

    1.0.1: July 24 2001

    +
      +
    • initial EXSLT framework
    • +
    • better error reporting
    • +
    • fixed the profiler on Windows
    • +
    • bug fixes
    • +
    + +

    1.0.0: July 10 2001

    +
      +
    • a lot of cleanup, a lot of regression tests added or fixed
    • +
    • added a documentation for writing + extensions
    • +
    • fixed some variable evaluation problems (with William)
    • +
    • added profiling of stylesheet execution accessible as the xsltproc + --profile option
    • +
    • fixed element-available() and the implementation of the various + chunking methods present, Norm Walsh provided a lot of feedback
    • +
    • exclude-result-prefixes and namespaces output should now work as + expected
    • +
    • added support of embedded stylesheet as described in section 2.7 of the + spec
    • +
    + +

    0.14.0: July 5 2001

    +
      +
    • lot of bug fixes, and code cleanup
    • +
    • completion of the little XSLT-1.0 features left unimplemented
    • +
    • Added and implemented the extension API suggested by Thomas Broyer
    • +
    • the Windows MSC environment should be complete
    • +
    • tested and optimized with a really large document (DocBook Definitive + Guide) libxml/libxslt should really be faster on serious workloads
    • +
    + +

    0.13.0: June 26 2001

    +
      +
    • lots of cleanups
    • +
    • fixed a C++ compilation problem
    • +
    • couple of fixes to xsltSaveTo()
    • +
    • try to fix Docbook-xslt-1.4 and chunking, updated the regression test + with them
    • +
    • fixed pattern compilation and priorities problems
    • +
    • Patches for Windows and MSC project mostly contributed by Yon Derek
    • +
    • update to the Tutorial by John Fleck
    • +
    • William fixed bugs in templates and for-each functions
    • +
    • added a new interface xsltRunStylesheet() for a more flexible output + (incomplete), added -o option to xsltproc
    • +
    + +

    0.12.0: June 18 2001

    +
      +
    • fixed a dozen of bugs reported
    • +
    • HTML generation should be quite better (requires libxml-2.3.11 upgrade + too)
    • +
    • William fixed some problems with document()
    • +
    • Fix namespace nodes selection and copy (requires libxml-2.3.11 upgrade + too)
    • +
    • John Fleck added a + tutorial
    • +
    • Fixes for namespace handling when evaluating variables
    • +
    • XInclude global flag added to process XInclude on document() if + requested
    • +
    • made xsltproc --version more detailed
    • +
    + +

    0.11.0: June 1 2001

    + +

    Mostly a bug fix release.

    +
      +
    • integration of catalogs from xsltproc
    • +
    • added --version to xsltproc for bug reporting
    • +
    • fixed errors when handling ID in external parsed entities
    • +
    • document() should hopefully work correctly but ...
    • +
    • fixed bug with PI and comments processing
    • +
    • William fixed the XPath string functions when using unicode
    • +
    + +

    0.10.0: May 19 2001

    +
      +
    • cleanups to make stylesheet read-only (not 100% complete)
    • +
    • fixed URI resolution in document()
    • +
    • force all XPath expression to be compiled at stylesheet parsing time, + even if unused ...
    • +
    • Fixed HTML default output detection
    • +
    • Fixed double attribute generation #54446
    • +
    • Fixed {{ handling in attributes #54451
    • +
    • More tests and speedups for DocBook document transformations
    • +
    • Fixed a really bad race like bug in xsltCopyTreeList()
    • +
    • added a documentation on the libxslt internals
    • +
    • William Brack and Bjorn Reese improved format-number()
    • +
    • Fixed multiple sort, it should really work now
    • +
    • added a --docbook option for SGML DocBook input (hackish)
    • +
    • a number of other bug fixes and regression test added as people were + submitting them
    • +
    + +

    0.9.0: May 3 2001

    +
      +
    • lot of various bugfixes, extended the regression suite
    • +
    • xsltproc should work with multiple params
    • +
    • added an option to use xsltproc with HTML input
    • +
    • improved the stylesheet compilation, processing of complex stylesheets + should be faster
    • +
    • using the same stylesheet for concurrent processing on multithreaded + programs should work now
    • +
    • fixed another batch of namespace handling problems
    • +
    • Implemented multiple level of sorting
    • +
    + +

    0.8.0: Apr 22 2001

    +
      +
    • fixed ansidecl.h problem
    • +
    • fixed unparsed-entity-uri() and generate-id()
    • +
    • sort semantic fixes and priority prob from William M. Brack
    • +
    • fixed namespace handling problems in XPath expression computations + (requires libxml-2.3.7)
    • +
    • fixes to current() and key()
    • +
    • other, smaller fixes, lots of testing with N Walsh DocBook HTML + stylesheets
    • +
    + +

    0.7.0: Apr 10 2001

    +
      +
    • cleanup using stricter compiler flags
    • +
    • command line parameter passing
    • +
    • fix to xsltApplyTemplates from William M. Brack
    • +
    • added the XSLTMark in the regression tests as well as document()
    • +
    + +

    0.6.0: Mar 22 2001

    +
      +
    • another beta
    • +
    • requires 2.3.5, which provide XPath expression compilation support
    • +
    • document() extension should function properly
    • +
    • fixed a number or reported bugs
    • +
    + +

    0.5.0: Mar 10 2001

    +
      +
    • fifth beta
    • +
    • some optimization work, for the moment 2 XSLT transform cannot use the + same stylesheet at the same time (to be fixed)
    • +
    • fixed problems with handling of tree results
    • +
    • fixed a reported strip-spaces problem
    • +
    • added more reported/fixed bugs to the test suite
    • +
    • incorporated William M. Brack fix for imports and global variables as + well as patch for with-param support in apply-templates
    • +
    • a bug fix on for-each
    • +
    + +

    0.4.0: Mar 1 2001

    +
      +
    • fourth beta test, released at the same time of libxml2-2.3.3
    • +
    • bug fixes
    • +
    • some optimization
    • +
    • started implement extension support, not finished
    • +
    • implemented but not tested multiple file output
    • +
    + +

    0.3.0: Feb 24 2001

    +
      +
    • third beta test, released at the same time of libxml2-2.3.2
    • +
    • lot of bug fixes
    • +
    • some optimization
    • +
    • added DocBook XSL based testsuite
    • +
    + +

    0.2.0: Feb 15 2001

    +
      +
    • second beta version, released at the same time as libxml2-2.3.1
    • +
    • getting close to feature completion, lot of bug fixes, some in the HTML + and XPath support of libxml
    • +
    • start becoming usable for real work. This version can now regenerate + the XML 2e HTML from the original XML sources and the associated + stylesheets (in section I of the XML + REC)
    • +
    • Still misses extension element/function/prefixes support. Support of + key() and document() is not complete
    • +
    + +

    0.1.0: Feb 8 2001

    +
      +
    • first beta version, released at the same time as libxml2-2.3.0
    • +
    • lots of bug fixes, first "testing" version, but incomplete
    • +
    + +

    0.0.1: Jan 25 2001

    +
      +
    • first alpha version released at the same time as libxml2-2.2.12
    • +
    • Framework in place, should work on simple examples, but far from being + feature complete
    • +
    + +

    The xsltproc tool

    + +

    This program is the simplest way to use libxslt: from the command line. It +is also used for doing the regression tests of the library.

    + +

    It takes as first argument the path or URL to an XSLT stylesheet, the next +arguments are filenames or URIs of the inputs to be processed. The output of +the processing is redirected on the standard output. There is actually a few +more options available:

    +
    orchis:~ -> xsltproc
    +Usage: xsltproc [options] stylesheet file [file ...]
    +   Options:
    +      --version or -V: show the version of libxml and libxslt used
    +      --verbose or -v: show logs of what's happening
    +      --output file or -o file: save to a given file
    +      --timing: display the time used
    +      --repeat: run the transformation 20 times
    +      --debug: dump the tree of the result instead
    +      --novalid: skip the DTD loading phase
    +      --noout: do not dump the result
    +      --maxdepth val : increase the maximum depth
    +      --html: the input document is(are) an HTML file(s)
    +      --docbook: the input document is SGML docbook
    +      --param name value : pass a (parameter,value) pair
    +      --nonet refuse to fetch DTDs or entities over network
    +      --warnnet warn against fetching over the network
    +      --catalogs : use the catalogs from $SGML_CATALOG_FILES
    +      --xinclude : do XInclude processing on document input
    +      --profile or --norman : dump profiling information 
    +orchis:~ ->
    + +

    DocBook

    + +

    The duck picture

    + +

    DocBook is an +XML/SGML vocabulary particularly well suited to books and papers about +computer hardware and software.

    + +

    xsltproc and libxslt are not specifically dependant on DocBook, but since +a lot of people use xsltproc and libxml2 for DocBook formatting, here are a +few pointers and information which may be helpful:

    + + +

    Do not use the --docbook option of xsltproc to process XML DocBook +documents, this option is only intended to provide some (limited) support of +the SGML version of DocBook.

    + +

    Points which are not DocBook specific but still worth mentionning +again:

    +
      +
    • if you think DocBook processing time is too slow, make sure you have + XML Catalogs pointing to a local installation of the DTD of DocBook. + Check the XML Catalog page + to understand more on this subject.
    • +
    • before processing a new document, use the command +

      xmllint --valid --noout path_to_document

      +

      to make sure that your input is valid DocBook. And fixes the errors + before processing further. Note that XSLT processing may work correctly + with some forms of validity errors left, but in general it can give + troubles on output.

      +
    • +
    + +

    The programming API

    + +

    Okay this section is clearly incomplete. But integrating libxslt into your +application should be relatively easy. First check the few steps described +below, then for more detailed information, look at the generated pages for the API and the source +of libxslt/xsltproc.c and the tutorial.

    + +

    Basically doing an XSLT transformation can be done in a few steps:

    +
      +
    1. configure the parser for XSLT: +

      xmlSubstituteEntitiesDefault(1);

      +

      xmlLoadExtDtdDefaultValue = 1;

      +
    2. +
    3. parse the stylesheet with xsltParseStylesheetFile()
    4. +
    5. parse the document with xmlParseFile()
    6. +
    7. apply the stylesheet using xsltApplyStylesheet()
    8. +
    9. save the result using xsltSaveResultToFile() if needed set + xmlIndentTreeOutput to 1
    10. +
    + +

    Steps 2,3, and 5 will probably need to be changed depending on you +processing needs and environment for example if reading/saving from/to +memory, or if you want to apply XInclude processing to the stylesheet or +input documents.

    + +

    Python and bindings

    + +

    There is a number of language bindings and wrappers available for libxml2, +the list below is not exhaustive. Please contact the xml-bindings@gnome.org +(archives) in +order to get updates to this list or to discuss the specific topic of libxml2 +or libxslt wrappers or bindings:

    + + +

    The libxslt Python module depends on the libxml2 Python module.

    + +

    The distribution includes a set of Python bindings, which are guaranteed to +be maintained as part of the library in the future, though the Python +interface have not yet reached the completeness of the C API.

    + +

    Stéphane Bidoul +maintains a Windows port +of the Python bindings.

    + +

    Note to people interested in building bindings, the API is formalized as +an XML API description file which allows to +automate a large part of the Python bindings, this includes function +descriptions, enums, structures, typedefs, etc... The Python script used to +build the bindings is python/generator.py in the source distribution.

    + +

    To install the Python bindings there are 2 options:

    + + +

    The distribution includes a set of examples and regression tests for the +python bindings in the python/tests directory. Here are some +excepts from those tests:

    + +

    basic.py:

    + +

    This is a basic test of XSLT interfaces: loading a stylesheet and a +document, transforming the document and saving the result.

    +
    import libxml2
    +import libxslt
    +
    +styledoc = libxml2.parseFile("test.xsl")
    +style = libxslt.parseStylesheetDoc(styledoc)
    +doc = libxml2.parseFile("test.xml")
    +result = style.applyStylesheet(doc, None)
    +style.saveResultToFilename("foo", result, 0)
    +style.freeStylesheet()
    +doc.freeDoc()
    +result.freeDoc()
    + +

    The Python module is called libxslt, you will also need the libxml2 module +for the operations on XML trees. Let's have a look at the objects manipulated +in that example and how is the processing done:

    +
      +
    • styledoc : is a libxml2 document tree. It is obtained by + parsing the XML file "test.xsl" containing the stylesheet.
    • +
    • style : this is a precompiled stylesheet ready to be used + by the following transformations (note the plural form, multiple + transformations can resuse the same stylesheet).
    • +
    • doc : this is the document to apply the transformation to. + In this case it is simply generated by parsing it from a file but any + other processing is possible as long as one get a libxml2 Doc. Note that + HTML tree are suitable for XSLT processing in libxslt. This is actually + how this page is generated !
    • +
    • result : this is a document generated by applying the + stylesheet to the document. Note that some of the stylesheet information + may be related to the serialization of that document and as in this + example a specific saveResultToFilename() method of the stylesheet should + be used to save it to a file (in that case to "foo").
    • +
    + +

    Also note the need to explicitely deallocate documents with freeDoc() +except for the stylesheet document which is freed when its compiled form is +garbage collected.

    + +

    extfunc.py:

    + +

    This one is a far more complex test. It shows how to modify the behaviour +of an XSLT transformation by passing parameters and how to extend the XSLT +engine with functions defined in python:

    +
    import libxml2
    +import libxslt
    +import string
    +
    +nodeName = None
    +def f(ctx, str):
    +    global nodeName
    +
    +    #
    +    # Small check to verify the context is correcly accessed
    +    #
    +    try:
    +        pctxt = libxslt.xpathParserContext(_obj=ctx)
    +        ctxt = pctxt.context()
    +        tctxt = ctxt.transformContext()
    +        nodeName = tctxt.insertNode().name
    +    except:
    +        pass
    +
    +    return string.upper(str)
    +
    +libxslt.registerExtModuleFunction("foo", "http://example.com/foo", f)
    + +

    This code defines and register an extension function. Note that the +function can be bound to any name (foo) and how the binding is also +associated to a namespace name "http://example.com/foo". From an XSLT point +of view the function just returns an upper case version of the string passed +as a parameter. But the first part of the function also read some contextual +information from the current XSLT processing environement, in that case it +looks for the current insertion node in the resulting output (either the +resulting document or the Result Value Tree being generated), and saves it to +a global variable for checking that the access actually worked.

    + +

    For more information on the xpathParserContext and transformContext +objects check the libray internals description. +The pctxt is actually an object from a class derived from the +libxml2.xpathParserContext() with just a couple more properties including the +possibility to look up the XSLT transformation context from the XPath +context.

    +
    styledoc = libxml2.parseDoc("""
    +<xsl:stylesheet version='1.0'
    +  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
    +  xmlns:foo='http://example.com/foo'
    +  xsl:exclude-result-prefixes='foo'>
    +
    +  <xsl:param name='bar'>failure</xsl:param>
    +  <xsl:template match='/'>
    +    <article><xsl:value-of select='foo:foo($bar)'/></article>
    +  </xsl:template>
    +</xsl:stylesheet>
    +""")
    + +

    Here is a simple example of how to read an XML document from a python +string with libxml2. Note how this stylesheet:

    +
      +
    • Uses a global parameter bar
    • +
    • Reference the extension function f
    • +
    • how the Namespace name "http://example.com/foo" has to be bound to a + prefix
    • +
    • how that prefix is excluded from the output
    • +
    • how the function is called from the select
    • +
    +
    style = libxslt.parseStylesheetDoc(styledoc)
    +doc = libxml2.parseDoc("<doc/>")
    +result = style.applyStylesheet(doc, { "bar": "'success'" })
    +style.freeStylesheet()
    +doc.freeDoc()
    + +

    that part is identical, to the basic example except that the +transformation is passed a dictionary of parameters. Note that the string +passed "success" had to be quoted, otherwise it is interpreted as an XPath +query for the childs of root named "success".

    +
    root = result.children
    +if root.name != "article":
    +    print "Unexpected root node name"
    +    sys.exit(1)
    +if root.content != "SUCCESS":
    +    print "Unexpected root node content, extension function failed"
    +    sys.exit(1)
    +if nodeName != 'article':
    +    print "The function callback failed to access its context"
    +    sys.exit(1)
    +
    +result.freeDoc()
    + +

    That part just verifies that the transformation worked, that the parameter +got properly passed to the engine, that the function f() got called and that +it properly accessed the context to find the name of the insertion node.

    + +

    pyxsltproc.py:

    + +

    this module is a bit too long to be described there but it is basically a +rewrite of the xsltproc command line interface of libxslt in Python. It +provides nearly all the functionalities of xsltproc and can be used as a base +module to write Python customized XSLT processors. One of the thing to notice +are:

    +
    libxml2.lineNumbersDefault(1)
    +libxml2.substituteEntitiesDefault(1)
    + +

    those two calls in the main() function are needed to force the libxml2 +processor to generate DOM trees compliant with the XPath data model.

    + +

    Library internals

    + +

    Table of contents

    + + +

    Introduction

    + +

    This document describes the processing of libxslt, the XSLT C library developed for the GNOME project.

    + +

    Note: this documentation is by definition incomplete and I am not good at +spelling, grammar, so patches and suggestions are really welcome.

    + +

    Basics

    + +

    XSLT is a transformation language. It takes an input document and a +stylesheet document and generates an output document:

    + +

    + +

    Libxslt is written in C. It relies on libxml, the XML C library for GNOME, for +the following operations:

    +
      +
    • parsing files
    • +
    • building the in-memory DOM structure associated with the documents + handled
    • +
    • the XPath implementation
    • +
    • serializing back the result document to XML and HTML. (Text is handled + directly.)
    • +
    + +

    Keep it simple stupid

    + +

    Libxslt is not very specialized. It is built under the assumption that all +nodes from the source and output document can fit in the virtual memory of +the system. There is a big trade-off there. It is fine for reasonably sized +documents but may not be suitable for large sets of data. The gain is that it +can be used in a relatively versatile way. The input or output may never be +serialized, but the size of documents it can handle are limited by the size +of the memory available.

    + +

    More specialized memory handling approaches are possible, like building +the input tree from a serialization progressively as it is consumed, +factoring repetitive patterns, or even on-the-fly generation of the output as +the input is parsed but it is possible only for a limited subset of the +stylesheets. In general the implementation of libxslt follows the following +pattern:

    +
      +
    • KISS (keep it simple stupid)
    • +
    • when there is a clear bottleneck optimize on top of this simple + framework and refine only as much as is needed to reach the expected + result
    • +
    + +

    The result is not that bad, clearly one can do a better job but more +specialized too. Most optimization like building the tree on-demand would +need serious changes to the libxml XPath framework. An easy step would be to +serialize the output directly (or call a set of SAX-like output handler to +keep this a flexible interface) and hence avoid the memory consumption of the +result.

    + +

    The libxml nodes

    + +

    DOM-like trees, as used and generated by libxml and libxslt, are +relatively complex. Most node types follow the given structure except a few +variations depending on the node type:

    + +

    description of a libxml node

    + +

    Nodes carry a name and the node type +indicates the kind of node it represents, the most common ones are:

    +
      +
    • document nodes
    • +
    • element nodes
    • +
    • text nodes
    • +
    + +

    For the XSLT processing, entity nodes should not be generated (i.e. they +should be replaced by their content). Most nodes also contains the following +"navigation" information:

    +
      +
    • the containing document
    • +
    • the parent node
    • +
    • the first children node
    • +
    • the last children node
    • +
    • the previous sibling
    • +
    • the following sibling (next)
    • +
    + +

    Elements nodes carries the list of attributes in the properties, an +attribute itself holds the navigation pointers and the children list (the +attribute value is not represented as a simple string to allow usage of +entities references).

    + +

    The ns points to the namespace declaration for the +namespace associated to the node, nsDef is the linked list +of namespace declaration present on element nodes.

    + +

    Most nodes also carry an _private pointer which can be +used by the application to hold specific data on this node.

    + +

    The XSLT processing steps

    + +

    There are a few steps which are clearly decoupled at the interface +level:

    +
      +
    1. parse the stylesheet and generate a DOM tree
    2. +
    3. take the stylesheet tree and build a compiled version of it (the + compilation phase)
    4. +
    5. take the input and generate a DOM tree
    6. +
    7. process the stylesheet against the input tree and generate an output + tree
    8. +
    9. serialize the output tree
    10. +
    + +

    A few things should be noted here:

    +
      +
    • the steps 1/ 3/ and 5/ are optional: the DOM representing the + stylesheet and input can be created by other means, not just by parsing + serialized XML documents, and similarly the result tree DOM can be + made available to other processeswithout being serialized. +
    • the stylesheet obtained at 2/ can be reused by multiple processing 4/ + (and this should also work in threaded programs)
    • +
    • the tree provided in 2/ should never be freed using xmlFreeDoc, but by + freeing the stylesheet.
    • +
    • the input tree created in step 3/ is not modified except the + _private field which may be used for labelling keys if used by the + stylesheet. It's not modified at all in step 4/ to allow parallel + processing using a shared precompiled stylesheet.
    • +
    + +

    The XSLT stylesheet compilation

    + +

    This is the second step described. It takes a stylesheet tree, and +"compiles" it. This associates to each node a structure stored in the +_private field and containing information computed in the stylesheet:

    + +

    + +

    One xsltStylesheet structure is generated per document parsed for the +stylesheet. XSLT documents allow includes and imports of other documents, +imports are stored in the imports list (hence keeping the +tree hierarchy of includes which is very important for a proper XSLT +processing model) and includes are stored in the doclist +list. An imported stylesheet has a parent link to allow browsing of the +tree.

    + +

    The DOM tree associated to the document is stored in doc. +It is preprocessed to remove ignorable empty nodes and all the nodes in the +XSLT namespace are subject to precomputing. This usually consist of +extracting all the context information from the context tree (attributes, +namespaces, XPath expressions), and storing them in an xsltStylePreComp +structure associated to the _private field of the node.

    + +

    A couple of notable exceptions to this are XSLT template nodes (more on +this later) and attribute value templates. If they are actually templates, +the value cannot be computed at compilation time. (Some preprocessing could +be done like isolation and preparsing of the XPath subexpressions but it's +not done, yet.)

    + +

    The xsltStylePreComp structure also allows storing of the precompiled form +of an XPath expression that can be associated to an XSLT element (more on +this later).

    + +

    The XSLT template compilation

    + +

    A proper handling of templates lookup is one of the keys of fast XSLT +processing. (Given a node in the source document this is the process of +finding which templates should be applied to this node.) Libxslt follows the +hint suggested in the 5.2 +Patterns section of the XSLT Recommendation, i.e. it doesn't evaluate it +as an XPath expression but tokenizes it and compiles it as a set of rules to +be evaluated on a candidate node. There usually is an indication of the node +name in the last step of this evaluation and this is used as a key check for +the match. As a result libxslt builds a relatively more complex set of +structures for the templates:

    + +

    + +

    Let's describe a bit more closely what is built. First the xsltStylesheet +structure holds a pointer to the template hash table. All the XSLT patterns +compiled in this stylesheet are indexed by the value of the the target +element (or attribute, pi ...) name, so when a element or an attribute "foo" +needs to be processed the lookup is done using the name as a key.

    + +

    Each of the patterns is compiled into an xsltCompMatch +(i.e. an ''XSLT compiled match') structure. It holds +the set of rules based on the tokenization of the pattern stored in reverse +order (matching is easier this way).

    + +

    The xsltCompMatch are then stored in the hash table, the clash list is +itself sorted by priority of the template to implement "naturally" the XSLT +priority rules.

    + +

    Associated to the compiled pattern is the xsltTemplate itself containing +the information required for the processing of the pattern including, of +course, a pointer to the list of elements used for building the pattern +result.

    + +

    Last but not least a number of patterns do not fit in the hash table +because they are not associated to a name, this is the case for patterns +applying to the root, any element, any attributes, text nodes, pi nodes, keys +etc. Those are stored independently in the stylesheet structure as separate +linked lists of xsltCompMatch.

    + +

    The processing itself

    + +

    The processing is defined by the XSLT specification (the basis of the +algorithm is explained in the Introduction +section). Basically it works by taking the root of the input document +as the cureent node and applying the following algorithm:

    +
      +
    1. Finding the template applying to current node. + This is a lookup in the template hash table, walking the hash list until + the node satisfies all the steps of the pattern, then checking the + appropriate global template(s) (i.e. templates applying to a node type) + to see if there isn't a higher priority rule to apply
    2. +
    3. If there is no template, apply the default rule (recurse on the + children as the current node)
    4. +
    5. else walk the content list of the selected templates, for each of them: +
        +
      • if the node is in the XSLT namespace then the node has a _private + field pointing to the preprocessed values, jump to the specific + code
      • +
      • if the node is in an extension namespace, look up the associated + behavior
      • +
      • otherwise copy the node.
      • +
      +

      The closure is usually done through the XSLT + apply-templatesconstruct, which invokes this process + recursively starting at step 1, to find the appropriate template + for the nodes selected by the 'select' attribute of the apply-templates + instruction (default: the children of the node currently being + processed)

      +
    6. +
    + +

    Note that large parts of the input tree may not be processed by a given +stylesheet and that conversely some may be processed multiple times. +(This often is the case when a Table of Contents is built).

    + +

    The module transform.c is the one implementing most of this +logic. xsltApplyStylesheet() is the entry point, it +allocates an xsltTransformContext containing the following:

    +
      +
    • a pointer to the stylesheet being processed
    • +
    • a stack of templates
    • +
    • a stack of variables and parameters
    • +
    • an XPath context
    • +
    • the template mode
    • +
    • current document
    • +
    • current input node
    • +
    • current selected node list
    • +
    • the current insertion points in the output document
    • +
    • a couple of hash tables for extension elements and functions
    • +
    + +

    Then a new document gets allocated (HTML or XML depending on the type of +output), the user parameters and global variables and parameters are +evaluated. Then xsltProcessOneNode() which implements the +1-2-3 algorithm is called on the docuemnt node of the input. Step 1/ is +implemented by calling xsltGetTemplate(), step 2/ is +implemented by xsltDefaultProcessOneNode() and step 3/ is +implemented by xsltApplyOneTemplate().

    + +

    XPath expression compilation

    + +

    The XPath support is actually implemented in the libxml module (where it +is reused by the XPointer implementation). XPath is a relatively classic +expression language. The only uncommon feature is that it is working on XML +trees and hence has specific syntax and types to handle them.

    + +

    XPath expressions are compiled using xmlXPathCompile(). +It will take an expression string in input and generate a structure +containing the parsed expression tree, for example the expression:

    +
    /doc/chapter[title='Introduction']
    + +

    will be compiled as

    +
    Compiled Expression : 10 elements
    +  SORT
    +    COLLECT  'child' 'name' 'node' chapter
    +      COLLECT  'child' 'name' 'node' doc
    +        ROOT
    +      PREDICATE
    +        SORT
    +          EQUAL =
    +            COLLECT  'child' 'name' 'node' title
    +              NODE
    +            ELEM Object is a string : Introduction
    +              COLLECT  'child' 'name' 'node' title
    +                NODE
    + +

    This can be tested using the testXPath command (in the +libxml codebase) using the --tree option.

    + +

    Again, the KISS approach is used. No optimization is done. This could be +an interesting thing to add. Michael +Kay describes a lot of possible and interesting optimizations done in +Saxon which would be possible at this level. I'm unsure they would provide +much gain since the expressions tends to be relatively simple in general and +stylesheets are still hand generated. Optimizations at the interpretation +sounds likely to be more efficient.

    + +

    XPath interpretation

    + +

    The interpreter is implemented by xmlXPathCompiledEval() +which is the front-end to xmlXPathCompOpEval() the function +implementing the evaluation of the expression tree. This evaluation follows +the KISS approach again. It's recursive and calls +xmlXPathNodeCollectAndTest() to collect a set of nodes when +evaluating a COLLECT node.

    + +

    An evaluation is done within the framework of an XPath context stored in +an xmlXPathContext structure, in the framework of a +transformation the context is maintained within the XSLT context. Its content +follows the requirements from the XPath specification:

    +
      +
    • the current document
    • +
    • the current node
    • +
    • a hash table of defined variables (but not used by XSLT, + which uses its own stack frame for variables, described below)
    • +
    • a hash table of defined functions
    • +
    • the proximity position (the place of the node in the current node + list)
    • +
    • the context size (the size of the current node list)
    • +
    • the array of namespace declarations in scope (there also is a namespace + hash table but it is not used in the XSLT transformation).
    • +
    + +

    For the purpose of XSLT an extra pointer has been added +allowing to retrieve the XSLT transformation context. When an XPath +evaluation is about to be performed, an XPath parser context is allocated +containing an XPath object stack (this is actually an XPath evaluation +context, this is a relic of the time where there was no separate parsing and +evaluation phase in the XPath implementation). Here is an overview of the set +of contexts associated to an XPath evaluation within an XSLT +transformation:

    + +

    + +

    Clearly this is a bit too complex and confusing and should be refactored +at the next set of binary incompatible releases of libxml. For example the +xmlXPathCtxt has a lot of unused parts and should probably be merged with +xmlXPathParserCtxt.

    + +

    Description of XPath Objects

    + +

    An XPath expression manipulates XPath objects. XPath defines the default +types boolean, numbers, strings and node sets. XSLT adds the result tree +fragment type which is basically an unmodifiable node set.

    + +

    Implementation-wise, libxml follows again a KISS approach, the +xmlXPathObject is a structure containing a type description and the various +possibilities. (Using an enum could have gained some bytes.) In the case of +node sets (or result tree fragments), it points to a separate xmlNodeSet +object which contains the list of pointers to the document nodes:

    + +

    + +

    The XPath API (and +its 'internal' +part) includes a number of functions to create, copy, compare, convert or +free XPath objects.

    + +

    XPath functions

    + +

    All the XPath functions available to the interpreter are registered in the +function hash table linked from the XPath context. They all share the same +signature:

    +
    void xmlXPathFunc (xmlXPathParserContextPtr ctxt, int nargs);
    + +

    The first argument is the XPath interpretation context, holding the +interpretation stack. The second argument defines the number of objects +passed on the stack for the function to consume (last argument is on top of +the stack).

    + +

    Basically an XPath function does the following:

    +
      +
    • check nargs for proper handling of errors or functions + with variable numbers of parameters
    • +
    • pop the parameters from the stack using obj = + valuePop(ctxt);
    • +
    • do the function specific computation
    • +
    • push the result parameter on the stack using valuePush(ctxt, + res);
    • +
    • free up the input parameters with + xmlXPathFreeObject(obj);
    • +
    • return
    • +
    + +

    Sometime the work can be done directly by modifying in-situ the top object +on the stack ctxt->value.

    + +

    The XSLT variables stack frame

    + +

    Not to be confused with XPath object stack, this stack holds the XSLT +variables and parameters as they are defined through the recursive calls of +call-template, apply-templates and default templates. This is used to define +the scope of variables being called.

    + +

    This part seems to be one needing most work , first it is +done in a very inefficient way since the location of the variables and +parameters within the stylesheet tree is still done at run time (it really +should be done statically at compile time), and I am still unsure that my +understanding of the template variables and parameter scope is actually +right.

    + +

    This part of the documentation is still to be written once this part of +the code will be stable. TODO

    + +

    Extension support

    + +

    There is a separate document explaining how the +extension support works.

    + +

    Further reading

    + +

    Michael Kay wrote a +really interesting article on Saxon internals and the work he did on +performance issues. I wish I had read it before starting libxslt design (I +would probably have avoided a few mistakes and progressed faster). A lot of +the ideas in his papers should be implemented or at least tried in +libxslt.

    + +

    The libxml documentation, especially the I/O interfaces and the memory management.

    + +

    TODOs

    + +

    redesign the XSLT stack frame handling. Far too much work is done at +execution time. Similarly for the attribute value templates handling, at +least the embedded subexpressions ought to be precompiled.

    + +

    Allow output to be saved to a SAX like output (this notion of SAX like API +for output should be added directly to libxml).

    + +

    Implement and test some of the optimization explained by Michael Kay +especially:

    +
      +
    • static slot allocation on the stack frame
    • +
    • specific boolean interpretation of an XPath expression
    • +
    • some of the sorting optimization
    • +
    • Lazy evaluation of location path. (this may require more changes but + sounds really interesting. XT does this too.)
    • +
    • Optimization of an expression tree (This could be done as a completely + independent module.)
    • +
    + +

    + +

    Error reporting, there is a lot of case where the XSLT specification +specify that a given construct is an error are not checked adequately by +libxslt. Basically one should do a complete pass on the XSLT spec again and +add all tests to the stylesheet compilation. Using the DTD provided in the +appendix and making direct checks using the libxml validation API sounds a +good idea too (though one should take care of not raising errors for +elements/attributes in different namespaces).

    + +

    Double check all the places where the stylesheet compiled form might be +modified at run time (extra removal of blanks nodes, hint on the +xsltCompMatch).

    + +

    Thanks:

    +

    Thanks to Michael Sperberg-McQueen for + various fixes and clarifications on this document!

    + +

    + +

    Writing extensions

    + +

    Table of content

    + + +

    Introduction

    + +

    This document describes the work needed to write extensions to the +standard XSLT library for use with libxslt, the XSLT C library developed for the GNOME project.

    + +

    Before starting reading this document it is highly recommended to get +familiar with the libxslt internals.

    + +

    Note: this documentation is by definition incomplete and I am not good at +spelling, grammar, so patches and suggestions are really welcome.

    + +

    Basics

    + +

    The XSLT specification provides +two ways to extend an XSLT engine:

    + + +

    In both cases the extensions need to be associated to a new namespace, +i.e. an URI used as the name for the extension's namespace (there is no need +to have a resource there for this to work).

    + +

    libxslt provides a few extensions itself, either in the libxslt namespace +"http://xmlsoft.org/XSLT/namespace" or in namespaces for other well known +extensions provided by other XSLT processors like Saxon, Xalan or XT.

    + +

    Extension modules

    + +

    Since extensions are bound to a namespace name, usually sets of extensions +coming from a given source are using the same namespace name defining in +practice a group of extensions providing elements, functions or both. From +the libxslt point of view those are considered as an "extension module", and +most of the APIs work at a module point of view.

    + +

    Registration of new functions or elements are bound to the activation of +the module. This is currently done by declaring the namespace as an extension +by using the attribute extension-element-prefixes on the +xsl:stylesheet +element.

    + +

    An extension module is defined by 3 objects:

    +
      +
    • the namespace name associated
    • +
    • an initialization function
    • +
    • a shutdown function
    • +
    + +

    Registering a module

    + +

    Currently a libxslt module has to be compiled within the application using +libxslt. There is no code to load dynamically shared libraries associated to +a namespace (this may be added but is likely to become a portability +nightmare).

    + +

    The current way to register a module is to link the code implementing it +with the application and to call a registration function:

    +
    int xsltRegisterExtModule(const xmlChar *URI,
    +                          xsltExtInitFunction initFunc,
    +                          xsltExtShutdownFunction shutdownFunc);
    + +

    The associated header is read by:

    +
    #include<libxslt/extensions.h>
    + +

    which also defines the type for the initialization and shutdown +functions

    + +

    Loading a module

    + +

    Once the module URI has been registered and if the XSLT processor detects +that a given stylesheet needs the functionalities of an extended module, this +one is initialized.

    + +

    The xsltExtInitFunction type defines the interface for an initialization +function:

    +
    /**
    + * xsltExtInitFunction:
    + * @ctxt:  an XSLT transformation context
    + * @URI:  the namespace URI for the extension
    + *
    + * A function called at initialization time of an XSLT
    + * extension module
    + *
    + * Returns a pointer to the module specific data for this
    + * transformation
    + */
    +typedef void *(*xsltExtInitFunction)(xsltTransformContextPtr ctxt,
    +                                     const xmlChar *URI);
    + +

    There are 3 things to notice:

    +
      +
    • The function gets passed the namespace name URI as an argument. This + allows a single function to provide the initialization for multiple + logical modules.
    • +
    • It also gets passed a transformation context. The initialization is + done at run time before any processing occurs on the stylesheet but it + will be invoked separately each time for each transformation.
    • +
    • It returns a pointer. This can be used to store module specific + information which can be retrieved later when a function or an element + from the extension is used. An obvious example is a connection to a + database which should be kept and reused along with the transformation. + NULL is a perfectly valid return; there is no way to indicate a failure + at this level
    • +
    + +

    What this function is expected to do is:

    +
      +
    • prepare the context for this module (like opening the database + connection)
    • +
    • register the extensions specific to this module
    • +
    + +

    Registering an extension function

    + +

    There is a single call to do this registration:

    +
    int xsltRegisterExtFunction(xsltTransformContextPtr ctxt,
    +                            const xmlChar *name,
    +                            const xmlChar *URI,
    +                            xmlXPathEvalFunc function);
    + +

    The registration is bound to a single transformation instance referred by +ctxt, name is the UTF8 encoded name for the NCName of the function, and URI +is the namespace name for the extension (no checking is done, a module could +register functions or elements from a different namespace, but it is not +recommended).

    + +

    Implementing an extension function

    + +

    The implementation of the function must have the signature of a libxml +XPath function:

    +
    /**
    + * xmlXPathEvalFunc:
    + * @ctxt: an XPath parser context
    + * @nargs: the number of arguments passed to the function
    + *
    + * an XPath evaluation function, the parameters are on the
    + * XPath context stack
    + */
    +
    +typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt,
    +                                 int nargs);
    + +

    The context passed to an XPath function is not an XSLT context but an XPath context. However it is possible to +find one from the other:

    +
      +
    • The function xsltXPathGetTransformContext provides this lookup facility: +
      xsltTransformContextPtr
      +         xsltXPathGetTransformContext
      +                          (xmlXPathParserContextPtr ctxt);
      +
    • +
    • The xmlXPathContextPtr associated to an + xsltTransformContext is stored in the xpathCtxt + field.
    • +
    + +

    The first thing an extension function may want to do is to check the +arguments passed on the stack, the nargs parameter will tell how +many of them were provided on the XPath expression. The macro valuePop will +extract them from the XPath stack:

    +
    #include <libxml/xpath.h>
    +#include <libxml/xpathInternals.h>
    +
    +xmlXPathObjectPtr obj = valuePop(ctxt); 
    + +

    Note that ctxt is the XPath context not the XSLT one. It is +then possible to examine the content of the value. Check the description of XPath objects if +necessary. The following is a common sequence checking whether the argument +passed is a string and converting it using the built-in XPath +string() function if this is not the case:

    +
    if (obj->type != XPATH_STRING) {
    +    valuePush(ctxt, obj);
    +    xmlXPathStringFunction(ctxt, 1);
    +    obj = valuePop(ctxt);
    +}
    + +

    Most common XPath functions are available directly at the C level and are +exported either in <libxml/xpath.h> or in +<libxml/xpathInternals.h>.

    + +

    The extension function may also need to retrieve the data associated to +this module instance (the database connection in the previous example) this +can be done using the xsltGetExtData:

    +
    void * xsltGetExtData(xsltTransformContextPtr ctxt,
    +                      const xmlChar *URI);
    + +

    Again the URI to be provided is the one which was used when registering +the module.

    + +

    Once the function finishes, don't forget to:

    +
      +
    • push the return value on the stack using valuePush(ctxt, + obj)
    • +
    • deallocate the parameters passed to the function using + xmlXPathFreeObject(obj)
    • +
    + +

    Examples for extension functions

    + +

    The module libxslt/functions.c contains the sources of the XSLT built-in +functions, including document(), key(), generate-id(), etc. as well as a full +example module at the end. Here is the test function implementation for the +libxslt:test function:

    +
    /**
    + * xsltExtFunctionTest:
    + * @ctxt:  the XPath Parser context
    + * @nargs:  the number of arguments
    + *
    + * function libxslt:test() for testing the extensions support.
    + */
    +static void
    +xsltExtFunctionTest(xmlXPathParserContextPtr ctxt, int nargs)
    +{
    +    xsltTransformContextPtr tctxt;
    +    void *data;
    +
    +    tctxt = xsltXPathGetTransformContext(ctxt);
    +    if (tctxt == NULL) {
    +        xsltGenericError(xsltGenericErrorContext,
    +            "xsltExtFunctionTest: failed to get the transformation context\n");
    +        return;
    +    }
    +    data = xsltGetExtData(tctxt, (const xmlChar *) XSLT_DEFAULT_URL);
    +    if (data == NULL) {
    +        xsltGenericError(xsltGenericErrorContext,
    +            "xsltExtFunctionTest: failed to get module data\n");
    +        return;
    +    }
    +#ifdef WITH_XSLT_DEBUG_FUNCTION
    +    xsltGenericDebug(xsltGenericDebugContext,
    +                     "libxslt:test() called with %d args\n", nargs);
    +#endif
    +}
    + +

    Registering an extension element

    + +

    There is a single call to do this registration:

    +
    int xsltRegisterExtElement(xsltTransformContextPtr ctxt,
    +                           const xmlChar *name,
    +                           const xmlChar *URI,
    +                           xsltTransformFunction function);
    + +

    It is similar to the mechanism used to register an extension function, +except that the signature of an extension element implementation is +different.

    + +

    The registration is bound to a single transformation instance referred to +by ctxt, name is the UTF8 encoded name for the NCName of the element, and URI +is the namespace name for the extension (no checking is done, a module could +register elements for a different namespace, but it is not recommended).

    + +

    Implementing an extension element

    + +

    The implementation of the element must have the signature of an XSLT +transformation function:

    +
    /** 
    + * xsltTransformFunction: 
    + * @ctxt: the XSLT transformation context
    + * @node: the input node
    + * @inst: the stylesheet node 
    + * @comp: the compiled information from the stylesheet 
    + * 
    + * signature of the function associated to elements part of the
    + * stylesheet language like xsl:if or xsl:apply-templates.
    + */ 
    +typedef void (*xsltTransformFunction)
    +                          (xsltTransformContextPtr ctxt,
    +                           xmlNodePtr node,
    +                           xmlNodePtr inst,
    +                           xsltStylePreCompPtr comp);
    + +

    The first argument is the XSLT transformation context. The second and +third arguments are xmlNodePtr i.e. internal memory representation of XML nodes. They are +respectively node from the the input document being transformed +by the stylesheet and inst the extension element in the +stylesheet. The last argument is comp a pointer to a precompiled +representation of inst but usually for an extension function +this value is NULL by default (it could be added and associated +to the instruction in inst->_private).

    + +

    The same functions are available from a function implementing an extension +element as in an extension function, including +xsltGetExtData().

    + +

    The goal of an extension element being usually to enrich the generated +output, it is expected that they will grow the currently generated output +tree. This can be done by grabbing ctxt->insert which is the current +libxml node being generated (Note this can also be the intermediate value +tree being built for example to initialize a variable, the processing should +be similar). The functions for libxml tree manipulation from <libxml/tree.h> can +be employed to extend or modify the tree, but it is required to preserve the +insertion node and its ancestors since there are existing pointers to those +elements still in use in the XSLT template execution stack.

    + +

    Example for extension elements

    + +

    The module libxslt/transform.c contains the sources of the XSLT built-in +elements, including xsl:element, xsl:attribute, xsl:if, etc. There is a small +but full example in functions.c providing the implementation for the +libxslt:test element, it will output a comment in the result tree:

    +
    /**
    + * xsltExtElementTest:
    + * @ctxt:  an XSLT processing context
    + * @node:  The current node
    + * @inst:  the instruction in the stylesheet
    + * @comp:  precomputed information
    + *
    + * Process a libxslt:test node
    + */
    +static void
    +xsltExtElementTest(xsltTransformContextPtr ctxt, xmlNodePtr node,
    +                   xmlNodePtr inst,
    +                   xsltStylePreCompPtr comp)
    +{
    +    xmlNodePtr comment;
    +
    +    if (ctxt == NULL) {
    +        xsltGenericError(xsltGenericErrorContext,
    +                         "xsltExtElementTest: no transformation context\n");
    +        return;
    +    }
    +    if (node == NULL) {
    +        xsltGenericError(xsltGenericErrorContext,
    +                         "xsltExtElementTest: no current node\n");
    +        return;
    +    }
    +    if (inst == NULL) {
    +        xsltGenericError(xsltGenericErrorContext,
    +                         "xsltExtElementTest: no instruction\n");
    +        return;
    +    }
    +    if (ctxt->insert == NULL) {
    +        xsltGenericError(xsltGenericErrorContext,
    +                         "xsltExtElementTest: no insertion point\n");
    +        return;
    +    }
    +    comment =
    +        xmlNewComment((const xmlChar *)
    +                      "libxslt:test element test worked");
    +    xmlAddChild(ctxt->insert, comment);
    +}
    + +

    The shutdown of a module

    + +

    When the XSLT processor ends a transformation, the shutdown function (if +it exists) for each of the modules initialized is called. The +xsltExtShutdownFunction type defines the interface for a shutdown +function:

    +
    /**
    + * xsltExtShutdownFunction:
    + * @ctxt:  an XSLT transformation context
    + * @URI:  the namespace URI for the extension
    + * @data:  the data associated to this module
    + *
    + * A function called at shutdown time of an XSLT extension module
    + */
    +typedef void (*xsltExtShutdownFunction) (xsltTransformContextPtr ctxt,
    +                                         const xmlChar *URI,
    +                                         void *data);
    + +

    This is really similar to a module initialization function except a third +argument is passed, it's the value that was returned by the initialization +function. This allows the routine to deallocate resources from the module for +example close the connection to the database to keep the same example.

    + +

    Future work

    + +

    Well, some of the pieces missing:

    +
      +
    • a way to load shared libraries to instantiate new modules
    • +
    • a better detection of extension functions usage and their registration + without having to use the extension prefix which ought to be reserved to + element extensions.
    • +
    • more examples
    • +
    • implementations of the EXSLT common + extension libraries, Thomas Broyer nearly finished implementing them.
    • +
    + +

    + +

    Contributions

    + + +

    + +

    Daniel Veillard

    + + diff --git a/doc/xsltproc.1 b/doc/xsltproc.1 new file mode 100644 index 0000000..d94e7a2 --- /dev/null +++ b/doc/xsltproc.1 @@ -0,0 +1,361 @@ +.\" Title: xsltproc +.\" Author: John Fleck +.\" Generator: DocBook XSL Stylesheets v1.73.2 +.\" Date: $Date: 2008-04-21 16:28:56 +0200 (Mon, 21 Apr 2008) $ +.\" Manual: xsltproc Manual +.\" Source: libxslt +.\" +.TH "XSLTPROC" "1" "$Date: 2008\-04\-21 16:28:56 +0200 (Mon, 21 Apr 2008) $" "libxslt" "xsltproc Manual" +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.SH "NAME" +xsltproc - command line XSLT processor +.SH "SYNOPSIS" +.HP 9 +\fBxsltproc\fR [[\fB\-V\fR | \fB\-\-version\fR] [\fB\-v\fR | \fB\-\-verbose\fR] [{\fB\-o\fR | \fB\-\-output\fR} {\fIFILE\fR | \fIDIRECTORY\fR}] | \fB\-\-timing\fR | \fB\-\-repeat\fR | \fB\-\-debug\fR | \fB\-\-novalid\fR | \fB\-\-noout\fR | \fB\-\-maxdepth\ \fR\fB\fIVALUE\fR\fR | \fB\-\-html\fR | \fB\-\-encoding\ \fR\fB\fIENCODING\fR\fR\fB\ \fR | \fB\-\-param\ \fR\fB\fIPARAMNAME\fR\fR\fB\ \fR\fB\fIPARAMVALUE\fR\fR\fB\ \fR | \fB\-\-stringparam\ \fR\fB\fIPARAMNAME\fR\fR\fB\ \fR\fB\fIPARAMVALUE\fR\fR\fB\ \fR | \fB\-\-nonet\fR | \fB\-\-path\ "\fR\fB\fIPATH(S)\fR\fR\fB"\fR | \fB\-\-load\-trace\fR | \fB\-\-catalogs\fR | \fB\-\-xinclude\fR | [\fB\-\-profile\fR\ |\ \fB\-\-norman\fR] | \fB\-\-dumpextensions\fR | \fB\-\-nowrite\fR | \fB\-\-nomkdir\fR | \fB\-\-writesubtree\ \fR\fB\fIPATH\fR\fR | \fB\-\-nodtdattr\fR] [\fISTYLESHEET\fR] {\fIXML\-FILE\fR | \-} +.SH "DESCRIPTION" +.PP + +\fBxsltproc\fR +is a command line tool for applying +XSLT +stylesheets to +XML +documents\. It is part of +\fBlibxslt\fR(3), the XSLT C library for GNOME\. While it was developed as part of the GNOME project, it can operate independently of the GNOME desktop\. +.PP + +\fBxsltproc\fR +is invoked from the command line with the name of the stylesheet to be used followed by the name of the file or files to which the stylesheet is to be applied\. It will use the standard input if a filename provided is +\fB\-\fR +\. +.PP +If a stylesheet is included in an +XML +document with a Stylesheet Processing Instruction, no stylesheet need to be named at the command line\. +\fBxsltproc\fR +will automatically detect the included stylesheet and use it\. +.PP +By default, output is to +\fIstdout\fR\. You can specify a file for output using the +\fB\-o\fR +or +\fB\-\-output\fR +option\. +.SH "OPTIONS" +.PP + +\fBxsltproc\fR +accepts the following options (in alphabetical order): +.PP +\fB\-\-catalogs\fR +.RS 4 +Use the +SGML +catalog specified in +\fBSGML_CATALOG_FILES\fR +to resolve the location of external entities\. By default, +\fBxsltproc\fR +looks for the catalog specified in +\fBXML_CATALOG_FILES\fR\. If that is not specified, it uses +\fI/etc/xml/catalog\fR\. +.RE +.PP +\fB\-\-debug\fR +.RS 4 +Output an +XML +tree of the transformed document for debugging purposes\. +.RE +.PP +\fB\-\-dumpextensions\fR +.RS 4 +Dumps the list of all registered extensions on +\fIstdout\fR\. +.RE +.PP +\fB\-\-html\fR +.RS 4 +The input document is an +HTML +file\. +.RE +.PP +\fB\-\-load\-trace\fR +.RS 4 +Display all the documents loaded during the processing to +\fIstderr\fR\. +.RE +.PP +\fB\-\-maxdepth \fR\fB\fIVALUE\fR\fR +.RS 4 +Adjust the maximum depth of the template stack before +\fBlibxslt\fR(3) +concludes it is in an infinite loop\. The default is 3000\. +.RE +.PP +\fB\-\-nodtdattr\fR +.RS 4 +Do not apply default attributes from the document\'s +DTD\. +.RE +.PP +\fB\-\-nomkdir\fR +.RS 4 +Refuses to create directories\. +.RE +.PP +\fB\-\-nonet\fR +.RS 4 +Do not use the Internet to fetch +DTDs, entities or documents\. +.RE +.PP +\fB\-\-noout\fR +.RS 4 +Do not output the result\. +.RE +.PP +\fB\-\-novalid\fR +.RS 4 +Skip loading the document\'s +DTD\. +.RE +.PP +\fB\-\-nowrite\fR +.RS 4 +Refuses to write to any file or resource\. +.RE +.PP +\fB\-o\fR or \fB\-\-output\fR \fIFILE\fR | \fIDIRECTORY\fR +.RS 4 +Direct output to the given +\fIFILE\fR\. Using the option with a +\fIDIRECTORY\fR +directs the output files to the specified directory\. This can be useful for multiple outputs (also known as "chunking") or manpage processing\. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +Important +The given directory +\fBmust\fR +already exist\. +.sp +.it 1 an-trap +.nr an-no-space-flag 1 +.nr an-break-flag 1 +.br +Note +Make sure that +\fIFILE\fR +and +\fIDIRECTORY\fR +follow the +\(lqURI reference computation\(rq +as described in RFC 2396 and laters\. This means, that e\.g\. +\fB\-o directory\fR +will maybe not work, but +\fB\-o directory/\fR +will\. +.RE +.PP +\fB\-\-encoding \fR\fB\fIENCODING\fR\fR +.RS 4 +Allow to specify the encoding for the input\. +.RE +.PP +\fB\-\-param \fR\fB\fIPARAMNAME\fR\fR\fB \fR\fB\fIPARAMVALUE\fR\fR +.RS 4 +Pass a parameter of name +\fIPARAMNAME\fR +and value +\fIPARAMVALUE\fR +to the stylesheet\. You may pass multiple name/value pairs up to a maximum of 32\. If the value being passed is a string, you can use +\fB\-\-stringparam\fR +instead, to avoid additional quote characters that appear in string expressions\. Note: the XPath expression must be UTF\-8 encoded\. +.RE +.PP +\fB\-\-path "\fR\fB\fIPATH(S)\fR\fR\fB"\fR +.RS 4 +Use the (space\- or colon\-separated) list of filesystem paths specified by +\fIPATHS\fR +to load +DTDs, entities or documents\. Enclose space\-separated lists by quotation marks\. +.RE +.PP +\fB\-\-profile\fR or \fB\-\-norman\fR +.RS 4 +Output profiling information detailing the amount of time spent in each part of the stylesheet\. This is useful in optimizing stylesheet performance\. +.RE +.PP +\fB\-\-repeat\fR +.RS 4 +Run the transformation 20 times\. Used for timing tests\. +.RE +.PP +\fB\-\-stringparam \fR\fB\fIPARAMNAME\fR\fR\fB \fR\fB\fIPARAMVALUE\fR\fR +.RS 4 +Pass a parameter of name +\fIPARAMNAME\fR +and value +\fIPARAMVALUE\fR +where +\fIPARAMVALUE\fR +is a string rather than a node identifier\. +\fBNote:\fR +The string must be UTF\-8 encoded\. +.RE +.PP +\fB\-\-timing\fR +.RS 4 +Display the time used for parsing the stylesheet, parsing the document and applying the stylesheet and saving the result\. Displayed in milliseconds\. +.RE +.PP +\fB\-v\fR or \fB\-\-verbose\fR +.RS 4 +Output each step taken by +\fBxsltproc\fR +in processing the stylesheet and the document\. +.RE +.PP +\fB\-V\fR or \fB\-\-version\fR +.RS 4 +Show the version of +\fBlibxml\fR(3) +and +\fBlibxslt\fR(3) +used\. +.RE +.PP +\fB\-\-writesubtree \fR\fB\fIPATH\fR\fR +.RS 4 +Allow file write only within the +\fIPATH\fR +subtree\. +.RE +.PP +\fB\-\-xinclude\fR +.RS 4 +Process the input document using the XInclude specification\. More details on this can be found in the XInclude specification: +\fI\%http://www.w3.org/TR/xinclude/\fR +.RE +.SH "ENVIRONMENT" +.PP +\fBSGML_CATALOG_FILES\fR +.RS 4 +SGML +catalog behavior can be changed by redirecting queries to the user\'s own set of catalogs\. This can be done by setting the +\fBSGML_CATALOG_FILES\fR +environment variable to a list of catalogs\. An empty one should deactivate loading the default +\fI/etc/sgml/catalog\fR +catalog\. +.RE +.PP +\fBXML_CATALOG_FILES\fR +.RS 4 +XML +catalog behavior can be changed by redirecting queries to the user\'s own set of catalogs\. This can be done by setting the +\fBXML_CATALOG_FILES\fR +environment variable to a list of catalogs\. An empty one should deactivate loading the default +\fI/etc/xml/catalog\fR +catalog\. +.RE +.SH "DIAGNOSTICS" +.PP + +\fBxsltproc\fR +return codes provide information that can be used when calling it from scripts\. +.PP +\fB0\fR +.RS 4 +No error (normal operation) +.RE +.PP +\fB1\fR +.RS 4 +No argument +.RE +.PP +\fB2\fR +.RS 4 +Too many parameters +.RE +.PP +\fB3\fR +.RS 4 +Unknown option +.RE +.PP +\fB4\fR +.RS 4 +Failed to parse the stylesheet +.RE +.PP +\fB5\fR +.RS 4 +Error in the stylesheet +.RE +.PP +\fB6\fR +.RS 4 +Error in one of the documents +.RE +.PP +\fB7\fR +.RS 4 +Unsupported xsl:output method +.RE +.PP +\fB8\fR +.RS 4 +String parameter contains both quote and double\-quotes +.RE +.PP +\fB9\fR +.RS 4 +Internal processing error +.RE +.PP +\fB10\fR +.RS 4 +Processing was stopped by a terminating message +.RE +.PP +\fB11\fR +.RS 4 +Could not write the result to the output file +.RE +.SH "SEE ALSO" +.PP +\fBlibxml\fR(3), +\fBlibxslt\fR(3) +.PP +More information can be found at +.sp +.RS 4 +\h'-04'\(bu\h'+03'\fBlibxml\fR(3) +web page +\fI\%http://www.xmlsoft.org/\fR +.RE +.sp +.RS 4 +\h'-04'\(bu\h'+03'W3C +XSLT +page +\fI\%http://www.w3.org/TR/xslt\fR +.RE +.sp +.RE +.SH "AUTHOR" +.PP +\fBJohn Fleck\fR <\&jfleck@inkstain\.net\&> +.sp -1n +.IP "" 4 +Author. +.SH "COPYRIGHT" +Copyright \(co 2001, 2002 +.br diff --git a/doc/xsltproc.html b/doc/xsltproc.html new file mode 100644 index 0000000..8d19223 --- /dev/null +++ b/doc/xsltproc.html @@ -0,0 +1,101 @@ +xsltproc

    Name

    xsltproc — command line xslt processor

    Synopsis

    xsltproc [[-V] | [-v] | [-o file] | [--timing] | [--repeat] | [--debug] | [--novalid] | [--noout] | [--maxdepth val] | [--html] | [--param name value] | [--stringparam name value] | [--nonet] | [--path paths] | [--load-trace] | [--catalogs] | [--xinclude] | [--profile] | [--dumpextensions] | [--nowrite] | [--nomkdir] | [--writesubtree] | [--nodtdattr]] [stylesheet] [file1] [file2] [....]

    Introduction

    + xsltproc is a command line tool for applying + XSLT stylesheets to XML + documents. It is part of libxslt, the XSLT C + library for GNOME. While it was developed as part of the GNOME project, it + can operate independently of the GNOME desktop. +

    + xsltproc is invoked from the command line with + the name of the stylesheet to be used followed by the name of the file or + files to which the stylesheet is to be applied. It will use the standard + input if a filename provided is - . +

    + If a stylesheet is included in an XML document with a + Stylesheet Processing Instruction, no stylesheet need be named at the + command line. xsltproc will automatically + detect the included stylesheet and use it. +

    + By default, output is to stdout. You can specify a file for output using + the -o option. +

    Command Line Options

    -V or --version
    Show the version of + libxml and libxslt used. +
    + -v or --verbose
    Output each step taken + by xsltproc in processing the stylesheet and the document. +
    + -o or --output file
    Direct output to the file named + file. For multiple outputs, also known as + "chunking", -o directory/ directs the + output files to a specified directory. The directory must already exist. +
    + --timing
    Display the time used for parsing the + stylesheet, parsing the document and applying the stylesheet and saving + the result. Displayed in milliseconds. +
    + --repeat
    Run the transformation 20 times. Used for + timing tests. +
    + --debug
    Output an XML tree of the + transformed document for debugging purposes. +
    + --novalid
    Skip loading the document's DTD. +
    + --noout
    Do not output the result. +
    + --maxdepth value
    Adjust the + maximum depth of the template stack before + libxslt concludes it is in an infinite + loop. The default is 500. +
    + --html
    The input document is an HTML + file. +
    + --param name value
    Pass a parameter of name + name and value + value to the stylesheet. You may pass multiple + name/value pairs up to a maximum of 32. If the value being passed is a + string rather than a node identifier, use + --stringparam instead. +
    + --stringparam name value
    Pass a paramenter of name name and + value value where + value is a string rather than a node + identifier. (Note: The string must be utf-8.)
    + --nonet
    Do not use the Internet to fetch DTD's, + entities or documents. +
    --path paths
    + Use the list (separated by space or column) of filesystem paths + specified by paths to load + DTDs, entities or documents. +
    --load-trace
    + Display to stderr all the documents loaded during the processing. +
    + --catalogs
    Use the SGML catalog specified in + SGML_CATALOG_FILES to resolve the location of + external entities. By default, xsltproc + looks for the catalog specified in + XML_CATALOG_FILES. If that is not specified, it uses + /etc/xml/catalog. +
    + --xinclude
    Process the input document using the + Xinclude specification. More details on this can be found in the Xinclude + specification: http://www.w3.org/TR/xinclude/ +
    + --profile or --norman
    Output profiling + information detailing the amount of time spent in each part of the + stylesheet. This is useful in optimizing stylesheet performance. +
    + --dumpextensions
    Dumps the list of all registered extensions on stdout. +
    + --nowrite
    Refuses to write to any file or resource. +
    + --nomkdir
    Refuses to create directories. +
    + --writesubtree path
    Allow file write only within the + path subtree. +
    + --nodtdattr +
    Do not apply default attributes from the document's + DTD. +

    Return values

    xsltproc's return codes provide information + that can be used when calling it from scripts.

    0: normal

    1: no argument

    2: too many parameters

    3: unknown option

    4: failed to parse the stylesheet

    5: error in the stylesheet

    6: error in one of the documents

    7: unsupported xsl:output method

    8: string parameter contains both quote and double-quotes

    9: internal processing error

    10: processing was stopped by a terminating message

    11: could not write the result to the output file

    More Information

    libxml web page: http://www.xmlsoft.org/

    W3C XSLT page: http://www.w3.org/TR/xslt

    diff --git a/doc/xsltproc.xml b/doc/xsltproc.xml new file mode 100644 index 0000000..bd1d79f --- /dev/null +++ b/doc/xsltproc.xml @@ -0,0 +1,573 @@ + + +xsltproc"> +]> + + + + + xsltproc Manual + libxslt + + 2001 + 2002 + + + John + Fleck + +
    + jfleck@inkstain.net +
    +
    +
    + + $Date$ + + + +
    + + + xsltproc + 1 + + + + xsltproc + command line XSLT processor + + + + + xsltproc + + + + + + + + + + + + + + + + FILE + DIRECTORY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + STYLESHEET + + XML-FILE + - + + + + + + DESCRIPTION + + &xsltproc; is a command line tool for applying XSLT + stylesheets to XML documents. It is part + of + libxslt + 3 + , the XSLT C library for GNOME. + While it was developed as part of the GNOME project, it can operate + independently of the GNOME desktop. + + + &xsltproc; is invoked from the command line with the name of the + stylesheet to be used followed by the name of the file or files to which + the stylesheet is to be applied. It will use the standard input if a + filename provided is - . + + + If a stylesheet is included in an XML document with a + Stylesheet Processing Instruction, no stylesheet need to be named at the + command line. &xsltproc; will automatically detect the included stylesheet + and use it. + + + By default, output is to stdout. + You can specify a file for output using + the or option. + + + + + OPTIONS + + &xsltproc; accepts the following options (in alphabetical order): + + + + + + + + Use the SGML catalog specified + in SGML_CATALOG_FILES to resolve the location of + external entities. By default, &xsltproc; looks for the catalog + specified in XML_CATALOG_FILES. If that is not + specified, it uses /etc/xml/catalog. + + + + + + + + + Output an XML tree of the transformed document + for debugging purposes. + + + + + + + + + Dumps the list of all registered extensions + on stdout. + + + + + + + + The input document is an HTML file. + + + + + + + + Display all the documents loaded during the processing + to stderr. + + + + + + + + + Adjust the maximum depth of the template stack + before + libxslt + 3 + concludes it is in an infinite loop. The default is 3000. + + + + + + + + + Do not apply default attributes from the + document's DTD. + + + + + + + + Refuses to create directories. + + + + + + + + Do not use the Internet to fetch DTDs, entities + or documents. + + + + + + + + Do not output the result. + + + + + + + Skip loading the document's DTD. + + + + + + + Refuses to write to any file or resource. + + + + + + or + FILE | DIRECTORY + + + + Direct output to the given FILE. Using + the option with a DIRECTORY directs the + output files to the specified directory. This can be + useful for multiple outputs (also known as "chunking") or manpage + processing. + + + + The given directory must already exist. + + + + + Make sure that FILE + and DIRECTORY follow the URI reference + computation as described in RFC 2396 and laters. This means, that + e.g. will maybe not work, + but will. + + + + + + + + + + + + Allow to specify the encoding for the input. + + + + + + + + + +Pass a parameter of name PARAMNAME and value +PARAMVALUE to the stylesheet. You may pass +multiple name/value pairs up to a maximum of 32. If the value being passed +is a string, you can use instead, to avoid +additional quote characters that appear in string expressions. Note: +the XPath expression must be UTF-8 encoded. + + + + + + + + + Use the (space- or colon-separated) list of filesystem paths specified + by PATHS to load DTDs, + entities or documents. Enclose space-separated lists by quotation marks. + + + + + + or + + + Output profiling information detailing the amount of time spent in + each part of the stylesheet. This is useful in optimizing stylesheet + performance. + + + + + + + + Run the transformation 20 times. Used for timing tests. + + + + + + + + + + Pass a parameter of name PARAMNAME and + value PARAMVALUE + where PARAMVALUE is a string rather than a + node identifier. Note: The string + must be UTF-8 encoded. + + + + + + + + + Display the time used for parsing the stylesheet, parsing the document + and applying the stylesheet and saving the result. Displayed in + milliseconds. + + + + + + or + + + Output each step taken by &xsltproc; in processing the stylesheet + and the document. + + + + + + or + + + Show the version of + libxml + 3 + and + libxslt + 3 + used. + + + + + + + + + Allow file write only within the PATH + subtree. + + + + + + + + + Process the input document using the XInclude specification. More + details on this can be found in the XInclude + specification: + + + + + + + + + ENVIRONMENT + + + + SGML_CATALOG_FILES + + SGML catalog behavior can be changed by redirecting + queries to the user's own set of catalogs. This can be done by setting + the SGML_CATALOG_FILES environment variable to a list + of catalogs. An empty one should deactivate loading the + default /etc/sgml/catalog catalog. + + + + + + XML_CATALOG_FILES + + XML catalog behavior can be changed by redirecting + queries to the user's own set of catalogs. This can be done by setting + the XML_CATALOG_FILES environment variable to a list + of catalogs. An empty one should deactivate loading the + default /etc/xml/catalog catalog. + + + + + + + + + DIAGNOSTICS + + &xsltproc; return codes provide information that can be used when + calling it from scripts. + + + + + 0 + + No error (normal operation) + + + + + 1 + + No argument + + + + + 2 + + Too many parameters + + + + + 3 + + Unknown option + + + + + 4 + + Failed to parse the stylesheet + + + + + 5 + + Error in the stylesheet + + + + + 6 + + Error in one of the documents + + + + + 7 + + Unsupported xsl:output method + + + + + 8 + + String parameter contains both quote and double-quotes + + + + + 9 + + Internal processing error + + + + + 10 + + Processing was stopped by a terminating message + + + + + 11 + + Could not write the result to the output file + + + + + + + + SEE ALSO + + libxml + 3 + , + libxslt + 3 + + + + More information can be found at + + + + libxml + 3 + web page + + + + W3C XSLT page + + + + + + +
    diff --git a/doc/xsltproc2.html b/doc/xsltproc2.html new file mode 100644 index 0000000..e24e456 --- /dev/null +++ b/doc/xsltproc2.html @@ -0,0 +1,35 @@ + + +The xsltproc tool
    Action against software patentsGNOME2 LogoW3C logoRed Hat Logo
    Made with Libxslt Logo

    The XSLT C library for GNOME

    The xsltproc tool

    Main Menu
    Related links
    API Indexes

    This program is the simplest way to use libxslt: from the command line. It +is also used for doing the regression tests of the library.

    It takes as first argument the path or URL to an XSLT stylesheet, the next +arguments are filenames or URIs of the inputs to be processed. The output of +the processing is redirected on the standard output. There is actually a few +more options available:

    orchis:~ -> xsltproc
    +Usage: xsltproc [options] stylesheet file [file ...]
    +   Options:
    +      --version or -V: show the version of libxml and libxslt used
    +      --verbose or -v: show logs of what's happening
    +      --output file or -o file: save to a given file
    +      --timing: display the time used
    +      --repeat: run the transformation 20 times
    +      --debug: dump the tree of the result instead
    +      --novalid: skip the DTD loading phase
    +      --noout: do not dump the result
    +      --maxdepth val : increase the maximum depth
    +      --html: the input document is(are) an HTML file(s)
    +      --docbook: the input document is SGML docbook
    +      --param name value : pass a (parameter,value) pair
    +      --nonet refuse to fetch DTDs or entities over network
    +      --warnnet warn against fetching over the network
    +      --catalogs : use the catalogs from $SGML_CATALOG_FILES
    +      --xinclude : do XInclude processing on document input
    +      --profile or --norman : dump profiling information 
    +orchis:~ ->

    Daniel Veillard

    diff --git a/examples/xsltICUSort.c b/examples/xsltICUSort.c new file mode 100644 index 0000000..6f76121 --- /dev/null +++ b/examples/xsltICUSort.c @@ -0,0 +1,304 @@ +/** + * xsltICUSort.c: module provided by Richard Jinks to provide a + * sort function replacement using ICU, it is not + * included in standard due to the size of the ICU + * library + * + * See http://mail.gnome.org/archives/xslt/2002-November/msg00093.html + * http://oss.software.ibm.com/icu/index.html + * + * Copyright Richard Jinks + */ +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "transform.h" +#include "templates.h" + +#include +#include +#include +#include +#include + +/** + * xsltICUSortFunction: + * @ctxt: a XSLT process context + * @sorts: array of sort nodes + * @nbsorts: the number of sorts in the array + * + * reorder the current node list accordingly to the set of sorting + * requirement provided by the arry of nodes. + * uses the ICU library + */ +void +xsltICUSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, + int nbsorts) { + xmlXPathObjectPtr *resultsTab[XSLT_MAX_SORT]; + xmlXPathObjectPtr *results = NULL, *res; + xmlNodeSetPtr list = NULL; + int descending, number, desc, numb; + int len = 0; + int i, j, incr; + int tst; + int depth; + xmlNodePtr node; + xmlXPathObjectPtr tmp; + xsltStylePreCompPtr comp; + int tempstype[XSLT_MAX_SORT], temporder[XSLT_MAX_SORT]; + + /* Start ICU change */ + UCollator *coll = 0; + UConverter *conv; + UErrorCode status; + UChar *target,*target2; + int targetlen, target2len; + /* End ICU change */ + + if ((ctxt == NULL) || (sorts == NULL) || (nbsorts <= 0) || + (nbsorts >= XSLT_MAX_SORT)) + return; + if (sorts[0] == NULL) + return; + comp = sorts[0]->_private; + if (comp == NULL) + return; + + list = ctxt->nodeList; + if ((list == NULL) || (list->nodeNr <= 1)) + return; /* nothing to do */ + + for (j = 0; j < nbsorts; j++) { + comp = sorts[j]->_private; + tempstype[j] = 0; + if ((comp->stype == NULL) && (comp->has_stype != 0)) { + comp->stype = + xsltEvalAttrValueTemplate(ctxt, sorts[j], + (const xmlChar *) "data-type", + XSLT_NAMESPACE); + if (comp->stype != NULL) { + tempstype[j] = 1; + if (xmlStrEqual(comp->stype, (const xmlChar *) "text")) + comp->number = 0; + else if (xmlStrEqual(comp->stype, (const xmlChar *) "number")) + comp->number = 1; + else { + xsltTransformError(ctxt, NULL, sorts[j], + "xsltDoSortFunction: no support for data-type = %s\n", + comp->stype); + comp->number = 0; /* use default */ + } + } + } + temporder[j] = 0; + if ((comp->order == NULL) && (comp->has_order != 0)) { + comp->order = xsltEvalAttrValueTemplate(ctxt, sorts[j], + (const xmlChar *) "order", + XSLT_NAMESPACE); + if (comp->order != NULL) { + temporder[j] = 1; + if (xmlStrEqual(comp->order, (const xmlChar *) "ascending")) + comp->descending = 0; + else if (xmlStrEqual(comp->order, + (const xmlChar *) "descending")) + comp->descending = 1; + else { + xsltTransformError(ctxt, NULL, sorts[j], + "xsltDoSortFunction: invalid value %s for order\n", + comp->order); + comp->descending = 0; /* use default */ + } + } + } + } + + len = list->nodeNr; + + resultsTab[0] = xsltComputeSortResult(ctxt, sorts[0]); + for (i = 1;i < XSLT_MAX_SORT;i++) + resultsTab[i] = NULL; + + results = resultsTab[0]; + + comp = sorts[0]->_private; + descending = comp->descending; + number = comp->number; + if (results == NULL) + return; + + /* Start ICU change */ + status = U_ZERO_ERROR; + conv = ucnv_open("UTF8", &status); + if(U_FAILURE(status)) { + xsltTransformError(ctxt, NULL, NULL, "xsltICUSortFunction: Error opening converter\n"); + } + if(comp->has_lang) + coll = ucol_open(comp->lang, &status); + if(U_FAILURE(status) || !comp->has_lang) { + status = U_ZERO_ERROR; + coll = ucol_open("en", &status); + } + if(U_FAILURE(status)) { + xsltTransformError(ctxt, NULL, NULL, "xsltICUSortFunction: Error opening collator\n"); + } + if(comp->lower_first) + ucol_setAttribute(coll,UCOL_CASE_FIRST,UCOL_LOWER_FIRST,&status); + else + ucol_setAttribute(coll,UCOL_CASE_FIRST,UCOL_UPPER_FIRST,&status); + if(U_FAILURE(status)) { + xsltTransformError(ctxt, NULL, NULL, "xsltICUSortFunction: Error setting collator attribute\n"); + } + /* End ICU change */ + + /* Shell's sort of node-set */ + for (incr = len / 2; incr > 0; incr /= 2) { + for (i = incr; i < len; i++) { + j = i - incr; + if (results[i] == NULL) + continue; + + while (j >= 0) { + if (results[j] == NULL) + tst = 1; + else { + if (number) { + if (results[j]->floatval == results[j + incr]->floatval) + tst = 0; + else if (results[j]->floatval > + results[j + incr]->floatval) + tst = 1; + else tst = -1; + } else { +/* tst = xmlStrcmp(results[j]->stringval, + results[j + incr]->stringval); */ + /* Start ICU change */ + targetlen = xmlStrlen(results[j]->stringval) * 2; + target2len = xmlStrlen(results[j + incr]->stringval) * 2; + target = xmlMalloc(targetlen * sizeof(UChar)); + target2 = xmlMalloc(target2len * sizeof(UChar)); + targetlen = ucnv_toUChars(conv, target, targetlen, results[j]->stringval, -1, &status); + target2len = ucnv_toUChars(conv, target2, target2len, results[j+incr]->stringval, -1, &status); + tst = ucol_strcoll(coll, target, u_strlen(target), target2, u_strlen(target2)); + /* End ICU change */ + } + if (descending) + tst = -tst; + } + if (tst == 0) { + /* + * Okay we need to use multi level sorts + */ + depth = 1; + while (depth < nbsorts) { + if (sorts[depth] == NULL) + break; + comp = sorts[depth]->_private; + if (comp == NULL) + break; + desc = comp->descending; + numb = comp->number; + + /* + * Compute the result of the next level for the + * full set, this might be optimized ... or not + */ + if (resultsTab[depth] == NULL) + resultsTab[depth] = xsltComputeSortResult(ctxt, + sorts[depth]); + res = resultsTab[depth]; + if (res == NULL) + break; + if (res[j] == NULL) + tst = 1; + else { + if (numb) { + if (res[j]->floatval == res[j + incr]->floatval) + tst = 0; + else if (res[j]->floatval > + res[j + incr]->floatval) + tst = 1; + else tst = -1; + } else { +/* tst = xmlStrcmp(res[j]->stringval, + res[j + incr]->stringval); */ + /* Start ICU change */ + targetlen = xmlStrlen(res[j]->stringval) * 2; + target2len = xmlStrlen(res[j + incr]->stringval) * 2; + target = xmlMalloc(targetlen * sizeof(UChar)); + target2 = xmlMalloc(target2len * sizeof(UChar)); + targetlen = ucnv_toUChars(conv, target, targetlen, res[j]->stringval, -1, &status); + target2len = ucnv_toUChars(conv, target2, target2len, res[j+incr]->stringval, -1, &status); + tst = ucol_strcoll(coll, target, u_strlen(target), target2, u_strlen(target2)); + /* End ICU change */ + } + if (desc) + tst = -tst; + } + /* + * if we still can't differenciate at this level + * try one level deeper. + */ + if (tst != 0) + break; + depth++; + } + } + if (tst == 0) { + tst = results[j]->index > results[j + incr]->index; + } + if (tst > 0) { + tmp = results[j]; + results[j] = results[j + incr]; + results[j + incr] = tmp; + node = list->nodeTab[j]; + list->nodeTab[j] = list->nodeTab[j + incr]; + list->nodeTab[j + incr] = node; + depth = 1; + while (depth < nbsorts) { + if (sorts[depth] == NULL) + break; + if (resultsTab[depth] == NULL) + break; + res = resultsTab[depth]; + tmp = res[j]; + res[j] = res[j + incr]; + res[j + incr] = tmp; + depth++; + } + j -= incr; + } else + break; + } + } + } + + /* Start ICU change */ + ucol_close(coll); + ucnv_close(conv); + /* End ICU change */ + + for (j = 0; j < nbsorts; j++) { + comp = sorts[j]->_private; + if (tempstype[j] == 1) { + /* The data-type needs to be recomputed each time */ + xmlFree(comp->stype); + comp->stype = NULL; + } + if (temporder[j] == 1) { + /* The order needs to be recomputed each time */ + xmlFree(comp->order); + comp->order = NULL; + } + if (resultsTab[j] != NULL) { + for (i = 0;i < len;i++) + xmlXPathFreeObject(resultsTab[j][i]); + xmlFree(resultsTab[j]); + } + } +} + diff --git a/libexslt.pc.in b/libexslt.pc.in new file mode 100644 index 0000000..16676ff --- /dev/null +++ b/libexslt.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + + +Name: libexslt +Version: @LIBEXSLT_VERSION@ +Description: EXSLT Extension library +Requires: libxml-2.0 +Libs: @EXSLT_LIBDIR@ @EXSLT_LIBS@ +Cflags: @EXSLT_INCLUDEDIR@ diff --git a/libexslt/Makefile.am b/libexslt/Makefile.am new file mode 100644 index 0000000..1cf5138 --- /dev/null +++ b/libexslt/Makefile.am @@ -0,0 +1,35 @@ +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/libxslt -I$(top_srcdir)/libexslt \ + -I$(top_builddir) -I$(top_builddir)/libxslt \ + -I$(top_builddir)/libexslt + +AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(LIBXML_CFLAGS) + +lib_LTLIBRARIES = libexslt.la + +exsltincdir = $(includedir)/libexslt + +exsltinc_HEADERS = \ + exslt.h \ + exsltexports.h +nodist_exsltinc_HEADERS = \ + exsltconfig.h + +libexslt_la_SOURCES = \ + exslt.c \ + common.c \ + crypto.c \ + math.c \ + sets.c \ + functions.c \ + strings.c \ + date.c \ + saxon.c \ + libexslt.h \ + dynamic.c + +libexslt_la_LIBADD = $(top_builddir)/libxslt/libxslt.la $(EXTRA_LIBS) $(LIBGCRYPT_LIBS) +libexslt_la_LDFLAGS = $(WIN32_EXTRA_LDFLAGS) -version-info $(LIBEXSLT_VERSION_INFO) + +man_MANS = libexslt.3 + +EXTRA_DIST = $(man_MANS) diff --git a/libexslt/common.c b/libexslt/common.c new file mode 100644 index 0000000..451a60d --- /dev/null +++ b/libexslt/common.c @@ -0,0 +1,137 @@ +#define IN_LIBEXSLT +#include "libexslt/libexslt.h" + +#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__) +#include +#else +#include "config.h" +#endif + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "exslt.h" + +static void +exsltNodeSetFunction (xmlXPathParserContextPtr ctxt, int nargs) { + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + if (xmlXPathStackIsNodeSet (ctxt)) { + xsltFunctionNodeSet (ctxt, nargs); + return; + } else { + xmlDocPtr fragment; + xsltTransformContextPtr tctxt = xsltXPathGetTransformContext(ctxt); + xmlNodePtr txt; + xmlChar *strval; + xmlXPathObjectPtr obj; + /* + * SPEC EXSLT: + * "You can also use this function to turn a string into a text + * node, which is helpful if you want to pass a string to a + * function that only accepts a node-set." + */ + fragment = xsltCreateRVT(tctxt); + if (fragment == NULL) { + xsltTransformError(tctxt, NULL, tctxt->inst, + "exsltNodeSetFunction: Failed to create a tree fragment.\n"); + tctxt->state = XSLT_STATE_STOPPED; + return; + } + xsltRegisterLocalRVT(tctxt, fragment); + + strval = xmlXPathPopString (ctxt); + + txt = xmlNewDocText (fragment, strval); + xmlAddChild((xmlNodePtr) fragment, txt); + obj = xmlXPathNewNodeSet(txt); + if (obj == NULL) { + xsltTransformError(tctxt, NULL, tctxt->inst, + "exsltNodeSetFunction: Failed to create a node set object.\n"); + tctxt->state = XSLT_STATE_STOPPED; + } else { + /* + * Mark it as a function result in order to avoid garbage + * collecting of tree fragments + */ + xsltExtensionInstructionResultRegister(tctxt, obj); + } + if (strval != NULL) + xmlFree (strval); + + valuePush (ctxt, obj); + } +} + +static void +exsltObjectTypeFunction (xmlXPathParserContextPtr ctxt, int nargs) { + xmlXPathObjectPtr obj, ret; + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + + obj = valuePop(ctxt); + + switch (obj->type) { + case XPATH_STRING: + ret = xmlXPathNewCString("string"); + break; + case XPATH_NUMBER: + ret = xmlXPathNewCString("number"); + break; + case XPATH_BOOLEAN: + ret = xmlXPathNewCString("boolean"); + break; + case XPATH_NODESET: + ret = xmlXPathNewCString("node-set"); + break; + case XPATH_XSLT_TREE: + ret = xmlXPathNewCString("RTF"); + break; + case XPATH_USERS: + ret = xmlXPathNewCString("external"); + break; + default: + xsltGenericError(xsltGenericErrorContext, + "object-type() invalid arg\n"); + ctxt->error = XPATH_INVALID_TYPE; + xmlXPathFreeObject(obj); + return; + } + xmlXPathFreeObject(obj); + valuePush(ctxt, ret); +} + + +/** + * exsltCommonRegister: + * + * Registers the EXSLT - Common module + */ + +void +exsltCommonRegister (void) { + xsltRegisterExtModuleFunction((const xmlChar *) "node-set", + EXSLT_COMMON_NAMESPACE, + exsltNodeSetFunction); + xsltRegisterExtModuleFunction((const xmlChar *) "object-type", + EXSLT_COMMON_NAMESPACE, + exsltObjectTypeFunction); + xsltRegisterExtModuleElement((const xmlChar *) "document", + EXSLT_COMMON_NAMESPACE, + (xsltPreComputeFunction) xsltDocumentComp, + (xsltTransformFunction) xsltDocumentElem); +} diff --git a/libexslt/crypto.c b/libexslt/crypto.c new file mode 100644 index 0000000..e13db8b --- /dev/null +++ b/libexslt/crypto.c @@ -0,0 +1,806 @@ +#define IN_LIBEXSLT +#include "libexslt/libexslt.h" + +#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__) +#include +#else +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "exslt.h" + +#ifdef EXSLT_CRYPTO_ENABLED + +#define HASH_DIGEST_LENGTH 32 +#define MD5_DIGEST_LENGTH 16 +#define SHA1_DIGEST_LENGTH 20 + +/* gcrypt rc4 can do 256 bit keys, but cryptoapi limit + seems to be 128 for the default provider */ +#define RC4_KEY_LENGTH 128 + +/* The following routines have been declared static - this should be + reviewed to consider whether we want to expose them to the API + exsltCryptoBin2Hex + exsltCryptoHex2Bin + exsltCryptoGcryptInit + exsltCryptoGcryptHash + exsltCryptoGcryptRc4Encrypt + exsltCryptoGcryptRC4Decrypt +*/ + +/** + * exsltCryptoBin2Hex: + * @bin: binary blob to convert + * @binlen: length of binary blob + * @hex: buffer to store hex version of blob + * @hexlen: length of buffer to store hex version of blob + * + * Helper function which encodes a binary blob as hex. + */ +static void +exsltCryptoBin2Hex (const unsigned char *bin, int binlen, + unsigned char *hex, int hexlen) { + static const char bin2hex[] = { '0', '1', '2', '3', + '4', '5', '6', '7', + '8', '9', 'a', 'b', + 'c', 'd', 'e', 'f' + }; + + unsigned char lo, hi; + int i, pos; + for (i = 0, pos = 0; (i < binlen && pos < hexlen); i++) { + lo = bin[i] & 0xf; + hi = bin[i] >> 4; + hex[pos++] = bin2hex[hi]; + hex[pos++] = bin2hex[lo]; + } + + hex[pos] = '\0'; +} + +/** + * exsltCryptoHex2Bin: + * @hex: hex version of blob to convert + * @hexlen: length of hex buffer + * @bin: destination binary buffer + * @binlen: length of binary buffer + * + * Helper function which decodes a hex blob to binary + */ +static int +exsltCryptoHex2Bin (const unsigned char *hex, int hexlen, + unsigned char *bin, int binlen) { + int i = 0, j = 0; + unsigned char lo, hi, result, tmp; + + while (i < hexlen && j < binlen) { + hi = lo = 0; + + tmp = hex[i++]; + if (tmp >= '0' && tmp <= '9') + hi = tmp - '0'; + else if (tmp >= 'a' && tmp <= 'f') + hi = 10 + (tmp - 'a'); + + tmp = hex[i++]; + if (tmp >= '0' && tmp <= '9') + lo = tmp - '0'; + else if (tmp >= 'a' && tmp <= 'f') + lo = 10 + (tmp - 'a'); + + result = hi << 4; + result += lo; + bin[j++] = result; + } + + return j; +} + +#if defined(WIN32) + +#define HAVE_CRYPTO +#define PLATFORM_HASH exsltCryptoCryptoApiHash +#define PLATFORM_RC4_ENCRYPT exsltCryptoCryptoApiRc4Encrypt +#define PLATFORM_RC4_DECRYPT exsltCryptoCryptoApiRc4Decrypt +#define PLATFORM_MD4 CALG_MD4 +#define PLATFORM_MD5 CALG_MD5 +#define PLATFORM_SHA1 CALG_SHA1 + +#include +#include +#pragma comment(lib, "advapi32.lib") + +static void +exsltCryptoCryptoApiReportError (xmlXPathParserContextPtr ctxt, + int line) { + LPVOID lpMsgBuf; + DWORD dw = GetLastError (); + + FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM, NULL, dw, + MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) & lpMsgBuf, 0, NULL); + + xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL, NULL, + "exslt:crypto error (line %d). %s", line, + lpMsgBuf); + LocalFree (lpMsgBuf); +} + +static HCRYPTHASH +exsltCryptoCryptoApiCreateHash (xmlXPathParserContextPtr ctxt, + HCRYPTPROV hCryptProv, ALG_ID algorithm, + const char *msg, unsigned int msglen, + char *dest, unsigned int destlen) +{ + HCRYPTHASH hHash = 0; + DWORD dwHashLen = destlen; + + if (!CryptCreateHash (hCryptProv, algorithm, 0, 0, &hHash)) { + exsltCryptoCryptoApiReportError (ctxt, __LINE__); + return 0; + } + + if (!CryptHashData (hHash, (const BYTE *) msg, msglen, 0)) { + exsltCryptoCryptoApiReportError (ctxt, __LINE__); + goto fail; + } + + if (!CryptGetHashParam (hHash, HP_HASHVAL, dest, &dwHashLen, 0)) { + exsltCryptoCryptoApiReportError (ctxt, __LINE__); + goto fail; + } + + fail: + return hHash; +} + +/** + * exsltCryptoCryptoApiHash: + * @ctxt: an XPath parser context + * @algorithm: hashing algorithm to use + * @msg: text to be hashed + * @msglen: length of text to be hashed + * @dest: buffer to place hash result + * + * Helper function which hashes a message using MD4, MD5, or SHA1. + * Uses Win32 CryptoAPI. + */ +static void +exsltCryptoCryptoApiHash (xmlXPathParserContextPtr ctxt, + ALG_ID algorithm, const char *msg, + unsigned long msglen, + char dest[HASH_DIGEST_LENGTH]) { + HCRYPTPROV hCryptProv; + HCRYPTHASH hHash; + + if (!CryptAcquireContext (&hCryptProv, NULL, NULL, PROV_RSA_FULL, + CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) { + exsltCryptoCryptoApiReportError (ctxt, __LINE__); + return; + } + + hHash = exsltCryptoCryptoApiCreateHash (ctxt, hCryptProv, + algorithm, msg, msglen, + dest, HASH_DIGEST_LENGTH); + if (0 != hHash) { + CryptDestroyHash (hHash); + } + + CryptReleaseContext (hCryptProv, 0); +} + +static void +exsltCryptoCryptoApiRc4Encrypt (xmlXPathParserContextPtr ctxt, + const unsigned char *key, + const unsigned char *msg, int msglen, + unsigned char *dest, int destlen) { + HCRYPTPROV hCryptProv; + HCRYPTKEY hKey; + HCRYPTHASH hHash; + DWORD dwDataLen; + unsigned char hash[HASH_DIGEST_LENGTH]; + + if (msglen > destlen) { + xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL, + NULL, + "exslt:crypto : internal error exsltCryptoCryptoApiRc4Encrypt dest buffer too small.\n"); + return; + } + + if (!CryptAcquireContext (&hCryptProv, NULL, NULL, PROV_RSA_FULL, + CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) { + exsltCryptoCryptoApiReportError (ctxt, __LINE__); + return; + } + + hHash = exsltCryptoCryptoApiCreateHash (ctxt, hCryptProv, + CALG_SHA1, key, + RC4_KEY_LENGTH, hash, + HASH_DIGEST_LENGTH); + + if (!CryptDeriveKey + (hCryptProv, CALG_RC4, hHash, 0x00800000, &hKey)) { + exsltCryptoCryptoApiReportError (ctxt, __LINE__); + goto fail; + } +/* Now encrypt data. */ + dwDataLen = msglen; + memcpy (dest, msg, msglen); + if (!CryptEncrypt (hKey, 0, TRUE, 0, dest, &dwDataLen, msglen)) { + exsltCryptoCryptoApiReportError (ctxt, __LINE__); + goto fail; + } + + fail: + if (0 != hHash) { + CryptDestroyHash (hHash); + } + + CryptDestroyKey (hKey); + CryptReleaseContext (hCryptProv, 0); +} + +static void +exsltCryptoCryptoApiRc4Decrypt (xmlXPathParserContextPtr ctxt, + const unsigned char *key, + const unsigned char *msg, int msglen, + unsigned char *dest, int destlen) { + HCRYPTPROV hCryptProv; + HCRYPTKEY hKey; + HCRYPTHASH hHash; + DWORD dwDataLen; + unsigned char hash[HASH_DIGEST_LENGTH]; + + if (msglen > destlen) { + xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL, + NULL, + "exslt:crypto : internal error exsltCryptoCryptoApiRc4Encrypt dest buffer too small.\n"); + return; + } + + if (!CryptAcquireContext (&hCryptProv, NULL, NULL, PROV_RSA_FULL, + CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) { + exsltCryptoCryptoApiReportError (ctxt, __LINE__); + return; + } + + hHash = exsltCryptoCryptoApiCreateHash (ctxt, hCryptProv, + CALG_SHA1, key, + RC4_KEY_LENGTH, hash, + HASH_DIGEST_LENGTH); + + if (!CryptDeriveKey + (hCryptProv, CALG_RC4, hHash, 0x00800000, &hKey)) { + exsltCryptoCryptoApiReportError (ctxt, __LINE__); + goto fail; + } +/* Now encrypt data. */ + dwDataLen = msglen; + memcpy (dest, msg, msglen); + if (!CryptDecrypt (hKey, 0, TRUE, 0, dest, &dwDataLen)) { + exsltCryptoCryptoApiReportError (ctxt, __LINE__); + goto fail; + } + + fail: + if (0 != hHash) { + CryptDestroyHash (hHash); + } + + CryptDestroyKey (hKey); + CryptReleaseContext (hCryptProv, 0); +} + +#endif /* defined(WIN32) */ + +#if defined(HAVE_GCRYPT) + +#define HAVE_CRYPTO +#define PLATFORM_HASH exsltCryptoGcryptHash +#define PLATFORM_RC4_ENCRYPT exsltCryptoGcryptRc4Encrypt +#define PLATFORM_RC4_DECRYPT exsltCryptoGcryptRc4Decrypt +#define PLATFORM_MD4 GCRY_MD_MD4 +#define PLATFORM_MD5 GCRY_MD_MD5 +#define PLATFORM_SHA1 GCRY_MD_SHA1 + +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif + +#ifdef HAVE_SYS_SELECT_H +#include /* needed by gcrypt.h 4 Jul 04 */ +#endif +#include + +static void +exsltCryptoGcryptInit (void) { + static int gcrypt_init; + xmlLockLibrary (); + + if (!gcrypt_init) { +/* The function `gcry_check_version' must be called before any other + function in the library, because it initializes the thread support + subsystem in Libgcrypt. To achieve this in all generality, it is + necessary to synchronize the call to this function with all other calls + to functions in the library, using the synchronization mechanisms + available in your thread library. (from gcrypt.info) +*/ + gcry_check_version (GCRYPT_VERSION); + gcrypt_init = 1; + } + + xmlUnlockLibrary (); +} + +/** + * exsltCryptoGcryptHash: + * @ctxt: an XPath parser context + * @algorithm: hashing algorithm to use + * @msg: text to be hashed + * @msglen: length of text to be hashed + * @dest: buffer to place hash result + * + * Helper function which hashes a message using MD4, MD5, or SHA1. + * using gcrypt + */ +static void +exsltCryptoGcryptHash (xmlXPathParserContextPtr ctxt ATTRIBUTE_UNUSED, +/* changed the enum to int */ + int algorithm, const char *msg, + unsigned long msglen, + char dest[HASH_DIGEST_LENGTH]) { + exsltCryptoGcryptInit (); + gcry_md_hash_buffer (algorithm, dest, msg, msglen); +} + +static void +exsltCryptoGcryptRc4Encrypt (xmlXPathParserContextPtr ctxt, + const unsigned char *key, + const unsigned char *msg, int msglen, + unsigned char *dest, int destlen) { + gcry_cipher_hd_t cipher; + gcry_error_t rc = 0; + + exsltCryptoGcryptInit (); + + rc = gcry_cipher_open (&cipher, GCRY_CIPHER_ARCFOUR, + GCRY_CIPHER_MODE_STREAM, 0); + if (rc) { + xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL, + NULL, + "exslt:crypto internal error %s (gcry_cipher_open)\n", + gcry_strerror (rc)); + } + + rc = gcry_cipher_setkey (cipher, key, RC4_KEY_LENGTH); + if (rc) { + xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL, + NULL, + "exslt:crypto internal error %s (gcry_cipher_setkey)\n", + gcry_strerror (rc)); + } + + rc = gcry_cipher_encrypt (cipher, (unsigned char *) dest, destlen, + (const unsigned char *) msg, msglen); + if (rc) { + xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL, + NULL, + "exslt:crypto internal error %s (gcry_cipher_encrypt)\n", + gcry_strerror (rc)); + } + + gcry_cipher_close (cipher); +} + +static void +exsltCryptoGcryptRc4Decrypt (xmlXPathParserContextPtr ctxt, + const unsigned char *key, + const unsigned char *msg, int msglen, + unsigned char *dest, int destlen) { + gcry_cipher_hd_t cipher; + gcry_error_t rc = 0; + + exsltCryptoGcryptInit (); + + rc = gcry_cipher_open (&cipher, GCRY_CIPHER_ARCFOUR, + GCRY_CIPHER_MODE_STREAM, 0); + if (rc) { + xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL, + NULL, + "exslt:crypto internal error %s (gcry_cipher_open)\n", + gcry_strerror (rc)); + } + + rc = gcry_cipher_setkey (cipher, key, RC4_KEY_LENGTH); + if (rc) { + xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL, + NULL, + "exslt:crypto internal error %s (gcry_cipher_setkey)\n", + gcry_strerror (rc)); + } + + rc = gcry_cipher_decrypt (cipher, (unsigned char *) dest, destlen, + (const unsigned char *) msg, msglen); + if (rc) { + xsltTransformError (xsltXPathGetTransformContext (ctxt), NULL, + NULL, + "exslt:crypto internal error %s (gcry_cipher_decrypt)\n", + gcry_strerror (rc)); + } + + gcry_cipher_close (cipher); +} + +#endif /* defined(HAVE_GCRYPT) */ + +#if defined(HAVE_CRYPTO) + +/** + * exsltCryptoPopString: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Helper function which checks for and returns first string argument and its + * length in bytes. + */ +static int +exsltCryptoPopString (xmlXPathParserContextPtr ctxt, int nargs, + xmlChar ** str) { + + int str_len = 0; + + if ((nargs < 1) || (nargs > 2)) { + xmlXPathSetArityError (ctxt); + return 0; + } + + *str = xmlXPathPopString (ctxt); + str_len = xmlStrlen (*str); + + if (str_len == 0) { + xmlXPathReturnEmptyString (ctxt); + xmlFree (*str); + return 0; + } + + return str_len; +} + +/** + * exsltCryptoMd4Function: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * computes the md4 hash of a string and returns as hex + */ +static void +exsltCryptoMd4Function (xmlXPathParserContextPtr ctxt, int nargs) { + + int str_len = 0; + xmlChar *str = NULL, *ret = NULL; + unsigned char hash[HASH_DIGEST_LENGTH]; + unsigned char hex[MD5_DIGEST_LENGTH * 2 + 1]; + + str_len = exsltCryptoPopString (ctxt, nargs, &str); + if (str_len == 0) + return; + + PLATFORM_HASH (ctxt, PLATFORM_MD4, (const char *) str, str_len, + (char *) hash); + exsltCryptoBin2Hex (hash, sizeof (hash) - 1, hex, sizeof (hex) - 1); + + ret = xmlStrdup ((xmlChar *) hex); + xmlXPathReturnString (ctxt, ret); + + if (str != NULL) + xmlFree (str); +} + +/** + * exsltCryptoMd5Function: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * computes the md5 hash of a string and returns as hex + */ +static void +exsltCryptoMd5Function (xmlXPathParserContextPtr ctxt, int nargs) { + + int str_len = 0; + xmlChar *str = NULL, *ret = NULL; + unsigned char hash[HASH_DIGEST_LENGTH]; + unsigned char hex[MD5_DIGEST_LENGTH * 2 + 1]; + + str_len = exsltCryptoPopString (ctxt, nargs, &str); + if (str_len == 0) + return; + + PLATFORM_HASH (ctxt, PLATFORM_MD5, (const char *) str, str_len, + (char *) hash); + exsltCryptoBin2Hex (hash, sizeof (hash) - 1, hex, sizeof (hex) - 1); + + ret = xmlStrdup ((xmlChar *) hex); + xmlXPathReturnString (ctxt, ret); + + if (str != NULL) + xmlFree (str); +} + +/** + * exsltCryptoSha1Function: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * computes the sha1 hash of a string and returns as hex + */ +static void +exsltCryptoSha1Function (xmlXPathParserContextPtr ctxt, int nargs) { + + int str_len = 0; + xmlChar *str = NULL, *ret = NULL; + unsigned char hash[HASH_DIGEST_LENGTH]; + unsigned char hex[SHA1_DIGEST_LENGTH * 2 + 1]; + + str_len = exsltCryptoPopString (ctxt, nargs, &str); + if (str_len == 0) + return; + + PLATFORM_HASH (ctxt, PLATFORM_SHA1, (const char *) str, str_len, + (char *) hash); + exsltCryptoBin2Hex (hash, sizeof (hash) - 1, hex, sizeof (hex) - 1); + + ret = xmlStrdup ((xmlChar *) hex); + xmlXPathReturnString (ctxt, ret); + + if (str != NULL) + xmlFree (str); +} + +/** + * exsltCryptoRc4EncryptFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * computes the sha1 hash of a string and returns as hex + */ +static void +exsltCryptoRc4EncryptFunction (xmlXPathParserContextPtr ctxt, int nargs) { + + int key_len = 0; + int str_len = 0, bin_len = 0, hex_len = 0; + xmlChar *key = NULL, *str = NULL, *padkey = NULL; + xmlChar *bin = NULL, *hex = NULL; + xsltTransformContextPtr tctxt = NULL; + + if (nargs != 2) { + xmlXPathSetArityError (ctxt); + return; + } + tctxt = xsltXPathGetTransformContext(ctxt); + + str = xmlXPathPopString (ctxt); + str_len = xmlStrlen (str); + + if (str_len == 0) { + xmlXPathReturnEmptyString (ctxt); + xmlFree (str); + return; + } + + key = xmlXPathPopString (ctxt); + key_len = xmlStrlen (key); + + if (key_len == 0) { + xmlXPathReturnEmptyString (ctxt); + xmlFree (key); + xmlFree (str); + return; + } + + padkey = xmlMallocAtomic (RC4_KEY_LENGTH + 1); + if (padkey == NULL) { + xsltTransformError(tctxt, NULL, tctxt->inst, + "exsltCryptoRc4EncryptFunction: Failed to allocate padkey\n"); + tctxt->state = XSLT_STATE_STOPPED; + xmlXPathReturnEmptyString (ctxt); + goto done; + } + memset(padkey, 0, RC4_KEY_LENGTH + 1); + + if ((key_len > RC4_KEY_LENGTH) || (key_len < 0)) { + xsltTransformError(tctxt, NULL, tctxt->inst, + "exsltCryptoRc4EncryptFunction: key size too long or key broken\n"); + tctxt->state = XSLT_STATE_STOPPED; + xmlXPathReturnEmptyString (ctxt); + goto done; + } + memcpy (padkey, key, key_len); + +/* encrypt it */ + bin_len = str_len; + bin = xmlStrdup (str); + if (bin == NULL) { + xsltTransformError(tctxt, NULL, tctxt->inst, + "exsltCryptoRc4EncryptFunction: Failed to allocate string\n"); + tctxt->state = XSLT_STATE_STOPPED; + xmlXPathReturnEmptyString (ctxt); + goto done; + } + PLATFORM_RC4_ENCRYPT (ctxt, padkey, str, str_len, bin, bin_len); + +/* encode it */ + hex_len = str_len * 2 + 1; + hex = xmlMallocAtomic (hex_len); + if (hex == NULL) { + xsltTransformError(tctxt, NULL, tctxt->inst, + "exsltCryptoRc4EncryptFunction: Failed to allocate result\n"); + tctxt->state = XSLT_STATE_STOPPED; + xmlXPathReturnEmptyString (ctxt); + goto done; + } + + exsltCryptoBin2Hex (bin, str_len, hex, hex_len); + xmlXPathReturnString (ctxt, hex); + +done: + if (key != NULL) + xmlFree (key); + if (str != NULL) + xmlFree (str); + if (padkey != NULL) + xmlFree (padkey); + if (bin != NULL) + xmlFree (bin); +} + +/** + * exsltCryptoRc4DecryptFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * computes the sha1 hash of a string and returns as hex + */ +static void +exsltCryptoRc4DecryptFunction (xmlXPathParserContextPtr ctxt, int nargs) { + + int key_len = 0; + int str_len = 0, bin_len = 0, ret_len = 0; + xmlChar *key = NULL, *str = NULL, *padkey = NULL, *bin = + NULL, *ret = NULL; + xsltTransformContextPtr tctxt = NULL; + + if (nargs != 2) { + xmlXPathSetArityError (ctxt); + return; + } + tctxt = xsltXPathGetTransformContext(ctxt); + + str = xmlXPathPopString (ctxt); + str_len = xmlStrlen (str); + + if (str_len == 0) { + xmlXPathReturnEmptyString (ctxt); + xmlFree (str); + return; + } + + key = xmlXPathPopString (ctxt); + key_len = xmlStrlen (key); + + if (key_len == 0) { + xmlXPathReturnEmptyString (ctxt); + xmlFree (key); + xmlFree (str); + return; + } + + padkey = xmlMallocAtomic (RC4_KEY_LENGTH + 1); + if (padkey == NULL) { + xsltTransformError(tctxt, NULL, tctxt->inst, + "exsltCryptoRc4EncryptFunction: Failed to allocate padkey\n"); + tctxt->state = XSLT_STATE_STOPPED; + xmlXPathReturnEmptyString (ctxt); + goto done; + } + memset(padkey, 0, RC4_KEY_LENGTH + 1); + if ((key_len > RC4_KEY_LENGTH) || (key_len < 0)) { + xsltTransformError(tctxt, NULL, tctxt->inst, + "exsltCryptoRc4EncryptFunction: key size too long or key broken\n"); + tctxt->state = XSLT_STATE_STOPPED; + xmlXPathReturnEmptyString (ctxt); + goto done; + } + memcpy (padkey, key, key_len); + +/* decode hex to binary */ + bin_len = str_len; + bin = xmlMallocAtomic (bin_len); + if (bin == NULL) { + xsltTransformError(tctxt, NULL, tctxt->inst, + "exsltCryptoRc4EncryptFunction: Failed to allocate string\n"); + tctxt->state = XSLT_STATE_STOPPED; + xmlXPathReturnEmptyString (ctxt); + goto done; + } + ret_len = exsltCryptoHex2Bin (str, str_len, bin, bin_len); + +/* decrypt the binary blob */ + ret = xmlMallocAtomic (ret_len + 1); + if (ret == NULL) { + xsltTransformError(tctxt, NULL, tctxt->inst, + "exsltCryptoRc4EncryptFunction: Failed to allocate result\n"); + tctxt->state = XSLT_STATE_STOPPED; + xmlXPathReturnEmptyString (ctxt); + goto done; + } + PLATFORM_RC4_DECRYPT (ctxt, padkey, bin, ret_len, ret, ret_len); + ret[ret_len] = 0; + + xmlXPathReturnString (ctxt, ret); + +done: + if (key != NULL) + xmlFree (key); + if (str != NULL) + xmlFree (str); + if (padkey != NULL) + xmlFree (padkey); + if (bin != NULL) + xmlFree (bin); +} + +/** + * exsltCryptoRegister: + * + * Registers the EXSLT - Crypto module + */ + +void +exsltCryptoRegister (void) { + xsltRegisterExtModuleFunction ((const xmlChar *) "md4", + EXSLT_CRYPTO_NAMESPACE, + exsltCryptoMd4Function); + xsltRegisterExtModuleFunction ((const xmlChar *) "md5", + EXSLT_CRYPTO_NAMESPACE, + exsltCryptoMd5Function); + xsltRegisterExtModuleFunction ((const xmlChar *) "sha1", + EXSLT_CRYPTO_NAMESPACE, + exsltCryptoSha1Function); + xsltRegisterExtModuleFunction ((const xmlChar *) "rc4_encrypt", + EXSLT_CRYPTO_NAMESPACE, + exsltCryptoRc4EncryptFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "rc4_decrypt", + EXSLT_CRYPTO_NAMESPACE, + exsltCryptoRc4DecryptFunction); +} + +#else +/** + * exsltCryptoRegister: + * + * Registers the EXSLT - Crypto module + */ +void +exsltCryptoRegister (void) { +} + +#endif /* defined(HAVE_CRYPTO) */ + +#endif /* EXSLT_CRYPTO_ENABLED */ diff --git a/libexslt/date.c b/libexslt/date.c new file mode 100644 index 0000000..3af6f7f --- /dev/null +++ b/libexslt/date.c @@ -0,0 +1,3911 @@ +/* + * date.c: Implementation of the EXSLT -- Dates and Times module + * + * References: + * http://www.exslt.org/date/date.html + * + * See Copyright for the status of this software. + * + * Authors: + * Charlie Bozeman + * Thomas Broyer + * + * TODO: + * elements: + * date-format + * functions: + * format-date + * parse-date + * sum + */ + +#define IN_LIBEXSLT +#include "libexslt/libexslt.h" + +#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__) +#include +#else +#include "config.h" +#endif + +#if defined(HAVE_LOCALTIME_R) && defined(__GLIBC__) /* _POSIX_SOURCE required by gnu libc */ +#ifndef _AIX51 /* but on AIX we're not using gnu libc */ +#define _POSIX_SOURCE +#endif +#endif + +#include +#include +#include + +#include +#include +#include +#include + +#include "exslt.h" + +#include + +#ifdef HAVE_ERRNO_H +#include +#endif +#ifdef HAVE_MATH_H +#include +#endif + +/* needed to get localtime_r on Solaris */ +#ifdef __sun +#ifndef __EXTENSIONS__ +#define __EXTENSIONS__ +#endif +#endif + +#ifdef HAVE_TIME_H +#include +#endif + +/* + * types of date and/or time (from schema datatypes) + * somewhat ordered from least specific to most specific (i.e. + * most truncated to least truncated). + */ +typedef enum { + EXSLT_UNKNOWN = 0, + XS_TIME = 1, /* time is left-truncated */ + XS_GDAY = (XS_TIME << 1), + XS_GMONTH = (XS_GDAY << 1), + XS_GMONTHDAY = (XS_GMONTH | XS_GDAY), + XS_GYEAR = (XS_GMONTH << 1), + XS_GYEARMONTH = (XS_GYEAR | XS_GMONTH), + XS_DATE = (XS_GYEAR | XS_GMONTH | XS_GDAY), + XS_DATETIME = (XS_DATE | XS_TIME), + XS_DURATION = (XS_GYEAR << 1) +} exsltDateType; + +/* Date value */ +typedef struct _exsltDateValDate exsltDateValDate; +typedef exsltDateValDate *exsltDateValDatePtr; +struct _exsltDateValDate { + long year; + unsigned int mon :4; /* 1 <= mon <= 12 */ + unsigned int day :5; /* 1 <= day <= 31 */ + unsigned int hour :5; /* 0 <= hour <= 23 */ + unsigned int min :6; /* 0 <= min <= 59 */ + double sec; + unsigned int tz_flag :1; /* is tzo explicitely set? */ + signed int tzo :12; /* -1440 <= tzo <= 1440 currently only -840 to +840 are needed */ +}; + +/* Duration value */ +typedef struct _exsltDateValDuration exsltDateValDuration; +typedef exsltDateValDuration *exsltDateValDurationPtr; +struct _exsltDateValDuration { + long mon; /* mon stores years also */ + long day; + double sec; /* sec stores min and hour also */ +}; + +typedef struct _exsltDateVal exsltDateVal; +typedef exsltDateVal *exsltDateValPtr; +struct _exsltDateVal { + exsltDateType type; + union { + exsltDateValDate date; + exsltDateValDuration dur; + } value; +}; + +/**************************************************************** + * * + * Compat./Port. macros * + * * + ****************************************************************/ + +#if defined(HAVE_TIME_H) \ + && (defined(HAVE_LOCALTIME) || defined(HAVE_LOCALTIME_R)) \ + && (defined(HAVE_GMTIME) || defined(HAVE_GMTIME_R)) \ + && defined(HAVE_TIME) +#define WITH_TIME +#endif + +/**************************************************************** + * * + * Convenience macros and functions * + * * + ****************************************************************/ + +#define IS_TZO_CHAR(c) \ + ((c == 0) || (c == 'Z') || (c == '+') || (c == '-')) + +#define VALID_ALWAYS(num) (num >= 0) +#define VALID_YEAR(yr) (yr != 0) +#define VALID_MONTH(mon) ((mon >= 1) && (mon <= 12)) +/* VALID_DAY should only be used when month is unknown */ +#define VALID_DAY(day) ((day >= 1) && (day <= 31)) +#define VALID_HOUR(hr) ((hr >= 0) && (hr <= 23)) +#define VALID_MIN(min) ((min >= 0) && (min <= 59)) +#define VALID_SEC(sec) ((sec >= 0) && (sec < 60)) +#define VALID_TZO(tzo) ((tzo > -1440) && (tzo < 1440)) +#define IS_LEAP(y) \ + (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)) + +static const unsigned long daysInMonth[12] = + { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; +static const unsigned long daysInMonthLeap[12] = + { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; + +#define MAX_DAYINMONTH(yr,mon) \ + (IS_LEAP(yr) ? daysInMonthLeap[mon - 1] : daysInMonth[mon - 1]) + +#define VALID_MDAY(dt) \ + (IS_LEAP(dt->year) ? \ + (dt->day <= daysInMonthLeap[dt->mon - 1]) : \ + (dt->day <= daysInMonth[dt->mon - 1])) + +#define VALID_DATE(dt) \ + (VALID_YEAR(dt->year) && VALID_MONTH(dt->mon) && VALID_MDAY(dt)) + +/* + hour and min structure vals are unsigned, so normal macros give + warnings on some compilers. +*/ +#define VALID_TIME(dt) \ + ((dt->hour <=23 ) && (dt->min <= 59) && \ + VALID_SEC(dt->sec) && VALID_TZO(dt->tzo)) + +#define VALID_DATETIME(dt) \ + (VALID_DATE(dt) && VALID_TIME(dt)) + +#define SECS_PER_MIN (60) +#define SECS_PER_HOUR (60 * SECS_PER_MIN) +#define SECS_PER_DAY (24 * SECS_PER_HOUR) + +static const unsigned long dayInYearByMonth[12] = + { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; +static const unsigned long dayInLeapYearByMonth[12] = + { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 }; + +#define DAY_IN_YEAR(day, month, year) \ + ((IS_LEAP(year) ? \ + dayInLeapYearByMonth[month - 1] : \ + dayInYearByMonth[month - 1]) + day) + +/** + * _exsltDateParseGYear: + * @dt: pointer to a date structure + * @str: pointer to the string to analyze + * + * Parses a xs:gYear without time zone and fills in the appropriate + * field of the @dt structure. @str is updated to point just after the + * xs:gYear. It is supposed that @dt->year is big enough to contain + * the year. + * + * Returns 0 or the error code + */ +static int +_exsltDateParseGYear (exsltDateValDatePtr dt, const xmlChar **str) +{ + const xmlChar *cur = *str, *firstChar; + int isneg = 0, digcnt = 0; + + if (((*cur < '0') || (*cur > '9')) && + (*cur != '-') && (*cur != '+')) + return -1; + + if (*cur == '-') { + isneg = 1; + cur++; + } + + firstChar = cur; + + while ((*cur >= '0') && (*cur <= '9')) { + dt->year = dt->year * 10 + (*cur - '0'); + cur++; + digcnt++; + } + + /* year must be at least 4 digits (CCYY); over 4 + * digits cannot have a leading zero. */ + if ((digcnt < 4) || ((digcnt > 4) && (*firstChar == '0'))) + return 1; + + if (isneg) + dt->year = - dt->year; + + if (!VALID_YEAR(dt->year)) + return 2; + + *str = cur; + +#ifdef DEBUG_EXSLT_DATE + xsltGenericDebug(xsltGenericDebugContext, + "Parsed year %04i\n", dt->year); +#endif + + return 0; +} + +/** + * FORMAT_GYEAR: + * @yr: the year to format + * @cur: a pointer to an allocated buffer + * + * Formats @yr in xsl:gYear format. Result is appended to @cur and + * @cur is updated to point after the xsl:gYear. + */ +#define FORMAT_GYEAR(yr, cur) \ + if (yr < 0) { \ + *cur = '-'; \ + cur++; \ + } \ + { \ + long year = (yr < 0) ? - yr : yr; \ + xmlChar tmp_buf[100], *tmp = tmp_buf; \ + /* result is in reverse-order */ \ + while (year > 0) { \ + *tmp = '0' + (xmlChar)(year % 10); \ + year /= 10; \ + tmp++; \ + } \ + /* virtually adds leading zeros */ \ + while ((tmp - tmp_buf) < 4) \ + *tmp++ = '0'; \ + /* restore the correct order */ \ + while (tmp > tmp_buf) { \ + tmp--; \ + *cur = *tmp; \ + cur++; \ + } \ + } + +/** + * PARSE_2_DIGITS: + * @num: the integer to fill in + * @cur: an #xmlChar * + * @func: validation function for the number + * @invalid: an integer + * + * Parses a 2-digits integer and updates @num with the value. @cur is + * updated to point just after the integer. + * In case of error, @invalid is set to %TRUE, values of @num and + * @cur are undefined. + */ +#define PARSE_2_DIGITS(num, cur, func, invalid) \ + if ((cur[0] < '0') || (cur[0] > '9') || \ + (cur[1] < '0') || (cur[1] > '9')) \ + invalid = 1; \ + else { \ + int val; \ + val = (cur[0] - '0') * 10 + (cur[1] - '0'); \ + if (!func(val)) \ + invalid = 2; \ + else \ + num = val; \ + } \ + cur += 2; + +/** + * FORMAT_2_DIGITS: + * @num: the integer to format + * @cur: a pointer to an allocated buffer + * + * Formats a 2-digits integer. Result is appended to @cur and + * @cur is updated to point after the integer. + */ +#define FORMAT_2_DIGITS(num, cur) \ + *cur = '0' + ((num / 10) % 10); \ + cur++; \ + *cur = '0' + (num % 10); \ + cur++; + +/** + * PARSE_FLOAT: + * @num: the double to fill in + * @cur: an #xmlChar * + * @invalid: an integer + * + * Parses a float and updates @num with the value. @cur is + * updated to point just after the float. The float must have a + * 2-digits integer part and may or may not have a decimal part. + * In case of error, @invalid is set to %TRUE, values of @num and + * @cur are undefined. + */ +#define PARSE_FLOAT(num, cur, invalid) \ + PARSE_2_DIGITS(num, cur, VALID_ALWAYS, invalid); \ + if (!invalid && (*cur == '.')) { \ + double mult = 1; \ + cur++; \ + if ((*cur < '0') || (*cur > '9')) \ + invalid = 1; \ + while ((*cur >= '0') && (*cur <= '9')) { \ + mult /= 10; \ + num += (*cur - '0') * mult; \ + cur++; \ + } \ + } + +/** + * FORMAT_FLOAT: + * @num: the double to format + * @cur: a pointer to an allocated buffer + * @pad: a flag for padding to 2 integer digits + * + * Formats a float. Result is appended to @cur and @cur is updated to + * point after the integer. If the @pad flag is non-zero, then the + * float representation has a minimum 2-digits integer part. The + * fractional part is formatted if @num has a fractional value. + */ +#define FORMAT_FLOAT(num, cur, pad) \ + { \ + xmlChar *sav, *str; \ + if ((pad) && (num < 10.0)) \ + *cur++ = '0'; \ + str = xmlXPathCastNumberToString(num); \ + sav = str; \ + while (*str != 0) \ + *cur++ = *str++; \ + xmlFree(sav); \ + } + +/** + * _exsltDateParseGMonth: + * @dt: pointer to a date structure + * @str: pointer to the string to analyze + * + * Parses a xs:gMonth without time zone and fills in the appropriate + * field of the @dt structure. @str is updated to point just after the + * xs:gMonth. + * + * Returns 0 or the error code + */ +static int +_exsltDateParseGMonth (exsltDateValDatePtr dt, const xmlChar **str) +{ + const xmlChar *cur = *str; + int ret = 0; + + PARSE_2_DIGITS(dt->mon, cur, VALID_MONTH, ret); + if (ret != 0) + return ret; + + *str = cur; + +#ifdef DEBUG_EXSLT_DATE + xsltGenericDebug(xsltGenericDebugContext, + "Parsed month %02i\n", dt->mon); +#endif + + return 0; +} + +/** + * FORMAT_GMONTH: + * @mon: the month to format + * @cur: a pointer to an allocated buffer + * + * Formats @mon in xsl:gMonth format. Result is appended to @cur and + * @cur is updated to point after the xsl:gMonth. + */ +#define FORMAT_GMONTH(mon, cur) \ + FORMAT_2_DIGITS(mon, cur) + +/** + * _exsltDateParseGDay: + * @dt: pointer to a date structure + * @str: pointer to the string to analyze + * + * Parses a xs:gDay without time zone and fills in the appropriate + * field of the @dt structure. @str is updated to point just after the + * xs:gDay. + * + * Returns 0 or the error code + */ +static int +_exsltDateParseGDay (exsltDateValDatePtr dt, const xmlChar **str) +{ + const xmlChar *cur = *str; + int ret = 0; + + PARSE_2_DIGITS(dt->day, cur, VALID_DAY, ret); + if (ret != 0) + return ret; + + *str = cur; + +#ifdef DEBUG_EXSLT_DATE + xsltGenericDebug(xsltGenericDebugContext, + "Parsed day %02i\n", dt->day); +#endif + + return 0; +} + +/** + * FORMAT_GDAY: + * @dt: the #exsltDateValDate to format + * @cur: a pointer to an allocated buffer + * + * Formats @dt in xsl:gDay format. Result is appended to @cur and + * @cur is updated to point after the xsl:gDay. + */ +#define FORMAT_GDAY(dt, cur) \ + FORMAT_2_DIGITS(dt->day, cur) + +/** + * FORMAT_DATE: + * @dt: the #exsltDateValDate to format + * @cur: a pointer to an allocated buffer + * + * Formats @dt in xsl:date format. Result is appended to @cur and + * @cur is updated to point after the xsl:date. + */ +#define FORMAT_DATE(dt, cur) \ + FORMAT_GYEAR(dt->year, cur); \ + *cur = '-'; \ + cur++; \ + FORMAT_GMONTH(dt->mon, cur); \ + *cur = '-'; \ + cur++; \ + FORMAT_GDAY(dt, cur); + +/** + * _exsltDateParseTime: + * @dt: pointer to a date structure + * @str: pointer to the string to analyze + * + * Parses a xs:time without time zone and fills in the appropriate + * fields of the @dt structure. @str is updated to point just after the + * xs:time. + * In case of error, values of @dt fields are undefined. + * + * Returns 0 or the error code + */ +static int +_exsltDateParseTime (exsltDateValDatePtr dt, const xmlChar **str) +{ + const xmlChar *cur = *str; + unsigned int hour = 0; /* use temp var in case str is not xs:time */ + int ret = 0; + + PARSE_2_DIGITS(hour, cur, VALID_HOUR, ret); + if (ret != 0) + return ret; + + if (*cur != ':') + return 1; + cur++; + + /* the ':' insures this string is xs:time */ + dt->hour = hour; + + PARSE_2_DIGITS(dt->min, cur, VALID_MIN, ret); + if (ret != 0) + return ret; + + if (*cur != ':') + return 1; + cur++; + + PARSE_FLOAT(dt->sec, cur, ret); + if (ret != 0) + return ret; + + if (!VALID_TIME(dt)) + return 2; + + *str = cur; + +#ifdef DEBUG_EXSLT_DATE + xsltGenericDebug(xsltGenericDebugContext, + "Parsed time %02i:%02i:%02.f\n", + dt->hour, dt->min, dt->sec); +#endif + + return 0; +} + +/** + * FORMAT_TIME: + * @dt: the #exsltDateValDate to format + * @cur: a pointer to an allocated buffer + * + * Formats @dt in xsl:time format. Result is appended to @cur and + * @cur is updated to point after the xsl:time. + */ +#define FORMAT_TIME(dt, cur) \ + FORMAT_2_DIGITS(dt->hour, cur); \ + *cur = ':'; \ + cur++; \ + FORMAT_2_DIGITS(dt->min, cur); \ + *cur = ':'; \ + cur++; \ + FORMAT_FLOAT(dt->sec, cur, 1); + +/** + * _exsltDateParseTimeZone: + * @dt: pointer to a date structure + * @str: pointer to the string to analyze + * + * Parses a time zone without time zone and fills in the appropriate + * field of the @dt structure. @str is updated to point just after the + * time zone. + * + * Returns 0 or the error code + */ +static int +_exsltDateParseTimeZone (exsltDateValDatePtr dt, const xmlChar **str) +{ + const xmlChar *cur; + int ret = 0; + + if (str == NULL) + return -1; + cur = *str; + switch (*cur) { + case 0: + dt->tz_flag = 0; + dt->tzo = 0; + break; + + case 'Z': + dt->tz_flag = 1; + dt->tzo = 0; + cur++; + break; + + case '+': + case '-': { + int isneg = 0, tmp = 0; + isneg = (*cur == '-'); + + cur++; + + PARSE_2_DIGITS(tmp, cur, VALID_HOUR, ret); + if (ret != 0) + return ret; + + if (*cur != ':') + return 1; + cur++; + + dt->tzo = tmp * 60; + + PARSE_2_DIGITS(tmp, cur, VALID_MIN, ret); + if (ret != 0) + return ret; + + dt->tzo += tmp; + if (isneg) + dt->tzo = - dt->tzo; + + if (!VALID_TZO(dt->tzo)) + return 2; + + break; + } + default: + return 1; + } + + *str = cur; + +#ifdef DEBUG_EXSLT_DATE + xsltGenericDebug(xsltGenericDebugContext, + "Parsed time zone offset (%s) %i\n", + dt->tz_flag ? "explicit" : "implicit", dt->tzo); +#endif + + return 0; +} + +/** + * FORMAT_TZ: + * @tzo: the timezone offset to format + * @cur: a pointer to an allocated buffer + * + * Formats @tzo timezone. Result is appended to @cur and + * @cur is updated to point after the timezone. + */ +#define FORMAT_TZ(tzo, cur) \ + if (tzo == 0) { \ + *cur = 'Z'; \ + cur++; \ + } else { \ + int aTzo = (tzo < 0) ? - tzo : tzo; \ + int tzHh = aTzo / 60, tzMm = aTzo % 60; \ + *cur = (tzo < 0) ? '-' : '+' ; \ + cur++; \ + FORMAT_2_DIGITS(tzHh, cur); \ + *cur = ':'; \ + cur++; \ + FORMAT_2_DIGITS(tzMm, cur); \ + } + +/**************************************************************** + * * + * XML Schema Dates/Times Datatypes Handling * + * * + ****************************************************************/ + +/** + * exsltDateCreateDate: + * @type: type to create + * + * Creates a new #exsltDateVal, uninitialized. + * + * Returns the #exsltDateValPtr + */ +static exsltDateValPtr +exsltDateCreateDate (exsltDateType type) +{ + exsltDateValPtr ret; + + ret = (exsltDateValPtr) xmlMalloc(sizeof(exsltDateVal)); + if (ret == NULL) { + xsltGenericError(xsltGenericErrorContext, + "exsltDateCreateDate: out of memory\n"); + return (NULL); + } + memset (ret, 0, sizeof(exsltDateVal)); + + if (type != XS_DURATION) { + ret->value.date.mon = 1; + ret->value.date.day = 1; + } + + if (type != EXSLT_UNKNOWN) + ret->type = type; + + return ret; +} + +/** + * exsltDateFreeDate: + * @date: an #exsltDateValPtr + * + * Frees up the @date + */ +static void +exsltDateFreeDate (exsltDateValPtr date) { + if (date == NULL) + return; + + xmlFree(date); +} + +/** + * PARSE_DIGITS: + * @num: the integer to fill in + * @cur: an #xmlChar * + * @num_type: an integer flag + * + * Parses a digits integer and updates @num with the value. @cur is + * updated to point just after the integer. + * In case of error, @num_type is set to -1, values of @num and + * @cur are undefined. + */ +#define PARSE_DIGITS(num, cur, num_type) \ + if ((*cur < '0') || (*cur > '9')) \ + num_type = -1; \ + else \ + while ((*cur >= '0') && (*cur <= '9')) { \ + num = num * 10 + (*cur - '0'); \ + cur++; \ + } + +/** + * PARSE_NUM: + * @num: the double to fill in + * @cur: an #xmlChar * + * @num_type: an integer flag + * + * Parses a float or integer and updates @num with the value. @cur is + * updated to point just after the number. If the number is a float, + * then it must have an integer part and a decimal part; @num_type will + * be set to 1. If there is no decimal part, @num_type is set to zero. + * In case of error, @num_type is set to -1, values of @num and + * @cur are undefined. + */ +#define PARSE_NUM(num, cur, num_type) \ + num = 0; \ + PARSE_DIGITS(num, cur, num_type); \ + if (!num_type && (*cur == '.')) { \ + double mult = 1; \ + cur++; \ + if ((*cur < '0') || (*cur > '9')) \ + num_type = -1; \ + else \ + num_type = 1; \ + while ((*cur >= '0') && (*cur <= '9')) { \ + mult /= 10; \ + num += (*cur - '0') * mult; \ + cur++; \ + } \ + } + +#ifdef WITH_TIME +/** + * exsltDateCurrent: + * + * Returns the current date and time. + */ +static exsltDateValPtr +exsltDateCurrent (void) +{ + struct tm localTm, gmTm; +#ifndef HAVE_GMTIME_R + struct tm *tb = NULL; +#endif + time_t secs; + int local_s, gm_s; + exsltDateValPtr ret; +#ifdef HAVE_ERRNO_H + char *source_date_epoch; +#endif /* HAVE_ERRNO_H */ + int override = 0; + + ret = exsltDateCreateDate(XS_DATETIME); + if (ret == NULL) + return NULL; + +#ifdef HAVE_ERRNO_H + /* + * Allow the date and time to be set externally by an exported + * environment variable to enable reproducible builds. + */ + source_date_epoch = getenv("SOURCE_DATE_EPOCH"); + if (source_date_epoch) { + errno = 0; + secs = (time_t) strtol (source_date_epoch, NULL, 10); + if (errno == 0) { +#if HAVE_GMTIME_R + if (gmtime_r(&secs, &localTm) != NULL) + override = 1; +#else + tb = gmtime(&secs); + if (tb != NULL) { + localTm = *tb; + override = 1; + } +#endif + } + } +#endif /* HAVE_ERRNO_H */ + + if (override == 0) { + /* get current time */ + secs = time(NULL); + +#if HAVE_LOCALTIME_R + localtime_r(&secs, &localTm); +#else + localTm = *localtime(&secs); +#endif + } + + /* get real year, not years since 1900 */ + ret->value.date.year = localTm.tm_year + 1900; + + ret->value.date.mon = localTm.tm_mon + 1; + ret->value.date.day = localTm.tm_mday; + ret->value.date.hour = localTm.tm_hour; + ret->value.date.min = localTm.tm_min; + + /* floating point seconds */ + ret->value.date.sec = (double) localTm.tm_sec; + + /* determine the time zone offset from local to gm time */ +#if HAVE_GMTIME_R + gmtime_r(&secs, &gmTm); +#else + tb = gmtime(&secs); + if (tb != NULL) + gmTm = *tb; +#endif + ret->value.date.tz_flag = 0; +#if 0 + ret->value.date.tzo = (((ret->value.date.day * 1440) + + (ret->value.date.hour * 60) + + ret->value.date.min) - + ((gmTm.tm_mday * 1440) + (gmTm.tm_hour * 60) + + gmTm.tm_min)); +#endif + local_s = localTm.tm_hour * SECS_PER_HOUR + + localTm.tm_min * SECS_PER_MIN + + localTm.tm_sec; + + gm_s = gmTm.tm_hour * SECS_PER_HOUR + + gmTm.tm_min * SECS_PER_MIN + + gmTm.tm_sec; + + if (localTm.tm_year < gmTm.tm_year) { + ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60; + } else if (localTm.tm_year > gmTm.tm_year) { + ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60; + } else if (localTm.tm_mon < gmTm.tm_mon) { + ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60; + } else if (localTm.tm_mon > gmTm.tm_mon) { + ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60; + } else if (localTm.tm_mday < gmTm.tm_mday) { + ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60; + } else if (localTm.tm_mday > gmTm.tm_mday) { + ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60; + } else { + ret->value.date.tzo = (local_s - gm_s)/60; + } + + return ret; +} +#endif + +/** + * exsltDateParse: + * @dateTime: string to analyze + * + * Parses a date/time string + * + * Returns a newly built #exsltDateValPtr of NULL in case of error + */ +static exsltDateValPtr +exsltDateParse (const xmlChar *dateTime) +{ + exsltDateValPtr dt; + int ret; + const xmlChar *cur = dateTime; + +#define RETURN_TYPE_IF_VALID(t) \ + if (IS_TZO_CHAR(*cur)) { \ + ret = _exsltDateParseTimeZone(&(dt->value.date), &cur); \ + if (ret == 0) { \ + if (*cur != 0) \ + goto error; \ + dt->type = t; \ + return dt; \ + } \ + } + + if (dateTime == NULL) + return NULL; + + if ((*cur != '-') && (*cur < '0') && (*cur > '9')) + return NULL; + + dt = exsltDateCreateDate(EXSLT_UNKNOWN); + if (dt == NULL) + return NULL; + + if ((cur[0] == '-') && (cur[1] == '-')) { + /* + * It's an incomplete date (xs:gMonthDay, xs:gMonth or + * xs:gDay) + */ + cur += 2; + + /* is it an xs:gDay? */ + if (*cur == '-') { + ++cur; + ret = _exsltDateParseGDay(&(dt->value.date), &cur); + if (ret != 0) + goto error; + + RETURN_TYPE_IF_VALID(XS_GDAY); + + goto error; + } + + /* + * it should be an xs:gMonthDay or xs:gMonth + */ + ret = _exsltDateParseGMonth(&(dt->value.date), &cur); + if (ret != 0) + goto error; + + if (*cur != '-') + goto error; + cur++; + + /* is it an xs:gMonth? */ + if (*cur == '-') { + cur++; + RETURN_TYPE_IF_VALID(XS_GMONTH); + goto error; + } + + /* it should be an xs:gMonthDay */ + ret = _exsltDateParseGDay(&(dt->value.date), &cur); + if (ret != 0) + goto error; + + RETURN_TYPE_IF_VALID(XS_GMONTHDAY); + + goto error; + } + + /* + * It's a right-truncated date or an xs:time. + * Try to parse an xs:time then fallback on right-truncated dates. + */ + if ((*cur >= '0') && (*cur <= '9')) { + ret = _exsltDateParseTime(&(dt->value.date), &cur); + if (ret == 0) { + /* it's an xs:time */ + RETURN_TYPE_IF_VALID(XS_TIME); + } + } + + /* fallback on date parsing */ + cur = dateTime; + + ret = _exsltDateParseGYear(&(dt->value.date), &cur); + if (ret != 0) + goto error; + + /* is it an xs:gYear? */ + RETURN_TYPE_IF_VALID(XS_GYEAR); + + if (*cur != '-') + goto error; + cur++; + + ret = _exsltDateParseGMonth(&(dt->value.date), &cur); + if (ret != 0) + goto error; + + /* is it an xs:gYearMonth? */ + RETURN_TYPE_IF_VALID(XS_GYEARMONTH); + + if (*cur != '-') + goto error; + cur++; + + ret = _exsltDateParseGDay(&(dt->value.date), &cur); + if ((ret != 0) || !VALID_DATE((&(dt->value.date)))) + goto error; + + /* is it an xs:date? */ + RETURN_TYPE_IF_VALID(XS_DATE); + + if (*cur != 'T') + goto error; + cur++; + + /* it should be an xs:dateTime */ + ret = _exsltDateParseTime(&(dt->value.date), &cur); + if (ret != 0) + goto error; + + ret = _exsltDateParseTimeZone(&(dt->value.date), &cur); + if ((ret != 0) || (*cur != 0) || !VALID_DATETIME((&(dt->value.date)))) + goto error; + + dt->type = XS_DATETIME; + + return dt; + +error: + if (dt != NULL) + exsltDateFreeDate(dt); + return NULL; +} + +/** + * exsltDateParseDuration: + * @duration: string to analyze + * + * Parses a duration string + * + * Returns a newly built #exsltDateValPtr of NULL in case of error + */ +static exsltDateValPtr +exsltDateParseDuration (const xmlChar *duration) +{ + const xmlChar *cur = duration; + exsltDateValPtr dur; + int isneg = 0; + unsigned int seq = 0; + + if (duration == NULL) + return NULL; + + if (*cur == '-') { + isneg = 1; + cur++; + } + + /* duration must start with 'P' (after sign) */ + if (*cur++ != 'P') + return NULL; + + dur = exsltDateCreateDate(XS_DURATION); + if (dur == NULL) + return NULL; + + while (*cur != 0) { + double num; + int num_type = 0; /* -1 = invalid, 0 = int, 1 = floating */ + const xmlChar desig[] = {'Y', 'M', 'D', 'H', 'M', 'S'}; + const double multi[] = { 0.0, 0.0, 86400.0, 3600.0, 60.0, 1.0, 0.0}; + + /* input string should be empty or invalid date/time item */ + if (seq >= sizeof(desig)) + goto error; + + /* T designator must be present for time items */ + if (*cur == 'T') { + if (seq <= 3) { + seq = 3; + cur++; + } else + return NULL; + } else if (seq == 3) + goto error; + + /* parse the number portion of the item */ + PARSE_NUM(num, cur, num_type); + + if ((num_type == -1) || (*cur == 0)) + goto error; + + /* update duration based on item type */ + while (seq < sizeof(desig)) { + if (*cur == desig[seq]) { + + /* verify numeric type; only seconds can be float */ + if ((num_type != 0) && (seq < (sizeof(desig)-1))) + goto error; + + switch (seq) { + case 0: + dur->value.dur.mon = (long)num * 12; + break; + case 1: + dur->value.dur.mon += (long)num; + break; + default: + /* convert to seconds using multiplier */ + dur->value.dur.sec += num * multi[seq]; + seq++; + break; + } + + break; /* exit loop */ + } + /* no date designators found? */ + if (++seq == 3) + goto error; + } + cur++; + } + + if (isneg) { + dur->value.dur.mon = -dur->value.dur.mon; + dur->value.dur.day = -dur->value.dur.day; + dur->value.dur.sec = -dur->value.dur.sec; + } + +#ifdef DEBUG_EXSLT_DATE + xsltGenericDebug(xsltGenericDebugContext, + "Parsed duration %f\n", dur->value.dur.sec); +#endif + + return dur; + +error: + if (dur != NULL) + exsltDateFreeDate(dur); + return NULL; +} + +/** + * FORMAT_ITEM: + * @num: number to format + * @cur: current location to convert number + * @limit: max value + * @item: char designator + * + */ +#define FORMAT_ITEM(num, cur, limit, item) \ + if (num != 0) { \ + long comp = (long)num / limit; \ + if (comp != 0) { \ + FORMAT_FLOAT((double)comp, cur, 0); \ + *cur++ = item; \ + num -= (double)(comp * limit); \ + } \ + } + +/** + * exsltDateFormatDuration: + * @dt: an #exsltDateValDurationPtr + * + * Formats @dt in xs:duration format. + * + * Returns a newly allocated string, or NULL in case of error + */ +static xmlChar * +exsltDateFormatDuration (const exsltDateValDurationPtr dt) +{ + xmlChar buf[100], *cur = buf; + double secs, days; + double years, months; + + if (dt == NULL) + return NULL; + + /* quick and dirty check */ + if ((dt->sec == 0.0) && (dt->day == 0) && (dt->mon == 0)) + return xmlStrdup((xmlChar*)"P0D"); + + secs = dt->sec; + days = (double)dt->day; + years = (double)(dt->mon / 12); + months = (double)(dt->mon % 12); + + *cur = '\0'; + if (secs < 0.0) { + secs = -secs; + *cur = '-'; + } + if (days < 0) { + days = -days; + *cur = '-'; + } + if (years < 0) { + years = -years; + *cur = '-'; + } + if (months < 0) { + months = -months; + *cur = '-'; + } + if (*cur == '-') + cur++; + + *cur++ = 'P'; + + if (years != 0.0) { + FORMAT_ITEM(years, cur, 1, 'Y'); + } + + if (months != 0.0) { + FORMAT_ITEM(months, cur, 1, 'M'); + } + + if (secs >= SECS_PER_DAY) { + double tmp = floor(secs / SECS_PER_DAY); + days += tmp; + secs -= (tmp * SECS_PER_DAY); + } + + FORMAT_ITEM(days, cur, 1, 'D'); + if (secs > 0.0) { + *cur++ = 'T'; + } + FORMAT_ITEM(secs, cur, SECS_PER_HOUR, 'H'); + FORMAT_ITEM(secs, cur, SECS_PER_MIN, 'M'); + if (secs > 0.0) { + FORMAT_FLOAT(secs, cur, 0); + *cur++ = 'S'; + } + + *cur = 0; + + return xmlStrdup(buf); +} + +/** + * exsltDateFormatDateTime: + * @dt: an #exsltDateValDatePtr + * + * Formats @dt in xs:dateTime format. + * + * Returns a newly allocated string, or NULL in case of error + */ +static xmlChar * +exsltDateFormatDateTime (const exsltDateValDatePtr dt) +{ + xmlChar buf[100], *cur = buf; + + if ((dt == NULL) || !VALID_DATETIME(dt)) + return NULL; + + FORMAT_DATE(dt, cur); + *cur = 'T'; + cur++; + FORMAT_TIME(dt, cur); + FORMAT_TZ(dt->tzo, cur); + *cur = 0; + + return xmlStrdup(buf); +} + +/** + * exsltDateFormatDate: + * @dt: an #exsltDateValDatePtr + * + * Formats @dt in xs:date format. + * + * Returns a newly allocated string, or NULL in case of error + */ +static xmlChar * +exsltDateFormatDate (const exsltDateValDatePtr dt) +{ + xmlChar buf[100], *cur = buf; + + if ((dt == NULL) || !VALID_DATETIME(dt)) + return NULL; + + FORMAT_DATE(dt, cur); + if (dt->tz_flag || (dt->tzo != 0)) { + FORMAT_TZ(dt->tzo, cur); + } + *cur = 0; + + return xmlStrdup(buf); +} + +/** + * exsltDateFormatTime: + * @dt: an #exsltDateValDatePtr + * + * Formats @dt in xs:time format. + * + * Returns a newly allocated string, or NULL in case of error + */ +static xmlChar * +exsltDateFormatTime (const exsltDateValDatePtr dt) +{ + xmlChar buf[100], *cur = buf; + + if ((dt == NULL) || !VALID_TIME(dt)) + return NULL; + + FORMAT_TIME(dt, cur); + if (dt->tz_flag || (dt->tzo != 0)) { + FORMAT_TZ(dt->tzo, cur); + } + *cur = 0; + + return xmlStrdup(buf); +} + +/** + * exsltDateFormat: + * @dt: an #exsltDateValPtr + * + * Formats @dt in the proper format. + * Note: xs:gmonth and xs:gday are not formatted as there are no + * routines that output them. + * + * Returns a newly allocated string, or NULL in case of error + */ +static xmlChar * +exsltDateFormat (const exsltDateValPtr dt) +{ + + if (dt == NULL) + return NULL; + + switch (dt->type) { + case XS_DURATION: + return exsltDateFormatDuration(&(dt->value.dur)); + case XS_DATETIME: + return exsltDateFormatDateTime(&(dt->value.date)); + case XS_DATE: + return exsltDateFormatDate(&(dt->value.date)); + case XS_TIME: + return exsltDateFormatTime(&(dt->value.date)); + default: + break; + } + + if (dt->type & XS_GYEAR) { + xmlChar buf[100], *cur = buf; + + FORMAT_GYEAR(dt->value.date.year, cur); + if (dt->type == XS_GYEARMONTH) { + *cur = '-'; + cur++; + FORMAT_GMONTH(dt->value.date.mon, cur); + } + + if (dt->value.date.tz_flag || (dt->value.date.tzo != 0)) { + FORMAT_TZ(dt->value.date.tzo, cur); + } + *cur = 0; + return xmlStrdup(buf); + } + + return NULL; +} + +/** + * _exsltDateCastYMToDays: + * @dt: an #exsltDateValPtr + * + * Convert mon and year of @dt to total number of days. Take the + * number of years since (or before) 1 AD and add the number of leap + * years. This is a function because negative + * years must be handled a little differently and there is no zero year. + * + * Returns number of days. + */ +static long +_exsltDateCastYMToDays (const exsltDateValPtr dt) +{ + long ret; + + if (dt->value.date.year < 0) + ret = (dt->value.date.year * 365) + + (((dt->value.date.year+1)/4)-((dt->value.date.year+1)/100)+ + ((dt->value.date.year+1)/400)) + + DAY_IN_YEAR(0, dt->value.date.mon, dt->value.date.year); + else + ret = ((dt->value.date.year-1) * 365) + + (((dt->value.date.year-1)/4)-((dt->value.date.year-1)/100)+ + ((dt->value.date.year-1)/400)) + + DAY_IN_YEAR(0, dt->value.date.mon, dt->value.date.year); + + return ret; +} + +/** + * TIME_TO_NUMBER: + * @dt: an #exsltDateValPtr + * + * Calculates the number of seconds in the time portion of @dt. + * + * Returns seconds. + */ +#define TIME_TO_NUMBER(dt) \ + ((double)((dt->value.date.hour * SECS_PER_HOUR) + \ + (dt->value.date.min * SECS_PER_MIN)) + dt->value.date.sec) + +/** + * exsltDateCastDateToNumber: + * @dt: an #exsltDateValPtr + * + * Calculates the number of seconds from year zero. + * + * Returns seconds from zero year. + */ +static double +exsltDateCastDateToNumber (const exsltDateValPtr dt) +{ + double ret = 0.0; + + if (dt == NULL) + return 0.0; + + if ((dt->type & XS_GYEAR) == XS_GYEAR) { + ret = (double)_exsltDateCastYMToDays(dt) * SECS_PER_DAY; + } + + /* add in days */ + if (dt->type == XS_DURATION) { + ret += (double)dt->value.dur.day * SECS_PER_DAY; + ret += dt->value.dur.sec; + } else { + ret += (double)dt->value.date.day * SECS_PER_DAY; + /* add in time */ + ret += TIME_TO_NUMBER(dt); + } + + + return ret; +} + +/** + * _exsltDateTruncateDate: + * @dt: an #exsltDateValPtr + * @type: dateTime type to set to + * + * Set @dt to truncated @type. + * + * Returns 0 success, non-zero otherwise. + */ +static int +_exsltDateTruncateDate (exsltDateValPtr dt, exsltDateType type) +{ + if (dt == NULL) + return 1; + + if ((type & XS_TIME) != XS_TIME) { + dt->value.date.hour = 0; + dt->value.date.min = 0; + dt->value.date.sec = 0.0; + } + + if ((type & XS_GDAY) != XS_GDAY) + dt->value.date.day = 1; + + if ((type & XS_GMONTH) != XS_GMONTH) + dt->value.date.mon = 1; + + if ((type & XS_GYEAR) != XS_GYEAR) + dt->value.date.year = 0; + + dt->type = type; + + return 0; +} + +/** + * _exsltDayInWeek: + * @yday: year day (1-366) + * @yr: year + * + * Determine the day-in-week from @yday and @yr. 0001-01-01 was + * a Monday so all other days are calculated from there. Take the + * number of years since (or before) add the number of leap years and + * the day-in-year and mod by 7. This is a function because negative + * years must be handled a little differently and there is no zero year. + * + * Returns day in week (Sunday = 0). + */ +static long +_exsltDateDayInWeek(long yday, long yr) +{ + long ret; + + if (yr < 0) { + ret = ((yr + (((yr+1)/4)-((yr+1)/100)+((yr+1)/400)) + yday) % 7); + if (ret < 0) + ret += 7; + } else + ret = (((yr-1) + (((yr-1)/4)-((yr-1)/100)+((yr-1)/400)) + yday) % 7); + + return ret; +} + +/* + * macros for adding date/times and durations + */ +#define FQUOTIENT(a,b) ((floor(((double)a/(double)b)))) +#define MODULO(a,b) ((a - FQUOTIENT(a,b) * b)) +#define FQUOTIENT_RANGE(a,low,high) (FQUOTIENT((a-low),(high-low))) +#define MODULO_RANGE(a,low,high) ((MODULO((a-low),(high-low)))+low) + +/** + * _exsltDateAdd: + * @dt: an #exsltDateValPtr + * @dur: an #exsltDateValPtr of type #XS_DURATION + * + * Compute a new date/time from @dt and @dur. This function assumes @dt + * is either #XS_DATETIME, #XS_DATE, #XS_GYEARMONTH, or #XS_GYEAR. + * + * Returns date/time pointer or NULL. + */ +static exsltDateValPtr +_exsltDateAdd (exsltDateValPtr dt, exsltDateValPtr dur) +{ + exsltDateValPtr ret; + long carry, tempdays, temp; + exsltDateValDatePtr r, d; + exsltDateValDurationPtr u; + + if ((dt == NULL) || (dur == NULL)) + return NULL; + + ret = exsltDateCreateDate(dt->type); + if (ret == NULL) + return NULL; + + r = &(ret->value.date); + d = &(dt->value.date); + u = &(dur->value.dur); + + /* month */ + carry = d->mon + u->mon; + r->mon = (unsigned int)MODULO_RANGE(carry, 1, 13); + carry = (long)FQUOTIENT_RANGE(carry, 1, 13); + + /* year (may be modified later) */ + r->year = d->year + carry; + if (r->year == 0) { + if (d->year > 0) + r->year--; + else + r->year++; + } + + /* time zone */ + r->tzo = d->tzo; + r->tz_flag = d->tz_flag; + + /* seconds */ + r->sec = d->sec + u->sec; + carry = (long)FQUOTIENT((long)r->sec, 60); + if (r->sec != 0.0) { + r->sec = MODULO(r->sec, 60.0); + } + + /* minute */ + carry += d->min; + r->min = (unsigned int)MODULO(carry, 60); + carry = (long)FQUOTIENT(carry, 60); + + /* hours */ + carry += d->hour; + r->hour = (unsigned int)MODULO(carry, 24); + carry = (long)FQUOTIENT(carry, 24); + + /* + * days + * Note we use tempdays because the temporary values may need more + * than 5 bits + */ + if ((VALID_YEAR(r->year)) && (VALID_MONTH(r->mon)) && + (d->day > MAX_DAYINMONTH(r->year, r->mon))) + tempdays = MAX_DAYINMONTH(r->year, r->mon); + else if (d->day < 1) + tempdays = 1; + else + tempdays = d->day; + + tempdays += u->day + carry; + + while (1) { + if (tempdays < 1) { + long tmon = (long)MODULO_RANGE((int)r->mon-1, 1, 13); + long tyr = r->year + (long)FQUOTIENT_RANGE((int)r->mon-1, 1, 13); + if (tyr == 0) + tyr--; + /* + * Coverity detected an overrun in daysInMonth + * of size 12 at position 12 with index variable "((r)->mon - 1)" + */ + if (tmon < 0) + tmon = 0; + if (tmon > 12) + tmon = 12; + tempdays += MAX_DAYINMONTH(tyr, tmon); + carry = -1; + } else if (tempdays > (long)MAX_DAYINMONTH(r->year, r->mon)) { + tempdays = tempdays - MAX_DAYINMONTH(r->year, r->mon); + carry = 1; + } else + break; + + temp = r->mon + carry; + r->mon = (unsigned int)MODULO_RANGE(temp, 1, 13); + r->year = r->year + (long)FQUOTIENT_RANGE(temp, 1, 13); + if (r->year == 0) { + if (temp < 1) + r->year--; + else + r->year++; + } + } + + r->day = tempdays; + + /* + * adjust the date/time type to the date values + */ + if (ret->type != XS_DATETIME) { + if ((r->hour) || (r->min) || (r->sec)) + ret->type = XS_DATETIME; + else if (ret->type != XS_DATE) { + if (r->day != 1) + ret->type = XS_DATE; + else if ((ret->type != XS_GYEARMONTH) && (r->mon != 1)) + ret->type = XS_GYEARMONTH; + } + } + + return ret; +} + +/** + * _exsltDateDifference: + * @x: an #exsltDateValPtr + * @y: an #exsltDateValPtr + * @flag: force difference in days + * + * Calculate the difference between @x and @y as a duration + * (i.e. y - x). If the @flag is set then even if the least specific + * format of @x or @y is xs:gYear or xs:gYearMonth. + * + * Returns date/time pointer or NULL. + */ +static exsltDateValPtr +_exsltDateDifference (exsltDateValPtr x, exsltDateValPtr y, int flag) +{ + exsltDateValPtr ret; + + if ((x == NULL) || (y == NULL)) + return NULL; + + if (((x->type < XS_GYEAR) || (x->type > XS_DATETIME)) || + ((y->type < XS_GYEAR) || (y->type > XS_DATETIME))) + return NULL; + + /* + * the operand with the most specific format must be converted to + * the same type as the operand with the least specific format. + */ + if (x->type != y->type) { + if (x->type < y->type) { + _exsltDateTruncateDate(y, x->type); + } else { + _exsltDateTruncateDate(x, y->type); + } + } + + ret = exsltDateCreateDate(XS_DURATION); + if (ret == NULL) + return NULL; + + if (((x->type == XS_GYEAR) || (x->type == XS_GYEARMONTH)) && (!flag)) { + /* compute the difference in months */ + ret->value.dur.mon = ((y->value.date.year * 12) + y->value.date.mon) - + ((x->value.date.year * 12) + x->value.date.mon); + /* The above will give a wrong result if x and y are on different sides + of the September 1752. Resolution is welcome :-) */ + } else { + ret->value.dur.day = _exsltDateCastYMToDays(y) - + _exsltDateCastYMToDays(x); + ret->value.dur.day += y->value.date.day - x->value.date.day; + ret->value.dur.sec = TIME_TO_NUMBER(y) - TIME_TO_NUMBER(x); + ret->value.dur.sec += (x->value.date.tzo - y->value.date.tzo) * + SECS_PER_MIN; + if (ret->value.dur.day > 0.0 && ret->value.dur.sec < 0.0) { + ret->value.dur.day -= 1; + ret->value.dur.sec = ret->value.dur.sec + SECS_PER_DAY; + } else if (ret->value.dur.day < 0.0 && ret->value.dur.sec > 0.0) { + ret->value.dur.day += 1; + ret->value.dur.sec = ret->value.dur.sec - SECS_PER_DAY; + } + } + + return ret; +} + +/** + * _exsltDateAddDurCalc + * @ret: an exsltDateValPtr for the return value: + * @x: an exsltDateValPtr for the first operand + * @y: an exsltDateValPtr for the second operand + * + * Add two durations, catering for possible negative values. + * The sum is placed in @ret. + * + * Returns 1 for success, 0 if error detected. + */ +static int +_exsltDateAddDurCalc (exsltDateValPtr ret, exsltDateValPtr x, + exsltDateValPtr y) +{ + long carry; + + /* months */ + ret->value.dur.mon = x->value.dur.mon + y->value.dur.mon; + + /* seconds */ + ret->value.dur.sec = x->value.dur.sec + y->value.dur.sec; + carry = (long)FQUOTIENT(ret->value.dur.sec, SECS_PER_DAY); + if (ret->value.dur.sec != 0.0) { + ret->value.dur.sec = MODULO(ret->value.dur.sec, SECS_PER_DAY); + /* + * Our function MODULO always gives us a positive value, so + * if we end up with a "-ve" carry we need to adjust it + * appropriately (bug 154021) + */ + if ((carry < 0) && (ret->value.dur.sec != 0)) { + /* change seconds to equiv negative modulus */ + ret->value.dur.sec = ret->value.dur.sec - SECS_PER_DAY; + carry++; + } + } + + /* days */ + ret->value.dur.day = x->value.dur.day + y->value.dur.day + carry; + + /* + * are the results indeterminate? i.e. how do you subtract days from + * months or years? + */ + if ((((ret->value.dur.day > 0) || (ret->value.dur.sec > 0)) && + (ret->value.dur.mon < 0)) || + (((ret->value.dur.day < 0) || (ret->value.dur.sec < 0)) && + (ret->value.dur.mon > 0))) { + return 0; + } + return 1; +} + +/** + * _exsltDateAddDuration: + * @x: an #exsltDateValPtr of type #XS_DURATION + * @y: an #exsltDateValPtr of type #XS_DURATION + * + * Compute a new duration from @x and @y. + * + * Returns date/time pointer or NULL. + */ +static exsltDateValPtr +_exsltDateAddDuration (exsltDateValPtr x, exsltDateValPtr y) +{ + exsltDateValPtr ret; + + if ((x == NULL) || (y == NULL)) + return NULL; + + ret = exsltDateCreateDate(XS_DURATION); + if (ret == NULL) + return NULL; + + if (_exsltDateAddDurCalc(ret, x, y)) + return ret; + + exsltDateFreeDate(ret); + return NULL; +} + +/**************************************************************** + * * + * EXSLT - Dates and Times functions * + * * + ****************************************************************/ + +/** + * exsltDateDateTime: + * + * Implements the EXSLT - Dates and Times date-time() function: + * string date:date-time() + * + * Returns the current date and time as a date/time string. + */ +static xmlChar * +exsltDateDateTime (void) +{ + xmlChar *ret = NULL; +#ifdef WITH_TIME + exsltDateValPtr cur; + + cur = exsltDateCurrent(); + if (cur != NULL) { + ret = exsltDateFormatDateTime(&(cur->value.date)); + exsltDateFreeDate(cur); + } +#endif + + return ret; +} + +/** + * exsltDateDate: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Times date() function: + * string date:date (string?) + * + * Returns the date specified in the date/time string given as the + * argument. If no argument is given, then the current local + * date/time, as returned by date:date-time is used as a default + * argument. + * The date/time string specified as an argument must be a string in + * the format defined as the lexical representation of either + * xs:dateTime or xs:date. If the argument is not in either of these + * formats, returns NULL. + */ +static xmlChar * +exsltDateDate (const xmlChar *dateTime) +{ + exsltDateValPtr dt = NULL; + xmlChar *ret = NULL; + + if (dateTime == NULL) { +#ifdef WITH_TIME + dt = exsltDateCurrent(); + if (dt == NULL) +#endif + return NULL; + } else { + dt = exsltDateParse(dateTime); + if (dt == NULL) + return NULL; + if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE)) { + exsltDateFreeDate(dt); + return NULL; + } + } + + ret = exsltDateFormatDate(&(dt->value.date)); + exsltDateFreeDate(dt); + + return ret; +} + +/** + * exsltDateTime: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Times time() function: + * string date:time (string?) + * + * Returns the time specified in the date/time string given as the + * argument. If no argument is given, then the current local + * date/time, as returned by date:date-time is used as a default + * argument. + * The date/time string specified as an argument must be a string in + * the format defined as the lexical representation of either + * xs:dateTime or xs:time. If the argument is not in either of these + * formats, returns NULL. + */ +static xmlChar * +exsltDateTime (const xmlChar *dateTime) +{ + exsltDateValPtr dt = NULL; + xmlChar *ret = NULL; + + if (dateTime == NULL) { +#ifdef WITH_TIME + dt = exsltDateCurrent(); + if (dt == NULL) +#endif + return NULL; + } else { + dt = exsltDateParse(dateTime); + if (dt == NULL) + return NULL; + if ((dt->type != XS_DATETIME) && (dt->type != XS_TIME)) { + exsltDateFreeDate(dt); + return NULL; + } + } + + ret = exsltDateFormatTime(&(dt->value.date)); + exsltDateFreeDate(dt); + + return ret; +} + +/** + * exsltDateYear: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Times year() function + * number date:year (string?) + * Returns the year of a date as a number. If no argument is given, + * then the current local date/time, as returned by date:date-time is + * used as a default argument. + * The date/time string specified as the first argument must be a + * right-truncated string in the format defined as the lexical + * representation of xs:dateTime in one of the formats defined in [XML + * Schema Part 2: Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * - xs:gYearMonth (CCYY-MM) + * - xs:gYear (CCYY) + * If the date/time string is not in one of these formats, then NaN is + * returned. + */ +static double +exsltDateYear (const xmlChar *dateTime) +{ + exsltDateValPtr dt; + double ret; + + if (dateTime == NULL) { +#ifdef WITH_TIME + dt = exsltDateCurrent(); + if (dt == NULL) +#endif + return xmlXPathNAN; + } else { + dt = exsltDateParse(dateTime); + if (dt == NULL) + return xmlXPathNAN; + if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE) && + (dt->type != XS_GYEARMONTH) && (dt->type != XS_GYEAR)) { + exsltDateFreeDate(dt); + return xmlXPathNAN; + } + } + + ret = (double) dt->value.date.year; + exsltDateFreeDate(dt); + + return ret; +} + +/** + * exsltDateLeapYear: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Times leap-year() function: + * boolean date:leap-yea (string?) + * Returns true if the year given in a date is a leap year. If no + * argument is given, then the current local date/time, as returned by + * date:date-time is used as a default argument. + * The date/time string specified as the first argument must be a + * right-truncated string in the format defined as the lexical + * representation of xs:dateTime in one of the formats defined in [XML + * Schema Part 2: Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * - xs:gYearMonth (CCYY-MM) + * - xs:gYear (CCYY) + * If the date/time string is not in one of these formats, then NaN is + * returned. + */ +static xmlXPathObjectPtr +exsltDateLeapYear (const xmlChar *dateTime) +{ + double year; + + year = exsltDateYear(dateTime); + if (xmlXPathIsNaN(year)) + return xmlXPathNewFloat(xmlXPathNAN); + + if (IS_LEAP((long)year)) + return xmlXPathNewBoolean(1); + + return xmlXPathNewBoolean(0); +} + +/** + * exsltDateMonthInYear: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Times month-in-year() function: + * number date:month-in-year (string?) + * Returns the month of a date as a number. If no argument is given, + * then the current local date/time, as returned by date:date-time is + * used the default argument. + * The date/time string specified as the argument is a left or + * right-truncated string in the format defined as the lexical + * representation of xs:dateTime in one of the formats defined in [XML + * Schema Part 2: Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * - xs:gYearMonth (CCYY-MM) + * - xs:gMonth (--MM--) + * - xs:gMonthDay (--MM-DD) + * If the date/time string is not in one of these formats, then NaN is + * returned. + */ +static double +exsltDateMonthInYear (const xmlChar *dateTime) +{ + exsltDateValPtr dt; + double ret; + + if (dateTime == NULL) { +#ifdef WITH_TIME + dt = exsltDateCurrent(); + if (dt == NULL) +#endif + return xmlXPathNAN; + } else { + dt = exsltDateParse(dateTime); + if (dt == NULL) + return xmlXPathNAN; + if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE) && + (dt->type != XS_GYEARMONTH) && (dt->type != XS_GMONTH) && + (dt->type != XS_GMONTHDAY)) { + exsltDateFreeDate(dt); + return xmlXPathNAN; + } + } + + ret = (double) dt->value.date.mon; + exsltDateFreeDate(dt); + + return ret; +} + +/** + * exsltDateMonthName: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Time month-name() function + * string date:month-name (string?) + * Returns the full name of the month of a date. If no argument is + * given, then the current local date/time, as returned by + * date:date-time is used the default argument. + * The date/time string specified as the argument is a left or + * right-truncated string in the format defined as the lexical + * representation of xs:dateTime in one of the formats defined in [XML + * Schema Part 2: Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * - xs:gYearMonth (CCYY-MM) + * - xs:gMonth (--MM--) + * If the date/time string is not in one of these formats, then an + * empty string ('') is returned. + * The result is an English month name: one of 'January', 'February', + * 'March', 'April', 'May', 'June', 'July', 'August', 'September', + * 'October', 'November' or 'December'. + */ +static const xmlChar * +exsltDateMonthName (const xmlChar *dateTime) +{ + static const xmlChar monthNames[13][10] = { + { 0 }, + { 'J', 'a', 'n', 'u', 'a', 'r', 'y', 0 }, + { 'F', 'e', 'b', 'r', 'u', 'a', 'r', 'y', 0 }, + { 'M', 'a', 'r', 'c', 'h', 0 }, + { 'A', 'p', 'r', 'i', 'l', 0 }, + { 'M', 'a', 'y', 0 }, + { 'J', 'u', 'n', 'e', 0 }, + { 'J', 'u', 'l', 'y', 0 }, + { 'A', 'u', 'g', 'u', 's', 't', 0 }, + { 'S', 'e', 'p', 't', 'e', 'm', 'b', 'e', 'r', 0 }, + { 'O', 'c', 't', 'o', 'b', 'e', 'r', 0 }, + { 'N', 'o', 'v', 'e', 'm', 'b', 'e', 'r', 0 }, + { 'D', 'e', 'c', 'e', 'm', 'b', 'e', 'r', 0 } + }; + int month; + month = (int) exsltDateMonthInYear(dateTime); + if (!VALID_MONTH(month)) + month = 0; + return monthNames[month]; +} + +/** + * exsltDateMonthAbbreviation: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Time month-abbreviation() function + * string date:month-abbreviation (string?) + * Returns the abbreviation of the month of a date. If no argument is + * given, then the current local date/time, as returned by + * date:date-time is used the default argument. + * The date/time string specified as the argument is a left or + * right-truncated string in the format defined as the lexical + * representation of xs:dateTime in one of the formats defined in [XML + * Schema Part 2: Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * - xs:gYearMonth (CCYY-MM) + * - xs:gMonth (--MM--) + * If the date/time string is not in one of these formats, then an + * empty string ('') is returned. + * The result is an English month abbreviation: one of 'Jan', 'Feb', + * 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov' or + * 'Dec'. + */ +static const xmlChar * +exsltDateMonthAbbreviation (const xmlChar *dateTime) +{ + static const xmlChar monthAbbreviations[13][4] = { + { 0 }, + { 'J', 'a', 'n', 0 }, + { 'F', 'e', 'b', 0 }, + { 'M', 'a', 'r', 0 }, + { 'A', 'p', 'r', 0 }, + { 'M', 'a', 'y', 0 }, + { 'J', 'u', 'n', 0 }, + { 'J', 'u', 'l', 0 }, + { 'A', 'u', 'g', 0 }, + { 'S', 'e', 'p', 0 }, + { 'O', 'c', 't', 0 }, + { 'N', 'o', 'v', 0 }, + { 'D', 'e', 'c', 0 } + }; + int month; + month = (int) exsltDateMonthInYear(dateTime); + if(!VALID_MONTH(month)) + month = 0; + return monthAbbreviations[month]; +} + +/** + * exsltDateWeekInYear: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Times week-in-year() function + * number date:week-in-year (string?) + * Returns the week of the year as a number. If no argument is given, + * then the current local date/time, as returned by date:date-time is + * used as the default argument. For the purposes of numbering, + * counting follows ISO 8601: week 1 in a year is the week containing + * the first Thursday of the year, with new weeks beginning on a + * Monday. + * The date/time string specified as the argument is a right-truncated + * string in the format defined as the lexical representation of + * xs:dateTime in one of the formats defined in [XML Schema Part 2: + * Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * If the date/time string is not in one of these formats, then NaN is + * returned. + */ +static double +exsltDateWeekInYear (const xmlChar *dateTime) +{ + exsltDateValPtr dt; + long diy, diw, year, ret; + + if (dateTime == NULL) { +#ifdef WITH_TIME + dt = exsltDateCurrent(); + if (dt == NULL) +#endif + return xmlXPathNAN; + } else { + dt = exsltDateParse(dateTime); + if (dt == NULL) + return xmlXPathNAN; + if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE)) { + exsltDateFreeDate(dt); + return xmlXPathNAN; + } + } + + diy = DAY_IN_YEAR(dt->value.date.day, dt->value.date.mon, + dt->value.date.year); + + /* + * Determine day-in-week (0=Sun, 1=Mon, etc.) then adjust so Monday + * is the first day-in-week + */ + diw = (_exsltDateDayInWeek(diy, dt->value.date.year) + 6) % 7; + + /* ISO 8601 adjustment, 3 is Thu */ + diy += (3 - diw); + if(diy < 1) { + year = dt->value.date.year - 1; + if(year == 0) year--; + diy = DAY_IN_YEAR(31, 12, year) + diy; + } else if (diy > (long)DAY_IN_YEAR(31, 12, dt->value.date.year)) { + diy -= DAY_IN_YEAR(31, 12, dt->value.date.year); + } + + ret = ((diy - 1) / 7) + 1; + + exsltDateFreeDate(dt); + + return (double) ret; +} + +/** + * exsltDateWeekInMonth: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Times week-in-month() function + * number date:week-in-month (string?) + * The date:week-in-month function returns the week in a month of a + * date as a number. If no argument is given, then the current local + * date/time, as returned by date:date-time is used the default + * argument. For the purposes of numbering, the first day of the month + * is in week 1 and new weeks begin on a Monday (so the first and last + * weeks in a month will often have less than 7 days in them). + * The date/time string specified as the argument is a right-truncated + * string in the format defined as the lexical representation of + * xs:dateTime in one of the formats defined in [XML Schema Part 2: + * Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * If the date/time string is not in one of these formats, then NaN is + * returned. + */ +static double +exsltDateWeekInMonth (const xmlChar *dateTime) +{ + exsltDateValPtr dt; + long fdiy, fdiw, ret; + + if (dateTime == NULL) { +#ifdef WITH_TIME + dt = exsltDateCurrent(); + if (dt == NULL) +#endif + return xmlXPathNAN; + } else { + dt = exsltDateParse(dateTime); + if (dt == NULL) + return xmlXPathNAN; + if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE)) { + exsltDateFreeDate(dt); + return xmlXPathNAN; + } + } + + fdiy = DAY_IN_YEAR(1, dt->value.date.mon, dt->value.date.year); + /* + * Determine day-in-week (0=Sun, 1=Mon, etc.) then adjust so Monday + * is the first day-in-week + */ + fdiw = (_exsltDateDayInWeek(fdiy, dt->value.date.year) + 6) % 7; + + ret = ((dt->value.date.day + fdiw - 1) / 7) + 1; + + exsltDateFreeDate(dt); + + return (double) ret; +} + +/** + * exsltDateDayInYear: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Times day-in-year() function + * number date:day-in-year (string?) + * Returns the day of a date in a year as a number. If no argument is + * given, then the current local date/time, as returned by + * date:date-time is used the default argument. + * The date/time string specified as the argument is a right-truncated + * string in the format defined as the lexical representation of + * xs:dateTime in one of the formats defined in [XML Schema Part 2: + * Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * If the date/time string is not in one of these formats, then NaN is + * returned. + */ +static double +exsltDateDayInYear (const xmlChar *dateTime) +{ + exsltDateValPtr dt; + long ret; + + if (dateTime == NULL) { +#ifdef WITH_TIME + dt = exsltDateCurrent(); + if (dt == NULL) +#endif + return xmlXPathNAN; + } else { + dt = exsltDateParse(dateTime); + if (dt == NULL) + return xmlXPathNAN; + if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE)) { + exsltDateFreeDate(dt); + return xmlXPathNAN; + } + } + + ret = DAY_IN_YEAR(dt->value.date.day, dt->value.date.mon, + dt->value.date.year); + + exsltDateFreeDate(dt); + + return (double) ret; +} + +/** + * exsltDateDayInMonth: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Times day-in-month() function: + * number date:day-in-month (string?) + * Returns the day of a date as a number. If no argument is given, + * then the current local date/time, as returned by date:date-time is + * used the default argument. + * The date/time string specified as the argument is a left or + * right-truncated string in the format defined as the lexical + * representation of xs:dateTime in one of the formats defined in [XML + * Schema Part 2: Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * - xs:gMonthDay (--MM-DD) + * - xs:gDay (---DD) + * If the date/time string is not in one of these formats, then NaN is + * returned. + */ +static double +exsltDateDayInMonth (const xmlChar *dateTime) +{ + exsltDateValPtr dt; + double ret; + + if (dateTime == NULL) { +#ifdef WITH_TIME + dt = exsltDateCurrent(); + if (dt == NULL) +#endif + return xmlXPathNAN; + } else { + dt = exsltDateParse(dateTime); + if (dt == NULL) + return xmlXPathNAN; + if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE) && + (dt->type != XS_GMONTHDAY) && (dt->type != XS_GDAY)) { + exsltDateFreeDate(dt); + return xmlXPathNAN; + } + } + + ret = (double) dt->value.date.day; + exsltDateFreeDate(dt); + + return ret; +} + +/** + * exsltDateDayOfWeekInMonth: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Times day-of-week-in-month() function: + * number date:day-of-week-in-month (string?) + * Returns the day-of-the-week in a month of a date as a number + * (e.g. 3 for the 3rd Tuesday in May). If no argument is + * given, then the current local date/time, as returned by + * date:date-time is used the default argument. + * The date/time string specified as the argument is a right-truncated + * string in the format defined as the lexical representation of + * xs:dateTime in one of the formats defined in [XML Schema Part 2: + * Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * If the date/time string is not in one of these formats, then NaN is + * returned. + */ +static double +exsltDateDayOfWeekInMonth (const xmlChar *dateTime) +{ + exsltDateValPtr dt; + long ret; + + if (dateTime == NULL) { +#ifdef WITH_TIME + dt = exsltDateCurrent(); + if (dt == NULL) +#endif + return xmlXPathNAN; + } else { + dt = exsltDateParse(dateTime); + if (dt == NULL) + return xmlXPathNAN; + if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE)) { + exsltDateFreeDate(dt); + return xmlXPathNAN; + } + } + + ret = ((dt->value.date.day -1) / 7) + 1; + + exsltDateFreeDate(dt); + + return (double) ret; +} + +/** + * exsltDateDayInWeek: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Times day-in-week() function: + * number date:day-in-week (string?) + * Returns the day of the week given in a date as a number. If no + * argument is given, then the current local date/time, as returned by + * date:date-time is used the default argument. + * The date/time string specified as the argument is a left or + * right-truncated string in the format defined as the lexical + * representation of xs:dateTime in one of the formats defined in [XML + * Schema Part 2: Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * If the date/time string is not in one of these formats, then NaN is + * returned. + * The numbering of days of the week starts at 1 for Sunday, 2 for + * Monday and so on up to 7 for Saturday. + */ +static double +exsltDateDayInWeek (const xmlChar *dateTime) +{ + exsltDateValPtr dt; + long diy, ret; + + if (dateTime == NULL) { +#ifdef WITH_TIME + dt = exsltDateCurrent(); + if (dt == NULL) +#endif + return xmlXPathNAN; + } else { + dt = exsltDateParse(dateTime); + if (dt == NULL) + return xmlXPathNAN; + if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE)) { + exsltDateFreeDate(dt); + return xmlXPathNAN; + } + } + + diy = DAY_IN_YEAR(dt->value.date.day, dt->value.date.mon, + dt->value.date.year); + + ret = _exsltDateDayInWeek(diy, dt->value.date.year) + 1; + + exsltDateFreeDate(dt); + + return (double) ret; +} + +/** + * exsltDateDayName: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Time day-name() function + * string date:day-name (string?) + * Returns the full name of the day of the week of a date. If no + * argument is given, then the current local date/time, as returned by + * date:date-time is used the default argument. + * The date/time string specified as the argument is a left or + * right-truncated string in the format defined as the lexical + * representation of xs:dateTime in one of the formats defined in [XML + * Schema Part 2: Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * If the date/time string is not in one of these formats, then an + * empty string ('') is returned. + * The result is an English day name: one of 'Sunday', 'Monday', + * 'Tuesday', 'Wednesday', 'Thursday' or 'Friday'. + */ +static const xmlChar * +exsltDateDayName (const xmlChar *dateTime) +{ + static const xmlChar dayNames[8][10] = { + { 0 }, + { 'S', 'u', 'n', 'd', 'a', 'y', 0 }, + { 'M', 'o', 'n', 'd', 'a', 'y', 0 }, + { 'T', 'u', 'e', 's', 'd', 'a', 'y', 0 }, + { 'W', 'e', 'd', 'n', 'e', 's', 'd', 'a', 'y', 0 }, + { 'T', 'h', 'u', 'r', 's', 'd', 'a', 'y', 0 }, + { 'F', 'r', 'i', 'd', 'a', 'y', 0 }, + { 'S', 'a', 't', 'u', 'r', 'd', 'a', 'y', 0 } + }; + int day; + day = (int) exsltDateDayInWeek(dateTime); + if((day < 1) || (day > 7)) + day = 0; + return dayNames[day]; +} + +/** + * exsltDateDayAbbreviation: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Time day-abbreviation() function + * string date:day-abbreviation (string?) + * Returns the abbreviation of the day of the week of a date. If no + * argument is given, then the current local date/time, as returned by + * date:date-time is used the default argument. + * The date/time string specified as the argument is a left or + * right-truncated string in the format defined as the lexical + * representation of xs:dateTime in one of the formats defined in [XML + * Schema Part 2: Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * If the date/time string is not in one of these formats, then an + * empty string ('') is returned. + * The result is a three-letter English day abbreviation: one of + * 'Sun', 'Mon', 'Tue', 'Wed', 'Thu' or 'Fri'. + */ +static const xmlChar * +exsltDateDayAbbreviation (const xmlChar *dateTime) +{ + static const xmlChar dayAbbreviations[8][4] = { + { 0 }, + { 'S', 'u', 'n', 0 }, + { 'M', 'o', 'n', 0 }, + { 'T', 'u', 'e', 0 }, + { 'W', 'e', 'd', 0 }, + { 'T', 'h', 'u', 0 }, + { 'F', 'r', 'i', 0 }, + { 'S', 'a', 't', 0 } + }; + int day; + day = (int) exsltDateDayInWeek(dateTime); + if((day < 1) || (day > 7)) + day = 0; + return dayAbbreviations[day]; +} + +/** + * exsltDateHourInDay: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Times day-in-month() function: + * number date:day-in-month (string?) + * Returns the hour of the day as a number. If no argument is given, + * then the current local date/time, as returned by date:date-time is + * used the default argument. + * The date/time string specified as the argument is a left or + * right-truncated string in the format defined as the lexical + * representation of xs:dateTime in one of the formats defined in [XML + * Schema Part 2: Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:time (hh:mm:ss) + * If the date/time string is not in one of these formats, then NaN is + * returned. + */ +static double +exsltDateHourInDay (const xmlChar *dateTime) +{ + exsltDateValPtr dt; + double ret; + + if (dateTime == NULL) { +#ifdef WITH_TIME + dt = exsltDateCurrent(); + if (dt == NULL) +#endif + return xmlXPathNAN; + } else { + dt = exsltDateParse(dateTime); + if (dt == NULL) + return xmlXPathNAN; + if ((dt->type != XS_DATETIME) && (dt->type != XS_TIME)) { + exsltDateFreeDate(dt); + return xmlXPathNAN; + } + } + + ret = (double) dt->value.date.hour; + exsltDateFreeDate(dt); + + return ret; +} + +/** + * exsltDateMinuteInHour: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Times day-in-month() function: + * number date:day-in-month (string?) + * Returns the minute of the hour as a number. If no argument is + * given, then the current local date/time, as returned by + * date:date-time is used the default argument. + * The date/time string specified as the argument is a left or + * right-truncated string in the format defined as the lexical + * representation of xs:dateTime in one of the formats defined in [XML + * Schema Part 2: Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:time (hh:mm:ss) + * If the date/time string is not in one of these formats, then NaN is + * returned. + */ +static double +exsltDateMinuteInHour (const xmlChar *dateTime) +{ + exsltDateValPtr dt; + double ret; + + if (dateTime == NULL) { +#ifdef WITH_TIME + dt = exsltDateCurrent(); + if (dt == NULL) +#endif + return xmlXPathNAN; + } else { + dt = exsltDateParse(dateTime); + if (dt == NULL) + return xmlXPathNAN; + if ((dt->type != XS_DATETIME) && (dt->type != XS_TIME)) { + exsltDateFreeDate(dt); + return xmlXPathNAN; + } + } + + ret = (double) dt->value.date.min; + exsltDateFreeDate(dt); + + return ret; +} + +/** + * exsltDateSecondInMinute: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Times second-in-minute() function: + * number date:day-in-month (string?) + * Returns the second of the minute as a number. If no argument is + * given, then the current local date/time, as returned by + * date:date-time is used the default argument. + * The date/time string specified as the argument is a left or + * right-truncated string in the format defined as the lexical + * representation of xs:dateTime in one of the formats defined in [XML + * Schema Part 2: Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:time (hh:mm:ss) + * If the date/time string is not in one of these formats, then NaN is + * returned. + * + * Returns the second or NaN. + */ +static double +exsltDateSecondInMinute (const xmlChar *dateTime) +{ + exsltDateValPtr dt; + double ret; + + if (dateTime == NULL) { +#ifdef WITH_TIME + dt = exsltDateCurrent(); + if (dt == NULL) +#endif + return xmlXPathNAN; + } else { + dt = exsltDateParse(dateTime); + if (dt == NULL) + return xmlXPathNAN; + if ((dt->type != XS_DATETIME) && (dt->type != XS_TIME)) { + exsltDateFreeDate(dt); + return xmlXPathNAN; + } + } + + ret = dt->value.date.sec; + exsltDateFreeDate(dt); + + return ret; +} + +/** + * exsltDateAdd: + * @xstr: date/time string + * @ystr: date/time string + * + * Implements the date:add (string,string) function which returns the + * date/time * resulting from adding a duration to a date/time. + * The first argument (@xstr) must be right-truncated date/time + * strings in one of the formats defined in [XML Schema Part 2: + * Datatypes]. The permitted formats are as follows: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * - xs:gYearMonth (CCYY-MM) + * - xs:gYear (CCYY) + * The second argument (@ystr) is a string in the format defined for + * xs:duration in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. + * The return value is a right-truncated date/time strings in one of + * the formats defined in [XML Schema Part 2: Datatypes] and listed + * above. This value is calculated using the algorithm described in + * [Appendix E Adding durations to dateTimes] of [XML Schema Part 2: + * Datatypes]. + + * Returns date/time string or NULL. + */ +static xmlChar * +exsltDateAdd (const xmlChar *xstr, const xmlChar *ystr) +{ + exsltDateValPtr dt, dur, res; + xmlChar *ret; + + if ((xstr == NULL) || (ystr == NULL)) + return NULL; + + dt = exsltDateParse(xstr); + if (dt == NULL) + return NULL; + else if ((dt->type < XS_GYEAR) || (dt->type > XS_DATETIME)) { + exsltDateFreeDate(dt); + return NULL; + } + + dur = exsltDateParseDuration(ystr); + if (dur == NULL) { + exsltDateFreeDate(dt); + return NULL; + } + + res = _exsltDateAdd(dt, dur); + + exsltDateFreeDate(dt); + exsltDateFreeDate(dur); + + if (res == NULL) + return NULL; + + ret = exsltDateFormat(res); + exsltDateFreeDate(res); + + return ret; +} + +/** + * exsltDateAddDuration: + * @xstr: first duration string + * @ystr: second duration string + * + * Implements the date:add-duration (string,string) function which returns + * the duration resulting from adding two durations together. + * Both arguments are strings in the format defined for xs:duration + * in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. If either + * argument is not in this format, the function returns an empty string + * (''). + * The return value is a string in the format defined for xs:duration + * in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. + * The durations can usually be added by summing the numbers given for + * each of the components in the durations. However, if the durations + * are differently signed, then this sometimes results in durations + * that are impossible to express in this syntax (e.g. 'P1M' + '-P1D'). + * In these cases, the function returns an empty string (''). + * + * Returns duration string or NULL. + */ +static xmlChar * +exsltDateAddDuration (const xmlChar *xstr, const xmlChar *ystr) +{ + exsltDateValPtr x, y, res; + xmlChar *ret; + + if ((xstr == NULL) || (ystr == NULL)) + return NULL; + + x = exsltDateParseDuration(xstr); + if (x == NULL) + return NULL; + + y = exsltDateParseDuration(ystr); + if (y == NULL) { + exsltDateFreeDate(x); + return NULL; + } + + res = _exsltDateAddDuration(x, y); + + exsltDateFreeDate(x); + exsltDateFreeDate(y); + + if (res == NULL) + return NULL; + + ret = exsltDateFormatDuration(&(res->value.dur)); + exsltDateFreeDate(res); + + return ret; +} + +/** + * exsltDateSumFunction: + * @ns: a node set of duration strings + * + * The date:sum function adds a set of durations together. + * The string values of the nodes in the node set passed as an argument + * are interpreted as durations and added together as if using the + * date:add-duration function. (from exslt.org) + * + * The return value is a string in the format defined for xs:duration + * in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. + * The durations can usually be added by summing the numbers given for + * each of the components in the durations. However, if the durations + * are differently signed, then this sometimes results in durations + * that are impossible to express in this syntax (e.g. 'P1M' + '-P1D'). + * In these cases, the function returns an empty string (''). + * + * Returns duration string or NULL. + */ +static void +exsltDateSumFunction (xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlNodeSetPtr ns; + void *user = NULL; + xmlChar *tmp; + exsltDateValPtr x, total; + xmlChar *ret; + int i; + + if (nargs != 1) { + xmlXPathSetArityError (ctxt); + return; + } + + /* We need to delay the freeing of value->user */ + if ((ctxt->value != NULL) && ctxt->value->boolval != 0) { + user = ctxt->value->user; + ctxt->value->boolval = 0; + ctxt->value->user = NULL; + } + + ns = xmlXPathPopNodeSet (ctxt); + if (xmlXPathCheckError (ctxt)) + return; + + if ((ns == NULL) || (ns->nodeNr == 0)) { + xmlXPathReturnEmptyString (ctxt); + if (ns != NULL) + xmlXPathFreeNodeSet (ns); + return; + } + + total = exsltDateCreateDate (XS_DURATION); + if (total == NULL) { + xmlXPathFreeNodeSet (ns); + return; + } + + for (i = 0; i < ns->nodeNr; i++) { + int result; + tmp = xmlXPathCastNodeToString (ns->nodeTab[i]); + if (tmp == NULL) { + xmlXPathFreeNodeSet (ns); + exsltDateFreeDate (total); + return; + } + + x = exsltDateParseDuration (tmp); + if (x == NULL) { + xmlFree (tmp); + exsltDateFreeDate (total); + xmlXPathFreeNodeSet (ns); + xmlXPathReturnEmptyString (ctxt); + return; + } + + result = _exsltDateAddDurCalc(total, total, x); + + exsltDateFreeDate (x); + xmlFree (tmp); + if (!result) { + exsltDateFreeDate (total); + xmlXPathFreeNodeSet (ns); + xmlXPathReturnEmptyString (ctxt); + return; + } + } + + ret = exsltDateFormatDuration (&(total->value.dur)); + exsltDateFreeDate (total); + + xmlXPathFreeNodeSet (ns); + if (user != NULL) + xmlFreeNodeList ((xmlNodePtr) user); + + if (ret == NULL) + xmlXPathReturnEmptyString (ctxt); + else + xmlXPathReturnString (ctxt, ret); +} + +/** + * exsltDateSeconds: + * @dateTime: a date/time string + * + * Implements the EXSLT - Dates and Times seconds() function: + * number date:seconds(string?) + * The date:seconds function returns the number of seconds specified + * by the argument string. If no argument is given, then the current + * local date/time, as returned by exsltDateCurrent() is used as the + * default argument. If the date/time string is a xs:duration, then the + * years and months must be zero (or not present). Parsing a duration + * converts the fields to seconds. If the date/time string is not a + * duration (and not null), then the legal formats are: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * - xs:gYearMonth (CCYY-MM) + * - xs:gYear (CCYY) + * In these cases the difference between the @dateTime and + * 1970-01-01T00:00:00Z is calculated and converted to seconds. + * + * Note that there was some confusion over whether "difference" meant + * that a dateTime of 1970-01-01T00:00:01Z should be a positive one or + * a negative one. After correspondence with exslt.org, it was determined + * that the intent of the specification was to have it positive. The + * coding was modified in July 2003 to reflect this. + * + * Returns seconds or Nan. + */ +static double +exsltDateSeconds (const xmlChar *dateTime) +{ + exsltDateValPtr dt; + double ret = xmlXPathNAN; + + if (dateTime == NULL) { +#ifdef WITH_TIME + dt = exsltDateCurrent(); + if (dt == NULL) +#endif + return xmlXPathNAN; + } else { + dt = exsltDateParseDuration(dateTime); + if (dt == NULL) + dt = exsltDateParse(dateTime); + } + + if (dt == NULL) + return xmlXPathNAN; + + if ((dt->type <= XS_DATETIME) && (dt->type >= XS_GYEAR)) { + exsltDateValPtr y, dur; + + /* + * compute the difference between the given (or current) date + * and epoch date + */ + y = exsltDateCreateDate(XS_DATETIME); + if (y != NULL) { + y->value.date.year = 1970; + y->value.date.mon = 1; + y->value.date.day = 1; + y->value.date.tz_flag = 1; + + dur = _exsltDateDifference(y, dt, 1); + if (dur != NULL) { + ret = exsltDateCastDateToNumber(dur); + exsltDateFreeDate(dur); + } + exsltDateFreeDate(y); + } + + } else if ((dt->type == XS_DURATION) && (dt->value.dur.mon == 0)) + ret = exsltDateCastDateToNumber(dt); + + exsltDateFreeDate(dt); + + return ret; +} + +/** + * exsltDateDifference: + * @xstr: date/time string + * @ystr: date/time string + * + * Implements the date:difference (string,string) function which returns + * the duration between the first date and the second date. If the first + * date occurs before the second date, then the result is a positive + * duration; if it occurs after the second date, the result is a + * negative duration. The two dates must both be right-truncated + * date/time strings in one of the formats defined in [XML Schema Part + * 2: Datatypes]. The date/time with the most specific format (i.e. the + * least truncation) is converted into the same format as the date with + * the least specific format (i.e. the most truncation). The permitted + * formats are as follows, from most specific to least specific: + * - xs:dateTime (CCYY-MM-DDThh:mm:ss) + * - xs:date (CCYY-MM-DD) + * - xs:gYearMonth (CCYY-MM) + * - xs:gYear (CCYY) + * If either of the arguments is not in one of these formats, + * date:difference returns the empty string (''). + * The difference between the date/times is returned as a string in the + * format defined for xs:duration in [3.2.6 duration] of [XML Schema + * Part 2: Datatypes]. + * If the date/time string with the least specific format is in either + * xs:gYearMonth or xs:gYear format, then the number of days, hours, + * minutes and seconds in the duration string must be equal to zero. + * (The format of the string will be PnYnM.) The number of months + * specified in the duration must be less than 12. + * Otherwise, the number of years and months in the duration string + * must be equal to zero. (The format of the string will be + * PnDTnHnMnS.) The number of seconds specified in the duration string + * must be less than 60; the number of minutes must be less than 60; + * the number of hours must be less than 24. + * + * Returns duration string or NULL. + */ +static xmlChar * +exsltDateDifference (const xmlChar *xstr, const xmlChar *ystr) +{ + exsltDateValPtr x, y, dur; + xmlChar *ret = NULL; + + if ((xstr == NULL) || (ystr == NULL)) + return NULL; + + x = exsltDateParse(xstr); + if (x == NULL) + return NULL; + + y = exsltDateParse(ystr); + if (y == NULL) { + exsltDateFreeDate(x); + return NULL; + } + + if (((x->type < XS_GYEAR) || (x->type > XS_DATETIME)) || + ((y->type < XS_GYEAR) || (y->type > XS_DATETIME))) { + exsltDateFreeDate(x); + exsltDateFreeDate(y); + return NULL; + } + + dur = _exsltDateDifference(x, y, 0); + + exsltDateFreeDate(x); + exsltDateFreeDate(y); + + if (dur == NULL) + return NULL; + + ret = exsltDateFormatDuration(&(dur->value.dur)); + exsltDateFreeDate(dur); + + return ret; +} + +/** + * exsltDateDuration: + * @number: a xmlChar string + * + * Implements the The date:duration function returns a duration string + * representing the number of seconds specified by the argument string. + * If no argument is given, then the result of calling date:seconds + * without any arguments is used as a default argument. + * The duration is returned as a string in the format defined for + * xs:duration in [3.2.6 duration] of [XML Schema Part 2: Datatypes]. + * The number of years and months in the duration string must be equal + * to zero. (The format of the string will be PnDTnHnMnS.) The number + * of seconds specified in the duration string must be less than 60; + * the number of minutes must be less than 60; the number of hours must + * be less than 24. + * If the argument is Infinity, -Infinity or NaN, then date:duration + * returns an empty string (''). + * + * Returns duration string or NULL. + */ +static xmlChar * +exsltDateDuration (const xmlChar *number) +{ + exsltDateValPtr dur; + double secs; + xmlChar *ret; + + if (number == NULL) + secs = exsltDateSeconds(number); + else + secs = xmlXPathCastStringToNumber(number); + + if ((xmlXPathIsNaN(secs)) || (xmlXPathIsInf(secs))) + return NULL; + + dur = exsltDateCreateDate(XS_DURATION); + if (dur == NULL) + return NULL; + + dur->value.dur.sec = secs; + + ret = exsltDateFormatDuration(&(dur->value.dur)); + exsltDateFreeDate(dur); + + return ret; +} + +/**************************************************************** + * * + * Wrappers for use by the XPath engine * + * * + ****************************************************************/ + +#ifdef WITH_TIME +/** + * exsltDateDateTimeFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateDateTime() for use by the XPath engine. + */ +static void +exsltDateDateTimeFunction (xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlChar *ret; + + if (nargs != 0) { + xmlXPathSetArityError(ctxt); + return; + } + + ret = exsltDateDateTime(); + if (ret == NULL) + xmlXPathReturnEmptyString(ctxt); + else + xmlXPathReturnString(ctxt, ret); +} +#endif + +/** + * exsltDateDateFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateDate() for use by the XPath engine. + */ +static void +exsltDateDateFunction (xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlChar *ret, *dt = NULL; + + if ((nargs < 0) || (nargs > 1)) { + xmlXPathSetArityError(ctxt); + return; + } + if (nargs == 1) { + dt = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + } + + ret = exsltDateDate(dt); + + if (ret == NULL) { + xsltGenericDebug(xsltGenericDebugContext, + "{http://exslt.org/dates-and-times}date: " + "invalid date or format %s\n", dt); + xmlXPathReturnEmptyString(ctxt); + } else { + xmlXPathReturnString(ctxt, ret); + } + + if (dt != NULL) + xmlFree(dt); +} + +/** + * exsltDateTimeFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateTime() for use by the XPath engine. + */ +static void +exsltDateTimeFunction (xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlChar *ret, *dt = NULL; + + if ((nargs < 0) || (nargs > 1)) { + xmlXPathSetArityError(ctxt); + return; + } + if (nargs == 1) { + dt = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + } + + ret = exsltDateTime(dt); + + if (ret == NULL) { + xsltGenericDebug(xsltGenericDebugContext, + "{http://exslt.org/dates-and-times}time: " + "invalid date or format %s\n", dt); + xmlXPathReturnEmptyString(ctxt); + } else { + xmlXPathReturnString(ctxt, ret); + } + + if (dt != NULL) + xmlFree(dt); +} + +/** + * exsltDateYearFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateYear() for use by the XPath engine. + */ +static void +exsltDateYearFunction (xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlChar *dt = NULL; + double ret; + + if ((nargs < 0) || (nargs > 1)) { + xmlXPathSetArityError(ctxt); + return; + } + + if (nargs == 1) { + dt = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + } + + ret = exsltDateYear(dt); + + if (dt != NULL) + xmlFree(dt); + + xmlXPathReturnNumber(ctxt, ret); +} + +/** + * exsltDateLeapYearFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateLeapYear() for use by the XPath engine. + */ +static void +exsltDateLeapYearFunction (xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlChar *dt = NULL; + xmlXPathObjectPtr ret; + + if ((nargs < 0) || (nargs > 1)) { + xmlXPathSetArityError(ctxt); + return; + } + + if (nargs == 1) { + dt = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + } + + ret = exsltDateLeapYear(dt); + + if (dt != NULL) + xmlFree(dt); + + valuePush(ctxt, ret); +} + +#define X_IN_Y(x, y) \ +static void \ +exsltDate##x##In##y##Function (xmlXPathParserContextPtr ctxt, \ + int nargs) { \ + xmlChar *dt = NULL; \ + double ret; \ + \ + if ((nargs < 0) || (nargs > 1)) { \ + xmlXPathSetArityError(ctxt); \ + return; \ + } \ + \ + if (nargs == 1) { \ + dt = xmlXPathPopString(ctxt); \ + if (xmlXPathCheckError(ctxt)) { \ + xmlXPathSetTypeError(ctxt); \ + return; \ + } \ + } \ + \ + ret = exsltDate##x##In##y(dt); \ + \ + if (dt != NULL) \ + xmlFree(dt); \ + \ + xmlXPathReturnNumber(ctxt, ret); \ +} + +/** + * exsltDateMonthInYearFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateMonthInYear() for use by the XPath engine. + */ +X_IN_Y(Month,Year) + +/** + * exsltDateMonthNameFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateMonthName() for use by the XPath engine. + */ +static void +exsltDateMonthNameFunction (xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlChar *dt = NULL; + const xmlChar *ret; + + if ((nargs < 0) || (nargs > 1)) { + xmlXPathSetArityError(ctxt); + return; + } + + if (nargs == 1) { + dt = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + } + + ret = exsltDateMonthName(dt); + + if (dt != NULL) + xmlFree(dt); + + if (ret == NULL) + xmlXPathReturnEmptyString(ctxt); + else + xmlXPathReturnString(ctxt, xmlStrdup(ret)); +} + +/** + * exsltDateMonthAbbreviationFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateMonthAbbreviation() for use by the XPath engine. + */ +static void +exsltDateMonthAbbreviationFunction (xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlChar *dt = NULL; + const xmlChar *ret; + + if ((nargs < 0) || (nargs > 1)) { + xmlXPathSetArityError(ctxt); + return; + } + + if (nargs == 1) { + dt = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + } + + ret = exsltDateMonthAbbreviation(dt); + + if (dt != NULL) + xmlFree(dt); + + if (ret == NULL) + xmlXPathReturnEmptyString(ctxt); + else + xmlXPathReturnString(ctxt, xmlStrdup(ret)); +} + +/** + * exsltDateWeekInYearFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateWeekInYear() for use by the XPath engine. + */ +X_IN_Y(Week,Year) + +/** + * exsltDateWeekInMonthFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateWeekInMonthYear() for use by the XPath engine. + */ +X_IN_Y(Week,Month) + +/** + * exsltDateDayInYearFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateDayInYear() for use by the XPath engine. + */ +X_IN_Y(Day,Year) + +/** + * exsltDateDayInMonthFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateDayInMonth() for use by the XPath engine. + */ +X_IN_Y(Day,Month) + +/** + * exsltDateDayOfWeekInMonthFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDayOfWeekInMonth() for use by the XPath engine. + */ +X_IN_Y(DayOfWeek,Month) + +/** + * exsltDateDayInWeekFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateDayInWeek() for use by the XPath engine. + */ +X_IN_Y(Day,Week) + +/** + * exsltDateDayNameFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateDayName() for use by the XPath engine. + */ +static void +exsltDateDayNameFunction (xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlChar *dt = NULL; + const xmlChar *ret; + + if ((nargs < 0) || (nargs > 1)) { + xmlXPathSetArityError(ctxt); + return; + } + + if (nargs == 1) { + dt = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + } + + ret = exsltDateDayName(dt); + + if (dt != NULL) + xmlFree(dt); + + if (ret == NULL) + xmlXPathReturnEmptyString(ctxt); + else + xmlXPathReturnString(ctxt, xmlStrdup(ret)); +} + +/** + * exsltDateMonthDayFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateDayAbbreviation() for use by the XPath engine. + */ +static void +exsltDateDayAbbreviationFunction (xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlChar *dt = NULL; + const xmlChar *ret; + + if ((nargs < 0) || (nargs > 1)) { + xmlXPathSetArityError(ctxt); + return; + } + + if (nargs == 1) { + dt = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + } + + ret = exsltDateDayAbbreviation(dt); + + if (dt != NULL) + xmlFree(dt); + + if (ret == NULL) + xmlXPathReturnEmptyString(ctxt); + else + xmlXPathReturnString(ctxt, xmlStrdup(ret)); +} + + +/** + * exsltDateHourInDayFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateHourInDay() for use by the XPath engine. + */ +X_IN_Y(Hour,Day) + +/** + * exsltDateMinuteInHourFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateMinuteInHour() for use by the XPath engine. + */ +X_IN_Y(Minute,Hour) + +/** + * exsltDateSecondInMinuteFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateSecondInMinute() for use by the XPath engine. + */ +X_IN_Y(Second,Minute) + +/** + * exsltDateSecondsFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateSeconds() for use by the XPath engine. + */ +static void +exsltDateSecondsFunction (xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlChar *str = NULL; + double ret; + + if (nargs > 1) { + xmlXPathSetArityError(ctxt); + return; + } + + if (nargs == 1) { + str = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + } + + ret = exsltDateSeconds(str); + if (str != NULL) + xmlFree(str); + + xmlXPathReturnNumber(ctxt, ret); +} + +/** + * exsltDateAddFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps exsltDateAdd() for use by the XPath processor. + */ +static void +exsltDateAddFunction (xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlChar *ret, *xstr, *ystr; + + if (nargs != 2) { + xmlXPathSetArityError(ctxt); + return; + } + ystr = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + xstr = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlFree(ystr); + return; + } + + ret = exsltDateAdd(xstr, ystr); + + xmlFree(ystr); + xmlFree(xstr); + + if (ret == NULL) + xmlXPathReturnEmptyString(ctxt); + else + xmlXPathReturnString(ctxt, ret); +} + +/** + * exsltDateAddDurationFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps exsltDateAddDuration() for use by the XPath processor. + */ +static void +exsltDateAddDurationFunction (xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlChar *ret, *xstr, *ystr; + + if (nargs != 2) { + xmlXPathSetArityError(ctxt); + return; + } + ystr = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + xstr = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlFree(ystr); + return; + } + + ret = exsltDateAddDuration(xstr, ystr); + + xmlFree(ystr); + xmlFree(xstr); + + if (ret == NULL) + xmlXPathReturnEmptyString(ctxt); + else + xmlXPathReturnString(ctxt, ret); +} + +/** + * exsltDateDifferenceFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps exsltDateDifference() for use by the XPath processor. + */ +static void +exsltDateDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlChar *ret, *xstr, *ystr; + + if (nargs != 2) { + xmlXPathSetArityError(ctxt); + return; + } + ystr = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + xstr = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlFree(ystr); + return; + } + + ret = exsltDateDifference(xstr, ystr); + + xmlFree(ystr); + xmlFree(xstr); + + if (ret == NULL) + xmlXPathReturnEmptyString(ctxt); + else + xmlXPathReturnString(ctxt, ret); +} + +/** + * exsltDateDurationFunction: + * @ctxt: an XPath parser context + * @nargs : the number of arguments + * + * Wraps exsltDateDuration() for use by the XPath engine + */ +static void +exsltDateDurationFunction (xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlChar *ret; + xmlChar *number = NULL; + + if ((nargs < 0) || (nargs > 1)) { + xmlXPathSetArityError(ctxt); + return; + } + + if (nargs == 1) { + number = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + } + + ret = exsltDateDuration(number); + + if (number != NULL) + xmlFree(number); + + if (ret == NULL) + xmlXPathReturnEmptyString(ctxt); + else + xmlXPathReturnString(ctxt, ret); +} + +/** + * exsltDateRegister: + * + * Registers the EXSLT - Dates and Times module + */ +void +exsltDateRegister (void) +{ + xsltRegisterExtModuleFunction ((const xmlChar *) "add", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateAddFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "add-duration", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateAddDurationFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "date", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDateFunction); +#ifdef WITH_TIME + xsltRegisterExtModuleFunction ((const xmlChar *) "date-time", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDateTimeFunction); +#endif + xsltRegisterExtModuleFunction ((const xmlChar *) "day-abbreviation", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDayAbbreviationFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "day-in-month", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDayInMonthFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "day-in-week", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDayInWeekFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "day-in-year", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDayInYearFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "day-name", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDayNameFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "day-of-week-in-month", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDayOfWeekInMonthFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "difference", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDifferenceFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "duration", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDurationFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "hour-in-day", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateHourInDayFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "leap-year", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateLeapYearFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "minute-in-hour", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateMinuteInHourFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "month-abbreviation", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateMonthAbbreviationFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "month-in-year", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateMonthInYearFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "month-name", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateMonthNameFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "second-in-minute", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateSecondInMinuteFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "seconds", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateSecondsFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "sum", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateSumFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "time", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateTimeFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "week-in-month", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateWeekInMonthFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "week-in-year", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateWeekInYearFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "year", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateYearFunction); +} + +/** + * exsltDateXpathCtxtRegister: + * + * Registers the EXSLT - Dates and Times module for use outside XSLT + */ +int +exsltDateXpathCtxtRegister (xmlXPathContextPtr ctxt, const xmlChar *prefix) +{ + if (ctxt + && prefix + && !xmlXPathRegisterNs(ctxt, + prefix, + (const xmlChar *) EXSLT_DATE_NAMESPACE) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "add", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateAddFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "add-duration", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateAddDurationFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "date", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDateFunction) +#ifdef WITH_TIME + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "date-time", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDateTimeFunction) +#endif + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "day-abbreviation", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDayAbbreviationFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "day-in-month", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDayInMonthFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "day-in-week", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDayInWeekFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "day-in-year", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDayInYearFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "day-name", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDayNameFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "day-of-week-in-month", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDayOfWeekInMonthFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "difference", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDifferenceFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "duration", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateDurationFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "hour-in-day", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateHourInDayFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "leap-year", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateLeapYearFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "minute-in-hour", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateMinuteInHourFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "month-abbreviation", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateMonthAbbreviationFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "month-in-year", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateMonthInYearFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "month-name", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateMonthNameFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "second-in-minute", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateSecondInMinuteFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "seconds", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateSecondsFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "sum", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateSumFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "time", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateTimeFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "week-in-month", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateWeekInMonthFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "week-in-year", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateWeekInYearFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "year", + (const xmlChar *) EXSLT_DATE_NAMESPACE, + exsltDateYearFunction)) { + return 0; + } + return -1; +} diff --git a/libexslt/dynamic.c b/libexslt/dynamic.c new file mode 100644 index 0000000..7b95fc5 --- /dev/null +++ b/libexslt/dynamic.c @@ -0,0 +1,304 @@ +/* + * dynamic.c: Implementation of the EXSLT -- Dynamic module + * + * References: + * http://www.exslt.org/dyn/dyn.html + * + * See Copyright for the status of this software. + * + * Authors: + * Mark Vakoc + * Thomas Broyer + * + * TODO: + * elements: + * functions: + * min + * max + * sum + * map + * closure + */ + +#define IN_LIBEXSLT +#include "libexslt/libexslt.h" + +#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__) +#include +#else +#include "config.h" +#endif + +#include +#include +#include + +#include +#include +#include +#include + +#include "exslt.h" + +/** + * exsltDynEvaluateFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Evaluates the string as an XPath expression and returns the result + * value, which may be a boolean, number, string, node set, result tree + * fragment or external object. + */ + +static void +exsltDynEvaluateFunction(xmlXPathParserContextPtr ctxt, int nargs) { + xmlChar *str = NULL; + xmlXPathObjectPtr ret = NULL; + + if (ctxt == NULL) + return; + if (nargs != 1) { + xsltPrintErrorContext(xsltXPathGetTransformContext(ctxt), NULL, NULL); + xsltGenericError(xsltGenericErrorContext, + "dyn:evalute() : invalid number of args %d\n", nargs); + ctxt->error = XPATH_INVALID_ARITY; + return; + } + str = xmlXPathPopString(ctxt); + /* return an empty node-set if an empty string is passed in */ + if (!str||!xmlStrlen(str)) { + if (str) xmlFree(str); + valuePush(ctxt,xmlXPathNewNodeSet(NULL)); + return; + } + ret = xmlXPathEval(str,ctxt->context); + if (ret) + valuePush(ctxt,ret); + else { + xsltGenericError(xsltGenericErrorContext, + "dyn:evaluate() : unable to evaluate expression '%s'\n",str); + valuePush(ctxt,xmlXPathNewNodeSet(NULL)); + } + xmlFree(str); + return; +} + +/** + * exsltDynMapFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Evaluates the string as an XPath expression and returns the result + * value, which may be a boolean, number, string, node set, result tree + * fragment or external object. + */ + +static void +exsltDynMapFunction(xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlChar *str = NULL; + xmlNodeSetPtr nodeset = NULL; + xsltTransformContextPtr tctxt; + xmlXPathCompExprPtr comp = NULL; + xmlXPathObjectPtr ret = NULL; + xmlDocPtr oldDoc, container = NULL; + xmlNodePtr oldNode; + int oldContextSize; + int oldProximityPosition; + int i, j; + + + if (nargs != 2) { + xmlXPathSetArityError(ctxt); + return; + } + str = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + + nodeset = xmlXPathPopNodeSet(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + if (str == NULL || !xmlStrlen(str) || !(comp = xmlXPathCompile(str))) { + if (nodeset != NULL) + xmlXPathFreeNodeSet(nodeset); + if (str != NULL) + xmlFree(str); + valuePush(ctxt, xmlXPathNewNodeSet(NULL)); + return; + } + + ret = xmlXPathNewNodeSet(NULL); + if (ret == NULL) { + xsltGenericError(xsltGenericErrorContext, + "exsltDynMapFunction: ret == NULL\n"); + goto cleanup; + } + + oldDoc = ctxt->context->doc; + oldNode = ctxt->context->node; + oldContextSize = ctxt->context->contextSize; + oldProximityPosition = ctxt->context->proximityPosition; + + /** + * since we really don't know we're going to be adding node(s) + * down the road we create the RVT regardless + */ + tctxt = xsltXPathGetTransformContext(ctxt); + if (tctxt == NULL) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "dyn:map : internal error tctxt == NULL\n"); + goto cleanup; + } + container = xsltCreateRVT(tctxt); + if (container == NULL) { + xsltTransformError(tctxt, NULL, NULL, + "dyn:map : internal error container == NULL\n"); + goto cleanup; + } + xsltRegisterLocalRVT(tctxt, container); + if (nodeset && nodeset->nodeNr > 0) { + xmlXPathNodeSetSort(nodeset); + ctxt->context->contextSize = nodeset->nodeNr; + ctxt->context->proximityPosition = 0; + for (i = 0; i < nodeset->nodeNr; i++) { + xmlXPathObjectPtr subResult = NULL; + xmlNodePtr cur = nodeset->nodeTab[i]; + + ctxt->context->proximityPosition++; + ctxt->context->node = cur; + + if (cur->type == XML_NAMESPACE_DECL) { + /* + * The XPath module sets the owner element of a ns-node on + * the ns->next field. + */ + cur = (xmlNodePtr) ((xmlNsPtr) cur)->next; + if ((cur == NULL) || (cur->type != XML_ELEMENT_NODE)) { + xsltGenericError(xsltGenericErrorContext, + "Internal error in exsltDynMapFunction: " + "Cannot retrieve the doc of a namespace node.\n"); + continue; + } + ctxt->context->doc = cur->doc; + } else { + ctxt->context->doc = cur->doc; + } + + subResult = xmlXPathCompiledEval(comp, ctxt->context); + if (subResult != NULL) { + switch (subResult->type) { + case XPATH_NODESET: + if (subResult->nodesetval != NULL) + for (j = 0; j < subResult->nodesetval->nodeNr; + j++) + xmlXPathNodeSetAdd(ret->nodesetval, + subResult->nodesetval-> + nodeTab[j]); + break; + case XPATH_BOOLEAN: + if (container != NULL) { + xmlNodePtr cur = + xmlNewChild((xmlNodePtr) container, NULL, + BAD_CAST "boolean", + BAD_CAST (subResult-> + boolval ? "true" : "")); + if (cur != NULL) { + cur->ns = + xmlNewNs(cur, + BAD_CAST + "http://exslt.org/common", + BAD_CAST "exsl"); + xmlXPathNodeSetAddUnique(ret->nodesetval, + cur); + } + xsltExtensionInstructionResultRegister(tctxt, ret); + } + break; + case XPATH_NUMBER: + if (container != NULL) { + xmlChar *val = + xmlXPathCastNumberToString(subResult-> + floatval); + xmlNodePtr cur = + xmlNewChild((xmlNodePtr) container, NULL, + BAD_CAST "number", val); + if (val != NULL) + xmlFree(val); + + if (cur != NULL) { + cur->ns = + xmlNewNs(cur, + BAD_CAST + "http://exslt.org/common", + BAD_CAST "exsl"); + xmlXPathNodeSetAddUnique(ret->nodesetval, + cur); + } + xsltExtensionInstructionResultRegister(tctxt, ret); + } + break; + case XPATH_STRING: + if (container != NULL) { + xmlNodePtr cur = + xmlNewChild((xmlNodePtr) container, NULL, + BAD_CAST "string", + subResult->stringval); + if (cur != NULL) { + cur->ns = + xmlNewNs(cur, + BAD_CAST + "http://exslt.org/common", + BAD_CAST "exsl"); + xmlXPathNodeSetAddUnique(ret->nodesetval, + cur); + } + xsltExtensionInstructionResultRegister(tctxt, ret); + } + break; + default: + break; + } + xmlXPathFreeObject(subResult); + } + } + } + ctxt->context->doc = oldDoc; + ctxt->context->node = oldNode; + ctxt->context->contextSize = oldContextSize; + ctxt->context->proximityPosition = oldProximityPosition; + + + cleanup: + /* restore the xpath context */ + if (comp != NULL) + xmlXPathFreeCompExpr(comp); + if (nodeset != NULL) + xmlXPathFreeNodeSet(nodeset); + if (str != NULL) + xmlFree(str); + valuePush(ctxt, ret); + return; +} + + +/** + * exsltDynRegister: + * + * Registers the EXSLT - Dynamic module + */ + +void +exsltDynRegister (void) { + xsltRegisterExtModuleFunction ((const xmlChar *) "evaluate", + EXSLT_DYNAMIC_NAMESPACE, + exsltDynEvaluateFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "map", + EXSLT_DYNAMIC_NAMESPACE, + exsltDynMapFunction); + +} diff --git a/libexslt/exslt.c b/libexslt/exslt.c new file mode 100644 index 0000000..0bccf17 --- /dev/null +++ b/libexslt/exslt.c @@ -0,0 +1,40 @@ +#define IN_LIBEXSLT +#include "libexslt/libexslt.h" + +#include + +#include "config.h" + +#include +#include + +#include +#include "exslt.h" + +const char *exsltLibraryVersion = LIBEXSLT_VERSION_STRING + LIBEXSLT_VERSION_EXTRA; +const int exsltLibexsltVersion = LIBEXSLT_VERSION; +const int exsltLibxsltVersion = LIBXSLT_VERSION; +const int exsltLibxmlVersion = LIBXML_VERSION; + +/** + * exsltRegisterAll: + * + * Registers all available EXSLT extensions + */ +void +exsltRegisterAll (void) { + xsltInitGlobals(); + exsltCommonRegister(); +#ifdef EXSLT_CRYPTO_ENABLED + exsltCryptoRegister(); +#endif + exsltMathRegister(); + exsltSetsRegister(); + exsltFuncRegister(); + exsltStrRegister(); + exsltDateRegister(); + exsltSaxonRegister(); + exsltDynRegister(); +} + diff --git a/libexslt/exslt.h b/libexslt/exslt.h new file mode 100644 index 0000000..2147308 --- /dev/null +++ b/libexslt/exslt.h @@ -0,0 +1,102 @@ + +#ifndef __EXSLT_H__ +#define __EXSLT_H__ + +#include +#include +#include "exsltexports.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +EXSLTPUBVAR const char *exsltLibraryVersion; +EXSLTPUBVAR const int exsltLibexsltVersion; +EXSLTPUBVAR const int exsltLibxsltVersion; +EXSLTPUBVAR const int exsltLibxmlVersion; + +/** + * EXSLT_COMMON_NAMESPACE: + * + * Namespace for EXSLT common functions + */ +#define EXSLT_COMMON_NAMESPACE ((const xmlChar *) "http://exslt.org/common") +/** + * EXSLT_CRYPTO_NAMESPACE: + * + * Namespace for EXSLT crypto functions + */ +#define EXSLT_CRYPTO_NAMESPACE ((const xmlChar *) "http://exslt.org/crypto") +/** + * EXSLT_MATH_NAMESPACE: + * + * Namespace for EXSLT math functions + */ +#define EXSLT_MATH_NAMESPACE ((const xmlChar *) "http://exslt.org/math") +/** + * EXSLT_SETS_NAMESPACE: + * + * Namespace for EXSLT set functions + */ +#define EXSLT_SETS_NAMESPACE ((const xmlChar *) "http://exslt.org/sets") +/** + * EXSLT_FUNCTIONS_NAMESPACE: + * + * Namespace for EXSLT functions extension functions + */ +#define EXSLT_FUNCTIONS_NAMESPACE ((const xmlChar *) "http://exslt.org/functions") +/** + * EXSLT_STRINGS_NAMESPACE: + * + * Namespace for EXSLT strings functions + */ +#define EXSLT_STRINGS_NAMESPACE ((const xmlChar *) "http://exslt.org/strings") +/** + * EXSLT_DATE_NAMESPACE: + * + * Namespace for EXSLT date functions + */ +#define EXSLT_DATE_NAMESPACE ((const xmlChar *) "http://exslt.org/dates-and-times") +/** + * EXSLT_DYNAMIC_NAMESPACE: + * + * Namespace for EXSLT dynamic functions + */ +#define EXSLT_DYNAMIC_NAMESPACE ((const xmlChar *) "http://exslt.org/dynamic") + +/** + * SAXON_NAMESPACE: + * + * Namespace for SAXON extensions functions + */ +#define SAXON_NAMESPACE ((const xmlChar *) "http://icl.com/saxon") + +EXSLTPUBFUN void EXSLTCALL exsltCommonRegister (void); +#ifdef EXSLT_CRYPTO_ENABLED +EXSLTPUBFUN void EXSLTCALL exsltCryptoRegister (void); +#endif +EXSLTPUBFUN void EXSLTCALL exsltMathRegister (void); +EXSLTPUBFUN void EXSLTCALL exsltSetsRegister (void); +EXSLTPUBFUN void EXSLTCALL exsltFuncRegister (void); +EXSLTPUBFUN void EXSLTCALL exsltStrRegister (void); +EXSLTPUBFUN void EXSLTCALL exsltDateRegister (void); +EXSLTPUBFUN void EXSLTCALL exsltSaxonRegister (void); +EXSLTPUBFUN void EXSLTCALL exsltDynRegister(void); + +EXSLTPUBFUN void EXSLTCALL exsltRegisterAll (void); + +EXSLTPUBFUN int EXSLTCALL exsltDateXpathCtxtRegister (xmlXPathContextPtr ctxt, + const xmlChar *prefix); +EXSLTPUBFUN int EXSLTCALL exsltMathXpathCtxtRegister (xmlXPathContextPtr ctxt, + const xmlChar *prefix); +EXSLTPUBFUN int EXSLTCALL exsltSetsXpathCtxtRegister (xmlXPathContextPtr ctxt, + const xmlChar *prefix); +EXSLTPUBFUN int EXSLTCALL exsltStrXpathCtxtRegister (xmlXPathContextPtr ctxt, + const xmlChar *prefix); + +#ifdef __cplusplus +} +#endif +#endif /* __EXSLT_H__ */ + diff --git a/libexslt/exsltconfig.h.in b/libexslt/exsltconfig.h.in new file mode 100644 index 0000000..b46ffc0 --- /dev/null +++ b/libexslt/exsltconfig.h.in @@ -0,0 +1,73 @@ +/* + * exsltconfig.h: compile-time version informations for the EXSLT library + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#ifndef __XML_EXSLTCONFIG_H__ +#define __XML_EXSLTCONFIG_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * LIBEXSLT_DOTTED_VERSION: + * + * the version string like "1.2.3" + */ +#define LIBEXSLT_DOTTED_VERSION "@VERSION@" + +/** + * LIBEXSLT_VERSION: + * + * the version number: 1.2.3 value is 10203 + */ +#define LIBEXSLT_VERSION @LIBEXSLT_VERSION_NUMBER@ + +/** + * LIBEXSLT_VERSION_STRING: + * + * the version number string, 1.2.3 value is "10203" + */ +#define LIBEXSLT_VERSION_STRING "@LIBEXSLT_VERSION_NUMBER@" + +/** + * LIBEXSLT_VERSION_EXTRA: + * + * extra version information, used to show a CVS compilation + */ +#define LIBEXSLT_VERSION_EXTRA "@LIBEXSLT_VERSION_EXTRA@" + +/** + * WITH_CRYPTO: + * + * Whether crypto support is configured into exslt + */ +#if @WITH_CRYPTO@ +#define EXSLT_CRYPTO_ENABLED +#endif + +/** + * ATTRIBUTE_UNUSED: + * + * This macro is used to flag unused function parameters to GCC + */ +#ifdef __GNUC__ +#ifdef HAVE_ANSIDECL_H +#include +#endif +#ifndef ATTRIBUTE_UNUSED +#define ATTRIBUTE_UNUSED __attribute__((unused)) +#endif +#else +#define ATTRIBUTE_UNUSED +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_EXSLTCONFIG_H__ */ diff --git a/libexslt/exsltexports.h b/libexslt/exsltexports.h new file mode 100644 index 0000000..bead915 --- /dev/null +++ b/libexslt/exsltexports.h @@ -0,0 +1,140 @@ +/* + * exsltexports.h : macros for marking symbols as exportable/importable. + * + * See Copyright for the status of this software. + * + * igor@zlatkovic.com + */ + +#ifndef __EXSLT_EXPORTS_H__ +#define __EXSLT_EXPORTS_H__ + +/** + * EXSLTPUBFUN, EXSLTPUBVAR, EXSLTCALL + * + * Macros which declare an exportable function, an exportable variable and + * the calling convention used for functions. + * + * Please use an extra block for every platform/compiler combination when + * modifying this, rather than overlong #ifdef lines. This helps + * readability as well as the fact that different compilers on the same + * platform might need different definitions. + */ + +/** + * EXSLTPUBFUN: + * + * Macros which declare an exportable function + */ +#define EXSLTPUBFUN +/** + * EXSLTPUBVAR: + * + * Macros which declare an exportable variable + */ +#define EXSLTPUBVAR extern +/** + * EXSLTCALL: + * + * Macros which declare the called convention for exported functions + */ +#define EXSLTCALL + +/** DOC_DISABLE */ + +/* Windows platform with MS compiler */ +#if defined(_WIN32) && defined(_MSC_VER) + #undef EXSLTPUBFUN + #undef EXSLTPUBVAR + #undef EXSLTCALL + #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC) + #define EXSLTPUBFUN __declspec(dllexport) + #define EXSLTPUBVAR __declspec(dllexport) + #else + #define EXSLTPUBFUN + #if !defined(LIBEXSLT_STATIC) + #define EXSLTPUBVAR __declspec(dllimport) extern + #else + #define EXSLTPUBVAR extern + #endif + #endif + #define EXSLTCALL __cdecl + #if !defined _REENTRANT + #define _REENTRANT + #endif +#endif + +/* Windows platform with Borland compiler */ +#if defined(_WIN32) && defined(__BORLANDC__) + #undef EXSLTPUBFUN + #undef EXSLTPUBVAR + #undef EXSLTCALL + #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC) + #define EXSLTPUBFUN __declspec(dllexport) + #define EXSLTPUBVAR __declspec(dllexport) extern + #else + #define EXSLTPUBFUN + #if !defined(LIBEXSLT_STATIC) + #define EXSLTPUBVAR __declspec(dllimport) extern + #else + #define EXSLTPUBVAR extern + #endif + #endif + #define EXSLTCALL __cdecl + #if !defined _REENTRANT + #define _REENTRANT + #endif +#endif + +/* Windows platform with GNU compiler (Mingw) */ +#if defined(_WIN32) && defined(__MINGW32__) + #undef EXSLTPUBFUN + #undef EXSLTPUBVAR + #undef EXSLTCALL +/* + #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC) +*/ + #if !defined(LIBEXSLT_STATIC) + #define EXSLTPUBFUN __declspec(dllexport) + #define EXSLTPUBVAR __declspec(dllexport) extern + #else + #define EXSLTPUBFUN + #if !defined(LIBEXSLT_STATIC) + #define EXSLTPUBVAR __declspec(dllimport) extern + #else + #define EXSLTPUBVAR extern + #endif + #endif + #define EXSLTCALL __cdecl + #if !defined _REENTRANT + #define _REENTRANT + #endif +#endif + +/* Cygwin platform, GNU compiler */ +#if defined(_WIN32) && defined(__CYGWIN__) + #undef EXSLTPUBFUN + #undef EXSLTPUBVAR + #undef EXSLTCALL + #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC) + #define EXSLTPUBFUN __declspec(dllexport) + #define EXSLTPUBVAR __declspec(dllexport) + #else + #define EXSLTPUBFUN + #if !defined(LIBEXSLT_STATIC) + #define EXSLTPUBVAR __declspec(dllimport) extern + #else + #define EXSLTPUBVAR + #endif + #endif + #define EXSLTCALL __cdecl +#endif + +/* Compatibility */ +#if !defined(LIBEXSLT_PUBLIC) +#define LIBEXSLT_PUBLIC EXSLTPUBVAR +#endif + +#endif /* __EXSLT_EXPORTS_H__ */ + + diff --git a/libexslt/functions.c b/libexslt/functions.c new file mode 100644 index 0000000..0795a13 --- /dev/null +++ b/libexslt/functions.c @@ -0,0 +1,795 @@ +#define IN_LIBEXSLT +#include "libexslt/libexslt.h" + +#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__) +#include +#else +#include "config.h" +#endif + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "exslt.h" + +typedef struct _exsltFuncFunctionData exsltFuncFunctionData; +struct _exsltFuncFunctionData { + int nargs; /* number of arguments to the function */ + xmlNodePtr content; /* the func:fuction template content */ +}; + +typedef struct _exsltFuncData exsltFuncData; +struct _exsltFuncData { + xmlHashTablePtr funcs; /* pointer to the stylesheet module data */ + xmlXPathObjectPtr result; /* returned by func:result */ + int error; /* did an error occur? */ + xmlDocPtr RVT; /* result tree fragment */ +}; + +typedef struct _exsltFuncResultPreComp exsltFuncResultPreComp; +struct _exsltFuncResultPreComp { + xsltElemPreComp comp; + xmlXPathCompExprPtr select; + xmlNsPtr *nsList; + int nsNr; +}; + +/* Used for callback function in exsltInitFunc */ +typedef struct _exsltFuncImportRegData exsltFuncImportRegData; +struct _exsltFuncImportRegData { + xsltTransformContextPtr ctxt; + xmlHashTablePtr hash; +}; + +static void exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, + int nargs); +static exsltFuncFunctionData *exsltFuncNewFunctionData(void); + +#define MAX_FUNC_RECURSION 1000 + +/*static const xmlChar *exsltResultDataID = (const xmlChar *) "EXSLT Result";*/ + +/** + * exsltFuncRegisterFunc: + * @func: the #exsltFuncFunctionData for the function + * @ctxt: an XSLT transformation context + * @URI: the function namespace URI + * @name: the function name + * + * Registers a function declared by a func:function element + */ +static void +exsltFuncRegisterFunc (exsltFuncFunctionData *data, + xsltTransformContextPtr ctxt, + const xmlChar *URI, const xmlChar *name, + ATTRIBUTE_UNUSED const xmlChar *ignored) { + if ((data == NULL) || (ctxt == NULL) || (URI == NULL) || (name == NULL)) + return; + + xsltGenericDebug(xsltGenericDebugContext, + "exsltFuncRegisterFunc: register {%s}%s\n", + URI, name); + xsltRegisterExtFunction(ctxt, name, URI, + exsltFuncFunctionFunction); +} + +/* + * exsltFuncRegisterImportFunc + * @data: the exsltFuncFunctionData for the function + * @ch: structure containing context and hash table + * @URI: the function namespace URI + * @name: the function name + * + * Checks if imported function is already registered in top-level + * stylesheet. If not, copies function data and registers function + */ +static void +exsltFuncRegisterImportFunc (exsltFuncFunctionData *data, + exsltFuncImportRegData *ch, + const xmlChar *URI, const xmlChar *name, + ATTRIBUTE_UNUSED const xmlChar *ignored) { + exsltFuncFunctionData *func=NULL; + + if ((data == NULL) || (ch == NULL) || (URI == NULL) || (name == NULL)) + return; + + if (ch->ctxt == NULL || ch->hash == NULL) + return; + + /* Check if already present */ + func = (exsltFuncFunctionData*)xmlHashLookup2(ch->hash, URI, name); + if (func == NULL) { /* Not yet present - copy it in */ + func = exsltFuncNewFunctionData(); + if (func == NULL) + return; + memcpy(func, data, sizeof(exsltFuncFunctionData)); + if (xmlHashAddEntry2(ch->hash, URI, name, func) < 0) { + xsltGenericError(xsltGenericErrorContext, + "Failed to register function {%s}%s\n", + URI, name); + } else { /* Do the registration */ + xsltGenericDebug(xsltGenericDebugContext, + "exsltFuncRegisterImportFunc: register {%s}%s\n", + URI, name); + xsltRegisterExtFunction(ch->ctxt, name, URI, + exsltFuncFunctionFunction); + } + } +} + +/** + * exsltFuncInit: + * @ctxt: an XSLT transformation context + * @URI: the namespace URI for the extension + * + * Initializes the EXSLT - Functions module. + * Called at transformation-time; merges all + * functions declared in the import tree taking + * import precedence into account, i.e. overriding + * functions with lower import precedence. + * + * Returns the data for this transformation + */ +static exsltFuncData * +exsltFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) { + exsltFuncData *ret; + xsltStylesheetPtr tmp; + exsltFuncImportRegData ch; + xmlHashTablePtr hash; + + ret = (exsltFuncData *) xmlMalloc (sizeof(exsltFuncData)); + if (ret == NULL) { + xsltGenericError(xsltGenericErrorContext, + "exsltFuncInit: not enough memory\n"); + return(NULL); + } + memset(ret, 0, sizeof(exsltFuncData)); + + ret->result = NULL; + ret->error = 0; + + ch.hash = (xmlHashTablePtr) xsltStyleGetExtData(ctxt->style, URI); + ret->funcs = ch.hash; + xmlHashScanFull(ch.hash, (xmlHashScannerFull) exsltFuncRegisterFunc, ctxt); + tmp = ctxt->style; + ch.ctxt = ctxt; + while ((tmp=xsltNextImport(tmp))!=NULL) { + hash = xsltGetExtInfo(tmp, URI); + if (hash != NULL) { + xmlHashScanFull(hash, + (xmlHashScannerFull) exsltFuncRegisterImportFunc, &ch); + } + } + + return(ret); +} + +/** + * exsltFuncShutdown: + * @ctxt: an XSLT transformation context + * @URI: the namespace URI for the extension + * @data: the module data to free up + * + * Shutdown the EXSLT - Functions module + * Called at transformation-time. + */ +static void +exsltFuncShutdown (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, + const xmlChar *URI ATTRIBUTE_UNUSED, + exsltFuncData *data) { + if (data->result != NULL) + xmlXPathFreeObject(data->result); + xmlFree(data); +} + +/** + * exsltFuncStyleInit: + * @style: an XSLT stylesheet + * @URI: the namespace URI for the extension + * + * Allocates the stylesheet data for EXSLT - Function + * Called at compile-time. + * + * Returns the allocated data + */ +static xmlHashTablePtr +exsltFuncStyleInit (xsltStylesheetPtr style ATTRIBUTE_UNUSED, + const xmlChar *URI ATTRIBUTE_UNUSED) { + return xmlHashCreate(1); +} + +/** + * exsltFuncStyleShutdown: + * @style: an XSLT stylesheet + * @URI: the namespace URI for the extension + * @data: the stylesheet data to free up + * + * Shutdown the EXSLT - Function module + * Called at compile-time. + */ +static void +exsltFuncStyleShutdown (xsltStylesheetPtr style ATTRIBUTE_UNUSED, + const xmlChar *URI ATTRIBUTE_UNUSED, + xmlHashTablePtr data) { + xmlHashFree(data, (xmlHashDeallocator) xmlFree); +} + +/** + * exsltFuncNewFunctionData: + * + * Allocates an #exslFuncFunctionData object + * + * Returns the new structure + */ +static exsltFuncFunctionData * +exsltFuncNewFunctionData (void) { + exsltFuncFunctionData *ret; + + ret = (exsltFuncFunctionData *) xmlMalloc (sizeof(exsltFuncFunctionData)); + if (ret == NULL) { + xsltGenericError(xsltGenericErrorContext, + "exsltFuncNewFunctionData: not enough memory\n"); + return (NULL); + } + memset(ret, 0, sizeof(exsltFuncFunctionData)); + + ret->nargs = 0; + ret->content = NULL; + + return(ret); +} + +/** + * exsltFreeFuncResultPreComp: + * @comp: the #exsltFuncResultPreComp to free up + * + * Deallocates an #exsltFuncResultPreComp + */ +static void +exsltFreeFuncResultPreComp (exsltFuncResultPreComp *comp) { + if (comp == NULL) + return; + + if (comp->select != NULL) + xmlXPathFreeCompExpr (comp->select); + if (comp->nsList != NULL) + xmlFree(comp->nsList); + xmlFree(comp); +} + +/** + * exsltFuncFunctionFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Evaluates the func:function element that defines the called function. + */ +static void +exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) { + xmlXPathObjectPtr oldResult, ret; + exsltFuncData *data; + exsltFuncFunctionData *func; + xmlNodePtr paramNode, oldInsert, fake; + int oldBase; + xsltStackElemPtr params = NULL, param; + xsltTransformContextPtr tctxt = xsltXPathGetTransformContext(ctxt); + int i, notSet; + struct objChain { + struct objChain *next; + xmlXPathObjectPtr obj; + }; + struct objChain *savedObjChain = NULL, *savedObj; + + /* + * retrieve func:function template + */ + data = (exsltFuncData *) xsltGetExtData (tctxt, + EXSLT_FUNCTIONS_NAMESPACE); + oldResult = data->result; + data->result = NULL; + + func = (exsltFuncFunctionData*) xmlHashLookup2 (data->funcs, + ctxt->context->functionURI, + ctxt->context->function); + if (func == NULL) { + /* Should never happen */ + xsltGenericError(xsltGenericErrorContext, + "{%s}%s: not found\n", + ctxt->context->functionURI, ctxt->context->function); + ctxt->error = XPATH_UNKNOWN_FUNC_ERROR; + return; + } + + /* + * params handling + */ + if (nargs > func->nargs) { + xsltGenericError(xsltGenericErrorContext, + "{%s}%s: called with too many arguments\n", + ctxt->context->functionURI, ctxt->context->function); + ctxt->error = XPATH_INVALID_ARITY; + return; + } + if (func->content != NULL) { + paramNode = func->content->prev; + } + else + paramNode = NULL; + if ((paramNode == NULL) && (func->nargs != 0)) { + xsltGenericError(xsltGenericErrorContext, + "exsltFuncFunctionFunction: nargs != 0 and " + "param == NULL\n"); + return; + } + if (tctxt->funcLevel > MAX_FUNC_RECURSION) { + xsltGenericError(xsltGenericErrorContext, + "{%s}%s: detected a recursion\n", + ctxt->context->functionURI, ctxt->context->function); + ctxt->error = XPATH_MEMORY_ERROR; + return; + } + tctxt->funcLevel++; + + /* + * We have a problem with the evaluation of function parameters. + * The original library code did not evaluate XPath expressions until + * the last moment. After version 1.1.17 of the libxslt, the logic + * of other parts of the library was changed, and the evaluation of + * XPath expressions within parameters now takes place as soon as the + * parameter is parsed/evaluated (xsltParseStylesheetCallerParam). + * This means that the parameters need to be evaluated in lexical + * order (since a variable is "in scope" as soon as it is declared). + * However, on entry to this routine, the values (from the caller) are + * in reverse order (held on the XPath context variable stack). To + * accomplish what is required, I have added code to pop the XPath + * objects off of the stack at the beginning and save them, then use + * them (in the reverse order) as the params are evaluated. This + * requires an xmlMalloc/xmlFree for each param set by the caller, + * which is not very nice. There is probably a much better solution + * (like change other code to delay the evaluation). + */ + /* + * In order to give the function params and variables a new 'scope' + * we change varsBase in the context. + */ + oldBase = tctxt->varsBase; + tctxt->varsBase = tctxt->varsNr; + /* If there are any parameters */ + if (paramNode != NULL) { + /* Fetch the stored argument values from the caller */ + for (i = 0; i < nargs; i++) { + savedObj = xmlMalloc(sizeof(struct objChain)); + savedObj->next = savedObjChain; + savedObj->obj = valuePop(ctxt); + savedObjChain = savedObj; + } + + /* + * Prepare to process params in reverse order. First, go to + * the beginning of the param chain. + */ + for (i = 1; i <= func->nargs; i++) { + if (paramNode->prev == NULL) + break; + paramNode = paramNode->prev; + } + /* + * i has total # params found, nargs is number which are present + * as arguments from the caller + * Calculate the number of un-set parameters + */ + notSet = func->nargs - nargs; + for (; i > 0; i--) { + param = xsltParseStylesheetCallerParam (tctxt, paramNode); + if (i > notSet) { /* if parameter value set */ + param->computed = 1; + if (param->value != NULL) + xmlXPathFreeObject(param->value); + savedObj = savedObjChain; /* get next val from chain */ + param->value = savedObj->obj; + savedObjChain = savedObjChain->next; + xmlFree(savedObj); + } + xsltLocalVariablePush(tctxt, param, -1); + param->next = params; + params = param; + paramNode = paramNode->next; + } + } + /* + * actual processing + */ + fake = xmlNewDocNode(tctxt->output, NULL, + (const xmlChar *)"fake", NULL); + oldInsert = tctxt->insert; + tctxt->insert = fake; + xsltApplyOneTemplate (tctxt, xmlXPathGetContextNode(ctxt), + func->content, NULL, NULL); + xsltLocalVariablePop(tctxt, tctxt->varsBase, -2); + tctxt->insert = oldInsert; + tctxt->varsBase = oldBase; /* restore original scope */ + if (params != NULL) + xsltFreeStackElemList(params); + + if (data->error != 0) + goto error; + + if (data->result != NULL) { + ret = data->result; + } else + ret = xmlXPathNewCString(""); + + data->result = oldResult; + + /* + * It is an error if the instantiation of the template results in + * the generation of result nodes. + */ + if (fake->children != NULL) { +#ifdef LIBXML_DEBUG_ENABLED + xmlDebugDumpNode (stderr, fake, 1); +#endif + xsltGenericError(xsltGenericErrorContext, + "{%s}%s: cannot write to result tree while " + "executing a function\n", + ctxt->context->functionURI, ctxt->context->function); + xmlFreeNode(fake); + goto error; + } + xmlFreeNode(fake); + valuePush(ctxt, ret); + +error: + /* + * IMPORTANT: This enables previously tree fragments marked as + * being results of a function, to be garbage-collected after + * the calling process exits. + */ + xsltExtensionInstructionResultFinalize(tctxt); + tctxt->funcLevel--; +} + + +static void +exsltFuncFunctionComp (xsltStylesheetPtr style, xmlNodePtr inst) { + xmlChar *name, *prefix; + xmlNsPtr ns; + xmlHashTablePtr data; + exsltFuncFunctionData *func; + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + + { + xmlChar *qname; + + qname = xmlGetProp(inst, (const xmlChar *) "name"); + name = xmlSplitQName2 (qname, &prefix); + xmlFree(qname); + } + if ((name == NULL) || (prefix == NULL)) { + xsltGenericError(xsltGenericErrorContext, + "func:function: not a QName\n"); + if (name != NULL) + xmlFree(name); + return; + } + /* namespace lookup */ + ns = xmlSearchNs (inst->doc, inst, prefix); + if (ns == NULL) { + xsltGenericError(xsltGenericErrorContext, + "func:function: undeclared prefix %s\n", + prefix); + xmlFree(name); + xmlFree(prefix); + return; + } + xmlFree(prefix); + + xsltParseTemplateContent(style, inst); + + /* + * Create function data + */ + func = exsltFuncNewFunctionData(); + if (func == NULL) { + xmlFree(name); + return; + } + func->content = inst->children; + while (IS_XSLT_ELEM(func->content) && + IS_XSLT_NAME(func->content, "param")) { + func->content = func->content->next; + func->nargs++; + } + + /* + * Register the function data such that it can be retrieved + * by exslFuncFunctionFunction + */ +#ifdef XSLT_REFACTORED + /* + * Ensure that the hash table will be stored in the *current* + * stylesheet level in order to correctly evaluate the + * import precedence. + */ + data = (xmlHashTablePtr) + xsltStyleStylesheetLevelGetExtData(style, + EXSLT_FUNCTIONS_NAMESPACE); +#else + data = (xmlHashTablePtr) + xsltStyleGetExtData (style, EXSLT_FUNCTIONS_NAMESPACE); +#endif + if (data == NULL) { + xsltGenericError(xsltGenericErrorContext, + "exsltFuncFunctionComp: no stylesheet data\n"); + xmlFree(name); + return; + } + + if (xmlHashAddEntry2 (data, ns->href, name, func) < 0) { + xsltTransformError(NULL, style, inst, + "Failed to register function {%s}%s\n", + ns->href, name); + style->errors++; + } else { + xsltGenericDebug(xsltGenericDebugContext, + "exsltFuncFunctionComp: register {%s}%s\n", + ns->href, name); + } + xmlFree(name); +} + +static xsltElemPreCompPtr +exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst, + xsltTransformFunction function) { + xmlNodePtr test; + xmlChar *sel; + exsltFuncResultPreComp *ret; + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return (NULL); + + /* + * "Validity" checking + */ + /* it is an error to have any following sibling elements aside + * from the xsl:fallback element. + */ + for (test = inst->next; test != NULL; test = test->next) { + if (test->type != XML_ELEMENT_NODE) + continue; + if (IS_XSLT_ELEM(test) && IS_XSLT_NAME(test, "fallback")) + continue; + xsltGenericError(xsltGenericErrorContext, + "exsltFuncResultElem: only xsl:fallback is " + "allowed to follow func:result\n"); + style->errors++; + return (NULL); + } + /* it is an error for a func:result element to not be a descendant + * of func:function. + * it is an error if a func:result occurs within a func:result + * element. + * it is an error if instanciating the content of a variable + * binding element (i.e. xsl:variable, xsl:param) results in the + * instanciation of a func:result element. + */ + for (test = inst->parent; test != NULL; test = test->parent) { + if (IS_XSLT_ELEM(test) && + IS_XSLT_NAME(test, "stylesheet")) { + xsltGenericError(xsltGenericErrorContext, + "func:result element not a descendant " + "of a func:function\n"); + style->errors++; + return (NULL); + } + if ((test->ns != NULL) && + (xmlStrEqual(test->ns->href, EXSLT_FUNCTIONS_NAMESPACE))) { + if (xmlStrEqual(test->name, (const xmlChar *) "function")) { + break; + } + if (xmlStrEqual(test->name, (const xmlChar *) "result")) { + xsltGenericError(xsltGenericErrorContext, + "func:result element not allowed within" + " another func:result element\n"); + style->errors++; + return (NULL); + } + } + if (IS_XSLT_ELEM(test) && + (IS_XSLT_NAME(test, "variable") || + IS_XSLT_NAME(test, "param"))) { + xsltGenericError(xsltGenericErrorContext, + "func:result element not allowed within" + " a variable binding element\n"); + style->errors++; + return (NULL); + } + } + + /* + * Precomputation + */ + ret = (exsltFuncResultPreComp *) + xmlMalloc (sizeof(exsltFuncResultPreComp)); + if (ret == NULL) { + xsltPrintErrorContext(NULL, NULL, NULL); + xsltGenericError(xsltGenericErrorContext, + "exsltFuncResultComp : malloc failed\n"); + style->errors++; + return (NULL); + } + memset(ret, 0, sizeof(exsltFuncResultPreComp)); + + xsltInitElemPreComp ((xsltElemPreCompPtr) ret, style, inst, function, + (xsltElemPreCompDeallocator) exsltFreeFuncResultPreComp); + ret->select = NULL; + + /* + * Precompute the select attribute + */ + sel = xmlGetNsProp(inst, (const xmlChar *) "select", NULL); + if (sel != NULL) { + ret->select = xmlXPathCompile (sel); + xmlFree(sel); + } + /* + * Precompute the namespace list + */ + ret->nsList = xmlGetNsList(inst->doc, inst); + if (ret->nsList != NULL) { + int i = 0; + while (ret->nsList[i] != NULL) + i++; + ret->nsNr = i; + } + return ((xsltElemPreCompPtr) ret); +} + +static void +exsltFuncResultElem (xsltTransformContextPtr ctxt, + xmlNodePtr node ATTRIBUTE_UNUSED, xmlNodePtr inst, + exsltFuncResultPreComp *comp) { + exsltFuncData *data; + xmlXPathObjectPtr ret; + + + /* It is an error if instantiating the content of the + * func:function element results in the instantiation of more than + * one func:result elements. + */ + data = (exsltFuncData *) xsltGetExtData (ctxt, EXSLT_FUNCTIONS_NAMESPACE); + if (data == NULL) { + xsltGenericError(xsltGenericErrorContext, + "exsltFuncReturnElem: data == NULL\n"); + return; + } + if (data->result != NULL) { + xsltGenericError(xsltGenericErrorContext, + "func:result already instanciated\n"); + data->error = 1; + return; + } + /* + * Processing + */ + if (comp->select != NULL) { + xmlNsPtr *oldXPNsList; + int oldXPNsNr; + xmlNodePtr oldXPContextNode; + /* If the func:result element has a select attribute, then the + * value of the attribute must be an expression and the + * returned value is the object that results from evaluating + * the expression. In this case, the content must be empty. + */ + if (inst->children != NULL) { + xsltGenericError(xsltGenericErrorContext, + "func:result content must be empty if" + " the function has a select attribute\n"); + data->error = 1; + return; + } + oldXPNsList = ctxt->xpathCtxt->namespaces; + oldXPNsNr = ctxt->xpathCtxt->nsNr; + oldXPContextNode = ctxt->xpathCtxt->node; + + ctxt->xpathCtxt->namespaces = comp->nsList; + ctxt->xpathCtxt->nsNr = comp->nsNr; + + ret = xmlXPathCompiledEval(comp->select, ctxt->xpathCtxt); + + ctxt->xpathCtxt->node = oldXPContextNode; + ctxt->xpathCtxt->nsNr = oldXPNsNr; + ctxt->xpathCtxt->namespaces = oldXPNsList; + + if (ret == NULL) { + xsltGenericError(xsltGenericErrorContext, + "exsltFuncResultElem: ret == NULL\n"); + return; + } + /* + * Mark it as a function result in order to avoid garbage + * collecting of tree fragments before the function exits. + */ + xsltExtensionInstructionResultRegister(ctxt, ret); + } else if (inst->children != NULL) { + /* If the func:result element does not have a select attribute + * and has non-empty content (i.e. the func:result element has + * one or more child nodes), then the content of the + * func:result element specifies the value. + */ + xmlNodePtr oldInsert; + xmlDocPtr container; + + container = xsltCreateRVT(ctxt); + if (container == NULL) { + xsltGenericError(xsltGenericErrorContext, + "exsltFuncResultElem: out of memory\n"); + data->error = 1; + return; + } + xsltRegisterLocalRVT(ctxt, container); + + oldInsert = ctxt->insert; + ctxt->insert = (xmlNodePtr) container; + xsltApplyOneTemplate (ctxt, ctxt->xpathCtxt->node, + inst->children, NULL, NULL); + ctxt->insert = oldInsert; + + ret = xmlXPathNewValueTree((xmlNodePtr) container); + if (ret == NULL) { + xsltGenericError(xsltGenericErrorContext, + "exsltFuncResultElem: ret == NULL\n"); + data->error = 1; + } else { + ret->boolval = 0; /* Freeing is not handled there anymore */ + /* + * Mark it as a function result in order to avoid garbage + * collecting of tree fragments before the function exits. + */ + xsltExtensionInstructionResultRegister(ctxt, ret); + } + } else { + /* If the func:result element has empty content and does not + * have a select attribute, then the returned value is an + * empty string. + */ + ret = xmlXPathNewCString(""); + } + data->result = ret; +} + +/** + * exsltFuncRegister: + * + * Registers the EXSLT - Functions module + */ +void +exsltFuncRegister (void) { + xsltRegisterExtModuleFull (EXSLT_FUNCTIONS_NAMESPACE, + (xsltExtInitFunction) exsltFuncInit, + (xsltExtShutdownFunction) exsltFuncShutdown, + (xsltStyleExtInitFunction) exsltFuncStyleInit, + (xsltStyleExtShutdownFunction) exsltFuncStyleShutdown); + + xsltRegisterExtModuleTopLevel ((const xmlChar *) "function", + EXSLT_FUNCTIONS_NAMESPACE, + exsltFuncFunctionComp); + xsltRegisterExtModuleElement ((const xmlChar *) "result", + EXSLT_FUNCTIONS_NAMESPACE, + (xsltPreComputeFunction)exsltFuncResultComp, + (xsltTransformFunction) exsltFuncResultElem); +} diff --git a/libexslt/libexslt.3 b/libexslt/libexslt.3 new file mode 100644 index 0000000..83c57d3 --- /dev/null +++ b/libexslt/libexslt.3 @@ -0,0 +1,270 @@ +.TH LIBEXSLT 3 "04 November 2003" libxslt +.SH NAME +libexslt \- extension library for XSLT +.SH SYNOPSIS +.B #include +.sp +.B void exsltCommonRegister(void); +.br +.B void exsltDateRegister(void); +.br +.B void exsltDynRegister(void); +.br +.B void exsltFuncRegister(void); +.br +.B void exsltMathRegister(void); +.br +.B void exsltSetsRegister(void); +.br +.B void exsltStrRegister(void); +.br +.B void exsltRegisterAll(void); +.br +.B void exsltSaxonRegister(void); +.SH DESCRIPTION +The +.B libexslt +library is used to provide extensions to +.SM XSLT +functions. These extensions come from the +.SM EXSLT +project +.LP +.SH USAGE +To make use of these functions in +.SM XSLT +the appropriate namespace must be defined on the +.B xsl:stylesheet +element. To enable support for them in +.BR libxslt (3) +you must call the appropriate functions (listed in the +.B SYNOPSIS +section) to register the extensions. The +.I xslt-config +shell script can be used to obtain the necessary flags for +the pre-processor and linker. +The supported extensions are: +.SS COMMON +.TP 2.2i +Namespace: http://exslt.org/common +.TP 2.2i +See http://www.exslt.org/exsl/index.html for a description. +.TP 2.2i +.B node-set() +convert the given RTF into a node-set. +.TP +.B object-type() +returns the type of the given argument. +.TP +.B document +Create multiple output documents. See http://www.exslt.org/exsl/elements/document/index.html + +.SS MATH +.TP 2.2i +Namespace: http://exslt.org/math +.TP 2.2i +See http://www.exslt.org/math/index.html for a description. +.TP 2.2i +.B min() +returns the minimum value of the given node-set +.TP +.B max() +returns the maximum value of the given node-set +.TP +.B highest() +returns the nodes in the node-set whose value is the maximum value for the node-set. +.TP +.B lowest() +returns the nodes in the node-set whose value is the minimum value for the node-set. +.TP +.B constant() +returns a number value of the given constant with the given precision. The constants are PI, E, SQRRT2, LN2, LN10, LOG2E, and SQRT1_2. +.TP +.B random() +returns a random number between 0 and 1 inclusive. +.TP +.B abs() +returns the absolute value of the argument. +.TP +.B sqrt() +returns the square root of the argument. +.TP +.B power() +returns the power base and power arguments. +.TP +.B log() +returns the natural log of the argument. +.TP +.B sin() +returns the sine of the argument. +.TP +.B cos() +returns the cosine of the argument. +.TP +.B tan() +returns the tangent of the argument. +.TP +.B asin() +returns the arc sine of the argument. +.TP +.B acos() +returns the arc cosine of the argument. +.TP +.B atan() +returns the arc tangent of the argument. +.TP +.B atan2() +returns the arc tangent function of the y/x arguments. +.TP +.B exp() +returns the exponential function of the argument. + +.SS SETS +.TP 2.2i +Namespace: http://exslt.org/sets +.TP 2.2i +See http://www.exslt.org/set/index.html for a description. +.TP 2.2i +.B difference() +returns the difference between the two given node-sets. +.TP +.B intersection() +returns a node-set of the nodes within both given node-sets. +.TP +.B distinct() +returns a node-set of all nodes in the first argument that are not in the seconds argument. +.TP +.B has-same-node() +returns TRUE if there is an intersection between the two given node-sets. +.TP +.B leading() +returns a node-set of all nodes in the first argument that precede the first node in the second argument. +.TP +.B trailing() +returns a node-set of all nodes in the first argument that follow the first node in the second argument. + +.SS "DATES and TIMES" +.TP 2.2i +Namespace: http://exslt.org/dates-and-times +.TP 2.2i +See http://www.exslt.org/date/date.html for a description. +.TP 2.2i +.B date-time() +returns the current date and time as a date/time string. +.TP +.B date() +returns the date specified in the given date/time string. +.TP +.B time() +returns the time specified in the date/time string given as the argument. +.TP +.B year() +returns the year of a date as a number. +.TP +.B leap-year() +returns true if the year given in a date is a leap year. +.TP +.B month-in-year() +returns the month of a date as a number. +.TP +.B month-name() +returns the full name of the month of a date. +.TP +.B month-abbreviation() +returns the abbreviation of the month of a date. +.TP +.B week-in-year() +returns the week of the year as a number. +.TP +.B week-in-month() +returns the week in a month of a date as a number. +.TP +.B day-in-year() +returns the month of a date as a number. +.TP +.B day-in-month() +returns the day of a date as a number. +.TP +.B day-of-week-in-month() +returns the day-of-the-week in a month of a date as a number. +.TP +.B day-in-week() +returns the day of the week given in a date as a number. +.TP +.B day-name() +returns the full name of the day of the week of a date. +.TP +.B day-abbreviation() +returns the abbreviation of the day of the week of a date. +.TP +.B hour-in-day() +returns the hour of the day as a number. +.TP +.B minute-in-hour() +returns the minute of the hour as a number. +.TP +.B second-in-minute() +returns the second of the minute as a number. +.TP +.B seconds() +returns the number of seconds specified by the argument string. +.TP +.B add() +returns the date/time resulting from adding a duration to a date/time. +.TP +.B add-duration() +returns the duration resulting from adding two given durations together. +.TP +.B difference() +returns the duration between the first date and the second date. +.TP +.B duration() +returns a duration string that represents the given number of seconds since 1970-01-01T00:00:00. + +.SS STRINGS +.TP 2.2i +Namespace: http://exslt.org/strings +.TP 2.2i +See http://www.exslt.org/str/index.html for a description. +.TP 2.2i +.B tokenize() +returns a node set of token elements, each containing one token from the string. +.TP +.B padding() +returns a string padded to a certain length. +.TP +.B align() +returns a string aligned within another string. +.TP +.B concat() +returns the concatenation of the string values of the nodes in that node set. + +.SS FUNCTIONS +.TP 2.2i +Namespace: http://exslt.org/functions +.TP 2.2i +See http://www.exslt.org/func/index.html for a description. +.TP 2.2i +.B function +declares an extension function. +.TP +.B result +returns the result of an extension function declared in function(). +.SH FILES +.TP +.I /usr/bin/xslt-config +shell script giving pre-processor and linker flags. +.TP +.I /usr/lib/libexslt.a +static library +.TP +.I /usr/lib/libexslt.so +sharable library +.SH AUTHORS +Manual page by Heiko W. Rupp (hwr@pilhuhn.de) +.SH "SEE ALSO" +.BR libxml (3), +.BR libxslt (3), +.BR xmllint (1) +.BR xsltproc (1), +.\" end of manual page diff --git a/libexslt/libexslt.h b/libexslt/libexslt.h new file mode 100644 index 0000000..2dd9b37 --- /dev/null +++ b/libexslt/libexslt.h @@ -0,0 +1,29 @@ +/* + * libexslt.h: internal header only used during the compilation of libexslt + * + * See COPYRIGHT for the status of this software + * + * Author: daniel@veillard.com + */ + +#ifndef __XSLT_LIBEXSLT_H__ +#define __XSLT_LIBEXSLT_H__ + +#if defined(WIN32) && !defined (__CYGWIN__) && !defined (__MINGW32__) +#include +#else +#include "config.h" +#endif + +#include +#include + +#if !defined LIBEXSLT_PUBLIC +#if (defined (__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBEXSLT && !defined LIBEXSLT_STATIC +#define LIBEXSLT_PUBLIC __declspec(dllimport) +#else +#define LIBEXSLT_PUBLIC +#endif +#endif + +#endif /* ! __XSLT_LIBEXSLT_H__ */ diff --git a/libexslt/math.c b/libexslt/math.c new file mode 100644 index 0000000..6b24dbe --- /dev/null +++ b/libexslt/math.c @@ -0,0 +1,1202 @@ +#define IN_LIBEXSLT +#include "libexslt/libexslt.h" + +#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__) +#include +#else +#include "config.h" +#endif + +#include +#include +#include + +#include +#include +#include +#include + +#ifdef HAVE_MATH_H +#include +#endif + +#ifdef HAVE_STDLIB_H +#include +#endif + +#include "exslt.h" + +/** + * exsltMathMin: + * @ns: a node-set + * + * Implements the EXSLT - Math min() function: + * number math:min (node-set) + * + * Returns the minimum value of the nodes passed as the argument, or + * xmlXPathNAN if @ns is NULL or empty or if one of the nodes + * turns into NaN. + */ +static double +exsltMathMin (xmlNodeSetPtr ns) { + double ret, cur; + int i; + + if ((ns == NULL) || (ns->nodeNr == 0)) + return(xmlXPathNAN); + ret = xmlXPathCastNodeToNumber(ns->nodeTab[0]); + if (xmlXPathIsNaN(ret)) + return(xmlXPathNAN); + for (i = 1; i < ns->nodeNr; i++) { + cur = xmlXPathCastNodeToNumber(ns->nodeTab[i]); + if (xmlXPathIsNaN(cur)) + return(xmlXPathNAN); + if (cur < ret) + ret = cur; + } + return(ret); +} + +/** + * exsltMathMinFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathMin for use by the XPath processor. + */ +static void +exsltMathMinFunction (xmlXPathParserContextPtr ctxt, int nargs) { + xmlNodeSetPtr ns; + double ret; + void *user = NULL; + + if (nargs != 1) { + xsltGenericError(xsltGenericErrorContext, + "math:min: invalid number of arguments\n"); + ctxt->error = XPATH_INVALID_ARITY; + return; + } + /* We need to delay the freeing of value->user */ + if ((ctxt->value != NULL) && (ctxt->value->boolval != 0)) { + user = ctxt->value->user; + ctxt->value->boolval = 0; + ctxt->value->user = NULL; + } + ns = xmlXPathPopNodeSet(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + ret = exsltMathMin(ns); + + xmlXPathFreeNodeSet(ns); + if (user != NULL) + xmlFreeNodeList((xmlNodePtr)user); + + xmlXPathReturnNumber(ctxt, ret); +} + +/** + * exsltMathMax: + * @ns: a node-set + * + * Implements the EXSLT - Math max() function: + * number math:max (node-set) + * + * Returns the maximum value of the nodes passed as arguments, or + * xmlXPathNAN if @ns is NULL or empty or if one of the nodes + * turns into NaN. + */ +static double +exsltMathMax (xmlNodeSetPtr ns) { + double ret, cur; + int i; + + if ((ns == NULL) || (ns->nodeNr == 0)) + return(xmlXPathNAN); + ret = xmlXPathCastNodeToNumber(ns->nodeTab[0]); + if (xmlXPathIsNaN(ret)) + return(xmlXPathNAN); + for (i = 1; i < ns->nodeNr; i++) { + cur = xmlXPathCastNodeToNumber(ns->nodeTab[i]); + if (xmlXPathIsNaN(cur)) + return(xmlXPathNAN); + if (cur > ret) + ret = cur; + } + return(ret); +} + +/** + * exsltMathMaxFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathMax for use by the XPath processor. + */ +static void +exsltMathMaxFunction (xmlXPathParserContextPtr ctxt, int nargs) { + xmlNodeSetPtr ns; + double ret; + void *user = NULL; + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + + /* We need to delay the freeing of value->user */ + if ((ctxt->value != NULL) && (ctxt->value->boolval != 0)) { + user = ctxt->value->user; + ctxt->value->boolval = 0; + ctxt->value->user = 0; + } + ns = xmlXPathPopNodeSet(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + ret = exsltMathMax(ns); + + xmlXPathFreeNodeSet(ns); + + if (user != NULL) + xmlFreeNodeList((xmlNodePtr)user); + xmlXPathReturnNumber(ctxt, ret); +} + +/** + * exsltMathHighest: + * @ns: a node-set + * + * Implements the EXSLT - Math highest() function: + * node-set math:highest (node-set) + * + * Returns the nodes in the node-set whose value is the maximum value + * for the node-set. + */ +static xmlNodeSetPtr +exsltMathHighest (xmlNodeSetPtr ns) { + xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL); + double max, cur; + int i; + + if ((ns == NULL) || (ns->nodeNr == 0)) + return(ret); + + max = xmlXPathCastNodeToNumber(ns->nodeTab[0]); + if (xmlXPathIsNaN(max)) + return(ret); + else + xmlXPathNodeSetAddUnique(ret, ns->nodeTab[0]); + + for (i = 1; i < ns->nodeNr; i++) { + cur = xmlXPathCastNodeToNumber(ns->nodeTab[i]); + if (xmlXPathIsNaN(cur)) { + xmlXPathEmptyNodeSet(ret); + return(ret); + } + if (cur < max) + continue; + if (cur > max) { + max = cur; + xmlXPathEmptyNodeSet(ret); + xmlXPathNodeSetAddUnique(ret, ns->nodeTab[i]); + continue; + } + xmlXPathNodeSetAddUnique(ret, ns->nodeTab[i]); + } + return(ret); +} + +/** + * exsltMathHighestFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathHighest for use by the XPath processor + */ +static void +exsltMathHighestFunction (xmlXPathParserContextPtr ctxt, int nargs) { + xmlNodeSetPtr ns, ret; + void *user = NULL; + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + + /* We need to delay the freeing of value->user */ + if ((ctxt->value != NULL) && ctxt->value->boolval != 0) { + user = ctxt->value->user; + ctxt->value->boolval = 0; + ctxt->value->user = NULL; + } + ns = xmlXPathPopNodeSet(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + ret = exsltMathHighest(ns); + + xmlXPathFreeNodeSet(ns); + if (user != NULL) + xmlFreeNodeList((xmlNodePtr)user); + + xmlXPathReturnNodeSet(ctxt, ret); +} + +/** + * exsltMathLowest: + * @ns: a node-set + * + * Implements the EXSLT - Math lowest() function + * node-set math:lowest (node-set) + * + * Returns the nodes in the node-set whose value is the minimum value + * for the node-set. + */ +static xmlNodeSetPtr +exsltMathLowest (xmlNodeSetPtr ns) { + xmlNodeSetPtr ret = xmlXPathNodeSetCreate(NULL); + double min, cur; + int i; + + if ((ns == NULL) || (ns->nodeNr == 0)) + return(ret); + + min = xmlXPathCastNodeToNumber(ns->nodeTab[0]); + if (xmlXPathIsNaN(min)) + return(ret); + else + xmlXPathNodeSetAddUnique(ret, ns->nodeTab[0]); + + for (i = 1; i < ns->nodeNr; i++) { + cur = xmlXPathCastNodeToNumber(ns->nodeTab[i]); + if (xmlXPathIsNaN(cur)) { + xmlXPathEmptyNodeSet(ret); + return(ret); + } + if (cur > min) + continue; + if (cur < min) { + min = cur; + xmlXPathEmptyNodeSet(ret); + xmlXPathNodeSetAddUnique(ret, ns->nodeTab[i]); + continue; + } + xmlXPathNodeSetAddUnique(ret, ns->nodeTab[i]); + } + return(ret); +} + +/** + * exsltMathLowestFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathLowest for use by the XPath processor + */ +static void +exsltMathLowestFunction (xmlXPathParserContextPtr ctxt, int nargs) { + xmlNodeSetPtr ns, ret; + void *user = NULL; + + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + + /* We need to delay the freeing of value->user */ + if ((ctxt->value != NULL) && (ctxt->value->boolval != 0)) { + user = ctxt->value->user; + ctxt->value->boolval = 0; + ctxt->value->user = NULL; + } + ns = xmlXPathPopNodeSet(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + ret = exsltMathLowest(ns); + + xmlXPathFreeNodeSet(ns); + if (user != NULL) + xmlFreeNodeList((xmlNodePtr)user); + + xmlXPathReturnNodeSet(ctxt, ret); +} + +/* math other functions */ + +/* constant values */ +#define EXSLT_PI (const xmlChar *) \ + "3.1415926535897932384626433832795028841971693993751" +#define EXSLT_E (const xmlChar *) \ + "2.71828182845904523536028747135266249775724709369996" +#define EXSLT_SQRRT2 (const xmlChar *) \ + "1.41421356237309504880168872420969807856967187537694" +#define EXSLT_LN2 (const xmlChar *) \ + "0.69314718055994530941723212145817656807550013436025" +#define EXSLT_LN10 (const xmlChar *) \ + "2.30258509299404568402" +#define EXSLT_LOG2E (const xmlChar *) \ + "1.4426950408889634074" +#define EXSLT_SQRT1_2 (const xmlChar *) \ + "0.70710678118654752440" + +/** + * exsltMathConstant + * @name: string + * @precision: number + * + * Implements the EXSLT - Math constant function: + * number math:constant(string, number) + * + * Returns a number value of the given constant with the given precision or + * xmlXPathNAN if name is unknown. + * The constants are PI, E, SQRRT2, LN2, LN10, LOG2E, and SQRT1_2 + */ +static double +exsltMathConstant (xmlChar *name, double precision) { + xmlChar *str; + double ret; + + if ((name == NULL) || (xmlXPathIsNaN(precision)) || (precision < 1.0)) { + return xmlXPathNAN; + } + + if (xmlStrEqual(name, BAD_CAST "PI")) { + int len = xmlStrlen(EXSLT_PI); + + if (precision <= len) + len = (int)precision; + + str = xmlStrsub(EXSLT_PI, 0, len); + + } else if (xmlStrEqual(name, BAD_CAST "E")) { + int len = xmlStrlen(EXSLT_E); + + if (precision <= len) + len = (int)precision; + + str = xmlStrsub(EXSLT_E, 0, len); + + } else if (xmlStrEqual(name, BAD_CAST "SQRRT2")) { + int len = xmlStrlen(EXSLT_SQRRT2); + + if (precision <= len) + len = (int)precision; + + str = xmlStrsub(EXSLT_SQRRT2, 0, len); + + } else if (xmlStrEqual(name, BAD_CAST "LN2")) { + int len = xmlStrlen(EXSLT_LN2); + + if (precision <= len) + len = (int)precision; + + str = xmlStrsub(EXSLT_LN2, 0, len); + + } else if (xmlStrEqual(name, BAD_CAST "LN10")) { + int len = xmlStrlen(EXSLT_LN10); + + if (precision <= len) + len = (int)precision; + + str = xmlStrsub(EXSLT_LN10, 0, len); + + } else if (xmlStrEqual(name, BAD_CAST "LOG2E")) { + int len = xmlStrlen(EXSLT_LOG2E); + + if (precision <= len) + len = (int)precision; + + str = xmlStrsub(EXSLT_LOG2E, 0, len); + + } else if (xmlStrEqual(name, BAD_CAST "SQRT1_2")) { + int len = xmlStrlen(EXSLT_SQRT1_2); + + if (precision <= len) + len = (int)precision; + + str = xmlStrsub(EXSLT_SQRT1_2, 0, len); + + } else { + str = NULL; + } + if (str == NULL) + return xmlXPathNAN; + ret = xmlXPathCastStringToNumber(str); + xmlFree(str); + return ret; +} + +/** + * exsltMathConstantFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathConstant for use by the XPath processor. + */ +static void +exsltMathConstantFunction (xmlXPathParserContextPtr ctxt, int nargs) { + double ret; + xmlChar *name; + + if (nargs != 2) { + xmlXPathSetArityError(ctxt); + return; + } + ret = xmlXPathPopNumber(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + name = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + ret = exsltMathConstant(name, ret); + if (name != NULL) + xmlFree(name); + + xmlXPathReturnNumber(ctxt, ret); +} + +#if defined(HAVE_STDLIB_H) && defined(RAND_MAX) + +/** + * exsltMathRandom: + * + * Implements the EXSLT - Math random() function: + * number math:random () + * + * Returns a random number between 0 and 1 inclusive. + */ +static double +exsltMathRandom (void) { + double ret; + int num; + + num = rand(); + ret = (double)num / (double)RAND_MAX; + return(ret); +} + +/** + * exsltMathRandomFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathRandom for use by the XPath processor. + */ +static void +exsltMathRandomFunction (xmlXPathParserContextPtr ctxt, int nargs) { + double ret; + + if (nargs != 0) { + xmlXPathSetArityError(ctxt); + return; + } + + ret = exsltMathRandom(); + + xmlXPathReturnNumber(ctxt, ret); +} + +#endif /* defined(HAVE_STDLIB_H) && defined(RAND_MAX) */ + +#if HAVE_MATH_H + +/** + * exsltMathAbs: + * @num: a double + * + * Implements the EXSLT - Math abs() function: + * number math:abs (number) + * + * Returns the absolute value of the argument, or xmlXPathNAN if @num is Nan. + */ +static double +exsltMathAbs (double num) { + double ret; + + if (xmlXPathIsNaN(num)) + return(xmlXPathNAN); + ret = fabs(num); + return(ret); +} + +/** + * exsltMathAbsFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathAbs for use by the XPath processor. + */ +static void +exsltMathAbsFunction (xmlXPathParserContextPtr ctxt, int nargs) { + double ret; + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + ret = xmlXPathPopNumber(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + ret = exsltMathAbs(ret); + + xmlXPathReturnNumber(ctxt, ret); +} + +/** + * exsltMathSqrt: + * @num: a double + * + * Implements the EXSLT - Math sqrt() function: + * number math:sqrt (number) + * + * Returns the square root of the argument, or xmlXPathNAN if @num is Nan. + */ +static double +exsltMathSqrt (double num) { + double ret; + + if (xmlXPathIsNaN(num)) + return(xmlXPathNAN); + ret = sqrt(num); + return(ret); +} + +/** + * exsltMathSqrtFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathSqrt for use by the XPath processor. + */ +static void +exsltMathSqrtFunction (xmlXPathParserContextPtr ctxt, int nargs) { + double ret; + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + ret = xmlXPathPopNumber(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + ret = exsltMathSqrt(ret); + + xmlXPathReturnNumber(ctxt, ret); +} + +/** + * exsltMathPower: + * @base: a double + * @power: a double + * + * Implements the EXSLT - Math power() function: + * number math:power (number, number) + * + * Returns the power base and power arguments, or xmlXPathNAN + * if either @base or @power is Nan. + */ +static double +exsltMathPower (double base, double power) { + double ret; + + if ((xmlXPathIsNaN(base) || xmlXPathIsNaN(power))) + return(xmlXPathNAN); + ret = pow(base, power); + return(ret); +} + +/** + * exsltMathPower: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathPower for use by the XPath processor. + */ +static void +exsltMathPowerFunction (xmlXPathParserContextPtr ctxt, int nargs) { + double ret, base; + + if (nargs != 2) { + xmlXPathSetArityError(ctxt); + return; + } + ret = xmlXPathPopNumber(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + /* power */ + base = xmlXPathPopNumber(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + ret = exsltMathPower(base, ret); + + xmlXPathReturnNumber(ctxt, ret); +} + +/** + * exsltMathLog: + * @num: a double + * + * Implements the EXSLT - Math log() function: + * number math:log (number) + * + * Returns the natural log of the argument, or xmlXPathNAN if @num is Nan. + */ +static double +exsltMathLog (double num) { + double ret; + + if (xmlXPathIsNaN(num)) + return(xmlXPathNAN); + ret = log(num); + return(ret); +} + +/** + * exsltMathLogFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathLog for use by the XPath processor. + */ +static void +exsltMathLogFunction (xmlXPathParserContextPtr ctxt, int nargs) { + double ret; + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + ret = xmlXPathPopNumber(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + ret = exsltMathLog(ret); + + xmlXPathReturnNumber(ctxt, ret); +} + +/** + * exsltMathSin: + * @num: a double + * + * Implements the EXSLT - Math sin() function: + * number math:sin (number) + * + * Returns the sine of the argument, or xmlXPathNAN if @num is Nan. + */ +static double +exsltMathSin (double num) { + double ret; + + if (xmlXPathIsNaN(num)) + return(xmlXPathNAN); + ret = sin(num); + return(ret); +} + +/** + * exsltMathSinFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathSin for use by the XPath processor. + */ +static void +exsltMathSinFunction (xmlXPathParserContextPtr ctxt, int nargs) { + double ret; + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + ret = xmlXPathPopNumber(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + ret = exsltMathSin(ret); + + xmlXPathReturnNumber(ctxt, ret); +} + +/** + * exsltMathCos: + * @num: a double + * + * Implements the EXSLT - Math cos() function: + * number math:cos (number) + * + * Returns the cosine of the argument, or xmlXPathNAN if @num is Nan. + */ +static double +exsltMathCos (double num) { + double ret; + + if (xmlXPathIsNaN(num)) + return(xmlXPathNAN); + ret = cos(num); + return(ret); +} + +/** + * exsltMathCosFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathCos for use by the XPath processor. + */ +static void +exsltMathCosFunction (xmlXPathParserContextPtr ctxt, int nargs) { + double ret; + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + ret = xmlXPathPopNumber(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + ret = exsltMathCos(ret); + + xmlXPathReturnNumber(ctxt, ret); +} + +/** + * exsltMathTan: + * @num: a double + * + * Implements the EXSLT - Math tan() function: + * number math:tan (number) + * + * Returns the tangent of the argument, or xmlXPathNAN if @num is Nan. + */ +static double +exsltMathTan (double num) { + double ret; + + if (xmlXPathIsNaN(num)) + return(xmlXPathNAN); + ret = tan(num); + return(ret); +} + +/** + * exsltMathTanFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathTan for use by the XPath processor. + */ +static void +exsltMathTanFunction (xmlXPathParserContextPtr ctxt, int nargs) { + double ret; + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + ret = xmlXPathPopNumber(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + ret = exsltMathTan(ret); + + xmlXPathReturnNumber(ctxt, ret); +} + +/** + * exsltMathAsin: + * @num: a double + * + * Implements the EXSLT - Math asin() function: + * number math:asin (number) + * + * Returns the arc sine of the argument, or xmlXPathNAN if @num is Nan. + */ +static double +exsltMathAsin (double num) { + double ret; + + if (xmlXPathIsNaN(num)) + return(xmlXPathNAN); + ret = asin(num); + return(ret); +} + +/** + * exsltMathAsinFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathAsin for use by the XPath processor. + */ +static void +exsltMathAsinFunction (xmlXPathParserContextPtr ctxt, int nargs) { + double ret; + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + ret = xmlXPathPopNumber(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + ret = exsltMathAsin(ret); + + xmlXPathReturnNumber(ctxt, ret); +} + +/** + * exsltMathAcos: + * @num: a double + * + * Implements the EXSLT - Math acos() function: + * number math:acos (number) + * + * Returns the arc cosine of the argument, or xmlXPathNAN if @num is Nan. + */ +static double +exsltMathAcos (double num) { + double ret; + + if (xmlXPathIsNaN(num)) + return(xmlXPathNAN); + ret = acos(num); + return(ret); +} + +/** + * exsltMathAcosFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathAcos for use by the XPath processor. + */ +static void +exsltMathAcosFunction (xmlXPathParserContextPtr ctxt, int nargs) { + double ret; + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + ret = xmlXPathPopNumber(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + ret = exsltMathAcos(ret); + + xmlXPathReturnNumber(ctxt, ret); +} + +/** + * exsltMathAtan: + * @num: a double + * + * Implements the EXSLT - Math atan() function: + * number math:atan (number) + * + * Returns the arc tangent of the argument, or xmlXPathNAN if @num is Nan. + */ +static double +exsltMathAtan (double num) { + double ret; + + if (xmlXPathIsNaN(num)) + return(xmlXPathNAN); + ret = atan(num); + return(ret); +} + +/** + * exsltMathAtanFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathAtan for use by the XPath processor. + */ +static void +exsltMathAtanFunction (xmlXPathParserContextPtr ctxt, int nargs) { + double ret; + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + ret = xmlXPathPopNumber(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + ret = exsltMathAtan(ret); + + xmlXPathReturnNumber(ctxt, ret); +} + +/** + * exsltMathAtan2: + * @y: a double + * @x: a double + * + * Implements the EXSLT - Math atan2() function: + * number math:atan2 (number, number) + * + * Returns the arc tangent function of the y/x arguments, or xmlXPathNAN + * if either @y or @x is Nan. + */ +static double +exsltMathAtan2 (double y, double x) { + double ret; + + if ((xmlXPathIsNaN(y) || xmlXPathIsNaN(x))) + return(xmlXPathNAN); + ret = atan2(y, x); + return(ret); +} + +/** + * exsltMathAtan2Function: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathAtan2 for use by the XPath processor. + */ +static void +exsltMathAtan2Function (xmlXPathParserContextPtr ctxt, int nargs) { + double ret, x; + + if (nargs != 2) { + xmlXPathSetArityError(ctxt); + return; + } + x = xmlXPathPopNumber(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + /* y */ + ret = xmlXPathPopNumber(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + ret = exsltMathAtan2(ret, x); + + xmlXPathReturnNumber(ctxt, ret); +} + +/** + * exsltMathExp: + * @num: a double + * + * Implements the EXSLT - Math exp() function: + * number math:exp (number) + * + * Returns the exponential function of the argument, or xmlXPathNAN if + * @num is Nan. + */ +static double +exsltMathExp (double num) { + double ret; + + if (xmlXPathIsNaN(num)) + return(xmlXPathNAN); + ret = exp(num); + return(ret); +} + +/** + * exsltMathExpFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #exsltMathExp for use by the XPath processor. + */ +static void +exsltMathExpFunction (xmlXPathParserContextPtr ctxt, int nargs) { + double ret; + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + ret = xmlXPathPopNumber(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + ret = exsltMathExp(ret); + + xmlXPathReturnNumber(ctxt, ret); +} + +#endif /* HAVE_MATH_H */ + +/** + * exsltMathRegister: + * + * Registers the EXSLT - Math module + */ + +void +exsltMathRegister (void) { + xsltRegisterExtModuleFunction ((const xmlChar *) "min", + EXSLT_MATH_NAMESPACE, + exsltMathMinFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "max", + EXSLT_MATH_NAMESPACE, + exsltMathMaxFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "highest", + EXSLT_MATH_NAMESPACE, + exsltMathHighestFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "lowest", + EXSLT_MATH_NAMESPACE, + exsltMathLowestFunction); + /* register other math functions */ + xsltRegisterExtModuleFunction ((const xmlChar *) "constant", + EXSLT_MATH_NAMESPACE, + exsltMathConstantFunction); +#ifdef HAVE_STDLIB_H + xsltRegisterExtModuleFunction ((const xmlChar *) "random", + EXSLT_MATH_NAMESPACE, + exsltMathRandomFunction); +#endif +#if HAVE_MATH_H + xsltRegisterExtModuleFunction ((const xmlChar *) "abs", + EXSLT_MATH_NAMESPACE, + exsltMathAbsFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "sqrt", + EXSLT_MATH_NAMESPACE, + exsltMathSqrtFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "power", + EXSLT_MATH_NAMESPACE, + exsltMathPowerFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "log", + EXSLT_MATH_NAMESPACE, + exsltMathLogFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "sin", + EXSLT_MATH_NAMESPACE, + exsltMathSinFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "cos", + EXSLT_MATH_NAMESPACE, + exsltMathCosFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "tan", + EXSLT_MATH_NAMESPACE, + exsltMathTanFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "asin", + EXSLT_MATH_NAMESPACE, + exsltMathAsinFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "acos", + EXSLT_MATH_NAMESPACE, + exsltMathAcosFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "atan", + EXSLT_MATH_NAMESPACE, + exsltMathAtanFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "atan2", + EXSLT_MATH_NAMESPACE, + exsltMathAtan2Function); + xsltRegisterExtModuleFunction ((const xmlChar *) "exp", + EXSLT_MATH_NAMESPACE, + exsltMathExpFunction); +#endif +} + +/** + * exsltMathXpathCtxtRegister: + * + * Registers the EXSLT - Math module for use outside XSLT + */ +int +exsltMathXpathCtxtRegister (xmlXPathContextPtr ctxt, const xmlChar *prefix) +{ + if (ctxt + && prefix + && !xmlXPathRegisterNs(ctxt, + prefix, + (const xmlChar *) EXSLT_MATH_NAMESPACE) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "min", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathMinFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "max", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathMaxFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "highest", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathHighestFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "lowest", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathLowestFunction) +#ifdef HAVE_STDLIB_H + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "random", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathRandomFunction) +#endif +#if HAVE_MATH_H + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "abs", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathAbsFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "sqrt", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathSqrtFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "power", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathPowerFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "log", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathLogFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "sin", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathSinFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "cos", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathCosFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "tan", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathTanFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "asin", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathAsinFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "acos", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathAcosFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "atan", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathAtanFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "atan2", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathAtan2Function) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "exp", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathExpFunction) +#endif + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "constant", + (const xmlChar *) EXSLT_MATH_NAMESPACE, + exsltMathConstantFunction)) { + return 0; + } + return -1; +} diff --git a/libexslt/saxon.c b/libexslt/saxon.c new file mode 100644 index 0000000..7a2f63b --- /dev/null +++ b/libexslt/saxon.c @@ -0,0 +1,313 @@ +#define IN_LIBEXSLT +#include "libexslt/libexslt.h" + +#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__) +#include +#else +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "exslt.h" + +/** + * exsltSaxonInit: + * @ctxt: an XSLT transformation context + * @URI: the namespace URI for the extension + * + * Initializes the SAXON module. + * + * Returns the data for this transformation + */ +static xmlHashTablePtr +exsltSaxonInit (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, + const xmlChar *URI ATTRIBUTE_UNUSED) { + return xmlHashCreate(1); +} + +/** + * exsltSaxonShutdown: + * @ctxt: an XSLT transformation context + * @URI: the namespace URI for the extension + * @data: the module data to free up + * + * Shutdown the SAXON extension module + */ +static void +exsltSaxonShutdown (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, + const xmlChar *URI ATTRIBUTE_UNUSED, + xmlHashTablePtr data) { + xmlHashFree(data, (xmlHashDeallocator) xmlXPathFreeCompExpr); +} + + +/** + * exsltSaxonExpressionFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * The supplied string must contain an XPath expression. The result of + * the function is a stored expression, which may be supplied as an + * argument to other extension functions such as saxon:eval(), + * saxon:sum() and saxon:distinct(). The result of the expression will + * usually depend on the current node. The expression may contain + * references to variables that are in scope at the point where + * saxon:expression() is called: these variables will be replaced in + * the stored expression with the values they take at the time + * saxon:expression() is called, not the values of the variables at + * the time the stored expression is evaluated. Similarly, if the + * expression contains namespace prefixes, these are interpreted in + * terms of the namespace declarations in scope at the point where the + * saxon:expression() function is called, not those in scope where the + * stored expression is evaluated. + * + * TODO: current implementation doesn't conform to SAXON behaviour + * regarding context and namespaces. + */ +static void +exsltSaxonExpressionFunction (xmlXPathParserContextPtr ctxt, int nargs) { + xmlChar *arg; + xmlXPathCompExprPtr ret; + xmlHashTablePtr hash; + xsltTransformContextPtr tctxt = xsltXPathGetTransformContext(ctxt); + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + + arg = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt) || (arg == NULL)) { + xmlXPathSetTypeError(ctxt); + return; + } + + hash = (xmlHashTablePtr) xsltGetExtData(tctxt, + ctxt->context->functionURI); + + ret = xmlHashLookup(hash, arg); + + if (ret == NULL) { + ret = xmlXPathCompile(arg); + if (ret == NULL) { + xmlFree(arg); + xmlXPathSetError(ctxt, XPATH_EXPR_ERROR); + return; + } + xmlHashAddEntry(hash, arg, (void *) ret); + } + + xmlFree(arg); + + xmlXPathReturnExternal(ctxt, ret); +} + +/** + * exsltSaxonEvalFunction: + * @ctxt: an XPath parser context + * @nargs: number of arguments + * + * Implements de SAXON eval() function: + * object saxon:eval (saxon:stored-expression) + * Returns the result of evaluating the supplied stored expression. + * A stored expression may be obtained as the result of calling + * the saxon:expression() function. + * The stored expression is evaluated in the current context, that + * is, the context node is the current node, and the context position + * and context size are the same as the result of calling position() + * or last() respectively. + */ +static void +exsltSaxonEvalFunction (xmlXPathParserContextPtr ctxt, int nargs) { + xmlXPathCompExprPtr expr; + xmlXPathObjectPtr ret; + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + + if (!xmlXPathStackIsExternal(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + + expr = (xmlXPathCompExprPtr) xmlXPathPopExternal(ctxt); + + ret = xmlXPathCompiledEval(expr, ctxt->context); + if (ret == NULL) { + xmlXPathSetError(ctxt, XPATH_EXPR_ERROR); + return; + } + + valuePush(ctxt, ret); +} + +/** + * exsltSaxonEvaluateFunction: + * @ctxt: an XPath parser context + * @nargs: number of arguments + * + * Implements the SAXON evaluate() function + * object saxon:evaluate (string) + * The supplied string must contain an XPath expression. The result of + * the function is the result of evaluating the XPath expression. This + * is useful where an expression needs to be constructed at run-time or + * passed to the stylesheet as a parameter, for example where the sort + * key is determined dynamically. The context for the expression (e.g. + * which variables and namespaces are available) is exactly the same as + * if the expression were written explicitly at this point in the + * stylesheet. The function saxon:evaluate(string) is shorthand for + * saxon:eval(saxon:expression(string)). + */ +static void +exsltSaxonEvaluateFunction (xmlXPathParserContextPtr ctxt, int nargs) { + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + + exsltSaxonExpressionFunction(ctxt, 1); + exsltSaxonEvalFunction(ctxt, 1); +} + +/** + * exsltSaxonSystemIdFunction: + * @ctxt: an XPath parser context + * @nargs: number of arguments + * + * Implements the SAXON systemId() function + * string saxon:systemId () + * This function returns the system ID of the document being styled. + */ +static void +exsltSaxonSystemIdFunction(xmlXPathParserContextPtr ctxt, int nargs) +{ + if (ctxt == NULL) + return; + if (nargs != 0) { + xmlXPathSetArityError(ctxt); + return; + } + + if ((ctxt->context) && (ctxt->context->doc) && + (ctxt->context->doc->URL)) + valuePush(ctxt, xmlXPathNewString(ctxt->context->doc->URL)); + else + valuePush(ctxt, xmlXPathNewString(BAD_CAST "")); +} + +/** + * exsltSaxonLineNumberFunction: + * @ctxt: an XPath parser context + * @nargs: number of arguments + * + * Implements the SAXON line-number() function + * integer saxon:line-number() + * + * This returns the line number of the context node in the source document + * within the entity that contains it. There are no arguments. If line numbers + * are not maintained for the current document, the function returns -1. (To + * ensure that line numbers are maintained, use the -l option on the command + * line) + * + * The extension has been extended to have the following form: + * integer saxon:line-number([node-set-1]) + * If a node-set is given, this extension will return the line number of the + * node in the argument node-set that is first in document order. + */ +static void +exsltSaxonLineNumberFunction(xmlXPathParserContextPtr ctxt, int nargs) { + xmlNodePtr cur = NULL; + xmlXPathObjectPtr obj = NULL; + long lineNo = -1; + + if (nargs == 0) { + cur = ctxt->context->node; + } else if (nargs == 1) { + xmlNodeSetPtr nodelist; + int i; + + if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_NODESET)) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "saxon:line-number() : invalid arg expecting a node-set\n"); + ctxt->error = XPATH_INVALID_TYPE; + return; + } + + obj = valuePop(ctxt); + nodelist = obj->nodesetval; + if ((nodelist != NULL) && (nodelist->nodeNr > 0)) { + cur = nodelist->nodeTab[0]; + for (i = 1;i < nodelist->nodeNr;i++) { + int ret = xmlXPathCmpNodes(cur, nodelist->nodeTab[i]); + if (ret == -1) + cur = nodelist->nodeTab[i]; + } + } + } else { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "saxon:line-number() : invalid number of args %d\n", + nargs); + ctxt->error = XPATH_INVALID_ARITY; + return; + } + + if ((cur != NULL) && (cur->type == XML_NAMESPACE_DECL)) { + /* + * The XPath module sets the owner element of a ns-node on + * the ns->next field. + */ + cur = (xmlNodePtr) ((xmlNsPtr) cur)->next; + if (cur == NULL || cur->type != XML_ELEMENT_NODE) { + xsltGenericError(xsltGenericErrorContext, + "Internal error in exsltSaxonLineNumberFunction: " + "Cannot retrieve the doc of a namespace node.\n"); + cur = NULL; + } + } + + if (cur != NULL) + lineNo = xmlGetLineNo(cur); + + valuePush(ctxt, xmlXPathNewFloat(lineNo)); + + xmlXPathFreeObject(obj); +} + +/** + * exsltSaxonRegister: + * + * Registers the SAXON extension module + */ +void +exsltSaxonRegister (void) { + xsltRegisterExtModule (SAXON_NAMESPACE, + (xsltExtInitFunction) exsltSaxonInit, + (xsltExtShutdownFunction) exsltSaxonShutdown); + xsltRegisterExtModuleFunction((const xmlChar *) "expression", + SAXON_NAMESPACE, + exsltSaxonExpressionFunction); + xsltRegisterExtModuleFunction((const xmlChar *) "eval", + SAXON_NAMESPACE, + exsltSaxonEvalFunction); + xsltRegisterExtModuleFunction((const xmlChar *) "evaluate", + SAXON_NAMESPACE, + exsltSaxonEvaluateFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "line-number", + SAXON_NAMESPACE, + exsltSaxonLineNumberFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "systemId", + SAXON_NAMESPACE, + exsltSaxonSystemIdFunction); +} diff --git a/libexslt/sets.c b/libexslt/sets.c new file mode 100644 index 0000000..a5a7913 --- /dev/null +++ b/libexslt/sets.c @@ -0,0 +1,334 @@ +#define IN_LIBEXSLT +#include "libexslt/libexslt.h" + +#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__) +#include +#else +#include "config.h" +#endif + +#include +#include +#include + +#include +#include +#include + +#include "exslt.h" + +/** + * exsltSetsDifferenceFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #xmlXPathDifference for use by the XPath processor + */ +static void +exsltSetsDifferenceFunction (xmlXPathParserContextPtr ctxt, int nargs) { + xmlNodeSetPtr arg1, arg2, ret; + + if (nargs != 2) { + xmlXPathSetArityError(ctxt); + return; + } + + arg2 = xmlXPathPopNodeSet(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + + arg1 = xmlXPathPopNodeSet(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + + ret = xmlXPathDifference(arg1, arg2); + + if (ret != arg1) + xmlXPathFreeNodeSet(arg1); + xmlXPathFreeNodeSet(arg2); + + xmlXPathReturnNodeSet(ctxt, ret); +} + +/** + * exsltSetsIntersectionFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #xmlXPathIntersection for use by the XPath processor + */ +static void +exsltSetsIntersectionFunction (xmlXPathParserContextPtr ctxt, int nargs) { + xmlNodeSetPtr arg1, arg2, ret; + + if (nargs != 2) { + xmlXPathSetArityError(ctxt); + return; + } + + arg2 = xmlXPathPopNodeSet(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + + arg1 = xmlXPathPopNodeSet(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + + ret = xmlXPathIntersection(arg1, arg2); + + xmlXPathFreeNodeSet(arg1); + xmlXPathFreeNodeSet(arg2); + + xmlXPathReturnNodeSet(ctxt, ret); +} + +/** + * exsltSetsDistinctFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #xmlXPathDistinct for use by the XPath processor + */ +static void +exsltSetsDistinctFunction (xmlXPathParserContextPtr ctxt, int nargs) { + xmlXPathObjectPtr obj; + xmlNodeSetPtr ns, ret; + int boolval = 0; + void *user = NULL; + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + + if (ctxt->value != NULL) { + boolval = ctxt->value->boolval; + user = ctxt->value->user; + ctxt->value->boolval = 0; + ctxt->value->user = NULL; + } + ns = xmlXPathPopNodeSet(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + + /* !!! must be sorted !!! */ + ret = xmlXPathDistinctSorted(ns); + + if (ret != ns) + xmlXPathFreeNodeSet(ns); + + obj = xmlXPathWrapNodeSet(ret); + obj->user = user; + obj->boolval = boolval; + valuePush((ctxt), obj); +} + +/** + * exsltSetsHasSameNodesFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #xmlXPathHasSameNodes for use by the XPath processor + */ +static void +exsltSetsHasSameNodesFunction (xmlXPathParserContextPtr ctxt, + int nargs) { + xmlNodeSetPtr arg1, arg2; + int ret; + + if (nargs != 2) { + xmlXPathSetArityError(ctxt); + return; + } + + arg2 = xmlXPathPopNodeSet(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + + arg1 = xmlXPathPopNodeSet(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + + ret = xmlXPathHasSameNodes(arg1, arg2); + + xmlXPathFreeNodeSet(arg1); + xmlXPathFreeNodeSet(arg2); + + xmlXPathReturnBoolean(ctxt, ret); +} + +/** + * exsltSetsLeadingFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #xmlXPathLeading for use by the XPath processor + */ +static void +exsltSetsLeadingFunction (xmlXPathParserContextPtr ctxt, int nargs) { + xmlNodeSetPtr arg1, arg2, ret; + + if (nargs != 2) { + xmlXPathSetArityError(ctxt); + return; + } + + arg2 = xmlXPathPopNodeSet(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + + arg1 = xmlXPathPopNodeSet(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + + /* If the second node set is empty, then the first node set is + * returned. + */ + if (xmlXPathNodeSetIsEmpty(arg2)) { + xmlXPathReturnNodeSet(ctxt, arg1); + + xmlXPathFreeNodeSet(arg2); + + return; + } + /* !!! must be sorted */ + ret = xmlXPathNodeLeadingSorted(arg1, xmlXPathNodeSetItem(arg2, 0)); + + xmlXPathFreeNodeSet(arg1); + xmlXPathFreeNodeSet(arg2); + + xmlXPathReturnNodeSet(ctxt, ret); +} + +/** + * exsltSetsTrailingFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Wraps #xmlXPathTrailing for use by the XPath processor + */ +static void +exsltSetsTrailingFunction (xmlXPathParserContextPtr ctxt, int nargs) { + xmlNodeSetPtr arg1, arg2, ret; + + if (nargs != 2) { + xmlXPathSetArityError(ctxt); + return; + } + + arg2 = xmlXPathPopNodeSet(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + + arg1 = xmlXPathPopNodeSet(ctxt); + if (xmlXPathCheckError(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + + /* If the second node set is empty, then the first node set is + * returned. + */ + if (xmlXPathNodeSetIsEmpty(arg2)) { + xmlXPathReturnNodeSet(ctxt, arg1); + + xmlXPathFreeNodeSet(arg2); + + return; + } + /* !!! mist be sorted */ + ret = xmlXPathNodeTrailingSorted(arg1, xmlXPathNodeSetItem(arg2, 0)); + + xmlXPathFreeNodeSet(arg1); + xmlXPathFreeNodeSet(arg2); + + xmlXPathReturnNodeSet(ctxt, ret); +} + +/** + * exsltSetsRegister: + * + * Registers the EXSLT - Sets module + */ + +void +exsltSetsRegister (void) { + xsltRegisterExtModuleFunction ((const xmlChar *) "difference", + EXSLT_SETS_NAMESPACE, + exsltSetsDifferenceFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "intersection", + EXSLT_SETS_NAMESPACE, + exsltSetsIntersectionFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "distinct", + EXSLT_SETS_NAMESPACE, + exsltSetsDistinctFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "has-same-node", + EXSLT_SETS_NAMESPACE, + exsltSetsHasSameNodesFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "leading", + EXSLT_SETS_NAMESPACE, + exsltSetsLeadingFunction); + xsltRegisterExtModuleFunction ((const xmlChar *) "trailing", + EXSLT_SETS_NAMESPACE, + exsltSetsTrailingFunction); +} + +/** + * exsltSetsXpathCtxtRegister: + * + * Registers the EXSLT - Sets module for use outside XSLT + */ +int +exsltSetsXpathCtxtRegister (xmlXPathContextPtr ctxt, const xmlChar *prefix) +{ + if (ctxt + && prefix + && !xmlXPathRegisterNs(ctxt, + prefix, + (const xmlChar *) EXSLT_SETS_NAMESPACE) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "difference", + (const xmlChar *) EXSLT_SETS_NAMESPACE, + exsltSetsDifferenceFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "intersection", + (const xmlChar *) EXSLT_SETS_NAMESPACE, + exsltSetsIntersectionFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "distinct", + (const xmlChar *) EXSLT_SETS_NAMESPACE, + exsltSetsDistinctFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "has-same-node", + (const xmlChar *) EXSLT_SETS_NAMESPACE, + exsltSetsHasSameNodesFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "leading", + (const xmlChar *) EXSLT_SETS_NAMESPACE, + exsltSetsLeadingFunction) + && !xmlXPathRegisterFuncNS(ctxt, + (const xmlChar *) "trailing", + (const xmlChar *) EXSLT_SETS_NAMESPACE, + exsltSetsTrailingFunction)) { + return 0; + } + return -1; +} diff --git a/libexslt/strings.c b/libexslt/strings.c new file mode 100644 index 0000000..f5f2d3c --- /dev/null +++ b/libexslt/strings.c @@ -0,0 +1,847 @@ +#define IN_LIBEXSLT +#include "libexslt/libexslt.h" + +#if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__) +#include +#else +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "exslt.h" + +/** + * exsltStrTokenizeFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Splits up a string on the characters of the delimiter string and returns a + * node set of token elements, each containing one token from the string. + */ +static void +exsltStrTokenizeFunction(xmlXPathParserContextPtr ctxt, int nargs) +{ + xsltTransformContextPtr tctxt; + xmlChar *str, *delimiters, *cur; + const xmlChar *token, *delimiter; + xmlNodePtr node; + xmlDocPtr container; + xmlXPathObjectPtr ret = NULL; + int clen; + + if ((nargs < 1) || (nargs > 2)) { + xmlXPathSetArityError(ctxt); + return; + } + + if (nargs == 2) { + delimiters = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + } else { + delimiters = xmlStrdup((const xmlChar *) "\t\r\n "); + } + if (delimiters == NULL) + return; + + str = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt) || (str == NULL)) { + xmlFree(delimiters); + return; + } + + /* Return a result tree fragment */ + tctxt = xsltXPathGetTransformContext(ctxt); + if (tctxt == NULL) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "exslt:tokenize : internal error tctxt == NULL\n"); + goto fail; + } + + container = xsltCreateRVT(tctxt); + if (container != NULL) { + xsltRegisterLocalRVT(tctxt, container); + ret = xmlXPathNewNodeSet(NULL); + if (ret != NULL) { + for (cur = str, token = str; *cur != 0; cur += clen) { + clen = xmlUTF8Size(cur); + if (*delimiters == 0) { /* empty string case */ + xmlChar ctmp; + ctmp = *(cur+clen); + *(cur+clen) = 0; + node = xmlNewDocRawNode(container, NULL, + (const xmlChar *) "token", cur); + xmlAddChild((xmlNodePtr) container, node); + xmlXPathNodeSetAddUnique(ret->nodesetval, node); + *(cur+clen) = ctmp; /* restore the changed byte */ + token = cur + clen; + } else for (delimiter = delimiters; *delimiter != 0; + delimiter += xmlUTF8Size(delimiter)) { + if (!xmlUTF8Charcmp(cur, delimiter)) { + if (cur == token) { + /* discard empty tokens */ + token = cur + clen; + break; + } + *cur = 0; /* terminate the token */ + node = xmlNewDocRawNode(container, NULL, + (const xmlChar *) "token", token); + xmlAddChild((xmlNodePtr) container, node); + xmlXPathNodeSetAddUnique(ret->nodesetval, node); + *cur = *delimiter; /* restore the changed byte */ + token = cur + clen; + break; + } + } + } + if (token != cur) { + node = xmlNewDocRawNode(container, NULL, + (const xmlChar *) "token", token); + xmlAddChild((xmlNodePtr) container, node); + xmlXPathNodeSetAddUnique(ret->nodesetval, node); + } + /* + * Mark it as a function result in order to avoid garbage + * collecting of tree fragments + */ + xsltExtensionInstructionResultRegister(tctxt, ret); + } + } + +fail: + if (str != NULL) + xmlFree(str); + if (delimiters != NULL) + xmlFree(delimiters); + if (ret != NULL) + valuePush(ctxt, ret); + else + valuePush(ctxt, xmlXPathNewNodeSet(NULL)); +} + +/** + * exsltStrSplitFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Splits up a string on a delimiting string and returns a node set of token + * elements, each containing one token from the string. + */ +static void +exsltStrSplitFunction(xmlXPathParserContextPtr ctxt, int nargs) { + xsltTransformContextPtr tctxt; + xmlChar *str, *delimiter, *cur; + const xmlChar *token; + xmlNodePtr node; + xmlDocPtr container; + xmlXPathObjectPtr ret = NULL; + int delimiterLength; + + if ((nargs < 1) || (nargs > 2)) { + xmlXPathSetArityError(ctxt); + return; + } + + if (nargs == 2) { + delimiter = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) + return; + } else { + delimiter = xmlStrdup((const xmlChar *) " "); + } + if (delimiter == NULL) + return; + delimiterLength = xmlStrlen (delimiter); + + str = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt) || (str == NULL)) { + xmlFree(delimiter); + return; + } + + /* Return a result tree fragment */ + tctxt = xsltXPathGetTransformContext(ctxt); + if (tctxt == NULL) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "exslt:tokenize : internal error tctxt == NULL\n"); + goto fail; + } + + /* + * OPTIMIZE TODO: We are creating an xmlDoc for every split! + */ + container = xsltCreateRVT(tctxt); + if (container != NULL) { + xsltRegisterLocalRVT(tctxt, container); + ret = xmlXPathNewNodeSet(NULL); + if (ret != NULL) { + for (cur = str, token = str; *cur != 0; cur++) { + if (delimiterLength == 0) { + if (cur != token) { + xmlChar tmp = *cur; + *cur = 0; + node = xmlNewDocRawNode(container, NULL, + (const xmlChar *) "token", token); + xmlAddChild((xmlNodePtr) container, node); + xmlXPathNodeSetAddUnique(ret->nodesetval, node); + *cur = tmp; + token++; + } + } + else if (!xmlStrncasecmp(cur, delimiter, delimiterLength)) { + if (cur == token) { + /* discard empty tokens */ + cur = cur + delimiterLength - 1; + token = cur + 1; + continue; + } + *cur = 0; + node = xmlNewDocRawNode(container, NULL, + (const xmlChar *) "token", token); + xmlAddChild((xmlNodePtr) container, node); + xmlXPathNodeSetAddUnique(ret->nodesetval, node); + *cur = *delimiter; + cur = cur + delimiterLength - 1; + token = cur + 1; + } + } + if (token != cur) { + node = xmlNewDocRawNode(container, NULL, + (const xmlChar *) "token", token); + xmlAddChild((xmlNodePtr) container, node); + xmlXPathNodeSetAddUnique(ret->nodesetval, node); + } + /* + * Mark it as a function result in order to avoid garbage + * collecting of tree fragments + */ + xsltExtensionInstructionResultRegister(tctxt, ret); + } + } + +fail: + if (str != NULL) + xmlFree(str); + if (delimiter != NULL) + xmlFree(delimiter); + if (ret != NULL) + valuePush(ctxt, ret); + else + valuePush(ctxt, xmlXPathNewNodeSet(NULL)); +} + +/** + * exsltStrEncodeUriFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * URI-Escapes a string + */ +static void +exsltStrEncodeUriFunction (xmlXPathParserContextPtr ctxt, int nargs) { + int escape_all = 1, str_len = 0; + xmlChar *str = NULL, *ret = NULL, *tmp; + + if ((nargs < 2) || (nargs > 3)) { + xmlXPathSetArityError(ctxt); + return; + } + + if (nargs >= 3) { + /* check for UTF-8 if encoding was explicitly given; + we don't support anything else yet */ + tmp = xmlXPathPopString(ctxt); + if (xmlUTF8Strlen(tmp) != 5 || xmlStrcmp((const xmlChar *)"UTF-8",tmp)) { + xmlXPathReturnEmptyString(ctxt); + xmlFree(tmp); + return; + } + xmlFree(tmp); + } + + escape_all = xmlXPathPopBoolean(ctxt); + + str = xmlXPathPopString(ctxt); + str_len = xmlUTF8Strlen(str); + + if (str_len == 0) { + xmlXPathReturnEmptyString(ctxt); + xmlFree(str); + return; + } + + ret = xmlURIEscapeStr(str,(const xmlChar *)(escape_all?"-_.!~*'()":"-_.!~*'();/?:@&=+$,[]")); + xmlXPathReturnString(ctxt, ret); + + if (str != NULL) + xmlFree(str); +} + +/** + * exsltStrDecodeUriFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * reverses URI-Escaping of a string + */ +static void +exsltStrDecodeUriFunction (xmlXPathParserContextPtr ctxt, int nargs) { + int str_len = 0; + xmlChar *str = NULL, *ret = NULL, *tmp; + + if ((nargs < 1) || (nargs > 2)) { + xmlXPathSetArityError(ctxt); + return; + } + + if (nargs >= 2) { + /* check for UTF-8 if encoding was explicitly given; + we don't support anything else yet */ + tmp = xmlXPathPopString(ctxt); + if (xmlUTF8Strlen(tmp) != 5 || xmlStrcmp((const xmlChar *)"UTF-8",tmp)) { + xmlXPathReturnEmptyString(ctxt); + xmlFree(tmp); + return; + } + xmlFree(tmp); + } + + str = xmlXPathPopString(ctxt); + str_len = xmlUTF8Strlen(str); + + if (str_len == 0) { + xmlXPathReturnEmptyString(ctxt); + xmlFree(str); + return; + } + + ret = (xmlChar *) xmlURIUnescapeString((const char *)str,0,NULL); + if (!xmlCheckUTF8(ret)) { + /* FIXME: instead of throwing away the whole URI, we should + only discard the invalid sequence(s). How to do that? */ + xmlXPathReturnEmptyString(ctxt); + xmlFree(str); + xmlFree(ret); + return; + } + + xmlXPathReturnString(ctxt, ret); + + if (str != NULL) + xmlFree(str); +} + +/** + * exsltStrPaddingFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Creates a padding string of a certain length. + */ +static void +exsltStrPaddingFunction (xmlXPathParserContextPtr ctxt, int nargs) { + int number, str_len = 0, str_size = 0; + xmlChar *str = NULL, *ret = NULL; + + if ((nargs < 1) || (nargs > 2)) { + xmlXPathSetArityError(ctxt); + return; + } + + if (nargs == 2) { + str = xmlXPathPopString(ctxt); + str_len = xmlUTF8Strlen(str); + str_size = xmlStrlen(str); + } + if (str_len == 0) { + if (str != NULL) xmlFree(str); + str = xmlStrdup((const xmlChar *) " "); + str_len = 1; + str_size = 1; + } + + number = (int) xmlXPathPopNumber(ctxt); + + if (number <= 0) { + xmlXPathReturnEmptyString(ctxt); + xmlFree(str); + return; + } + + while (number >= str_len) { + ret = xmlStrncat(ret, str, str_size); + number -= str_len; + } + if (number > 0) { + str_size = xmlUTF8Strsize(str, number); + ret = xmlStrncat(ret, str, str_size); + } + + xmlXPathReturnString(ctxt, ret); + + if (str != NULL) + xmlFree(str); +} + +/** + * exsltStrAlignFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Aligns a string within another string. + */ +static void +exsltStrAlignFunction (xmlXPathParserContextPtr ctxt, int nargs) { + xmlChar *str, *padding, *alignment, *ret; + int str_l, padding_l; + + if ((nargs < 2) || (nargs > 3)) { + xmlXPathSetArityError(ctxt); + return; + } + + if (nargs == 3) + alignment = xmlXPathPopString(ctxt); + else + alignment = NULL; + + padding = xmlXPathPopString(ctxt); + str = xmlXPathPopString(ctxt); + + str_l = xmlUTF8Strlen (str); + padding_l = xmlUTF8Strlen (padding); + + if (str_l == padding_l) { + xmlXPathReturnString (ctxt, str); + xmlFree(padding); + xmlFree(alignment); + return; + } + + if (str_l > padding_l) { + ret = xmlUTF8Strndup (str, padding_l); + } else { + if (xmlStrEqual(alignment, (const xmlChar *) "right")) { + ret = xmlUTF8Strndup (padding, padding_l - str_l); + ret = xmlStrcat (ret, str); + } else if (xmlStrEqual(alignment, (const xmlChar *) "center")) { + int left = (padding_l - str_l) / 2; + int right_start; + + ret = xmlUTF8Strndup (padding, left); + ret = xmlStrcat (ret, str); + + right_start = xmlUTF8Strsize (padding, left + str_l); + ret = xmlStrcat (ret, padding + right_start); + } else { + int str_s; + + str_s = xmlUTF8Strsize(padding, str_l); + ret = xmlStrdup (str); + ret = xmlStrcat (ret, padding + str_s); + } + } + + xmlXPathReturnString (ctxt, ret); + + xmlFree(str); + xmlFree(padding); + xmlFree(alignment); +} + +/** + * exsltStrConcatFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Takes a node set and returns the concatenation of the string values + * of the nodes in that node set. If the node set is empty, it + * returns an empty string. + */ +static void +exsltStrConcatFunction (xmlXPathParserContextPtr ctxt, int nargs) { + xmlXPathObjectPtr obj; + xmlChar *ret = NULL; + int i; + + if (nargs != 1) { + xmlXPathSetArityError(ctxt); + return; + } + + if (!xmlXPathStackIsNodeSet(ctxt)) { + xmlXPathSetTypeError(ctxt); + return; + } + + obj = valuePop (ctxt); + + if (xmlXPathNodeSetIsEmpty(obj->nodesetval)) { + xmlXPathReturnEmptyString(ctxt); + return; + } + + for (i = 0; i < obj->nodesetval->nodeNr; i++) { + xmlChar *tmp; + tmp = xmlXPathCastNodeToString(obj->nodesetval->nodeTab[i]); + + ret = xmlStrcat (ret, tmp); + + xmlFree(tmp); + } + + xmlXPathFreeObject (obj); + + xmlXPathReturnString(ctxt, ret); +} + +/** + * exsltStrReturnString: + * @ctxt: an XPath parser context + * @str: a string + * @len: length of string + * + * Returns a string as a node set. + */ +static int +exsltStrReturnString(xmlXPathParserContextPtr ctxt, const xmlChar *str, + int len) +{ + xsltTransformContextPtr tctxt = xsltXPathGetTransformContext(ctxt); + xmlDocPtr container; + xmlNodePtr text_node; + xmlXPathObjectPtr ret; + + container = xsltCreateRVT(tctxt); + if (container == NULL) { + xmlXPathSetError(ctxt, XPATH_MEMORY_ERROR); + return(-1); + } + xsltRegisterLocalRVT(tctxt, container); + + text_node = xmlNewTextLen(str, len); + if (text_node == NULL) { + xmlXPathSetError(ctxt, XPATH_MEMORY_ERROR); + return(-1); + } + xmlAddChild((xmlNodePtr) container, text_node); + + ret = xmlXPathNewNodeSet(text_node); + if (ret == NULL) { + xmlXPathSetError(ctxt, XPATH_MEMORY_ERROR); + return(-1); + } + + xsltExtensionInstructionResultRegister(tctxt, ret); + valuePush(ctxt, ret); + + return(0); +} + +/** + * exsltStrReplaceFunction: + * @ctxt: an XPath parser context + * @nargs: the number of arguments + * + * Takes a string, and two node sets and returns the string with all strings in + * the first node set replaced by all strings in the second node set. + */ +static void +exsltStrReplaceFunction (xmlXPathParserContextPtr ctxt, int nargs) { + int i, i_empty, n, slen0, rlen0, *slen, *rlen; + void *mem = NULL; + const xmlChar *src, *start; + xmlChar *string, *search_str = NULL, *replace_str = NULL; + xmlChar **search, **replace; + xmlNodeSetPtr search_set = NULL, replace_set = NULL; + xmlBufferPtr buf; + + if (nargs != 3) { + xmlXPathSetArityError(ctxt); + return; + } + + /* get replace argument */ + + if (!xmlXPathStackIsNodeSet(ctxt)) + replace_str = xmlXPathPopString(ctxt); + else + replace_set = xmlXPathPopNodeSet(ctxt); + + if (xmlXPathCheckError(ctxt)) + goto fail_replace; + + /* get search argument */ + + if (!xmlXPathStackIsNodeSet(ctxt)) { + search_str = xmlXPathPopString(ctxt); + n = 1; + } + else { + search_set = xmlXPathPopNodeSet(ctxt); + n = search_set != NULL ? search_set->nodeNr : 0; + } + + if (xmlXPathCheckError(ctxt)) + goto fail_search; + + /* get string argument */ + + string = xmlXPathPopString(ctxt); + if (xmlXPathCheckError(ctxt)) + goto fail_string; + + /* check for empty search node list */ + + if (n <= 0) { + exsltStrReturnString(ctxt, string, xmlStrlen(string)); + goto done_empty_search; + } + + /* allocate memory for string pointer and length arrays */ + + if (n == 1) { + search = &search_str; + replace = &replace_str; + slen = &slen0; + rlen = &rlen0; + } + else { + mem = xmlMalloc(2 * n * (sizeof(const xmlChar *) + sizeof(int))); + if (mem == NULL) { + xmlXPathSetError(ctxt, XPATH_MEMORY_ERROR); + goto fail_malloc; + } + search = (xmlChar **) mem; + replace = search + n; + slen = (int *) (replace + n); + rlen = slen + n; + } + + /* process arguments */ + + i_empty = -1; + + for (i=0; inodeTab[i]); + if (search[i] == NULL) { + n = i; + goto fail_process_args; + } + } + + slen[i] = xmlStrlen(search[i]); + if (i_empty < 0 && slen[i] == 0) + i_empty = i; + + if (replace_set != NULL) { + if (i < replace_set->nodeNr) { + replace[i] = xmlXPathCastNodeToString(replace_set->nodeTab[i]); + if (replace[i] == NULL) { + n = i + 1; + goto fail_process_args; + } + } + else + replace[i] = NULL; + } + else { + if (i == 0) + replace[i] = replace_str; + else + replace[i] = NULL; + } + + if (replace[i] == NULL) + rlen[i] = 0; + else + rlen[i] = xmlStrlen(replace[i]); + } + + if (i_empty >= 0 && rlen[i_empty] == 0) + i_empty = -1; + + /* replace operation */ + + buf = xmlBufferCreate(); + if (buf == NULL) { + xmlXPathSetError(ctxt, XPATH_MEMORY_ERROR); + goto fail_buffer; + } + src = string; + start = string; + + while (*src != 0) { + int max_len = 0, i_match = 0; + + for (i=0; i max_len && + xmlStrncmp(src, search[i], slen[i]) == 0) + { + i_match = i; + max_len = slen[i]; + } + } + + if (max_len == 0) { + if (i_empty >= 0 && start < src) { + if (xmlBufferAdd(buf, start, src - start) || + xmlBufferAdd(buf, replace[i_empty], rlen[i_empty])) + { + xmlXPathSetError(ctxt, XPATH_MEMORY_ERROR); + goto fail_buffer_add; + } + start = src; + } + + src += xmlUTF8Size(src); + } + else { + if ((start < src && + xmlBufferAdd(buf, start, src - start)) || + (rlen[i_match] && + xmlBufferAdd(buf, replace[i_match], rlen[i_match]))) + { + xmlXPathSetError(ctxt, XPATH_MEMORY_ERROR); + goto fail_buffer_add; + } + + src += slen[i_match]; + start = src; + } + } + + if (start < src && xmlBufferAdd(buf, start, src - start)) { + xmlXPathSetError(ctxt, XPATH_MEMORY_ERROR); + goto fail_buffer_add; + } + + /* create result node set */ + + exsltStrReturnString(ctxt, xmlBufferContent(buf), xmlBufferLength(buf)); + + /* clean up */ + +fail_buffer_add: + xmlBufferFree(buf); + +fail_buffer: +fail_process_args: + if (search_set != NULL) { + for (i=0; i + + libxslt + XSLT transformation library + + + + + + + Daniel Veillard + veillard + + + diff --git a/libxslt.m4 b/libxslt.m4 new file mode 100644 index 0000000..c03ec4f --- /dev/null +++ b/libxslt.m4 @@ -0,0 +1,191 @@ +# Based on: +# Configure paths for LIBXML2 +# Toshio Kuratomi 2001-04-21 +# Adapted from: +# Configure paths for GLIB +# Owen Taylor 97-11-3 +# +# Modified to work with libxslt by Thomas Schraitle 2002/10/25 +# Fixed by Edward Rudd 2004/05/12 + +dnl AM_PATH_XSLT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for XML, and define XML_CFLAGS and XML_LIBS +dnl +AC_DEFUN([AM_PATH_XSLT],[ +AC_ARG_WITH(xslt-prefix, + [ --with-xslt-prefix=PFX Prefix where libxslt is installed (optional)], + xslt_config_prefix="$withval", xslt_config_prefix="") +AC_ARG_WITH(xslt-exec-prefix, + [ --with-xslt-exec-prefix=PFX Exec prefix where libxslt is installed (optional)], + xslt_config_exec_prefix="$withval", xslt_config_exec_prefix="") +AC_ARG_ENABLE(xslttest, + [ --disable-xslttest Do not try to compile and run a test LIBXSLT program],, + enable_xslttest=yes) + + if test x$xslt_config_exec_prefix != x ; then + xslt_config_args="$xslt_config_args --exec-prefix=$xslt_config_exec_prefix" + if test x${XSLT_CONFIG+set} != xset ; then + XSLT_CONFIG=$xslt_config_exec_prefix/bin/xslt-config + fi + fi + if test x$xslt_config_prefix != x ; then + xslt_config_args="$xslt_config_args --prefix=$xslt_config_prefix" + if test x${XSLT_CONFIG+set} != xset ; then + XSLT_CONFIG=$xslt_config_prefix/bin/xslt-config + fi + fi + + AC_PATH_PROG(XSLT_CONFIG, xslt-config, no) + min_xslt_version=ifelse([$1], ,1.0.0,[$1]) + AC_MSG_CHECKING(for libxslt - version >= $min_xslt_version) + no_xslt="" + if test "$XSLT_CONFIG" = "no" ; then + no_xslt=yes + else + XSLT_CFLAGS=`$XSLT_CONFIG $xslt_config_args --cflags` + XSLT_LIBS=`$XSLT_CONFIG $xslt_config_args --libs` + xslt_config_major_version=`$XSLT_CONFIG $xslt_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + xslt_config_minor_version=`$XSLT_CONFIG $xslt_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + xslt_config_micro_version=`$XSLT_CONFIG $xslt_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_xslttest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $XSLT_CFLAGS" + LIBS="$XSLT_LIBS $LIBS" +dnl +dnl Now check if the installed libxslt is sufficiently new. +dnl (Also sanity checks the results of xslt-config to some extent) +dnl + rm -f conf.xslttest + AC_TRY_RUN([ +#include +#include +#include +#include +#include +int +main() +{ + int xslt_major_version, xslt_minor_version, xslt_micro_version; + int major, minor, micro; + char *tmp_version; + + system("touch conf.xslttest"); + + /* Capture xslt-config output via autoconf/configure variables */ + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = (char *)strdup("$min_xslt_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string from xslt-config\n", "$min_xslt_version"); + exit(1); + } + free(tmp_version); + + /* Capture the version information from the header files */ + tmp_version = (char *)strdup(LIBXSLT_DOTTED_VERSION); + if (sscanf(tmp_version, "%d.%d.%d", &xslt_major_version, &xslt_minor_version, &xslt_micro_version) != 3) { + printf("%s, bad version string from libxslt includes\n", "LIBXSLT_DOTTED_VERSION"); + exit(1); + } + free(tmp_version); + + /* Compare xslt-config output to the libxslt headers */ + if ((xslt_major_version != $xslt_config_major_version) || + (xslt_minor_version != $xslt_config_minor_version) || + (xslt_micro_version != $xslt_config_micro_version)) + { + printf("*** libxslt header files (version %d.%d.%d) do not match\n", + xslt_major_version, xslt_minor_version, xslt_micro_version); + printf("*** xslt-config (version %d.%d.%d)\n", + $xslt_config_major_version, $xslt_config_minor_version, $xslt_config_micro_version); + return 1; + } +/* Compare the headers to the library to make sure we match */ + /* Less than ideal -- doesn't provide us with return value feedback, + * only exits if there's a serious mismatch between header and library. + */ + /* copied from LIBXML_TEST_VERSION; */ + xmlCheckVersion(LIBXML_VERSION); + + /* Test that the library is greater than our minimum version */ + if ((xslt_major_version > major) || + ((xslt_major_version == major) && (xslt_minor_version > minor)) || + ((xslt_major_version == major) && (xslt_minor_version == minor) && + (xslt_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of libxslt (%d.%d.%d) was found.\n", + xslt_major_version, xslt_minor_version, xslt_micro_version); + printf("*** You need a version of libxslt newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** libxslt is always available from ftp://ftp.xmlsoft.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the xslt-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of LIBXSLT, but you can also set the XSLT_CONFIG environment to point to the\n"); + printf("*** correct copy of xslt-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + return 1; +} +],, no_xslt=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + + if test "x$no_xslt" = x ; then + AC_MSG_RESULT(yes (version $xslt_config_major_version.$xslt_config_minor_version.$xslt_config_micro_version)) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$XSLT_CONFIG" = "no" ; then + echo "*** The xslt-config script installed by LIBXSLT could not be found" + echo "*** If libxslt was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the XSLT_CONFIG environment variable to the" + echo "*** full path to xslt-config." + else + if test -f conf.xslttest ; then + : + else + echo "*** Could not run libxslt test program, checking why..." + CFLAGS="$CFLAGS $XSLT_CFLAGS" + LIBS="$LIBS $XSLT_LIBS" + AC_TRY_LINK([ +#include +#include +], [ LIBXSLT_TEST_VERSION; return 0;], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding LIBXSLT or finding the wrong" + echo "*** version of LIBXSLT. If it is not finding LIBXSLT, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means LIBXSLT was incorrectly installed" + echo "*** or that you have moved LIBXSLT since it was installed. In the latter case, you" + echo "*** may want to edit the xslt-config script: $XSLT_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + + XSLT_CFLAGS="" + XSLT_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(XSLT_CFLAGS) + AC_SUBST(XSLT_LIBS) + rm -f conf.xslttest +]) diff --git a/libxslt.pc.in b/libxslt.pc.in new file mode 100644 index 0000000..082d64c --- /dev/null +++ b/libxslt.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + + +Name: libxslt +Version: @VERSION@ +Description: XSLT library version 2. +Requires: libxml-2.0 +Libs: @XSLT_LIBDIR@ @XSLT_LIBS@ @EXTRA_LIBS@ +Cflags: @XSLT_INCLUDEDIR@ diff --git a/libxslt.spec.in b/libxslt.spec.in new file mode 100644 index 0000000..96c0ca6 --- /dev/null +++ b/libxslt.spec.in @@ -0,0 +1,133 @@ +Summary: Library providing the GNOME XSLT engine +Name: libxslt +Version: @VERSION@ +Release: 1%{?dist}%{?extra_release} +License: MIT +Group: Development/Libraries +Source: ftp://xmlsoft.org/XSLT/libxslt-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-root +URL: http://xmlsoft.org/XSLT/ +Requires: libxml2 >= @LIBXML_REQUIRED_VERSION@ +BuildRequires: libxml2-devel >= @LIBXML_REQUIRED_VERSION@ +BuildRequires: python python-devel +BuildRequires: libxml2-python +BuildRequires: libgcrypt-devel +Prefix: %{_prefix} +Docdir: %{_docdir} + +%description +This C library allows to transform XML files into other XML files +(or HTML, text, ...) using the standard XSLT stylesheet transformation +mechanism. To use it you need to have a version of libxml2 >= @LIBXML_REQUIRED_VERSION@ +installed. The xsltproc command is a command line interface to the XSLT engine + +%package devel +Summary: Libraries, includes, etc. to embed the GNOME XSLT engine +Group: Development/Libraries +Requires: libxslt = %{version}-%{release} +Requires: libxml2-devel >= @LIBXML_REQUIRED_VERSION@ +Requires: libgcrypt-devel +Requires: pkgconfig + +%description devel +This C library allows to transform XML files into other XML files +(or HTML, text, ...) using the standard XSLT stylesheet transformation +mechanism. To use it you need to have a version of libxml2 >= @LIBXML_REQUIRED_VERSION@ +installed. + +%package python +Summary: Python bindings for the libxslt library +Group: Development/Libraries +Requires: libxslt = %{version}-%{release} +Requires: libxml2 >= @LIBXML_REQUIRED_VERSION@ +Requires: libxml2-python >= @LIBXML_REQUIRED_VERSION@ +Requires: python + +%description python +The libxslt-python package contains a module that permits applications +written in the Python programming language to use the interface +supplied by the libxslt library to apply XSLT transformations. + +This library allows to parse sytlesheets, uses the libxml2-python +to load and save XML and HTML files. Direct access to XPath and +the XSLT transformation context are possible to extend the XSLT language +with XPath functions written in Python. + +%prep +%setup -q + +%build +%configure +make +gzip -9 ChangeLog + +%install +rm -fr %{buildroot} + +%makeinstall + +rm -f $RPM_BUILD_ROOT%{_libdir}/*.la +rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/%{name}{,-python}-%{version} + +%check +make check + +%clean +rm -fr %{buildroot} + +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig + +%files +%defattr(-, root, root) + +%doc AUTHORS ChangeLog.gz NEWS README Copyright TODO FEATURES +%doc doc/*.html doc/html doc/tutorial doc/tutorial2 doc/*.gif +%doc doc/EXSLT +%doc %{_mandir}/man1/xsltproc.1* +%{_libdir}/lib*.so.* +%{_libdir}/libxslt-plugins +%{prefix}/bin/xsltproc + +%files devel +%defattr(-, root, root) + +%doc AUTHORS ChangeLog.gz NEWS README Copyright TODO FEATURES +%doc doc/libxslt-api.xml +%doc doc/libxslt-refs.xml +%doc doc/EXSLT/libexslt-api.xml +%doc doc/EXSLT/libexslt-refs.xml +%doc %{_mandir}/man3/libxslt.3* +%doc %{_mandir}/man3/libexslt.3* +%doc doc/*.html doc/html doc/*.gif doc/*.png +%doc doc/tutorial +%doc doc/tutorial2 +%doc doc/images +%doc doc/EXSLT +%{_libdir}/lib*.so +%{_libdir}/*a +%{_libdir}/*.sh +%{prefix}/share/aclocal/libxslt.m4 +%{prefix}/include/* +%{prefix}/bin/xslt-config +%{_libdir}/pkgconfig/libxslt.pc +%{_libdir}/pkgconfig/libexslt.pc + +%files python +%defattr(-, root, root) + +%doc AUTHORS ChangeLog.gz NEWS README Copyright FEATURES +%{_libdir}/python*/site-packages/libxslt.py* +%{_libdir}/python*/site-packages/libxsltmod* +%doc python/TODO +%doc python/libxsltclass.txt +%doc python/tests/*.py +%doc python/tests/*.xml +%doc python/tests/*.xsl + +%changelog +* @RELDATE@ Daniel Veillard +- upstream release @VERSION@ see http://xmlsoft.org/XSLT/news.html diff --git a/libxslt/Makefile.am b/libxslt/Makefile.am new file mode 100644 index 0000000..d9fed68 --- /dev/null +++ b/libxslt/Makefile.am @@ -0,0 +1,79 @@ +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/libxslt + +AM_CFLAGS = $(LIBXML_CFLAGS) + +lib_LTLIBRARIES = libxslt.la + +xsltincdir = $(includedir)/libxslt + +xsltinc_HEADERS = \ + xslt.h \ + xsltutils.h \ + pattern.h \ + templates.h \ + variables.h \ + keys.h \ + numbersInternals.h \ + extensions.h \ + extra.h \ + functions.h \ + namespaces.h \ + imports.h \ + attributes.h \ + documents.h \ + preproc.h \ + transform.h \ + security.h \ + xsltInternals.h \ + xsltexports.h \ + xsltlocale.h +nodist_xsltinc_HEADERS = \ + xsltconfig.h + +libxslt_la_SOURCES = \ + attrvt.c \ + xslt.c \ + xsltlocale.c \ + xsltutils.c \ + pattern.c \ + templates.c \ + variables.c \ + keys.c \ + numbers.c \ + extensions.c \ + extra.c \ + functions.c \ + namespaces.c \ + imports.c \ + attributes.c \ + documents.c \ + preproc.c \ + transform.c \ + security.c \ + win32config.h \ + xsltwin32config.h.in \ + libxslt.h +nodist_libxslt_la_SOURCES = \ + xsltwin32config.h + +if USE_VERSION_SCRIPT +LIBXSLT_VERSION_SCRIPT = $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxslt.syms +else +LIBXSLT_VERSION_SCRIPT = +endif + +libxslt_la_LIBADD = $(LIBXML_LIBS) $(EXTRA_LIBS) +libxslt_la_LDFLAGS = \ + $(WIN32_EXTRA_LDFLAGS) \ + $(LIBXSLT_VERSION_SCRIPT) \ + -version-info $(LIBXSLT_VERSION_INFO) + +man_MANS = libxslt.3 + +EXTRA_DIST = $(man_MANS) trio.h triodef.h libxslt.syms + +xsltproc: all + @(cd ../xsltproc ; $(MAKE)) + +install-exec-hook: + $(MKDIR_P) "$(DESTDIR)$(libdir)/libxslt-plugins" diff --git a/libxslt/attributes.c b/libxslt/attributes.c new file mode 100644 index 0000000..8440b10 --- /dev/null +++ b/libxslt/attributes.c @@ -0,0 +1,1162 @@ +/* + * attributes.c: Implementation of the XSLT attributes handling + * + * Reference: + * http://www.w3.org/TR/1999/REC-xslt-19991116 + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_MATH_H +#include +#endif +#ifdef HAVE_FLOAT_H +#include +#endif +#ifdef HAVE_IEEEFP_H +#include +#endif +#ifdef HAVE_NAN_H +#include +#endif +#ifdef HAVE_CTYPE_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "attributes.h" +#include "namespaces.h" +#include "templates.h" +#include "imports.h" +#include "transform.h" +#include "preproc.h" + +#define WITH_XSLT_DEBUG_ATTRIBUTES +#ifdef WITH_XSLT_DEBUG +#define WITH_XSLT_DEBUG_ATTRIBUTES +#endif + +/* + * TODO: merge attribute sets from different import precedence. + * all this should be precomputed just before the transformation + * starts or at first hit with a cache in the context. + * The simple way for now would be to not allow redefinition of + * attributes once generated in the output tree, possibly costlier. + */ + +/* + * Useful macros + */ +#ifdef IS_BLANK +#undef IS_BLANK +#endif + +#define IS_BLANK(c) (((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) || \ + ((c) == 0x0D)) + +#define IS_BLANK_NODE(n) \ + (((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content))) + + +/* + * The in-memory structure corresponding to an XSLT Attribute in + * an attribute set + */ + + +typedef struct _xsltAttrElem xsltAttrElem; +typedef xsltAttrElem *xsltAttrElemPtr; +struct _xsltAttrElem { + struct _xsltAttrElem *next;/* chained list */ + xmlNodePtr attr; /* the xsl:attribute definition */ + const xmlChar *set; /* or the attribute set */ + const xmlChar *ns; /* and its namespace */ +}; + +/************************************************************************ + * * + * XSLT Attribute handling * + * * + ************************************************************************/ + +/** + * xsltNewAttrElem: + * @attr: the new xsl:attribute node + * + * Create a new XSLT AttrElem + * + * Returns the newly allocated xsltAttrElemPtr or NULL in case of error + */ +static xsltAttrElemPtr +xsltNewAttrElem(xmlNodePtr attr) { + xsltAttrElemPtr cur; + + cur = (xsltAttrElemPtr) xmlMalloc(sizeof(xsltAttrElem)); + if (cur == NULL) { + xsltGenericError(xsltGenericErrorContext, + "xsltNewAttrElem : malloc failed\n"); + return(NULL); + } + memset(cur, 0, sizeof(xsltAttrElem)); + cur->attr = attr; + return(cur); +} + +/** + * xsltFreeAttrElem: + * @attr: an XSLT AttrElem + * + * Free up the memory allocated by @attr + */ +static void +xsltFreeAttrElem(xsltAttrElemPtr attr) { + xmlFree(attr); +} + +/** + * xsltFreeAttrElemList: + * @list: an XSLT AttrElem list + * + * Free up the memory allocated by @list + */ +static void +xsltFreeAttrElemList(xsltAttrElemPtr list) { + xsltAttrElemPtr next; + + while (list != NULL) { + next = list->next; + xsltFreeAttrElem(list); + list = next; + } +} + +#ifdef XSLT_REFACTORED + /* + * This was moved to xsltParseStylesheetAttributeSet(). + */ +#else +/** + * xsltAddAttrElemList: + * @list: an XSLT AttrElem list + * @attr: the new xsl:attribute node + * + * Add the new attribute to the list. + * + * Returns the new list pointer + */ +static xsltAttrElemPtr +xsltAddAttrElemList(xsltAttrElemPtr list, xmlNodePtr attr) { + xsltAttrElemPtr next, cur; + + if (attr == NULL) + return(list); + if (list == NULL) + return(xsltNewAttrElem(attr)); + cur = list; + while (cur != NULL) { + next = cur->next; + if (cur->attr == attr) + return(cur); + if (cur->next == NULL) { + cur->next = xsltNewAttrElem(attr); + return(list); + } + cur = next; + } + return(list); +} +#endif /* XSLT_REFACTORED */ + +/** + * xsltMergeAttrElemList: + * @list: an XSLT AttrElem list + * @old: another XSLT AttrElem list + * + * Add all the attributes from list @old to list @list, + * but drop redefinition of existing values. + * + * Returns the new list pointer + */ +static xsltAttrElemPtr +xsltMergeAttrElemList(xsltStylesheetPtr style, + xsltAttrElemPtr list, xsltAttrElemPtr old) { + xsltAttrElemPtr cur; + int add; + + while (old != NULL) { + if ((old->attr == NULL) && (old->set == NULL)) { + old = old->next; + continue; + } + /* + * Check that the attribute is not yet in the list + */ + cur = list; + add = 1; + while (cur != NULL) { + if ((cur->attr == NULL) && (cur->set == NULL)) { + if (cur->next == NULL) + break; + cur = cur->next; + continue; + } + if ((cur->set != NULL) && (cur->set == old->set)) { + add = 0; + break; + } + if (cur->set != NULL) { + if (cur->next == NULL) + break; + cur = cur->next; + continue; + } + if (old->set != NULL) { + if (cur->next == NULL) + break; + cur = cur->next; + continue; + } + if (cur->attr == old->attr) { + xsltGenericError(xsltGenericErrorContext, + "xsl:attribute-set : use-attribute-sets recursion detected\n"); + return(list); + } + if (cur->next == NULL) + break; + cur = cur->next; + } + + if (add == 1) { + /* + * Changed to use the string-dict, rather than duplicating + * @set and @ns; this fixes bug #340400. + */ + if (cur == NULL) { + list = xsltNewAttrElem(old->attr); + if (old->set != NULL) { + list->set = xmlDictLookup(style->dict, old->set, -1); + if (old->ns != NULL) + list->ns = xmlDictLookup(style->dict, old->ns, -1); + } + } else if (add) { + cur->next = xsltNewAttrElem(old->attr); + if (old->set != NULL) { + cur->next->set = xmlDictLookup(style->dict, old->set, -1); + if (old->ns != NULL) + cur->next->ns = xmlDictLookup(style->dict, old->ns, -1); + } + } + } + + old = old->next; + } + return(list); +} + +/************************************************************************ + * * + * Module interfaces * + * * + ************************************************************************/ + +/** + * xsltParseStylesheetAttributeSet: + * @style: the XSLT stylesheet + * @cur: the "attribute-set" element + * + * parse an XSLT stylesheet attribute-set element + */ + +void +xsltParseStylesheetAttributeSet(xsltStylesheetPtr style, xmlNodePtr cur) { + const xmlChar *ncname; + const xmlChar *prefix; + xmlChar *value; + xmlNodePtr child; + xsltAttrElemPtr attrItems; + + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) + return; + + value = xmlGetNsProp(cur, (const xmlChar *)"name", NULL); + if ((value == NULL) || (*value == 0)) { + xsltGenericError(xsltGenericErrorContext, + "xsl:attribute-set : name is missing\n"); + if (value) + xmlFree(value); + return; + } + + ncname = xsltSplitQName(style->dict, value, &prefix); + xmlFree(value); + value = NULL; + + if (style->attributeSets == NULL) { +#ifdef WITH_XSLT_DEBUG_ATTRIBUTES + xsltGenericDebug(xsltGenericDebugContext, + "creating attribute set table\n"); +#endif + style->attributeSets = xmlHashCreate(10); + } + if (style->attributeSets == NULL) + return; + + attrItems = xmlHashLookup2(style->attributeSets, ncname, prefix); + + /* + * Parse the content. Only xsl:attribute elements are allowed. + */ + child = cur->children; + while (child != NULL) { + /* + * Report invalid nodes. + */ + if ((child->type != XML_ELEMENT_NODE) || + (child->ns == NULL) || + (! IS_XSLT_ELEM(child))) + { + if (child->type == XML_ELEMENT_NODE) + xsltTransformError(NULL, style, child, + "xsl:attribute-set : unexpected child %s\n", + child->name); + else + xsltTransformError(NULL, style, child, + "xsl:attribute-set : child of unexpected type\n"); + } else if (!IS_XSLT_NAME(child, "attribute")) { + xsltTransformError(NULL, style, child, + "xsl:attribute-set : unexpected child xsl:%s\n", + child->name); + } else { +#ifdef XSLT_REFACTORED + xsltAttrElemPtr nextAttr, curAttr; + + /* + * Process xsl:attribute + * --------------------- + */ + +#ifdef WITH_XSLT_DEBUG_ATTRIBUTES + xsltGenericDebug(xsltGenericDebugContext, + "add attribute to list %s\n", ncname); +#endif + /* + * The following was taken over from + * xsltAddAttrElemList(). + */ + if (attrItems == NULL) { + attrItems = xsltNewAttrElem(child); + } else { + curAttr = attrItems; + while (curAttr != NULL) { + nextAttr = curAttr->next; + if (curAttr->attr == child) { + /* + * URGENT TODO: Can somebody explain + * why attrItems is set to curAttr + * here? Is this somehow related to + * avoidance of recursions? + */ + attrItems = curAttr; + goto next_child; + } + if (curAttr->next == NULL) + curAttr->next = xsltNewAttrElem(child); + curAttr = nextAttr; + } + } + /* + * Parse the xsl:attribute and its content. + */ + xsltParseAnyXSLTElem(XSLT_CCTXT(style), child); +#else +#ifdef WITH_XSLT_DEBUG_ATTRIBUTES + xsltGenericDebug(xsltGenericDebugContext, + "add attribute to list %s\n", ncname); +#endif + /* + * OLD behaviour: + */ + attrItems = xsltAddAttrElemList(attrItems, child); +#endif + } + +#ifdef XSLT_REFACTORED +next_child: +#endif + child = child->next; + } + + /* + * Process attribue "use-attribute-sets". + */ + /* TODO check recursion */ + value = xmlGetNsProp(cur, (const xmlChar *)"use-attribute-sets", + NULL); + if (value != NULL) { + const xmlChar *curval, *endval; + curval = value; + while (*curval != 0) { + while (IS_BLANK(*curval)) curval++; + if (*curval == 0) + break; + endval = curval; + while ((*endval != 0) && (!IS_BLANK(*endval))) endval++; + curval = xmlDictLookup(style->dict, curval, endval - curval); + if (curval) { + const xmlChar *ncname2 = NULL; + const xmlChar *prefix2 = NULL; + xsltAttrElemPtr refAttrItems; + +#ifdef WITH_XSLT_DEBUG_ATTRIBUTES + xsltGenericDebug(xsltGenericDebugContext, + "xsl:attribute-set : %s adds use %s\n", ncname, curval); +#endif + ncname2 = xsltSplitQName(style->dict, curval, &prefix2); + refAttrItems = xsltNewAttrElem(NULL); + if (refAttrItems != NULL) { + refAttrItems->set = ncname2; + refAttrItems->ns = prefix2; + attrItems = xsltMergeAttrElemList(style, + attrItems, refAttrItems); + xsltFreeAttrElem(refAttrItems); + } + } + curval = endval; + } + xmlFree(value); + value = NULL; + } + + /* + * Update the value + */ + /* + * TODO: Why is this dummy entry needed.? + */ + if (attrItems == NULL) + attrItems = xsltNewAttrElem(NULL); + xmlHashUpdateEntry2(style->attributeSets, ncname, prefix, attrItems, NULL); +#ifdef WITH_XSLT_DEBUG_ATTRIBUTES + xsltGenericDebug(xsltGenericDebugContext, + "updated attribute list %s\n", ncname); +#endif +} + +/** + * xsltGetSAS: + * @style: the XSLT stylesheet + * @name: the attribute list name + * @ns: the attribute list namespace + * + * lookup an attribute set based on the style cascade + * + * Returns the attribute set or NULL + */ +static xsltAttrElemPtr +xsltGetSAS(xsltStylesheetPtr style, const xmlChar *name, const xmlChar *ns) { + xsltAttrElemPtr values; + + while (style != NULL) { + values = xmlHashLookup2(style->attributeSets, name, ns); + if (values != NULL) + return(values); + style = xsltNextImport(style); + } + return(NULL); +} + +/** + * xsltResolveSASCallbackInt: + * @style: the XSLT stylesheet + * + * resolve the references in an attribute set. + */ +static void +xsltResolveSASCallbackInt(xsltAttrElemPtr values, xsltStylesheetPtr style, + const xmlChar *name, const xmlChar *ns, + int depth) { + xsltAttrElemPtr tmp; + xsltAttrElemPtr refs; + + tmp = values; + if ((name == NULL) || (name[0] == 0)) + return; + if (depth > 100) { + xsltGenericError(xsltGenericErrorContext, + "xsl:attribute-set : use-attribute-sets recursion detected on %s\n", + name); + return; + } + while (tmp != NULL) { + if (tmp->set != NULL) { + /* + * Check against cycles ! + */ + if ((xmlStrEqual(name, tmp->set)) && (xmlStrEqual(ns, tmp->ns))) { + xsltGenericError(xsltGenericErrorContext, + "xsl:attribute-set : use-attribute-sets recursion detected on %s\n", + name); + } else { +#ifdef WITH_XSLT_DEBUG_ATTRIBUTES + xsltGenericDebug(xsltGenericDebugContext, + "Importing attribute list %s\n", tmp->set); +#endif + + refs = xsltGetSAS(style, tmp->set, tmp->ns); + if (refs == NULL) { + xsltGenericError(xsltGenericErrorContext, + "xsl:attribute-set : use-attribute-sets %s reference missing %s\n", + name, tmp->set); + } else { + /* + * recurse first for cleanup + */ + xsltResolveSASCallbackInt(refs, style, name, ns, depth + 1); + /* + * Then merge + */ + xsltMergeAttrElemList(style, values, refs); + /* + * Then suppress the reference + */ + tmp->set = NULL; + tmp->ns = NULL; + } + } + } + tmp = tmp->next; + } +} + +/** + * xsltResolveSASCallback,: + * @style: the XSLT stylesheet + * + * resolve the references in an attribute set. + */ +static void +xsltResolveSASCallback(xsltAttrElemPtr values, xsltStylesheetPtr style, + const xmlChar *name, const xmlChar *ns, + ATTRIBUTE_UNUSED const xmlChar *ignored) { + xsltResolveSASCallbackInt(values, style, name, ns, 1); +} + +/** + * xsltMergeSASCallback,: + * @style: the XSLT stylesheet + * + * Merge an attribute set from an imported stylesheet. + */ +static void +xsltMergeSASCallback(xsltAttrElemPtr values, xsltStylesheetPtr style, + const xmlChar *name, const xmlChar *ns, + ATTRIBUTE_UNUSED const xmlChar *ignored) { + int ret; + xsltAttrElemPtr topSet; + + ret = xmlHashAddEntry2(style->attributeSets, name, ns, values); + if (ret < 0) { + /* + * Add failed, this attribute set can be removed. + */ +#ifdef WITH_XSLT_DEBUG_ATTRIBUTES + xsltGenericDebug(xsltGenericDebugContext, + "attribute set %s present already in top stylesheet" + " - merging\n", name); +#endif + topSet = xmlHashLookup2(style->attributeSets, name, ns); + if (topSet==NULL) { + xsltGenericError(xsltGenericErrorContext, + "xsl:attribute-set : logic error merging from imports for" + " attribute-set %s\n", name); + } else { + topSet = xsltMergeAttrElemList(style, topSet, values); + xmlHashUpdateEntry2(style->attributeSets, name, ns, topSet, NULL); + } + xsltFreeAttrElemList(values); +#ifdef WITH_XSLT_DEBUG_ATTRIBUTES + } else { + xsltGenericDebug(xsltGenericDebugContext, + "attribute set %s moved to top stylesheet\n", + name); +#endif + } +} + +/** + * xsltResolveStylesheetAttributeSet: + * @style: the XSLT stylesheet + * + * resolve the references between attribute sets. + */ +void +xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style) { + xsltStylesheetPtr cur; + +#ifdef WITH_XSLT_DEBUG_ATTRIBUTES + xsltGenericDebug(xsltGenericDebugContext, + "Resolving attribute sets references\n"); +#endif + /* + * First aggregate all the attribute sets definitions from the imports + */ + cur = xsltNextImport(style); + while (cur != NULL) { + if (cur->attributeSets != NULL) { + if (style->attributeSets == NULL) { +#ifdef WITH_XSLT_DEBUG_ATTRIBUTES + xsltGenericDebug(xsltGenericDebugContext, + "creating attribute set table\n"); +#endif + style->attributeSets = xmlHashCreate(10); + } + xmlHashScanFull(cur->attributeSets, + (xmlHashScannerFull) xsltMergeSASCallback, style); + /* + * the attribute lists have either been migrated to style + * or freed directly in xsltMergeSASCallback() + */ + xmlHashFree(cur->attributeSets, NULL); + cur->attributeSets = NULL; + } + cur = xsltNextImport(cur); + } + + /* + * Then resolve all the references and computes the resulting sets + */ + if (style->attributeSets != NULL) { + xmlHashScanFull(style->attributeSets, + (xmlHashScannerFull) xsltResolveSASCallback, style); + } +} + +/** + * xsltAttributeInternal: + * @ctxt: a XSLT process context + * @node: the current node in the source tree + * @inst: the xsl:attribute element + * @comp: precomputed information + * @fromAttributeSet: the attribute comes from an attribute-set + * + * Process the xslt attribute node on the source node + */ +static void +xsltAttributeInternal(xsltTransformContextPtr ctxt, + xmlNodePtr contextNode, + xmlNodePtr inst, + xsltStylePreCompPtr castedComp, + int fromAttributeSet) +{ +#ifdef XSLT_REFACTORED + xsltStyleItemAttributePtr comp = + (xsltStyleItemAttributePtr) castedComp; +#else + xsltStylePreCompPtr comp = castedComp; +#endif + xmlNodePtr targetElem; + xmlChar *prop = NULL; + const xmlChar *name = NULL, *prefix = NULL, *nsName = NULL; + xmlChar *value = NULL; + xmlNsPtr ns = NULL; + xmlAttrPtr attr; + + if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL) || + (inst->type != XML_ELEMENT_NODE) ) + return; + + /* + * A comp->has_name == 0 indicates that we need to skip this instruction, + * since it was evaluated to be invalid already during compilation. + */ + if (!comp->has_name) + return; + /* + * BIG NOTE: This previously used xsltGetSpecialNamespace() and + * xsltGetNamespace(), but since both are not appropriate, we + * will process namespace lookup here to avoid adding yet another + * ns-lookup function to namespaces.c. + */ + /* + * SPEC XSLT 1.0: Error cases: + * - Creating nodes other than text nodes during the instantiation of + * the content of the xsl:attribute element; implementations may + * either signal the error or ignore the offending nodes." + */ + + if (comp == NULL) { + xsltTransformError(ctxt, NULL, inst, + "Internal error in xsltAttributeInternal(): " + "The XSLT 'attribute' instruction was not compiled.\n"); + return; + } + /* + * TODO: Shouldn't ctxt->insert == NULL be treated as an internal error? + * So report an internal error? + */ + if (ctxt->insert == NULL) + return; + /* + * SPEC XSLT 1.0: + * "Adding an attribute to a node that is not an element; + * implementations may either signal the error or ignore the attribute." + * + * TODO: I think we should signal such errors in the future, and maybe + * provide an option to ignore such errors. + */ + targetElem = ctxt->insert; + if (targetElem->type != XML_ELEMENT_NODE) + return; + + /* + * SPEC XSLT 1.0: + * "Adding an attribute to an element after children have been added + * to it; implementations may either signal the error or ignore the + * attribute." + * + * TODO: We should decide whether not to report such errors or + * to ignore them; note that we *ignore* if the parent is not an + * element, but here we report an error. + */ + if (targetElem->children != NULL) { + /* + * NOTE: Ah! This seems to be intended to support streamed + * result generation!. + */ + xsltTransformError(ctxt, NULL, inst, + "xsl:attribute: Cannot add attributes to an " + "element if children have been already added " + "to the element.\n"); + return; + } + + /* + * Process the name + * ---------------- + */ + +#ifdef WITH_DEBUGGER + if (ctxt->debugStatus != XSLT_DEBUG_NONE) + xslHandleDebugger(inst, contextNode, NULL, ctxt); +#endif + + if (comp->name == NULL) { + /* TODO: fix attr acquisition wrt to the XSLT namespace */ + prop = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) "name", XSLT_NAMESPACE); + if (prop == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsl:attribute: The attribute 'name' is missing.\n"); + goto error; + } + if (xmlValidateQName(prop, 0)) { + xsltTransformError(ctxt, NULL, inst, + "xsl:attribute: The effective name '%s' is not a " + "valid QName.\n", prop); + /* we fall through to catch any further errors, if possible */ + } + + /* + * Reject a name of "xmlns". + */ + if (xmlStrEqual(prop, BAD_CAST "xmlns")) { + xsltTransformError(ctxt, NULL, inst, + "xsl:attribute: The effective name 'xmlns' is not allowed.\n"); + xmlFree(prop); + goto error; + } + + name = xsltSplitQName(ctxt->dict, prop, &prefix); + xmlFree(prop); + } else { + /* + * The "name" value was static. + */ +#ifdef XSLT_REFACTORED + prefix = comp->nsPrefix; + name = comp->name; +#else + name = xsltSplitQName(ctxt->dict, comp->name, &prefix); +#endif + } + + /* + * Process namespace semantics + * --------------------------- + * + * Evaluate the namespace name. + */ + if (comp->has_ns) { + /* + * The "namespace" attribute was existent. + */ + if (comp->ns != NULL) { + /* + * No AVT; just plain text for the namespace name. + */ + if (comp->ns[0] != 0) + nsName = comp->ns; + } else { + xmlChar *tmpNsName; + /* + * Eval the AVT. + */ + /* TODO: check attr acquisition wrt to the XSLT namespace */ + tmpNsName = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) "namespace", XSLT_NAMESPACE); + /* + * This fixes bug #302020: The AVT might also evaluate to the + * empty string; this means that the empty string also indicates + * "no namespace". + * SPEC XSLT 1.0: + * "If the string is empty, then the expanded-name of the + * attribute has a null namespace URI." + */ + if ((tmpNsName != NULL) && (tmpNsName[0] != 0)) + nsName = xmlDictLookup(ctxt->dict, BAD_CAST tmpNsName, -1); + xmlFree(tmpNsName); + } + + if (xmlStrEqual(nsName, BAD_CAST "http://www.w3.org/2000/xmlns/")) { + xsltTransformError(ctxt, NULL, inst, + "xsl:attribute: Namespace http://www.w3.org/2000/xmlns/ " + "forbidden.\n"); + goto error; + } + if (xmlStrEqual(nsName, XML_XML_NAMESPACE)) { + prefix = BAD_CAST "xml"; + } else if (xmlStrEqual(prefix, BAD_CAST "xml")) { + prefix = NULL; + } + } else if (prefix != NULL) { + /* + * SPEC XSLT 1.0: + * "If the namespace attribute is not present, then the QName is + * expanded into an expanded-name using the namespace declarations + * in effect for the xsl:attribute element, *not* including any + * default namespace declaration." + */ + ns = xmlSearchNs(inst->doc, inst, prefix); + if (ns == NULL) { + /* + * Note that this is treated as an error now (checked with + * Saxon, Xalan-J and MSXML). + */ + xsltTransformError(ctxt, NULL, inst, + "xsl:attribute: The QName '%s:%s' has no " + "namespace binding in scope in the stylesheet; " + "this is an error, since the namespace was not " + "specified by the instruction itself.\n", prefix, name); + } else + nsName = ns->href; + } + + if (fromAttributeSet) { + /* + * This tries to ensure that xsl:attribute(s) coming + * from an xsl:attribute-set won't override attribute of + * literal result elements or of explicit xsl:attribute(s). + * URGENT TODO: This might be buggy, since it will miss to + * overwrite two equal attributes both from attribute sets. + */ + attr = xmlHasNsProp(targetElem, name, nsName); + if (attr != NULL) + return; + } + + /* + * Find/create a matching ns-decl in the result tree. + */ + ns = NULL; + +#if 0 + if (0) { + /* + * OPTIMIZE TODO: How do we know if we are adding to a + * fragment or to the result tree? + * + * If we are adding to a result tree fragment (i.e., not to the + * actual result tree), we'll don't bother searching for the + * ns-decl, but just store it in the dummy-doc of the result + * tree fragment. + */ + if (nsName != NULL) { + /* + * TODO: Get the doc of @targetElem. + */ + ns = xsltTreeAcquireStoredNs(some doc, nsName, prefix); + } + } +#endif + + if (nsName != NULL) { + /* + * Something about ns-prefixes: + * SPEC XSLT 1.0: + * "XSLT processors may make use of the prefix of the QName specified + * in the name attribute when selecting the prefix used for outputting + * the created attribute as XML; however, they are not required to do + * so and, if the prefix is xmlns, they must not do so" + */ + /* + * xsl:attribute can produce a scenario where the prefix is NULL, + * so generate a prefix. + */ + if ((prefix == NULL) || xmlStrEqual(prefix, BAD_CAST "xmlns")) { + xmlChar *pref = xmlStrdup(BAD_CAST "ns_1"); + + ns = xsltGetSpecialNamespace(ctxt, inst, nsName, pref, targetElem); + + xmlFree(pref); + } else { + ns = xsltGetSpecialNamespace(ctxt, inst, nsName, prefix, + targetElem); + } + if (ns == NULL) { + xsltTransformError(ctxt, NULL, inst, + "Namespace fixup error: Failed to acquire an in-scope " + "namespace binding for the generated attribute '{%s}%s'.\n", + nsName, name); + goto error; + } + } + /* + * Construction of the value + * ------------------------- + */ + if (inst->children == NULL) { + /* + * No content. + * TODO: Do we need to put the empty string in ? + */ + attr = xmlSetNsProp(ctxt->insert, ns, name, (const xmlChar *) ""); + } else if ((inst->children->next == NULL) && + ((inst->children->type == XML_TEXT_NODE) || + (inst->children->type == XML_CDATA_SECTION_NODE))) + { + xmlNodePtr copyTxt; + + /* + * xmlSetNsProp() will take care of duplicates. + */ + attr = xmlSetNsProp(ctxt->insert, ns, name, NULL); + if (attr == NULL) /* TODO: report error ? */ + goto error; + /* + * This was taken over from xsltCopyText() (transform.c). + */ + if (ctxt->internalized && + (ctxt->insert->doc != NULL) && + (ctxt->insert->doc->dict == ctxt->dict)) + { + copyTxt = xmlNewText(NULL); + if (copyTxt == NULL) /* TODO: report error */ + goto error; + /* + * This is a safe scenario where we don't need to lookup + * the dict. + */ + copyTxt->content = inst->children->content; + /* + * Copy "disable-output-escaping" information. + * TODO: Does this have any effect for attribute values + * anyway? + */ + if (inst->children->name == xmlStringTextNoenc) + copyTxt->name = xmlStringTextNoenc; + } else { + /* + * Copy the value. + */ + copyTxt = xmlNewText(inst->children->content); + if (copyTxt == NULL) /* TODO: report error */ + goto error; + } + attr->children = attr->last = copyTxt; + copyTxt->parent = (xmlNodePtr) attr; + copyTxt->doc = attr->doc; + /* + * Copy "disable-output-escaping" information. + * TODO: Does this have any effect for attribute values + * anyway? + */ + if (inst->children->name == xmlStringTextNoenc) + copyTxt->name = xmlStringTextNoenc; + + /* + * since we create the attribute without content IDness must be + * asserted as a second step + */ + if ((copyTxt->content != NULL) && + (xmlIsID(attr->doc, attr->parent, attr))) + xmlAddID(NULL, attr->doc, copyTxt->content, attr); + } else { + /* + * The sequence constructor might be complex, so instantiate it. + */ + value = xsltEvalTemplateString(ctxt, contextNode, inst); + if (value != NULL) { + attr = xmlSetNsProp(ctxt->insert, ns, name, value); + xmlFree(value); + } else { + /* + * TODO: Do we have to add the empty string to the attr? + * TODO: Does a value of NULL indicate an + * error in xsltEvalTemplateString() ? + */ + attr = xmlSetNsProp(ctxt->insert, ns, name, + (const xmlChar *) ""); + } + } + +error: + return; +} + +/** + * xsltAttribute: + * @ctxt: a XSLT process context + * @node: the node in the source tree. + * @inst: the xslt attribute node + * @comp: precomputed information + * + * Process the xslt attribute node on the source node + */ +void +xsltAttribute(xsltTransformContextPtr ctxt, xmlNodePtr node, + xmlNodePtr inst, xsltStylePreCompPtr comp) { + xsltAttributeInternal(ctxt, node, inst, comp, 0); +} + +/** + * xsltApplyAttributeSet: + * @ctxt: the XSLT stylesheet + * @node: the node in the source tree. + * @inst: the attribute node "xsl:use-attribute-sets" + * @attrSets: the list of QNames of the attribute-sets to be applied + * + * Apply the xsl:use-attribute-sets. + * If @attrSets is NULL, then @inst will be used to exctract this + * value. + * If both, @attrSets and @inst, are NULL, then this will do nothing. + */ +void +xsltApplyAttributeSet(xsltTransformContextPtr ctxt, xmlNodePtr node, + xmlNodePtr inst, + const xmlChar *attrSets) +{ + const xmlChar *ncname = NULL; + const xmlChar *prefix = NULL; + const xmlChar *curstr, *endstr; + xsltAttrElemPtr attrs; + xsltStylesheetPtr style; + + if (attrSets == NULL) { + if (inst == NULL) + return; + else { + /* + * Extract the value from @inst. + */ + if (inst->type == XML_ATTRIBUTE_NODE) { + if ( ((xmlAttrPtr) inst)->children != NULL) + attrSets = ((xmlAttrPtr) inst)->children->content; + + } + if (attrSets == NULL) { + /* + * TODO: Return an error? + */ + return; + } + } + } + /* + * Parse/apply the list of QNames. + */ + curstr = attrSets; + while (*curstr != 0) { + while (IS_BLANK(*curstr)) + curstr++; + if (*curstr == 0) + break; + endstr = curstr; + while ((*endstr != 0) && (!IS_BLANK(*endstr))) + endstr++; + curstr = xmlDictLookup(ctxt->dict, curstr, endstr - curstr); + if (curstr) { + /* + * TODO: Validate the QName. + */ + +#ifdef WITH_XSLT_DEBUG_curstrUTES + xsltGenericDebug(xsltGenericDebugContext, + "apply curstrute set %s\n", curstr); +#endif + ncname = xsltSplitQName(ctxt->dict, curstr, &prefix); + + style = ctxt->style; + +#ifdef WITH_DEBUGGER + if ((style != NULL) && + (style->attributeSets != NULL) && + (ctxt->debugStatus != XSLT_DEBUG_NONE)) + { + attrs = + xmlHashLookup2(style->attributeSets, ncname, prefix); + if ((attrs != NULL) && (attrs->attr != NULL)) + xslHandleDebugger(attrs->attr->parent, node, NULL, + ctxt); + } +#endif + /* + * Lookup the referenced curstrute-set. + */ + while (style != NULL) { + attrs = + xmlHashLookup2(style->attributeSets, ncname, prefix); + while (attrs != NULL) { + if (attrs->attr != NULL) { + xsltAttributeInternal(ctxt, node, attrs->attr, + attrs->attr->psvi, 1); + } + attrs = attrs->next; + } + style = xsltNextImport(style); + } + } + curstr = endstr; + } +} + +/** + * xsltFreeAttributeSetsHashes: + * @style: an XSLT stylesheet + * + * Free up the memory used by attribute sets + */ +void +xsltFreeAttributeSetsHashes(xsltStylesheetPtr style) { + if (style->attributeSets != NULL) + xmlHashFree((xmlHashTablePtr) style->attributeSets, + (xmlHashDeallocator) xsltFreeAttrElemList); + style->attributeSets = NULL; +} diff --git a/libxslt/attributes.h b/libxslt/attributes.h new file mode 100644 index 0000000..05b8a6e --- /dev/null +++ b/libxslt/attributes.h @@ -0,0 +1,38 @@ +/* + * Summary: interface for the XSLT attribute handling + * Description: this module handles the specificities of attribute + * and attribute groups processing. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XSLT_ATTRIBUTES_H__ +#define __XML_XSLT_ATTRIBUTES_H__ + +#include +#include "xsltexports.h" + +#ifdef __cplusplus +extern "C" { +#endif + +XSLTPUBFUN void XSLTCALL + xsltParseStylesheetAttributeSet (xsltStylesheetPtr style, + xmlNodePtr cur); +XSLTPUBFUN void XSLTCALL + xsltFreeAttributeSetsHashes (xsltStylesheetPtr style); +XSLTPUBFUN void XSLTCALL + xsltApplyAttributeSet (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + const xmlChar *attributes); +XSLTPUBFUN void XSLTCALL + xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style); +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XSLT_ATTRIBUTES_H__ */ + diff --git a/libxslt/attrvt.c b/libxslt/attrvt.c new file mode 100644 index 0000000..125159c --- /dev/null +++ b/libxslt/attrvt.c @@ -0,0 +1,387 @@ +/* + * attrvt.c: Implementation of the XSL Transformation 1.0 engine + * attribute value template handling part. + * + * References: + * http://www.w3.org/TR/1999/REC-xslt-19991116 + * + * Michael Kay "XSLT Programmer's Reference" pp 637-643 + * Writing Multiple Output Files + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include +#include +#include +#include +#include "xslt.h" +#include "xsltutils.h" +#include "xsltInternals.h" +#include "templates.h" + +#ifdef WITH_XSLT_DEBUG +#define WITH_XSLT_DEBUG_AVT +#endif + +#define MAX_AVT_SEG 10 + +typedef struct _xsltAttrVT xsltAttrVT; +typedef xsltAttrVT *xsltAttrVTPtr; +struct _xsltAttrVT { + struct _xsltAttrVT *next; /* next xsltAttrVT */ + int nb_seg; /* Number of segments */ + int max_seg; /* max capacity before re-alloc needed */ + int strstart; /* is the start a string */ + /* + * the namespaces in scope + */ + xmlNsPtr *nsList; + int nsNr; + /* + * the content is an alternate of string and xmlXPathCompExprPtr + */ + void *segments[MAX_AVT_SEG]; +}; + +/** + * xsltNewAttrVT: + * @style: a XSLT process context + * + * Build a new xsltAttrVT structure + * + * Returns the structure or NULL in case of error + */ +static xsltAttrVTPtr +xsltNewAttrVT(xsltStylesheetPtr style) { + xsltAttrVTPtr cur; + + cur = (xsltAttrVTPtr) xmlMalloc(sizeof(xsltAttrVT)); + if (cur == NULL) { + xsltTransformError(NULL, style, NULL, + "xsltNewAttrVTPtr : malloc failed\n"); + if (style != NULL) style->errors++; + return(NULL); + } + memset(cur, 0, sizeof(xsltAttrVT)); + + cur->nb_seg = 0; + cur->max_seg = MAX_AVT_SEG; + cur->strstart = 0; + cur->next = style->attVTs; + /* + * Note: this pointer may be changed by a re-alloc within xsltCompileAttr, + * so that code may change the stylesheet pointer also! + */ + style->attVTs = (xsltAttrVTPtr) cur; + + return(cur); +} + +/** + * xsltFreeAttrVT: + * @avt: pointer to an xsltAttrVT structure + * + * Free up the memory associated to the attribute value template + */ +static void +xsltFreeAttrVT(xsltAttrVTPtr avt) { + int i; + + if (avt == NULL) return; + + if (avt->strstart == 1) { + for (i = 0;i < avt->nb_seg; i += 2) + if (avt->segments[i] != NULL) + xmlFree((xmlChar *) avt->segments[i]); + for (i = 1;i < avt->nb_seg; i += 2) + xmlXPathFreeCompExpr((xmlXPathCompExprPtr) avt->segments[i]); + } else { + for (i = 0;i < avt->nb_seg; i += 2) + xmlXPathFreeCompExpr((xmlXPathCompExprPtr) avt->segments[i]); + for (i = 1;i < avt->nb_seg; i += 2) + if (avt->segments[i] != NULL) + xmlFree((xmlChar *) avt->segments[i]); + } + if (avt->nsList != NULL) + xmlFree(avt->nsList); + xmlFree(avt); +} + +/** + * xsltFreeAVTList: + * @avt: pointer to an list of AVT structures + * + * Free up the memory associated to the attribute value templates + */ +void +xsltFreeAVTList(void *avt) { + xsltAttrVTPtr cur = (xsltAttrVTPtr) avt, next; + + while (cur != NULL) { + next = cur->next; + xsltFreeAttrVT(cur); + cur = next; + } +} +/** + * xsltSetAttrVTsegment: + * @ avt: pointer to an xsltAttrVT structure + * @ val: the value to be set to the next available segment + * + * Within xsltCompileAttr there are several places where a value + * needs to be added to the 'segments' array within the xsltAttrVT + * structure, and at each place the allocated size may have to be + * re-allocated. This routine takes care of that situation. + * + * Returns the avt pointer, which may have been changed by a re-alloc + */ +static xsltAttrVTPtr +xsltSetAttrVTsegment(xsltAttrVTPtr avt, void *val) { + if (avt->nb_seg >= avt->max_seg) { + avt = (xsltAttrVTPtr) xmlRealloc(avt, sizeof(xsltAttrVT) + + avt->max_seg * sizeof(void *)); + if (avt == NULL) { + return NULL; + } + memset(&avt->segments[avt->nb_seg], 0, MAX_AVT_SEG*sizeof(void *)); + avt->max_seg += MAX_AVT_SEG; + } + avt->segments[avt->nb_seg++] = val; + return avt; +} + +/** + * xsltCompileAttr: + * @style: a XSLT process context + * @attr: the attribute coming from the stylesheet. + * + * Precompile an attribute in a stylesheet, basically it checks if it is + * an attrubute value template, and if yes establish some structures needed + * to process it at transformation time. + */ +void +xsltCompileAttr(xsltStylesheetPtr style, xmlAttrPtr attr) { + const xmlChar *str; + const xmlChar *cur; + xmlChar *ret = NULL; + xmlChar *expr = NULL; + xsltAttrVTPtr avt; + int i = 0, lastavt = 0; + + if ((style == NULL) || (attr == NULL) || (attr->children == NULL)) + return; + if ((attr->children->type != XML_TEXT_NODE) || + (attr->children->next != NULL)) { + xsltTransformError(NULL, style, attr->parent, + "Attribute '%s': The content is expected to be a single text " + "node when compiling an AVT.\n", attr->name); + style->errors++; + return; + } + str = attr->children->content; + if ((xmlStrchr(str, '{') == NULL) && + (xmlStrchr(str, '}') == NULL)) return; + +#ifdef WITH_XSLT_DEBUG_AVT + xsltGenericDebug(xsltGenericDebugContext, + "Found AVT %s: %s\n", attr->name, str); +#endif + if (attr->psvi != NULL) { +#ifdef WITH_XSLT_DEBUG_AVT + xsltGenericDebug(xsltGenericDebugContext, + "AVT %s: already compiled\n", attr->name); +#endif + return; + } + /* + * Create a new AVT object. + */ + avt = xsltNewAttrVT(style); + if (avt == NULL) + return; + attr->psvi = avt; + + avt->nsList = xmlGetNsList(attr->doc, attr->parent); + if (avt->nsList != NULL) { + while (avt->nsList[i] != NULL) + i++; + } + avt->nsNr = i; + + cur = str; + while (*cur != 0) { + if (*cur == '{') { + if (*(cur+1) == '{') { /* escaped '{' */ + cur++; + ret = xmlStrncat(ret, str, cur - str); + cur++; + str = cur; + continue; + } + if (*(cur+1) == '}') { /* skip empty AVT */ + ret = xmlStrncat(ret, str, cur - str); + cur += 2; + str = cur; + continue; + } + if ((ret != NULL) || (cur - str > 0)) { + ret = xmlStrncat(ret, str, cur - str); + str = cur; + if (avt->nb_seg == 0) + avt->strstart = 1; + if ((avt = xsltSetAttrVTsegment(avt, (void *) ret)) == NULL) + goto error; + ret = NULL; + lastavt = 0; + } + + cur++; + while ((*cur != 0) && (*cur != '}')) { + /* Need to check for literal (bug539741) */ + if ((*cur == '\'') || (*cur == '"')) { + char delim = *(cur++); + while ((*cur != 0) && (*cur != delim)) + cur++; + if (*cur != 0) + cur++; /* skip the ending delimiter */ + } else + cur++; + } + if (*cur == 0) { + xsltTransformError(NULL, style, attr->parent, + "Attribute '%s': The AVT has an unmatched '{'.\n", + attr->name); + style->errors++; + goto error; + } + str++; + expr = xmlStrndup(str, cur - str); + if (expr == NULL) { + /* + * TODO: What needs to be done here? + */ + XSLT_TODO + goto error; + } else { + xmlXPathCompExprPtr comp; + + comp = xsltXPathCompile(style, expr); + if (comp == NULL) { + xsltTransformError(NULL, style, attr->parent, + "Attribute '%s': Failed to compile the expression " + "'%s' in the AVT.\n", attr->name, expr); + style->errors++; + goto error; + } + if (avt->nb_seg == 0) + avt->strstart = 0; + if (lastavt == 1) { + if ((avt = xsltSetAttrVTsegment(avt, NULL)) == NULL) + goto error; + } + if ((avt = xsltSetAttrVTsegment(avt, (void *) comp)) == NULL) + goto error; + lastavt = 1; + xmlFree(expr); + expr = NULL; + } + cur++; + str = cur; + } else if (*cur == '}') { + cur++; + if (*cur == '}') { /* escaped '}' */ + ret = xmlStrncat(ret, str, cur - str); + cur++; + str = cur; + continue; + } else { + xsltTransformError(NULL, style, attr->parent, + "Attribute '%s': The AVT has an unmatched '}'.\n", + attr->name); + goto error; + } + } else + cur++; + } + if ((ret != NULL) || (cur - str > 0)) { + ret = xmlStrncat(ret, str, cur - str); + str = cur; + if (avt->nb_seg == 0) + avt->strstart = 1; + if ((avt = xsltSetAttrVTsegment(avt, (void *) ret)) == NULL) + goto error; + ret = NULL; + } + +error: + if (avt == NULL) { + xsltTransformError(NULL, style, attr->parent, + "xsltCompileAttr: malloc problem\n"); + } else { + if (attr->psvi != avt) { /* may have changed from realloc */ + attr->psvi = avt; + /* + * This is a "hack", but I can't see any clean method of + * doing it. If a re-alloc has taken place, then the pointer + * for this AVT may have changed. style->attVTs was set by + * xsltNewAttrVT, so it needs to be re-set to the new value! + */ + style->attVTs = avt; + } + } + if (ret != NULL) + xmlFree(ret); + if (expr != NULL) + xmlFree(expr); +} + + +/** + * xsltEvalAVT: + * @ctxt: the XSLT transformation context + * @avt: the prevompiled attribute value template info + * @node: the node hosting the attribute + * + * Process the given AVT, and return the new string value. + * + * Returns the computed string value or NULL, must be deallocated by the + * caller. + */ +xmlChar * +xsltEvalAVT(xsltTransformContextPtr ctxt, void *avt, xmlNodePtr node) { + xmlChar *ret = NULL, *tmp; + xmlXPathCompExprPtr comp; + xsltAttrVTPtr cur = (xsltAttrVTPtr) avt; + int i; + int str; + + if ((ctxt == NULL) || (avt == NULL) || (node == NULL)) + return(NULL); + str = cur->strstart; + for (i = 0;i < cur->nb_seg;i++) { + if (str) { + ret = xmlStrcat(ret, (const xmlChar *) cur->segments[i]); + } else { + comp = (xmlXPathCompExprPtr) cur->segments[i]; + tmp = xsltEvalXPathStringNs(ctxt, comp, cur->nsNr, cur->nsList); + if (tmp != NULL) { + if (ret != NULL) { + ret = xmlStrcat(ret, tmp); + xmlFree(tmp); + } else { + ret = tmp; + } + } + } + str = !str; + } + return(ret); +} diff --git a/libxslt/documents.c b/libxslt/documents.c new file mode 100644 index 0000000..3f3a731 --- /dev/null +++ b/libxslt/documents.c @@ -0,0 +1,434 @@ +/* + * documents.c: Implementation of the documents handling + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "documents.h" +#include "transform.h" +#include "imports.h" +#include "keys.h" +#include "security.h" + +#ifdef LIBXML_XINCLUDE_ENABLED +#include +#endif + +#define WITH_XSLT_DEBUG_DOCUMENTS + +#ifdef WITH_XSLT_DEBUG +#define WITH_XSLT_DEBUG_DOCUMENTS +#endif + +/************************************************************************ + * * + * Hooks for the document loader * + * * + ************************************************************************/ + +/** + * xsltDocDefaultLoaderFunc: + * @URI: the URI of the document to load + * @dict: the dictionary to use when parsing that document + * @options: parsing options, a set of xmlParserOption + * @ctxt: the context, either a stylesheet or a transformation context + * @type: the xsltLoadType indicating the kind of loading required + * + * Default function to load document not provided by the compilation or + * transformation API themselve, for example when an xsl:import, + * xsl:include is found at compilation time or when a document() + * call is made at runtime. + * + * Returns the pointer to the document (which will be modified and + * freed by the engine later), or NULL in case of error. + */ +static xmlDocPtr +xsltDocDefaultLoaderFunc(const xmlChar * URI, xmlDictPtr dict, int options, + void *ctxt ATTRIBUTE_UNUSED, + xsltLoadType type ATTRIBUTE_UNUSED) +{ + xmlParserCtxtPtr pctxt; + xmlParserInputPtr inputStream; + xmlDocPtr doc; + + pctxt = xmlNewParserCtxt(); + if (pctxt == NULL) + return(NULL); + if ((dict != NULL) && (pctxt->dict != NULL)) { + xmlDictFree(pctxt->dict); + pctxt->dict = NULL; + } + if (dict != NULL) { + pctxt->dict = dict; + xmlDictReference(pctxt->dict); +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "Reusing dictionary for document\n"); +#endif + } + xmlCtxtUseOptions(pctxt, options); + inputStream = xmlLoadExternalEntity((const char *) URI, NULL, pctxt); + if (inputStream == NULL) { + xmlFreeParserCtxt(pctxt); + return(NULL); + } + inputPush(pctxt, inputStream); + if (pctxt->directory == NULL) + pctxt->directory = xmlParserGetDirectory((const char *) URI); + + xmlParseDocument(pctxt); + + if (pctxt->wellFormed) { + doc = pctxt->myDoc; + } + else { + doc = NULL; + xmlFreeDoc(pctxt->myDoc); + pctxt->myDoc = NULL; + } + xmlFreeParserCtxt(pctxt); + + return(doc); +} + + +xsltDocLoaderFunc xsltDocDefaultLoader = xsltDocDefaultLoaderFunc; + +/** + * xsltSetLoaderFunc: + * @f: the new function to handle document loading. + * + * Set the new function to load document, if NULL it resets it to the + * default function. + */ + +void +xsltSetLoaderFunc(xsltDocLoaderFunc f) { + if (f == NULL) + xsltDocDefaultLoader = xsltDocDefaultLoaderFunc; + else + xsltDocDefaultLoader = f; +} + +/************************************************************************ + * * + * Module interfaces * + * * + ************************************************************************/ + +/** + * xsltNewDocument: + * @ctxt: an XSLT transformation context (or NULL) + * @doc: a parsed XML document + * + * Register a new document, apply key computations + * + * Returns a handler to the document + */ +xsltDocumentPtr +xsltNewDocument(xsltTransformContextPtr ctxt, xmlDocPtr doc) { + xsltDocumentPtr cur; + + cur = (xsltDocumentPtr) xmlMalloc(sizeof(xsltDocument)); + if (cur == NULL) { + xsltTransformError(ctxt, NULL, (xmlNodePtr) doc, + "xsltNewDocument : malloc failed\n"); + return(NULL); + } + memset(cur, 0, sizeof(xsltDocument)); + cur->doc = doc; + if (ctxt != NULL) { + if (! XSLT_IS_RES_TREE_FRAG(doc)) { + cur->next = ctxt->docList; + ctxt->docList = cur; + } + /* + * A key with a specific name for a specific document + * will only be computed if there's a call to the key() + * function using that specific name for that specific + * document. I.e. computation of keys will be done in + * xsltGetKey() (keys.c) on an on-demand basis. + * + * xsltInitCtxtKeys(ctxt, cur); not called here anymore + */ + } + return(cur); +} + +/** + * xsltNewStyleDocument: + * @style: an XSLT style sheet + * @doc: a parsed XML document + * + * Register a new document, apply key computations + * + * Returns a handler to the document + */ +xsltDocumentPtr +xsltNewStyleDocument(xsltStylesheetPtr style, xmlDocPtr doc) { + xsltDocumentPtr cur; + + cur = (xsltDocumentPtr) xmlMalloc(sizeof(xsltDocument)); + if (cur == NULL) { + xsltTransformError(NULL, style, (xmlNodePtr) doc, + "xsltNewStyleDocument : malloc failed\n"); + return(NULL); + } + memset(cur, 0, sizeof(xsltDocument)); + cur->doc = doc; + if (style != NULL) { + cur->next = style->docList; + style->docList = cur; + } + return(cur); +} + +/** + * xsltFreeStyleDocuments: + * @style: an XSLT stylesheet (representing a stylesheet-level) + * + * Frees the node-trees (and xsltDocument structures) of all + * stylesheet-modules of the stylesheet-level represented by + * the given @style. + */ +void +xsltFreeStyleDocuments(xsltStylesheetPtr style) { + xsltDocumentPtr doc, cur; +#ifdef XSLT_REFACTORED_XSLT_NSCOMP + xsltNsMapPtr nsMap; +#endif + + if (style == NULL) + return; + +#ifdef XSLT_REFACTORED_XSLT_NSCOMP + if (XSLT_HAS_INTERNAL_NSMAP(style)) + nsMap = XSLT_GET_INTERNAL_NSMAP(style); + else + nsMap = NULL; +#endif + + cur = style->docList; + while (cur != NULL) { + doc = cur; + cur = cur->next; +#ifdef XSLT_REFACTORED_XSLT_NSCOMP + /* + * Restore all changed namespace URIs of ns-decls. + */ + if (nsMap) + xsltRestoreDocumentNamespaces(nsMap, doc->doc); +#endif + xsltFreeDocumentKeys(doc); + if (!doc->main) + xmlFreeDoc(doc->doc); + xmlFree(doc); + } +} + +/** + * xsltFreeDocuments: + * @ctxt: an XSLT transformation context + * + * Free up all the space used by the loaded documents + */ +void +xsltFreeDocuments(xsltTransformContextPtr ctxt) { + xsltDocumentPtr doc, cur; + + cur = ctxt->docList; + while (cur != NULL) { + doc = cur; + cur = cur->next; + xsltFreeDocumentKeys(doc); + if (!doc->main) + xmlFreeDoc(doc->doc); + xmlFree(doc); + } + cur = ctxt->styleList; + while (cur != NULL) { + doc = cur; + cur = cur->next; + xsltFreeDocumentKeys(doc); + if (!doc->main) + xmlFreeDoc(doc->doc); + xmlFree(doc); + } +} + +/** + * xsltLoadDocument: + * @ctxt: an XSLT transformation context + * @URI: the computed URI of the document + * + * Try to load a document (not a stylesheet) + * within the XSLT transformation context + * + * Returns the new xsltDocumentPtr or NULL in case of error + */ +xsltDocumentPtr +xsltLoadDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) { + xsltDocumentPtr ret; + xmlDocPtr doc; + + if ((ctxt == NULL) || (URI == NULL)) + return(NULL); + + /* + * Security framework check + */ + if (ctxt->sec != NULL) { + int res; + + res = xsltCheckRead(ctxt->sec, ctxt, URI); + if (res == 0) { + xsltTransformError(ctxt, NULL, NULL, + "xsltLoadDocument: read rights for %s denied\n", + URI); + return(NULL); + } + } + + /* + * Walk the context list to find the document if preparsed + */ + ret = ctxt->docList; + while (ret != NULL) { + if ((ret->doc != NULL) && (ret->doc->URL != NULL) && + (xmlStrEqual(ret->doc->URL, URI))) + return(ret); + ret = ret->next; + } + + doc = xsltDocDefaultLoader(URI, ctxt->dict, ctxt->parserOptions, + (void *) ctxt, XSLT_LOAD_DOCUMENT); + + if (doc == NULL) + return(NULL); + + if (ctxt->xinclude != 0) { +#ifdef LIBXML_XINCLUDE_ENABLED +#if LIBXML_VERSION >= 20603 + xmlXIncludeProcessFlags(doc, ctxt->parserOptions); +#else + xmlXIncludeProcess(doc); +#endif +#else + xsltTransformError(ctxt, NULL, NULL, + "xsltLoadDocument(%s) : XInclude processing not compiled in\n", + URI); +#endif + } + /* + * Apply white-space stripping if asked for + */ + if (xsltNeedElemSpaceHandling(ctxt)) + xsltApplyStripSpaces(ctxt, xmlDocGetRootElement(doc)); + if (ctxt->debugStatus == XSLT_DEBUG_NONE) + xmlXPathOrderDocElems(doc); + + ret = xsltNewDocument(ctxt, doc); + return(ret); +} + +/** + * xsltLoadStyleDocument: + * @style: an XSLT style sheet + * @URI: the computed URI of the document + * + * Try to load a stylesheet document within the XSLT transformation context + * + * Returns the new xsltDocumentPtr or NULL in case of error + */ +xsltDocumentPtr +xsltLoadStyleDocument(xsltStylesheetPtr style, const xmlChar *URI) { + xsltDocumentPtr ret; + xmlDocPtr doc; + xsltSecurityPrefsPtr sec; + + if ((style == NULL) || (URI == NULL)) + return(NULL); + + /* + * Security framework check + */ + sec = xsltGetDefaultSecurityPrefs(); + if (sec != NULL) { + int res; + + res = xsltCheckRead(sec, NULL, URI); + if (res == 0) { + xsltTransformError(NULL, NULL, NULL, + "xsltLoadStyleDocument: read rights for %s denied\n", + URI); + return(NULL); + } + } + + /* + * Walk the context list to find the document if preparsed + */ + ret = style->docList; + while (ret != NULL) { + if ((ret->doc != NULL) && (ret->doc->URL != NULL) && + (xmlStrEqual(ret->doc->URL, URI))) + return(ret); + ret = ret->next; + } + + doc = xsltDocDefaultLoader(URI, style->dict, XSLT_PARSE_OPTIONS, + (void *) style, XSLT_LOAD_STYLESHEET); + if (doc == NULL) + return(NULL); + + ret = xsltNewStyleDocument(style, doc); + return(ret); +} + +/** + * xsltFindDocument: + * @ctxt: an XSLT transformation context + * @doc: a parsed XML document + * + * Try to find a document within the XSLT transformation context. + * This will not find document infos for temporary + * Result Tree Fragments. + * + * Returns the desired xsltDocumentPtr or NULL in case of error + */ +xsltDocumentPtr +xsltFindDocument (xsltTransformContextPtr ctxt, xmlDocPtr doc) { + xsltDocumentPtr ret; + + if ((ctxt == NULL) || (doc == NULL)) + return(NULL); + + /* + * Walk the context list to find the document + */ + ret = ctxt->docList; + while (ret != NULL) { + if (ret->doc == doc) + return(ret); + ret = ret->next; + } + if (doc == ctxt->style->doc) + return(ctxt->document); + return(NULL); +} + diff --git a/libxslt/documents.h b/libxslt/documents.h new file mode 100644 index 0000000..ae7c0ca --- /dev/null +++ b/libxslt/documents.h @@ -0,0 +1,93 @@ +/* + * Summary: interface for the document handling + * Description: implements document loading and cache (multiple + * document() reference for the same resources must + * be equal. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XSLT_DOCUMENTS_H__ +#define __XML_XSLT_DOCUMENTS_H__ + +#include +#include "xsltexports.h" +#include "xsltInternals.h" + +#ifdef __cplusplus +extern "C" { +#endif + +XSLTPUBFUN xsltDocumentPtr XSLTCALL + xsltNewDocument (xsltTransformContextPtr ctxt, + xmlDocPtr doc); +XSLTPUBFUN xsltDocumentPtr XSLTCALL + xsltLoadDocument (xsltTransformContextPtr ctxt, + const xmlChar *URI); +XSLTPUBFUN xsltDocumentPtr XSLTCALL + xsltFindDocument (xsltTransformContextPtr ctxt, + xmlDocPtr doc); +XSLTPUBFUN void XSLTCALL + xsltFreeDocuments (xsltTransformContextPtr ctxt); + +XSLTPUBFUN xsltDocumentPtr XSLTCALL + xsltLoadStyleDocument (xsltStylesheetPtr style, + const xmlChar *URI); +XSLTPUBFUN xsltDocumentPtr XSLTCALL + xsltNewStyleDocument (xsltStylesheetPtr style, + xmlDocPtr doc); +XSLTPUBFUN void XSLTCALL + xsltFreeStyleDocuments (xsltStylesheetPtr style); + +/* + * Hooks for document loading + */ + +/** + * xsltLoadType: + * + * Enum defining the kind of loader requirement. + */ +typedef enum { + XSLT_LOAD_START = 0, /* loading for a top stylesheet */ + XSLT_LOAD_STYLESHEET = 1, /* loading for a stylesheet include/import */ + XSLT_LOAD_DOCUMENT = 2 /* loading document at transformation time */ +} xsltLoadType; + +/** + * xsltDocLoaderFunc: + * @URI: the URI of the document to load + * @dict: the dictionary to use when parsing that document + * @options: parsing options, a set of xmlParserOption + * @ctxt: the context, either a stylesheet or a transformation context + * @type: the xsltLoadType indicating the kind of loading required + * + * An xsltDocLoaderFunc is a signature for a function which can be + * registered to load document not provided by the compilation or + * transformation API themselve, for example when an xsl:import, + * xsl:include is found at compilation time or when a document() + * call is made at runtime. + * + * Returns the pointer to the document (which will be modified and + * freed by the engine later), or NULL in case of error. + */ +typedef xmlDocPtr (*xsltDocLoaderFunc) (const xmlChar *URI, + xmlDictPtr dict, + int options, + void *ctxt, + xsltLoadType type); + +XSLTPUBFUN void XSLTCALL + xsltSetLoaderFunc (xsltDocLoaderFunc f); + +/* the loader may be needed by extension libraries so it is exported */ +XSLTPUBVAR xsltDocLoaderFunc xsltDocDefaultLoader; + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XSLT_DOCUMENTS_H__ */ + diff --git a/libxslt/extensions.c b/libxslt/extensions.c new file mode 100644 index 0000000..ae6eef0 --- /dev/null +++ b/libxslt/extensions.c @@ -0,0 +1,2365 @@ +/* + * extensions.c: Implemetation of the extensions support + * + * Reference: + * http://www.w3.org/TR/1999/REC-xslt-19991116 + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#ifdef WITH_MODULES +#include +#endif +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "imports.h" +#include "extensions.h" + +#ifdef _WIN32 +#include /* for _MAX_PATH */ +#ifndef PATH_MAX +#define PATH_MAX _MAX_PATH +#endif +#endif + +#ifdef WITH_XSLT_DEBUG +#define WITH_XSLT_DEBUG_EXTENSIONS +#endif + +/************************************************************************ + * * + * Private Types and Globals * + * * + ************************************************************************/ + +typedef struct _xsltExtDef xsltExtDef; +typedef xsltExtDef *xsltExtDefPtr; +struct _xsltExtDef { + struct _xsltExtDef *next; + xmlChar *prefix; + xmlChar *URI; + void *data; +}; + +typedef struct _xsltExtModule xsltExtModule; +typedef xsltExtModule *xsltExtModulePtr; +struct _xsltExtModule { + xsltExtInitFunction initFunc; + xsltExtShutdownFunction shutdownFunc; + xsltStyleExtInitFunction styleInitFunc; + xsltStyleExtShutdownFunction styleShutdownFunc; +}; + +typedef struct _xsltExtData xsltExtData; +typedef xsltExtData *xsltExtDataPtr; +struct _xsltExtData { + xsltExtModulePtr extModule; + void *extData; +}; + +typedef struct _xsltExtElement xsltExtElement; +typedef xsltExtElement *xsltExtElementPtr; +struct _xsltExtElement { + xsltPreComputeFunction precomp; + xsltTransformFunction transform; +}; + +static xmlHashTablePtr xsltExtensionsHash = NULL; +static xmlHashTablePtr xsltFunctionsHash = NULL; +static xmlHashTablePtr xsltElementsHash = NULL; +static xmlHashTablePtr xsltTopLevelsHash = NULL; +static xmlHashTablePtr xsltModuleHash = NULL; +static xmlMutexPtr xsltExtMutex = NULL; + +/************************************************************************ + * * + * Type functions * + * * + ************************************************************************/ + +/** + * xsltNewExtDef: + * @prefix: the extension prefix + * @URI: the namespace URI + * + * Create a new XSLT ExtDef + * + * Returns the newly allocated xsltExtDefPtr or NULL in case of error + */ +static xsltExtDefPtr +xsltNewExtDef(const xmlChar * prefix, const xmlChar * URI) +{ + xsltExtDefPtr cur; + + cur = (xsltExtDefPtr) xmlMalloc(sizeof(xsltExtDef)); + if (cur == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltNewExtDef : malloc failed\n"); + return (NULL); + } + memset(cur, 0, sizeof(xsltExtDef)); + if (prefix != NULL) + cur->prefix = xmlStrdup(prefix); + if (URI != NULL) + cur->URI = xmlStrdup(URI); + return (cur); +} + +/** + * xsltFreeExtDef: + * @extensiond: an XSLT extension definition + * + * Free up the memory allocated by @extensiond + */ +static void +xsltFreeExtDef(xsltExtDefPtr extensiond) +{ + if (extensiond == NULL) + return; + if (extensiond->prefix != NULL) + xmlFree(extensiond->prefix); + if (extensiond->URI != NULL) + xmlFree(extensiond->URI); + xmlFree(extensiond); +} + +/** + * xsltFreeExtDefList: + * @extensiond: an XSLT extension definition list + * + * Free up the memory allocated by all the elements of @extensiond + */ +static void +xsltFreeExtDefList(xsltExtDefPtr extensiond) +{ + xsltExtDefPtr cur; + + while (extensiond != NULL) { + cur = extensiond; + extensiond = extensiond->next; + xsltFreeExtDef(cur); + } +} + +/** + * xsltNewExtModule: + * @initFunc: the module initialization function + * @shutdownFunc: the module shutdown function + * @styleInitFunc: the stylesheet module data allocator function + * @styleShutdownFunc: the stylesheet module data free function + * + * Create a new XSLT extension module + * + * Returns the newly allocated xsltExtModulePtr or NULL in case of error + */ +static xsltExtModulePtr +xsltNewExtModule(xsltExtInitFunction initFunc, + xsltExtShutdownFunction shutdownFunc, + xsltStyleExtInitFunction styleInitFunc, + xsltStyleExtShutdownFunction styleShutdownFunc) +{ + xsltExtModulePtr cur; + + cur = (xsltExtModulePtr) xmlMalloc(sizeof(xsltExtModule)); + if (cur == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltNewExtModule : malloc failed\n"); + return (NULL); + } + cur->initFunc = initFunc; + cur->shutdownFunc = shutdownFunc; + cur->styleInitFunc = styleInitFunc; + cur->styleShutdownFunc = styleShutdownFunc; + return (cur); +} + +/** + * xsltFreeExtModule: + * @ext: an XSLT extension module + * + * Free up the memory allocated by @ext + */ +static void +xsltFreeExtModule(xsltExtModulePtr ext) +{ + if (ext == NULL) + return; + xmlFree(ext); +} + +/** + * xsltNewExtData: + * @extModule: the module + * @extData: the associated data + * + * Create a new XSLT extension module data wrapper + * + * Returns the newly allocated xsltExtDataPtr or NULL in case of error + */ +static xsltExtDataPtr +xsltNewExtData(xsltExtModulePtr extModule, void *extData) +{ + xsltExtDataPtr cur; + + if (extModule == NULL) + return (NULL); + cur = (xsltExtDataPtr) xmlMalloc(sizeof(xsltExtData)); + if (cur == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltNewExtData : malloc failed\n"); + return (NULL); + } + cur->extModule = extModule; + cur->extData = extData; + return (cur); +} + +/** + * xsltFreeExtData: + * @ext: an XSLT extension module data wrapper + * + * Free up the memory allocated by @ext + */ +static void +xsltFreeExtData(xsltExtDataPtr ext) +{ + if (ext == NULL) + return; + xmlFree(ext); +} + +/** + * xsltNewExtElement: + * @precomp: the pre-computation function + * @transform: the transformation function + * + * Create a new XSLT extension element + * + * Returns the newly allocated xsltExtElementPtr or NULL in case of + * error + */ +static xsltExtElementPtr +xsltNewExtElement(xsltPreComputeFunction precomp, + xsltTransformFunction transform) +{ + xsltExtElementPtr cur; + + if (transform == NULL) + return (NULL); + + cur = (xsltExtElementPtr) xmlMalloc(sizeof(xsltExtElement)); + if (cur == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltNewExtElement : malloc failed\n"); + return (NULL); + } + cur->precomp = precomp; + cur->transform = transform; + return (cur); +} + +/** + * xsltFreeExtElement: + * @ext: an XSLT extension element + * + * Frees up the memory allocated by @ext + */ +static void +xsltFreeExtElement(xsltExtElementPtr ext) +{ + if (ext == NULL) + return; + xmlFree(ext); +} + + +#ifdef WITH_MODULES +typedef void (*exsltRegisterFunction) (void); + +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif + +/** + * xsltExtModuleRegisterDynamic: + * @URI: the function or element namespace URI + * + * Dynamically loads an extension plugin when available. + * + * The plugin name is derived from the URI by removing the + * initial protocol designation, e.g. "http://", then converting + * the characters ".", "-", "/", and "\" into "_", the removing + * any trailing "/", then concatenating LIBXML_MODULE_EXTENSION. + * + * Plugins are loaded from the directory specified by the + * environment variable LIBXSLT_PLUGINS_PATH, or if NULL, + * by LIBXSLT_DEFAULT_PLUGINS_PATH() which is determined at + * compile time. + * + * Returns 0 if successful, -1 in case of error. + */ + +static int +xsltExtModuleRegisterDynamic(const xmlChar * URI) +{ + + xmlModulePtr m; + exsltRegisterFunction regfunc; + xmlChar *ext_name; + char module_filename[PATH_MAX]; + const xmlChar *ext_directory = NULL; + const xmlChar *protocol = NULL; + xmlChar *i, *regfunc_name; + void *vregfunc; + int rc; + + /* check for bad inputs */ + if (URI == NULL) + return (-1); + + if (NULL == xsltModuleHash) { + xsltModuleHash = xmlHashCreate(5); + if (xsltModuleHash == NULL) + return (-1); + } + + xmlMutexLock(xsltExtMutex); + + /* have we attempted to register this module already? */ + if (xmlHashLookup(xsltModuleHash, URI) != NULL) { + xmlMutexUnlock(xsltExtMutex); + return (-1); + } + xmlMutexUnlock(xsltExtMutex); + + /* transform extension namespace into a module name */ + protocol = xmlStrstr(URI, BAD_CAST "://"); + if (protocol == NULL) { + ext_name = xmlStrdup(URI); + } else { + ext_name = xmlStrdup(protocol + 3); + } + if (ext_name == NULL) { + return (-1); + } + + i = ext_name; + while ('\0' != *i) { + if (('/' == *i) || ('\\' == *i) || ('.' == *i) || ('-' == *i)) + *i = '_'; + i++; + } + + /* Strip underscores from end of string. */ + while (i > ext_name && *(i - 1) == '_') { + i--; + *i = '\0'; + } + + /* determine module directory */ + ext_directory = (xmlChar *) getenv("LIBXSLT_PLUGINS_PATH"); + + if (NULL == ext_directory) { + ext_directory = BAD_CAST LIBXSLT_DEFAULT_PLUGINS_PATH(); + if (NULL == ext_directory) + return (-1); + } +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + else + xsltGenericDebug(xsltGenericDebugContext, + "LIBXSLT_PLUGINS_PATH is %s\n", ext_directory); +#endif + + /* build the module filename, and confirm the module exists */ + xmlStrPrintf((xmlChar *) module_filename, sizeof(module_filename), + BAD_CAST "%s/%s%s", + ext_directory, ext_name, LIBXML_MODULE_EXTENSION); + +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, + "Attempting to load plugin: %s for URI: %s\n", + module_filename, URI); +#endif + + if (1 != xmlCheckFilename(module_filename)) { + +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, + "xmlCheckFilename failed for plugin: %s\n", module_filename); +#endif + + xmlFree(ext_name); + return (-1); + } + + /* attempt to open the module */ + m = xmlModuleOpen(module_filename, 0); + if (NULL == m) { + +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, + "xmlModuleOpen failed for plugin: %s\n", module_filename); +#endif + + xmlFree(ext_name); + return (-1); + } + + /* construct initialization func name */ + regfunc_name = xmlStrdup(ext_name); + regfunc_name = xmlStrcat(regfunc_name, BAD_CAST "_init"); + + vregfunc = NULL; + rc = xmlModuleSymbol(m, (const char *) regfunc_name, &vregfunc); + regfunc = vregfunc; + if (0 == rc) { + /* + * Call the module's init function. Note that this function + * calls xsltRegisterExtModuleFull which will add the module + * to xsltExtensionsHash (together with it's entry points). + */ + (*regfunc) (); + + /* register this module in our hash */ + xmlMutexLock(xsltExtMutex); + xmlHashAddEntry(xsltModuleHash, URI, (void *) m); + xmlMutexUnlock(xsltExtMutex); + } else { + +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, + "xmlModuleSymbol failed for plugin: %s, regfunc: %s\n", + module_filename, regfunc_name); +#endif + + /* if regfunc not found unload the module immediately */ + xmlModuleClose(m); + } + + xmlFree(ext_name); + xmlFree(regfunc_name); + return (NULL == regfunc) ? -1 : 0; +} +#else +static int +xsltExtModuleRegisterDynamic(const xmlChar * URI ATTRIBUTE_UNUSED) +{ + return -1; +} +#endif + +/************************************************************************ + * * + * The stylesheet extension prefixes handling * + * * + ************************************************************************/ + + +/** + * xsltFreeExts: + * @style: an XSLT stylesheet + * + * Free up the memory used by XSLT extensions in a stylesheet + */ +void +xsltFreeExts(xsltStylesheetPtr style) +{ + if (style->nsDefs != NULL) + xsltFreeExtDefList((xsltExtDefPtr) style->nsDefs); +} + +/** + * xsltRegisterExtPrefix: + * @style: an XSLT stylesheet + * @prefix: the prefix used (optional) + * @URI: the URI associated to the extension + * + * Registers an extension namespace + * This is called from xslt.c during compile-time. + * The given prefix is not needed. + * Called by: + * xsltParseExtElemPrefixes() (new function) + * xsltRegisterExtPrefix() (old function) + * + * Returns 0 in case of success, 1 if the @URI was already + * registered as an extension namespace and + * -1 in case of failure + */ +int +xsltRegisterExtPrefix(xsltStylesheetPtr style, + const xmlChar * prefix, const xmlChar * URI) +{ + xsltExtDefPtr def, ret; + + if ((style == NULL) || (URI == NULL)) + return (-1); + +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, + "Registering extension namespace '%s'.\n", URI); +#endif + def = (xsltExtDefPtr) style->nsDefs; +#ifdef XSLT_REFACTORED + /* + * The extension is associated with a namespace name. + */ + while (def != NULL) { + if (xmlStrEqual(URI, def->URI)) + return (1); + def = def->next; + } +#else + while (def != NULL) { + if (xmlStrEqual(prefix, def->prefix)) + return (-1); + def = def->next; + } +#endif + ret = xsltNewExtDef(prefix, URI); + if (ret == NULL) + return (-1); + ret->next = (xsltExtDefPtr) style->nsDefs; + style->nsDefs = ret; + + /* + * check whether there is an extension module with a stylesheet + * initialization function. + */ +#ifdef XSLT_REFACTORED + /* + * Don't initialize modules based on specified namespaces via + * the attribute "[xsl:]extension-element-prefixes". + */ +#else + if (xsltExtensionsHash != NULL) { + xsltExtModulePtr module; + + xmlMutexLock(xsltExtMutex); + module = xmlHashLookup(xsltExtensionsHash, URI); + xmlMutexUnlock(xsltExtMutex); + if (NULL == module) { + if (!xsltExtModuleRegisterDynamic(URI)) { + xmlMutexLock(xsltExtMutex); + module = xmlHashLookup(xsltExtensionsHash, URI); + xmlMutexUnlock(xsltExtMutex); + } + } + if (module != NULL) { + xsltStyleGetExtData(style, URI); + } + } +#endif + return (0); +} + +/************************************************************************ + * * + * The extensions modules interfaces * + * * + ************************************************************************/ + +/** + * xsltRegisterExtFunction: + * @ctxt: an XSLT transformation context + * @name: the name of the element + * @URI: the URI associated to the element + * @function: the actual implementation which should be called + * + * Registers an extension function + * + * Returns 0 in case of success, -1 in case of failure + */ +int +xsltRegisterExtFunction(xsltTransformContextPtr ctxt, const xmlChar * name, + const xmlChar * URI, xmlXPathFunction function) +{ + int ret; + + if ((ctxt == NULL) || (name == NULL) || + (URI == NULL) || (function == NULL)) + return (-1); + if (ctxt->xpathCtxt != NULL) { + xmlXPathRegisterFuncNS(ctxt->xpathCtxt, name, URI, function); + } + if (ctxt->extFunctions == NULL) + ctxt->extFunctions = xmlHashCreate(10); + if (ctxt->extFunctions == NULL) + return (-1); + + ret = xmlHashAddEntry2(ctxt->extFunctions, name, URI, + XML_CAST_FPTR(function)); + + return(ret); +} + +/** + * xsltRegisterExtElement: + * @ctxt: an XSLT transformation context + * @name: the name of the element + * @URI: the URI associated to the element + * @function: the actual implementation which should be called + * + * Registers an extension element + * + * Returns 0 in case of success, -1 in case of failure + */ +int +xsltRegisterExtElement(xsltTransformContextPtr ctxt, const xmlChar * name, + const xmlChar * URI, xsltTransformFunction function) +{ + if ((ctxt == NULL) || (name == NULL) || + (URI == NULL) || (function == NULL)) + return (-1); + if (ctxt->extElements == NULL) + ctxt->extElements = xmlHashCreate(10); + if (ctxt->extElements == NULL) + return (-1); + return (xmlHashAddEntry2 + (ctxt->extElements, name, URI, XML_CAST_FPTR(function))); +} + +/** + * xsltFreeCtxtExts: + * @ctxt: an XSLT transformation context + * + * Free the XSLT extension data + */ +void +xsltFreeCtxtExts(xsltTransformContextPtr ctxt) +{ + if (ctxt->extElements != NULL) + xmlHashFree(ctxt->extElements, NULL); + if (ctxt->extFunctions != NULL) + xmlHashFree(ctxt->extFunctions, NULL); +} + +/** + * xsltStyleGetStylesheetExtData: + * @style: an XSLT stylesheet + * @URI: the URI associated to the exension module + * + * Fires the compile-time initialization callback + * of an extension module and returns a container + * holding the user-data (retrieved via the callback). + * + * Returns the create module-data container + * or NULL if such a module was not registered. + */ +static xsltExtDataPtr +xsltStyleInitializeStylesheetModule(xsltStylesheetPtr style, + const xmlChar * URI) +{ + xsltExtDataPtr dataContainer; + void *userData = NULL; + xsltExtModulePtr module; + + if ((style == NULL) || (URI == NULL)) + return(NULL); + + if (xsltExtensionsHash == NULL) { +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, + "Not registered extension module: %s\n", URI); +#endif + return(NULL); + } + + xmlMutexLock(xsltExtMutex); + + module = xmlHashLookup(xsltExtensionsHash, URI); + + xmlMutexUnlock(xsltExtMutex); + + if (module == NULL) { +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, + "Not registered extension module: %s\n", URI); +#endif + return (NULL); + } + /* + * The specified module was registered so initialize it. + */ + if (style->extInfos == NULL) { + style->extInfos = xmlHashCreate(10); + if (style->extInfos == NULL) + return (NULL); + } + /* + * Fire the initialization callback if available. + */ + if (module->styleInitFunc == NULL) { +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, + "Initializing module with *no* callback: %s\n", URI); +#endif + } else { +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, + "Initializing module with callback: %s\n", URI); +#endif + /* + * Fire the initialization callback. + */ + userData = module->styleInitFunc(style, URI); + } + /* + * Store the user-data in the context of the given stylesheet. + */ + dataContainer = xsltNewExtData(module, userData); + if (dataContainer == NULL) + return (NULL); + + if (xmlHashAddEntry(style->extInfos, URI, + (void *) dataContainer) < 0) + { + xsltTransformError(NULL, style, NULL, + "Failed to register module '%s'.\n", URI); + style->errors++; + if (module->styleShutdownFunc) + module->styleShutdownFunc(style, URI, userData); + xsltFreeExtData(dataContainer); + return (NULL); + } + + return(dataContainer); +} + +/** + * xsltStyleGetExtData: + * @style: an XSLT stylesheet + * @URI: the URI associated to the exension module + * + * Retrieve the data associated to the extension module + * in this given stylesheet. + * Called by: + * xsltRegisterExtPrefix(), + * ( xsltExtElementPreCompTest(), xsltExtInitTest ) + * + * Returns the pointer or NULL if not present + */ +void * +xsltStyleGetExtData(xsltStylesheetPtr style, const xmlChar * URI) +{ + xsltExtDataPtr dataContainer = NULL; + xsltStylesheetPtr tmpStyle; + + if ((style == NULL) || (URI == NULL) || + (xsltExtensionsHash == NULL)) + return (NULL); + + +#ifdef XSLT_REFACTORED + /* + * This is intended for global storage, so only the main + * stylesheet will hold the data. + */ + tmpStyle = style; + while (tmpStyle->parent != NULL) + tmpStyle = tmpStyle->parent; + if (tmpStyle->extInfos != NULL) { + dataContainer = + (xsltExtDataPtr) xmlHashLookup(tmpStyle->extInfos, URI); + if (dataContainer != NULL) { + /* + * The module was already initialized in the context + * of this stylesheet; just return the user-data that + * comes with it. + */ + return(dataContainer->extData); + } + } +#else + /* + * Old behaviour. + */ + tmpStyle = style; + while (tmpStyle != NULL) { + if (tmpStyle->extInfos != NULL) { + dataContainer = + (xsltExtDataPtr) xmlHashLookup(tmpStyle->extInfos, URI); + if (dataContainer != NULL) { + return(dataContainer->extData); + } + } + tmpStyle = xsltNextImport(tmpStyle); + } + tmpStyle = style; +#endif + + dataContainer = + xsltStyleInitializeStylesheetModule(tmpStyle, URI); + if (dataContainer != NULL) + return (dataContainer->extData); + return(NULL); +} + +#ifdef XSLT_REFACTORED +/** + * xsltStyleStylesheetLevelGetExtData: + * @style: an XSLT stylesheet + * @URI: the URI associated to the exension module + * + * Retrieve the data associated to the extension module in this given + * stylesheet. + * + * Returns the pointer or NULL if not present + */ +void * +xsltStyleStylesheetLevelGetExtData(xsltStylesheetPtr style, + const xmlChar * URI) +{ + xsltExtDataPtr dataContainer = NULL; + + if ((style == NULL) || (URI == NULL) || + (xsltExtensionsHash == NULL)) + return (NULL); + + if (style->extInfos != NULL) { + dataContainer = (xsltExtDataPtr) xmlHashLookup(style->extInfos, URI); + /* + * The module was already initialized in the context + * of this stylesheet; just return the user-data that + * comes with it. + */ + if (dataContainer) + return(dataContainer->extData); + } + + dataContainer = + xsltStyleInitializeStylesheetModule(style, URI); + if (dataContainer != NULL) + return (dataContainer->extData); + return(NULL); +} +#endif + +/** + * xsltGetExtData: + * @ctxt: an XSLT transformation context + * @URI: the URI associated to the exension module + * + * Retrieve the data associated to the extension module in this given + * transformation. + * + * Returns the pointer or NULL if not present + */ +void * +xsltGetExtData(xsltTransformContextPtr ctxt, const xmlChar * URI) +{ + xsltExtDataPtr data; + + if ((ctxt == NULL) || (URI == NULL)) + return (NULL); + if (ctxt->extInfos == NULL) { + ctxt->extInfos = xmlHashCreate(10); + if (ctxt->extInfos == NULL) + return (NULL); + data = NULL; + } else { + data = (xsltExtDataPtr) xmlHashLookup(ctxt->extInfos, URI); + } + if (data == NULL) { + void *extData; + xsltExtModulePtr module; + + xmlMutexLock(xsltExtMutex); + + module = xmlHashLookup(xsltExtensionsHash, URI); + + xmlMutexUnlock(xsltExtMutex); + + if (module == NULL) { +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, + "Not registered extension module: %s\n", URI); +#endif + return (NULL); + } else { + if (module->initFunc == NULL) + return (NULL); + +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, + "Initializing module: %s\n", URI); +#endif + + extData = module->initFunc(ctxt, URI); + if (extData == NULL) + return (NULL); + + data = xsltNewExtData(module, extData); + if (data == NULL) + return (NULL); + if (xmlHashAddEntry(ctxt->extInfos, URI, (void *) data) < 0) { + xsltTransformError(ctxt, NULL, NULL, + "Failed to register module data: %s\n", + URI); + if (module->shutdownFunc) + module->shutdownFunc(ctxt, URI, extData); + xsltFreeExtData(data); + return (NULL); + } + } + } + return (data->extData); +} + +typedef struct _xsltInitExtCtxt xsltInitExtCtxt; +struct _xsltInitExtCtxt { + xsltTransformContextPtr ctxt; + int ret; +}; + +/** + * xsltInitCtxtExt: + * @styleData: the registered stylesheet data for the module + * @ctxt: the XSLT transformation context + the return value + * @URI: the extension URI + * + * Initializes an extension module + */ +static void +xsltInitCtxtExt(xsltExtDataPtr styleData, xsltInitExtCtxt * ctxt, + const xmlChar * URI) +{ + xsltExtModulePtr module; + xsltExtDataPtr ctxtData; + void *extData; + + if ((styleData == NULL) || (ctxt == NULL) || (URI == NULL) || + (ctxt->ret == -1)) { +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, + "xsltInitCtxtExt: NULL param or error\n"); +#endif + return; + } + module = styleData->extModule; + if ((module == NULL) || (module->initFunc == NULL)) { +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, + "xsltInitCtxtExt: no module or no initFunc\n"); +#endif + return; + } + + ctxtData = (xsltExtDataPtr) xmlHashLookup(ctxt->ctxt->extInfos, URI); + if (ctxtData != NULL) { +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, + "xsltInitCtxtExt: already initialized\n"); +#endif + return; + } + + extData = module->initFunc(ctxt->ctxt, URI); + if (extData == NULL) { +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, + "xsltInitCtxtExt: no extData\n"); +#endif + } + ctxtData = xsltNewExtData(module, extData); + if (ctxtData == NULL) { + ctxt->ret = -1; + return; + } + + if (ctxt->ctxt->extInfos == NULL) + ctxt->ctxt->extInfos = xmlHashCreate(10); + if (ctxt->ctxt->extInfos == NULL) { + ctxt->ret = -1; + return; + } + + if (xmlHashAddEntry(ctxt->ctxt->extInfos, URI, ctxtData) < 0) { + xsltGenericError(xsltGenericErrorContext, + "Failed to register module data: %s\n", URI); + if (module->shutdownFunc) + module->shutdownFunc(ctxt->ctxt, URI, extData); + xsltFreeExtData(ctxtData); + ctxt->ret = -1; + return; + } +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, "Registered module %s\n", + URI); +#endif + ctxt->ret++; +} + +/** + * xsltInitCtxtExts: + * @ctxt: an XSLT transformation context + * + * Initialize the set of modules with registered stylesheet data + * + * Returns the number of modules initialized or -1 in case of error + */ +int +xsltInitCtxtExts(xsltTransformContextPtr ctxt) +{ + xsltStylesheetPtr style; + xsltInitExtCtxt ctx; + + if (ctxt == NULL) + return (-1); + + style = ctxt->style; + if (style == NULL) + return (-1); + + ctx.ctxt = ctxt; + ctx.ret = 0; + + while (style != NULL) { + if (style->extInfos != NULL) { + xmlHashScan(style->extInfos, + (xmlHashScanner) xsltInitCtxtExt, &ctx); + if (ctx.ret == -1) + return (-1); + } + style = xsltNextImport(style); + } +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, "Registered %d modules\n", + ctx.ret); +#endif + return (ctx.ret); +} + +/** + * xsltShutdownCtxtExt: + * @data: the registered data for the module + * @ctxt: the XSLT transformation context + * @URI: the extension URI + * + * Shutdown an extension module loaded + */ +static void +xsltShutdownCtxtExt(xsltExtDataPtr data, xsltTransformContextPtr ctxt, + const xmlChar * URI) +{ + xsltExtModulePtr module; + + if ((data == NULL) || (ctxt == NULL) || (URI == NULL)) + return; + module = data->extModule; + if ((module == NULL) || (module->shutdownFunc == NULL)) + return; + +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, + "Shutting down module : %s\n", URI); +#endif + module->shutdownFunc(ctxt, URI, data->extData); +} + +/** + * xsltShutdownCtxtExts: + * @ctxt: an XSLT transformation context + * + * Shutdown the set of modules loaded + */ +void +xsltShutdownCtxtExts(xsltTransformContextPtr ctxt) +{ + if (ctxt == NULL) + return; + if (ctxt->extInfos == NULL) + return; + xmlHashScan(ctxt->extInfos, (xmlHashScanner) xsltShutdownCtxtExt, + ctxt); + xmlHashFree(ctxt->extInfos, (xmlHashDeallocator) xsltFreeExtData); + ctxt->extInfos = NULL; +} + +/** + * xsltShutdownExt: + * @data: the registered data for the module + * @ctxt: the XSLT stylesheet + * @URI: the extension URI + * + * Shutdown an extension module loaded + */ +static void +xsltShutdownExt(xsltExtDataPtr data, xsltStylesheetPtr style, + const xmlChar * URI) +{ + xsltExtModulePtr module; + + if ((data == NULL) || (style == NULL) || (URI == NULL)) + return; + module = data->extModule; + if ((module == NULL) || (module->styleShutdownFunc == NULL)) + return; + +#ifdef WITH_XSLT_DEBUG_EXTENSIONS + xsltGenericDebug(xsltGenericDebugContext, + "Shutting down module : %s\n", URI); +#endif + module->styleShutdownFunc(style, URI, data->extData); + /* + * Don't remove the entry from the hash table here, since + * this will produce segfaults - this fixes bug #340624. + * + * xmlHashRemoveEntry(style->extInfos, URI, + * (xmlHashDeallocator) xsltFreeExtData); + */ +} + +/** + * xsltShutdownExts: + * @style: an XSLT stylesheet + * + * Shutdown the set of modules loaded + */ +void +xsltShutdownExts(xsltStylesheetPtr style) +{ + if (style == NULL) + return; + if (style->extInfos == NULL) + return; + xmlHashScan(style->extInfos, (xmlHashScanner) xsltShutdownExt, style); + xmlHashFree(style->extInfos, (xmlHashDeallocator) xsltFreeExtData); + style->extInfos = NULL; +} + +/** + * xsltCheckExtPrefix: + * @style: the stylesheet + * @URI: the namespace prefix (possibly NULL) + * + * Check if the given prefix is one of the declared extensions. + * This is intended to be called only at compile-time. + * Called by: + * xsltGetInheritedNsList() (xslt.c) + * xsltParseTemplateContent (xslt.c) + * + * Returns 1 if this is an extension, 0 otherwise + */ +int +xsltCheckExtPrefix(xsltStylesheetPtr style, const xmlChar * URI) +{ +#ifdef XSLT_REFACTORED + if ((style == NULL) || (style->compCtxt == NULL) || + (XSLT_CCTXT(style)->inode == NULL) || + (XSLT_CCTXT(style)->inode->extElemNs == NULL)) + return (0); + /* + * Lookup the extension namespaces registered + * at the current node in the stylesheet's tree. + */ + if (XSLT_CCTXT(style)->inode->extElemNs != NULL) { + int i; + xsltPointerListPtr list = XSLT_CCTXT(style)->inode->extElemNs; + + for (i = 0; i < list->number; i++) { + if (xmlStrEqual((const xmlChar *) list->items[i], + URI)) + { + return(1); + } + } + } +#else + xsltExtDefPtr cur; + + if ((style == NULL) || (style->nsDefs == NULL)) + return (0); + if (URI == NULL) + URI = BAD_CAST "#default"; + cur = (xsltExtDefPtr) style->nsDefs; + while (cur != NULL) { + /* + * NOTE: This was change to work on namespace names rather + * than namespace prefixes. This fixes bug #339583. + * TODO: Consider renaming the field "prefix" of xsltExtDef + * to "href". + */ + if (xmlStrEqual(URI, cur->prefix)) + return (1); + cur = cur->next; + } +#endif + return (0); +} + +/** + * xsltCheckExtURI: + * @style: the stylesheet + * @URI: the namespace URI (possibly NULL) + * + * Check if the given prefix is one of the declared extensions. + * This is intended to be called only at compile-time. + * Called by: + * xsltPrecomputeStylesheet() (xslt.c) + * xsltParseTemplateContent (xslt.c) + * + * Returns 1 if this is an extension, 0 otherwise + */ +int +xsltCheckExtURI(xsltStylesheetPtr style, const xmlChar * URI) +{ + xsltExtDefPtr cur; + + if ((style == NULL) || (style->nsDefs == NULL)) + return (0); + if (URI == NULL) + return (0); + cur = (xsltExtDefPtr) style->nsDefs; + while (cur != NULL) { + if (xmlStrEqual(URI, cur->URI)) + return (1); + cur = cur->next; + } + return (0); +} + +/** + * xsltRegisterExtModuleFull: + * @URI: URI associated to this module + * @initFunc: the module initialization function + * @shutdownFunc: the module shutdown function + * @styleInitFunc: the module initialization function + * @styleShutdownFunc: the module shutdown function + * + * Register an XSLT extension module to the library. + * + * Returns 0 if sucessful, -1 in case of error + */ +int +xsltRegisterExtModuleFull(const xmlChar * URI, + xsltExtInitFunction initFunc, + xsltExtShutdownFunction shutdownFunc, + xsltStyleExtInitFunction styleInitFunc, + xsltStyleExtShutdownFunction styleShutdownFunc) +{ + int ret; + xsltExtModulePtr module; + + if ((URI == NULL) || (initFunc == NULL)) + return (-1); + if (xsltExtensionsHash == NULL) + xsltExtensionsHash = xmlHashCreate(10); + + if (xsltExtensionsHash == NULL) + return (-1); + + xmlMutexLock(xsltExtMutex); + + module = xmlHashLookup(xsltExtensionsHash, URI); + if (module != NULL) { + if ((module->initFunc == initFunc) && + (module->shutdownFunc == shutdownFunc)) + ret = 0; + else + ret = -1; + goto done; + } + module = xsltNewExtModule(initFunc, shutdownFunc, + styleInitFunc, styleShutdownFunc); + if (module == NULL) { + ret = -1; + goto done; + } + ret = xmlHashAddEntry(xsltExtensionsHash, URI, (void *) module); + +done: + xmlMutexUnlock(xsltExtMutex); + return (ret); +} + +/** + * xsltRegisterExtModule: + * @URI: URI associated to this module + * @initFunc: the module initialization function + * @shutdownFunc: the module shutdown function + * + * Register an XSLT extension module to the library. + * + * Returns 0 if sucessful, -1 in case of error + */ +int +xsltRegisterExtModule(const xmlChar * URI, + xsltExtInitFunction initFunc, + xsltExtShutdownFunction shutdownFunc) +{ + return xsltRegisterExtModuleFull(URI, initFunc, shutdownFunc, + NULL, NULL); +} + +/** + * xsltUnregisterExtModule: + * @URI: URI associated to this module + * + * Unregister an XSLT extension module from the library. + * + * Returns 0 if sucessful, -1 in case of error + */ +int +xsltUnregisterExtModule(const xmlChar * URI) +{ + int ret; + + if (URI == NULL) + return (-1); + if (xsltExtensionsHash == NULL) + return (-1); + + xmlMutexLock(xsltExtMutex); + + ret = xmlHashRemoveEntry(xsltExtensionsHash, URI, + (xmlHashDeallocator) xsltFreeExtModule); + + xmlMutexUnlock(xsltExtMutex); + + return (ret); +} + +/** + * xsltUnregisterAllExtModules: + * + * Unregister all the XSLT extension module from the library. + */ +static void +xsltUnregisterAllExtModules(void) +{ + if (xsltExtensionsHash == NULL) + return; + + xmlMutexLock(xsltExtMutex); + + xmlHashFree(xsltExtensionsHash, + (xmlHashDeallocator) xsltFreeExtModule); + xsltExtensionsHash = NULL; + + xmlMutexUnlock(xsltExtMutex); +} + +/** + * xsltXPathGetTransformContext: + * @ctxt: an XPath transformation context + * + * Provides the XSLT transformation context from the XPath transformation + * context. This is useful when an XPath function in the extension module + * is called by the XPath interpreter and that the XSLT context is needed + * for example to retrieve the associated data pertaining to this XSLT + * transformation. + * + * Returns the XSLT transformation context or NULL in case of error. + */ +xsltTransformContextPtr +xsltXPathGetTransformContext(xmlXPathParserContextPtr ctxt) +{ + if ((ctxt == NULL) || (ctxt->context == NULL)) + return (NULL); + return (ctxt->context->extra); +} + +/** + * xsltRegisterExtModuleFunction: + * @name: the function name + * @URI: the function namespace URI + * @function: the function callback + * + * Registers an extension module function. + * + * Returns 0 if successful, -1 in case of error. + */ +int +xsltRegisterExtModuleFunction(const xmlChar * name, const xmlChar * URI, + xmlXPathFunction function) +{ + if ((name == NULL) || (URI == NULL) || (function == NULL)) + return (-1); + + if (xsltFunctionsHash == NULL) + xsltFunctionsHash = xmlHashCreate(10); + if (xsltFunctionsHash == NULL) + return (-1); + + xmlMutexLock(xsltExtMutex); + + xmlHashUpdateEntry2(xsltFunctionsHash, name, URI, + XML_CAST_FPTR(function), NULL); + + xmlMutexUnlock(xsltExtMutex); + + return (0); +} + +/** + * xsltExtModuleFunctionLookup: + * @name: the function name + * @URI: the function namespace URI + * + * Looks up an extension module function + * + * Returns the function if found, NULL otherwise. + */ +xmlXPathFunction +xsltExtModuleFunctionLookup(const xmlChar * name, const xmlChar * URI) +{ + xmlXPathFunction ret; + + if ((xsltFunctionsHash == NULL) || (name == NULL) || (URI == NULL)) + return (NULL); + + xmlMutexLock(xsltExtMutex); + + XML_CAST_FPTR(ret) = xmlHashLookup2(xsltFunctionsHash, name, URI); + + xmlMutexUnlock(xsltExtMutex); + + /* if lookup fails, attempt a dynamic load on supported platforms */ + if (NULL == ret) { + if (!xsltExtModuleRegisterDynamic(URI)) { + xmlMutexLock(xsltExtMutex); + + XML_CAST_FPTR(ret) = + xmlHashLookup2(xsltFunctionsHash, name, URI); + + xmlMutexUnlock(xsltExtMutex); + } + } + + return ret; +} + +/** + * xsltUnregisterExtModuleFunction: + * @name: the function name + * @URI: the function namespace URI + * + * Unregisters an extension module function + * + * Returns 0 if successful, -1 in case of error. + */ +int +xsltUnregisterExtModuleFunction(const xmlChar * name, const xmlChar * URI) +{ + int ret; + + if ((xsltFunctionsHash == NULL) || (name == NULL) || (URI == NULL)) + return (-1); + + xmlMutexLock(xsltExtMutex); + + ret = xmlHashRemoveEntry2(xsltFunctionsHash, name, URI, NULL); + + xmlMutexUnlock(xsltExtMutex); + + return(ret); +} + +/** + * xsltUnregisterAllExtModuleFunction: + * + * Unregisters all extension module function + */ +static void +xsltUnregisterAllExtModuleFunction(void) +{ + xmlMutexLock(xsltExtMutex); + + xmlHashFree(xsltFunctionsHash, NULL); + xsltFunctionsHash = NULL; + + xmlMutexUnlock(xsltExtMutex); +} + + +/** + * xsltNewElemPreComp: + * @style: the XSLT stylesheet + * @inst: the element node + * @function: the transform function + * + * Creates and initializes an #xsltElemPreComp + * + * Returns the new and initialized #xsltElemPreComp + */ +xsltElemPreCompPtr +xsltNewElemPreComp(xsltStylesheetPtr style, xmlNodePtr inst, + xsltTransformFunction function) +{ + xsltElemPreCompPtr cur; + + cur = (xsltElemPreCompPtr) xmlMalloc(sizeof(xsltElemPreComp)); + if (cur == NULL) { + xsltTransformError(NULL, style, NULL, + "xsltNewExtElement : malloc failed\n"); + return (NULL); + } + memset(cur, 0, sizeof(xsltElemPreComp)); + + xsltInitElemPreComp(cur, style, inst, function, + (xsltElemPreCompDeallocator) xmlFree); + + return (cur); +} + +/** + * xsltInitElemPreComp: + * @comp: an #xsltElemPreComp (or generally a derived structure) + * @style: the XSLT stylesheet + * @inst: the element node + * @function: the transform function + * @freeFunc: the @comp deallocator + * + * Initializes an existing #xsltElemPreComp structure. This is usefull + * when extending an #xsltElemPreComp to store precomputed data. + * This function MUST be called on any extension element precomputed + * data struct. + */ +void +xsltInitElemPreComp(xsltElemPreCompPtr comp, xsltStylesheetPtr style, + xmlNodePtr inst, xsltTransformFunction function, + xsltElemPreCompDeallocator freeFunc) +{ + comp->type = XSLT_FUNC_EXTENSION; + comp->func = function; + comp->inst = inst; + comp->free = freeFunc; + + comp->next = style->preComps; + style->preComps = comp; +} + +/** + * xsltPreComputeExtModuleElement: + * @style: the stylesheet + * @inst: the element node + * + * Precomputes an extension module element + * + * Returns the precomputed data + */ +xsltElemPreCompPtr +xsltPreComputeExtModuleElement(xsltStylesheetPtr style, xmlNodePtr inst) +{ + xsltExtElementPtr ext; + xsltElemPreCompPtr comp = NULL; + + if ((style == NULL) || (inst == NULL) || + (inst->type != XML_ELEMENT_NODE) || (inst->ns == NULL)) + return (NULL); + + xmlMutexLock(xsltExtMutex); + + ext = (xsltExtElementPtr) + xmlHashLookup2(xsltElementsHash, inst->name, inst->ns->href); + + xmlMutexUnlock(xsltExtMutex); + + /* + * EXT TODO: Now what? + */ + if (ext == NULL) + return (NULL); + + if (ext->precomp != NULL) { + /* + * REVISIT TODO: Check if the text below is correct. + * This will return a xsltElemPreComp structure or NULL. + * 1) If the the author of the extension needs a + * custom structure to hold the specific values of + * this extension, he will derive a structure based on + * xsltElemPreComp; thus we obviously *cannot* refactor + * the xsltElemPreComp structure, since all already derived + * user-defined strucures will break. + * Example: For the extension xsl:document, + * in xsltDocumentComp() (preproc.c), the structure + * xsltStyleItemDocument is allocated, filled with + * specific values and returned. + * 2) If the author needs no values to be stored in + * this structure, then he'll return NULL; + */ + comp = ext->precomp(style, inst, ext->transform); + } + if (comp == NULL) { + /* + * Default creation of a xsltElemPreComp structure, if + * the author of this extension did not create a custom + * structure. + */ + comp = xsltNewElemPreComp(style, inst, ext->transform); + } + + return (comp); +} + +/** + * xsltRegisterExtModuleElement: + * @name: the element name + * @URI: the element namespace URI + * @precomp: the pre-computation callback + * @transform: the transformation callback + * + * Registers an extension module element. + * + * Returns 0 if successful, -1 in case of error. + */ +int +xsltRegisterExtModuleElement(const xmlChar * name, const xmlChar * URI, + xsltPreComputeFunction precomp, + xsltTransformFunction transform) +{ + int ret = 0; + + xsltExtElementPtr ext; + + if ((name == NULL) || (URI == NULL) || (transform == NULL)) + return (-1); + + if (xsltElementsHash == NULL) + xsltElementsHash = xmlHashCreate(10); + if (xsltElementsHash == NULL) + return (-1); + + xmlMutexLock(xsltExtMutex); + + ext = xsltNewExtElement(precomp, transform); + if (ext == NULL) { + ret = -1; + goto done; + } + + xmlHashUpdateEntry2(xsltElementsHash, name, URI, (void *) ext, + (xmlHashDeallocator) xsltFreeExtElement); + +done: + xmlMutexUnlock(xsltExtMutex); + + return (ret); +} + +/** + * xsltExtElementLookup: + * @ctxt: an XSLT process context + * @name: the element name + * @URI: the element namespace URI + * + * Looks up an extension element. @ctxt can be NULL to search only in + * module elements. + * + * Returns the element callback or NULL if not found + */ +xsltTransformFunction +xsltExtElementLookup(xsltTransformContextPtr ctxt, + const xmlChar * name, const xmlChar * URI) +{ + xsltTransformFunction ret; + + if ((name == NULL) || (URI == NULL)) + return (NULL); + + if ((ctxt != NULL) && (ctxt->extElements != NULL)) { + XML_CAST_FPTR(ret) = xmlHashLookup2(ctxt->extElements, name, URI); + if (ret != NULL) { + return(ret); + } + } + + ret = xsltExtModuleElementLookup(name, URI); + + return (ret); +} + +/** + * xsltExtModuleElementLookup: + * @name: the element name + * @URI: the element namespace URI + * + * Looks up an extension module element + * + * Returns the callback function if found, NULL otherwise. + */ +xsltTransformFunction +xsltExtModuleElementLookup(const xmlChar * name, const xmlChar * URI) +{ + xsltExtElementPtr ext; + + if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL)) + return (NULL); + + xmlMutexLock(xsltExtMutex); + + ext = (xsltExtElementPtr) xmlHashLookup2(xsltElementsHash, name, URI); + + xmlMutexUnlock(xsltExtMutex); + + /* + * if function lookup fails, attempt a dynamic load on + * supported platforms + */ + if (NULL == ext) { + if (!xsltExtModuleRegisterDynamic(URI)) { + xmlMutexLock(xsltExtMutex); + + ext = (xsltExtElementPtr) + xmlHashLookup2(xsltElementsHash, name, URI); + + xmlMutexUnlock(xsltExtMutex); + } + } + + if (ext == NULL) + return (NULL); + return (ext->transform); +} + +/** + * xsltExtModuleElementPreComputeLookup: + * @name: the element name + * @URI: the element namespace URI + * + * Looks up an extension module element pre-computation function + * + * Returns the callback function if found, NULL otherwise. + */ +xsltPreComputeFunction +xsltExtModuleElementPreComputeLookup(const xmlChar * name, + const xmlChar * URI) +{ + xsltExtElementPtr ext; + + if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL)) + return (NULL); + + xmlMutexLock(xsltExtMutex); + + ext = (xsltExtElementPtr) xmlHashLookup2(xsltElementsHash, name, URI); + + xmlMutexUnlock(xsltExtMutex); + + if (ext == NULL) { + if (!xsltExtModuleRegisterDynamic(URI)) { + xmlMutexLock(xsltExtMutex); + + ext = (xsltExtElementPtr) + xmlHashLookup2(xsltElementsHash, name, URI); + + xmlMutexUnlock(xsltExtMutex); + } + } + + if (ext == NULL) + return (NULL); + return (ext->precomp); +} + +/** + * xsltUnregisterExtModuleElement: + * @name: the element name + * @URI: the element namespace URI + * + * Unregisters an extension module element + * + * Returns 0 if successful, -1 in case of error. + */ +int +xsltUnregisterExtModuleElement(const xmlChar * name, const xmlChar * URI) +{ + int ret; + + if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL)) + return (-1); + + xmlMutexLock(xsltExtMutex); + + ret = xmlHashRemoveEntry2(xsltElementsHash, name, URI, + (xmlHashDeallocator) xsltFreeExtElement); + + xmlMutexUnlock(xsltExtMutex); + + return(ret); +} + +/** + * xsltUnregisterAllExtModuleElement: + * + * Unregisters all extension module element + */ +static void +xsltUnregisterAllExtModuleElement(void) +{ + xmlMutexLock(xsltExtMutex); + + xmlHashFree(xsltElementsHash, (xmlHashDeallocator) xsltFreeExtElement); + xsltElementsHash = NULL; + + xmlMutexUnlock(xsltExtMutex); +} + +/** + * xsltRegisterExtModuleTopLevel: + * @name: the top-level element name + * @URI: the top-level element namespace URI + * @function: the top-level element callback + * + * Registers an extension module top-level element. + * + * Returns 0 if successful, -1 in case of error. + */ +int +xsltRegisterExtModuleTopLevel(const xmlChar * name, const xmlChar * URI, + xsltTopLevelFunction function) +{ + if ((name == NULL) || (URI == NULL) || (function == NULL)) + return (-1); + + if (xsltTopLevelsHash == NULL) + xsltTopLevelsHash = xmlHashCreate(10); + if (xsltTopLevelsHash == NULL) + return (-1); + + xmlMutexLock(xsltExtMutex); + + xmlHashUpdateEntry2(xsltTopLevelsHash, name, URI, + XML_CAST_FPTR(function), NULL); + + xmlMutexUnlock(xsltExtMutex); + + return (0); +} + +/** + * xsltExtModuleTopLevelLookup: + * @name: the top-level element name + * @URI: the top-level element namespace URI + * + * Looks up an extension module top-level element + * + * Returns the callback function if found, NULL otherwise. + */ +xsltTopLevelFunction +xsltExtModuleTopLevelLookup(const xmlChar * name, const xmlChar * URI) +{ + xsltTopLevelFunction ret; + + if ((xsltTopLevelsHash == NULL) || (name == NULL) || (URI == NULL)) + return (NULL); + + xmlMutexLock(xsltExtMutex); + + XML_CAST_FPTR(ret) = xmlHashLookup2(xsltTopLevelsHash, name, URI); + + xmlMutexUnlock(xsltExtMutex); + + /* if lookup fails, attempt a dynamic load on supported platforms */ + if (NULL == ret) { + if (!xsltExtModuleRegisterDynamic(URI)) { + xmlMutexLock(xsltExtMutex); + + XML_CAST_FPTR(ret) = xmlHashLookup2(xsltTopLevelsHash, name, URI); + + xmlMutexUnlock(xsltExtMutex); + } + } + + return (ret); +} + +/** + * xsltUnregisterExtModuleTopLevel: + * @name: the top-level element name + * @URI: the top-level element namespace URI + * + * Unregisters an extension module top-level element + * + * Returns 0 if successful, -1 in case of error. + */ +int +xsltUnregisterExtModuleTopLevel(const xmlChar * name, const xmlChar * URI) +{ + int ret; + + if ((xsltTopLevelsHash == NULL) || (name == NULL) || (URI == NULL)) + return (-1); + + xmlMutexLock(xsltExtMutex); + + ret = xmlHashRemoveEntry2(xsltTopLevelsHash, name, URI, NULL); + + xmlMutexUnlock(xsltExtMutex); + + return(ret); +} + +/** + * xsltUnregisterAllExtModuleTopLevel: + * + * Unregisters all extension module function + */ +static void +xsltUnregisterAllExtModuleTopLevel(void) +{ + xmlMutexLock(xsltExtMutex); + + xmlHashFree(xsltTopLevelsHash, NULL); + xsltTopLevelsHash = NULL; + + xmlMutexUnlock(xsltExtMutex); +} + +/** + * xsltGetExtInfo: + * @style: pointer to a stylesheet + * @URI: the namespace URI desired + * + * looks up URI in extInfos of the stylesheet + * + * returns a pointer to the hash table if found, else NULL + */ +xmlHashTablePtr +xsltGetExtInfo(xsltStylesheetPtr style, const xmlChar * URI) +{ + xsltExtDataPtr data; + + /* + * TODO: Why do we have a return type of xmlHashTablePtr? + * Is the user-allocated data for extension modules expected + * to be a xmlHashTablePtr only? Or is this intended for + * the EXSLT module only? + */ + + if (style != NULL && style->extInfos != NULL) { + data = xmlHashLookup(style->extInfos, URI); + if (data != NULL && data->extData != NULL) + return data->extData; + } + return NULL; +} + +/************************************************************************ + * * + * Test module http://xmlsoft.org/XSLT/ * + * * + ************************************************************************/ + +/************************************************************************ + * * + * Test of the extension module API * + * * + ************************************************************************/ + +static xmlChar *testData = NULL; +static xmlChar *testStyleData = NULL; + +/** + * xsltExtFunctionTest: + * @ctxt: the XPath Parser context + * @nargs: the number of arguments + * + * function libxslt:test() for testing the extensions support. + */ +static void +xsltExtFunctionTest(xmlXPathParserContextPtr ctxt, + int nargs ATTRIBUTE_UNUSED) +{ + xsltTransformContextPtr tctxt; + void *data = NULL; + + tctxt = xsltXPathGetTransformContext(ctxt); + + if (testData == NULL) { + xsltGenericDebug(xsltGenericDebugContext, + "xsltExtFunctionTest: not initialized," + " calling xsltGetExtData\n"); + data = xsltGetExtData(tctxt, (const xmlChar *) XSLT_DEFAULT_URL); + if (data == NULL) { + xsltTransformError(tctxt, NULL, NULL, + "xsltExtElementTest: not initialized\n"); + return; + } + } + if (tctxt == NULL) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "xsltExtFunctionTest: failed to get the transformation context\n"); + return; + } + if (data == NULL) + data = xsltGetExtData(tctxt, (const xmlChar *) XSLT_DEFAULT_URL); + if (data == NULL) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "xsltExtFunctionTest: failed to get module data\n"); + return; + } + if (data != testData) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "xsltExtFunctionTest: got wrong module data\n"); + return; + } +#ifdef WITH_XSLT_DEBUG_FUNCTION + xsltGenericDebug(xsltGenericDebugContext, + "libxslt:test() called with %d args\n", nargs); +#endif +} + +/** + * xsltExtElementPreCompTest: + * @style: the stylesheet + * @inst: the instruction in the stylesheet + * + * Process a libxslt:test node + */ +static xsltElemPreCompPtr +xsltExtElementPreCompTest(xsltStylesheetPtr style, xmlNodePtr inst, + xsltTransformFunction function) +{ + xsltElemPreCompPtr ret; + + if (style == NULL) { + xsltTransformError(NULL, NULL, inst, + "xsltExtElementTest: no transformation context\n"); + return (NULL); + } + if (testStyleData == NULL) { + xsltGenericDebug(xsltGenericDebugContext, + "xsltExtElementPreCompTest: not initialized," + " calling xsltStyleGetExtData\n"); + xsltStyleGetExtData(style, (const xmlChar *) XSLT_DEFAULT_URL); + if (testStyleData == NULL) { + xsltTransformError(NULL, style, inst, + "xsltExtElementPreCompTest: not initialized\n"); + if (style != NULL) + style->errors++; + return (NULL); + } + } + if (inst == NULL) { + xsltTransformError(NULL, style, inst, + "xsltExtElementPreCompTest: no instruction\n"); + if (style != NULL) + style->errors++; + return (NULL); + } + ret = xsltNewElemPreComp(style, inst, function); + return (ret); +} + +/** + * xsltExtElementTest: + * @ctxt: an XSLT processing context + * @node: The current node + * @inst: the instruction in the stylesheet + * @comp: precomputed informations + * + * Process a libxslt:test node + */ +static void +xsltExtElementTest(xsltTransformContextPtr ctxt, xmlNodePtr node, + xmlNodePtr inst, + xsltElemPreCompPtr comp ATTRIBUTE_UNUSED) +{ + xmlNodePtr commentNode; + + if (testData == NULL) { + xsltGenericDebug(xsltGenericDebugContext, + "xsltExtElementTest: not initialized," + " calling xsltGetExtData\n"); + xsltGetExtData(ctxt, (const xmlChar *) XSLT_DEFAULT_URL); + if (testData == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsltExtElementTest: not initialized\n"); + return; + } + } + if (ctxt == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsltExtElementTest: no transformation context\n"); + return; + } + if (node == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsltExtElementTest: no current node\n"); + return; + } + if (inst == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsltExtElementTest: no instruction\n"); + return; + } + if (ctxt->insert == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsltExtElementTest: no insertion point\n"); + return; + } + commentNode = xmlNewComment((const xmlChar *) + "libxslt:test element test worked"); + xmlAddChild(ctxt->insert, commentNode); +} + +/** + * xsltExtInitTest: + * @ctxt: an XSLT transformation context + * @URI: the namespace URI for the extension + * + * A function called at initialization time of an XSLT extension module + * + * Returns a pointer to the module specific data for this transformation + */ +static void * +xsltExtInitTest(xsltTransformContextPtr ctxt, const xmlChar * URI) +{ + if (testStyleData == NULL) { + xsltGenericDebug(xsltGenericErrorContext, + "xsltExtInitTest: not initialized," + " calling xsltStyleGetExtData\n"); + testStyleData = xsltStyleGetExtData(ctxt->style, URI); + if (testStyleData == NULL) { + xsltTransformError(ctxt, NULL, NULL, + "xsltExtInitTest: not initialized\n"); + return (NULL); + } + } + if (testData != NULL) { + xsltTransformError(ctxt, NULL, NULL, + "xsltExtInitTest: already initialized\n"); + return (NULL); + } + testData = (void *) "test data"; + xsltGenericDebug(xsltGenericDebugContext, + "Registered test module : %s\n", URI); + return (testData); +} + + +/** + * xsltExtShutdownTest: + * @ctxt: an XSLT transformation context + * @URI: the namespace URI for the extension + * @data: the data associated to this module + * + * A function called at shutdown time of an XSLT extension module + */ +static void +xsltExtShutdownTest(xsltTransformContextPtr ctxt, + const xmlChar * URI, void *data) +{ + if (testData == NULL) { + xsltTransformError(ctxt, NULL, NULL, + "xsltExtShutdownTest: not initialized\n"); + return; + } + if (data != testData) { + xsltTransformError(ctxt, NULL, NULL, + "xsltExtShutdownTest: wrong data\n"); + } + testData = NULL; + xsltGenericDebug(xsltGenericDebugContext, + "Unregistered test module : %s\n", URI); +} + +/** + * xsltExtStyleInitTest: + * @style: an XSLT stylesheet + * @URI: the namespace URI for the extension + * + * A function called at initialization time of an XSLT extension module + * + * Returns a pointer to the module specific data for this transformation + */ +static void * +xsltExtStyleInitTest(xsltStylesheetPtr style ATTRIBUTE_UNUSED, + const xmlChar * URI) +{ + if (testStyleData != NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltExtInitTest: already initialized\n"); + return (NULL); + } + testStyleData = (void *) "test data"; + xsltGenericDebug(xsltGenericDebugContext, + "Registered test module : %s\n", URI); + return (testStyleData); +} + + +/** + * xsltExtStyleShutdownTest: + * @style: an XSLT stylesheet + * @URI: the namespace URI for the extension + * @data: the data associated to this module + * + * A function called at shutdown time of an XSLT extension module + */ +static void +xsltExtStyleShutdownTest(xsltStylesheetPtr style ATTRIBUTE_UNUSED, + const xmlChar * URI, void *data) +{ + if (testStyleData == NULL) { + xsltGenericError(xsltGenericErrorContext, + "xsltExtShutdownTest: not initialized\n"); + return; + } + if (data != testStyleData) { + xsltTransformError(NULL, NULL, NULL, + "xsltExtShutdownTest: wrong data\n"); + } + testStyleData = NULL; + xsltGenericDebug(xsltGenericDebugContext, + "Unregistered test module : %s\n", URI); +} + +/** + * xsltRegisterTestModule: + * + * Registers the test module + */ +void +xsltRegisterTestModule(void) +{ + xsltInitGlobals(); + xsltRegisterExtModuleFull((const xmlChar *) XSLT_DEFAULT_URL, + xsltExtInitTest, xsltExtShutdownTest, + xsltExtStyleInitTest, + xsltExtStyleShutdownTest); + xsltRegisterExtModuleFunction((const xmlChar *) "test", + (const xmlChar *) XSLT_DEFAULT_URL, + xsltExtFunctionTest); + xsltRegisterExtModuleElement((const xmlChar *) "test", + (const xmlChar *) XSLT_DEFAULT_URL, + xsltExtElementPreCompTest, + xsltExtElementTest); +} + +static void +xsltHashScannerModuleFree(void *payload ATTRIBUTE_UNUSED, + void *data ATTRIBUTE_UNUSED, + xmlChar * name ATTRIBUTE_UNUSED) +{ +#ifdef WITH_MODULES + xmlModuleClose(payload); +#endif +} + +/** + * xsltInitGlobals: + * + * Initialize the global variables for extensions + */ +void +xsltInitGlobals(void) +{ + if (xsltExtMutex == NULL) { + xsltExtMutex = xmlNewMutex(); + } +} + +/** + * xsltCleanupGlobals: + * + * Unregister all global variables set up by the XSLT library + */ +void +xsltCleanupGlobals(void) +{ + xsltUnregisterAllExtModules(); + xsltUnregisterAllExtModuleFunction(); + xsltUnregisterAllExtModuleElement(); + xsltUnregisterAllExtModuleTopLevel(); + + xmlMutexLock(xsltExtMutex); + /* cleanup dynamic module hash */ + if (NULL != xsltModuleHash) { + xmlHashScan(xsltModuleHash, xsltHashScannerModuleFree, 0); + xmlHashFree(xsltModuleHash, NULL); + xsltModuleHash = NULL; + } + xmlMutexUnlock(xsltExtMutex); + + xmlFreeMutex(xsltExtMutex); + xsltExtMutex = NULL; + xsltFreeLocales(); + xsltUninit(); +} + +static void +xsltDebugDumpExtensionsCallback(void *function ATTRIBUTE_UNUSED, + FILE * output, const xmlChar * name, + const xmlChar * URI, + const xmlChar * not_used ATTRIBUTE_UNUSED) +{ + if (!name || !URI) + return; + fprintf(output, "{%s}%s\n", URI, name); +} + +static void +xsltDebugDumpExtModulesCallback(void *function ATTRIBUTE_UNUSED, + FILE * output, const xmlChar * URI, + const xmlChar * not_used ATTRIBUTE_UNUSED, + const xmlChar * not_used2 ATTRIBUTE_UNUSED) +{ + if (!URI) + return; + fprintf(output, "%s\n", URI); +} + +/** + * xsltDebugDumpExtensions: + * @output: the FILE * for the output, if NULL stdout is used + * + * Dumps a list of the registered XSLT extension functions and elements + */ +void +xsltDebugDumpExtensions(FILE * output) +{ + if (output == NULL) + output = stdout; + fprintf(output, + "Registered XSLT Extensions\n--------------------------\n"); + if (!xsltFunctionsHash) + fprintf(output, "No registered extension functions\n"); + else { + fprintf(output, "Registered Extension Functions:\n"); + xmlMutexLock(xsltExtMutex); + xmlHashScanFull(xsltFunctionsHash, + (xmlHashScannerFull) + xsltDebugDumpExtensionsCallback, output); + xmlMutexUnlock(xsltExtMutex); + } + if (!xsltElementsHash) + fprintf(output, "\nNo registered extension elements\n"); + else { + fprintf(output, "\nRegistered Extension Elements:\n"); + xmlMutexLock(xsltExtMutex); + xmlHashScanFull(xsltElementsHash, + (xmlHashScannerFull) + xsltDebugDumpExtensionsCallback, output); + xmlMutexUnlock(xsltExtMutex); + } + if (!xsltExtensionsHash) + fprintf(output, "\nNo registered extension modules\n"); + else { + fprintf(output, "\nRegistered Extension Modules:\n"); + xmlMutexLock(xsltExtMutex); + xmlHashScanFull(xsltExtensionsHash, + (xmlHashScannerFull) + xsltDebugDumpExtModulesCallback, output); + xmlMutexUnlock(xsltExtMutex); + } + +} diff --git a/libxslt/extensions.h b/libxslt/extensions.h new file mode 100644 index 0000000..900779c --- /dev/null +++ b/libxslt/extensions.h @@ -0,0 +1,262 @@ +/* + * Summary: interface for the extension support + * Description: This provide the API needed for simple and module + * extension support. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XSLT_EXTENSION_H__ +#define __XML_XSLT_EXTENSION_H__ + +#include +#include "xsltexports.h" +#include "xsltInternals.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Extension Modules API. + */ + +/** + * xsltInitGlobals: + * + * Initialize the global variables for extensions + * + */ + +XSLTPUBFUN void XSLTCALL + xsltInitGlobals (void); + +/** + * xsltStyleExtInitFunction: + * @ctxt: an XSLT stylesheet + * @URI: the namespace URI for the extension + * + * A function called at initialization time of an XSLT extension module. + * + * Returns a pointer to the module specific data for this transformation. + */ +typedef void * (*xsltStyleExtInitFunction) (xsltStylesheetPtr style, + const xmlChar *URI); + +/** + * xsltStyleExtShutdownFunction: + * @ctxt: an XSLT stylesheet + * @URI: the namespace URI for the extension + * @data: the data associated to this module + * + * A function called at shutdown time of an XSLT extension module. + */ +typedef void (*xsltStyleExtShutdownFunction) (xsltStylesheetPtr style, + const xmlChar *URI, + void *data); + +/** + * xsltExtInitFunction: + * @ctxt: an XSLT transformation context + * @URI: the namespace URI for the extension + * + * A function called at initialization time of an XSLT extension module. + * + * Returns a pointer to the module specific data for this transformation. + */ +typedef void * (*xsltExtInitFunction) (xsltTransformContextPtr ctxt, + const xmlChar *URI); + +/** + * xsltExtShutdownFunction: + * @ctxt: an XSLT transformation context + * @URI: the namespace URI for the extension + * @data: the data associated to this module + * + * A function called at shutdown time of an XSLT extension module. + */ +typedef void (*xsltExtShutdownFunction) (xsltTransformContextPtr ctxt, + const xmlChar *URI, + void *data); + +XSLTPUBFUN int XSLTCALL + xsltRegisterExtModule (const xmlChar *URI, + xsltExtInitFunction initFunc, + xsltExtShutdownFunction shutdownFunc); +XSLTPUBFUN int XSLTCALL + xsltRegisterExtModuleFull + (const xmlChar * URI, + xsltExtInitFunction initFunc, + xsltExtShutdownFunction shutdownFunc, + xsltStyleExtInitFunction styleInitFunc, + xsltStyleExtShutdownFunction styleShutdownFunc); + +XSLTPUBFUN int XSLTCALL + xsltUnregisterExtModule (const xmlChar * URI); + +XSLTPUBFUN void * XSLTCALL + xsltGetExtData (xsltTransformContextPtr ctxt, + const xmlChar *URI); + +XSLTPUBFUN void * XSLTCALL + xsltStyleGetExtData (xsltStylesheetPtr style, + const xmlChar *URI); +#ifdef XSLT_REFACTORED +XSLTPUBFUN void * XSLTCALL + xsltStyleStylesheetLevelGetExtData( + xsltStylesheetPtr style, + const xmlChar * URI); +#endif +XSLTPUBFUN void XSLTCALL + xsltShutdownCtxtExts (xsltTransformContextPtr ctxt); + +XSLTPUBFUN void XSLTCALL + xsltShutdownExts (xsltStylesheetPtr style); + +XSLTPUBFUN xsltTransformContextPtr XSLTCALL + xsltXPathGetTransformContext + (xmlXPathParserContextPtr ctxt); + +/* + * extension functions +*/ +XSLTPUBFUN int XSLTCALL + xsltRegisterExtModuleFunction + (const xmlChar *name, + const xmlChar *URI, + xmlXPathFunction function); +XSLTPUBFUN xmlXPathFunction XSLTCALL + xsltExtModuleFunctionLookup (const xmlChar *name, + const xmlChar *URI); +XSLTPUBFUN int XSLTCALL + xsltUnregisterExtModuleFunction + (const xmlChar *name, + const xmlChar *URI); + +/* + * extension elements + */ +typedef xsltElemPreCompPtr (*xsltPreComputeFunction) + (xsltStylesheetPtr style, + xmlNodePtr inst, + xsltTransformFunction function); + +XSLTPUBFUN xsltElemPreCompPtr XSLTCALL + xsltNewElemPreComp (xsltStylesheetPtr style, + xmlNodePtr inst, + xsltTransformFunction function); +XSLTPUBFUN void XSLTCALL + xsltInitElemPreComp (xsltElemPreCompPtr comp, + xsltStylesheetPtr style, + xmlNodePtr inst, + xsltTransformFunction function, + xsltElemPreCompDeallocator freeFunc); + +XSLTPUBFUN int XSLTCALL + xsltRegisterExtModuleElement + (const xmlChar *name, + const xmlChar *URI, + xsltPreComputeFunction precomp, + xsltTransformFunction transform); +XSLTPUBFUN xsltTransformFunction XSLTCALL + xsltExtElementLookup (xsltTransformContextPtr ctxt, + const xmlChar *name, + const xmlChar *URI); +XSLTPUBFUN xsltTransformFunction XSLTCALL + xsltExtModuleElementLookup + (const xmlChar *name, + const xmlChar *URI); +XSLTPUBFUN xsltPreComputeFunction XSLTCALL + xsltExtModuleElementPreComputeLookup + (const xmlChar *name, + const xmlChar *URI); +XSLTPUBFUN int XSLTCALL + xsltUnregisterExtModuleElement + (const xmlChar *name, + const xmlChar *URI); + +/* + * top-level elements + */ +typedef void (*xsltTopLevelFunction) (xsltStylesheetPtr style, + xmlNodePtr inst); + +XSLTPUBFUN int XSLTCALL + xsltRegisterExtModuleTopLevel + (const xmlChar *name, + const xmlChar *URI, + xsltTopLevelFunction function); +XSLTPUBFUN xsltTopLevelFunction XSLTCALL + xsltExtModuleTopLevelLookup + (const xmlChar *name, + const xmlChar *URI); +XSLTPUBFUN int XSLTCALL + xsltUnregisterExtModuleTopLevel + (const xmlChar *name, + const xmlChar *URI); + + +/* These 2 functions are deprecated for use within modules. */ +XSLTPUBFUN int XSLTCALL + xsltRegisterExtFunction (xsltTransformContextPtr ctxt, + const xmlChar *name, + const xmlChar *URI, + xmlXPathFunction function); +XSLTPUBFUN int XSLTCALL + xsltRegisterExtElement (xsltTransformContextPtr ctxt, + const xmlChar *name, + const xmlChar *URI, + xsltTransformFunction function); + +/* + * Extension Prefix handling API. + * Those are used by the XSLT (pre)processor. + */ + +XSLTPUBFUN int XSLTCALL + xsltRegisterExtPrefix (xsltStylesheetPtr style, + const xmlChar *prefix, + const xmlChar *URI); +XSLTPUBFUN int XSLTCALL + xsltCheckExtPrefix (xsltStylesheetPtr style, + const xmlChar *URI); +XSLTPUBFUN int XSLTCALL + xsltCheckExtURI (xsltStylesheetPtr style, + const xmlChar *URI); +XSLTPUBFUN int XSLTCALL + xsltInitCtxtExts (xsltTransformContextPtr ctxt); +XSLTPUBFUN void XSLTCALL + xsltFreeCtxtExts (xsltTransformContextPtr ctxt); +XSLTPUBFUN void XSLTCALL + xsltFreeExts (xsltStylesheetPtr style); + +XSLTPUBFUN xsltElemPreCompPtr XSLTCALL + xsltPreComputeExtModuleElement + (xsltStylesheetPtr style, + xmlNodePtr inst); +/* + * Extension Infos access. + * Used by exslt initialisation + */ + +XSLTPUBFUN xmlHashTablePtr XSLTCALL + xsltGetExtInfo (xsltStylesheetPtr style, + const xmlChar *URI); + +/** + * Test module http://xmlsoft.org/XSLT/ + */ +XSLTPUBFUN void XSLTCALL + xsltRegisterTestModule (void); +XSLTPUBFUN void XSLTCALL + xsltDebugDumpExtensions (FILE * output); + + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XSLT_EXTENSION_H__ */ + diff --git a/libxslt/extra.c b/libxslt/extra.c new file mode 100644 index 0000000..17df4ba --- /dev/null +++ b/libxslt/extra.c @@ -0,0 +1,332 @@ +/* + * extra.c: Implementation of non-standard features + * + * Reference: + * Michael Kay "XSLT Programmer's Reference" pp 637-643 + * The node-set() extension function + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include +#ifdef HAVE_TIME_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif + +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "extensions.h" +#include "variables.h" +#include "transform.h" +#include "extra.h" +#include "preproc.h" + +#ifdef WITH_XSLT_DEBUG +#define WITH_XSLT_DEBUG_EXTRA +#endif + +/************************************************************************ + * * + * Handling of XSLT debugging * + * * + ************************************************************************/ + +/** + * xsltDebug: + * @ctxt: an XSLT processing context + * @node: The current node + * @inst: the instruction in the stylesheet + * @comp: precomputed informations + * + * Process an debug node + */ +void +xsltDebug(xsltTransformContextPtr ctxt, xmlNodePtr node ATTRIBUTE_UNUSED, + xmlNodePtr inst ATTRIBUTE_UNUSED, + xsltStylePreCompPtr comp ATTRIBUTE_UNUSED) +{ + int i, j; + + xsltGenericError(xsltGenericErrorContext, "Templates:\n"); + for (i = 0, j = ctxt->templNr - 1; ((i < 15) && (j >= 0)); i++, j--) { + xsltGenericError(xsltGenericErrorContext, "#%d ", i); + if (ctxt->templTab[j]->name != NULL) + xsltGenericError(xsltGenericErrorContext, "name %s ", + ctxt->templTab[j]->name); + if (ctxt->templTab[j]->match != NULL) + xsltGenericError(xsltGenericErrorContext, "name %s ", + ctxt->templTab[j]->match); + if (ctxt->templTab[j]->mode != NULL) + xsltGenericError(xsltGenericErrorContext, "name %s ", + ctxt->templTab[j]->mode); + xsltGenericError(xsltGenericErrorContext, "\n"); + } + xsltGenericError(xsltGenericErrorContext, "Variables:\n"); + for (i = 0, j = ctxt->varsNr - 1; ((i < 15) && (j >= 0)); i++, j--) { + xsltStackElemPtr cur; + + if (ctxt->varsTab[j] == NULL) + continue; + xsltGenericError(xsltGenericErrorContext, "#%d\n", i); + cur = ctxt->varsTab[j]; + while (cur != NULL) { + if (cur->comp == NULL) { + xsltGenericError(xsltGenericErrorContext, + "corrupted !!!\n"); + } else if (cur->comp->type == XSLT_FUNC_PARAM) { + xsltGenericError(xsltGenericErrorContext, "param "); + } else if (cur->comp->type == XSLT_FUNC_VARIABLE) { + xsltGenericError(xsltGenericErrorContext, "var "); + } + if (cur->name != NULL) + xsltGenericError(xsltGenericErrorContext, "%s ", + cur->name); + else + xsltGenericError(xsltGenericErrorContext, "noname !!!!"); +#ifdef LIBXML_DEBUG_ENABLED + if (cur->value != NULL) { + xmlXPathDebugDumpObject(stdout, cur->value, 1); + } else { + xsltGenericError(xsltGenericErrorContext, "NULL !!!!"); + } +#endif + xsltGenericError(xsltGenericErrorContext, "\n"); + cur = cur->next; + } + + } +} + +/************************************************************************ + * * + * Classic extensions as described by M. Kay * + * * + ************************************************************************/ + +/** + * xsltFunctionNodeSet: + * @ctxt: the XPath Parser context + * @nargs: the number of arguments + * + * Implement the node-set() XSLT function + * node-set node-set(result-tree) + * + * This function is available in libxslt, saxon or xt namespace. + */ +void +xsltFunctionNodeSet(xmlXPathParserContextPtr ctxt, int nargs){ + if (nargs != 1) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "node-set() : expects one result-tree arg\n"); + ctxt->error = XPATH_INVALID_ARITY; + return; + } + if ((ctxt->value == NULL) || + ((ctxt->value->type != XPATH_XSLT_TREE) && + (ctxt->value->type != XPATH_NODESET))) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "node-set() invalid arg expecting a result tree\n"); + ctxt->error = XPATH_INVALID_TYPE; + return; + } + if (ctxt->value->type == XPATH_XSLT_TREE) { + ctxt->value->type = XPATH_NODESET; + } +} + + +/* + * Okay the following really seems unportable and since it's not + * part of any standard I'm not too ashamed to do this + */ +#if defined(linux) || defined(__sun) +#if defined(HAVE_MKTIME) && defined(HAVE_LOCALTIME) && defined(HAVE_ASCTIME) +#define WITH_LOCALTIME + +/** + * xsltFunctionLocalTime: + * @ctxt: the XPath Parser context + * @nargs: the number of arguments + * + * Implement the localTime XSLT function used by NORM + * string localTime(???) + * + * This function is available in Norm's extension namespace + * Code (and comments) contributed by Norm + */ +static void +xsltFunctionLocalTime(xmlXPathParserContextPtr ctxt, int nargs) { + xmlXPathObjectPtr obj; + char *str; + char digits[5]; + char result[29]; + long int field; + time_t gmt, lmt; + struct tm gmt_tm; + struct tm *local_tm; + + if (nargs != 1) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "localTime() : invalid number of args %d\n", nargs); + ctxt->error = XPATH_INVALID_ARITY; + return; + } + + obj = valuePop(ctxt); + + if (obj->type != XPATH_STRING) { + obj = xmlXPathConvertString(obj); + } + if (obj == NULL) { + valuePush(ctxt, xmlXPathNewString((const xmlChar *)"")); + return; + } + + str = (char *) obj->stringval; + + /* str = "$Date$" */ + memset(digits, 0, sizeof(digits)); + strncpy(digits, str+7, 4); + field = strtol(digits, NULL, 10); + gmt_tm.tm_year = field - 1900; + + memset(digits, 0, sizeof(digits)); + strncpy(digits, str+12, 2); + field = strtol(digits, NULL, 10); + gmt_tm.tm_mon = field - 1; + + memset(digits, 0, sizeof(digits)); + strncpy(digits, str+15, 2); + field = strtol(digits, NULL, 10); + gmt_tm.tm_mday = field; + + memset(digits, 0, sizeof(digits)); + strncpy(digits, str+18, 2); + field = strtol(digits, NULL, 10); + gmt_tm.tm_hour = field; + + memset(digits, 0, sizeof(digits)); + strncpy(digits, str+21, 2); + field = strtol(digits, NULL, 10); + gmt_tm.tm_min = field; + + memset(digits, 0, sizeof(digits)); + strncpy(digits, str+24, 2); + field = strtol(digits, NULL, 10); + gmt_tm.tm_sec = field; + + /* Now turn gmt_tm into a time. */ + gmt = mktime(&gmt_tm); + + + /* + * FIXME: it's been too long since I did manual memory management. + * (I swore never to do it again.) Does this introduce a memory leak? + */ + local_tm = localtime(&gmt); + + /* + * Calling localtime() has the side-effect of setting timezone. + * After we know the timezone, we can adjust for it + */ +#if !defined(__FreeBSD__) + lmt = gmt - timezone; +#else /* FreeBSD DOESN'T have such side-ffect */ + lmt = gmt - local_tm->tm_gmtoff; +#endif + /* + * FIXME: it's been too long since I did manual memory management. + * (I swore never to do it again.) Does this introduce a memory leak? + */ + local_tm = localtime(&lmt); + + /* + * Now convert local_tm back into a string. This doesn't introduce + * a memory leak, so says asctime(3). + */ + + str = asctime(local_tm); /* "Tue Jun 26 05:02:16 2001" */ + /* 0123456789 123456789 123 */ + + memset(result, 0, sizeof(result)); /* "Thu, 26 Jun 2001" */ + /* 0123456789 12345 */ + + strncpy(result, str, 20); + strcpy(result+20, "???"); /* tzname doesn't work, fake it */ + strncpy(result+23, str+19, 5); + + /* Ok, now result contains the string I want to send back. */ + valuePush(ctxt, xmlXPathNewString((xmlChar *)result)); +} +#endif +#endif /* linux or sun */ + + +/** + * xsltRegisterExtras: + * @ctxt: a XSLT process context + * + * Registers the built-in extensions. This function is deprecated, use + * xsltRegisterAllExtras instead. + */ +void +xsltRegisterExtras(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED) { + xsltRegisterAllExtras(); +} + +/** + * xsltRegisterAllExtras: + * + * Registers the built-in extensions + */ +void +xsltRegisterAllExtras (void) { + xsltRegisterExtModuleFunction((const xmlChar *) "node-set", + XSLT_LIBXSLT_NAMESPACE, + xsltFunctionNodeSet); + xsltRegisterExtModuleFunction((const xmlChar *) "node-set", + XSLT_SAXON_NAMESPACE, + xsltFunctionNodeSet); + xsltRegisterExtModuleFunction((const xmlChar *) "node-set", + XSLT_XT_NAMESPACE, + xsltFunctionNodeSet); +#ifdef WITH_LOCALTIME + xsltRegisterExtModuleFunction((const xmlChar *) "localTime", + XSLT_NORM_SAXON_NAMESPACE, + xsltFunctionLocalTime); +#endif + xsltRegisterExtModuleElement((const xmlChar *) "debug", + XSLT_LIBXSLT_NAMESPACE, + NULL, + (xsltTransformFunction) xsltDebug); + xsltRegisterExtModuleElement((const xmlChar *) "output", + XSLT_SAXON_NAMESPACE, + xsltDocumentComp, + (xsltTransformFunction) xsltDocumentElem); + xsltRegisterExtModuleElement((const xmlChar *) "write", + XSLT_XALAN_NAMESPACE, + xsltDocumentComp, + (xsltTransformFunction) xsltDocumentElem); + xsltRegisterExtModuleElement((const xmlChar *) "document", + XSLT_XT_NAMESPACE, + xsltDocumentComp, + (xsltTransformFunction) xsltDocumentElem); + xsltRegisterExtModuleElement((const xmlChar *) "document", + XSLT_NAMESPACE, + xsltDocumentComp, + (xsltTransformFunction) xsltDocumentElem); +} diff --git a/libxslt/extra.h b/libxslt/extra.h new file mode 100644 index 0000000..6929e3c --- /dev/null +++ b/libxslt/extra.h @@ -0,0 +1,80 @@ +/* + * Summary: interface for the non-standard features + * Description: implement some extension outside the XSLT namespace + * but not EXSLT with is in a different library. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XSLT_EXTRA_H__ +#define __XML_XSLT_EXTRA_H__ + +#include +#include "xsltexports.h" +#include "xsltInternals.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * XSLT_LIBXSLT_NAMESPACE: + * + * This is the libxslt namespace for specific extensions. + */ +#define XSLT_LIBXSLT_NAMESPACE ((xmlChar *) "http://xmlsoft.org/XSLT/namespace") + +/** + * XSLT_SAXON_NAMESPACE: + * + * This is Michael Kay's Saxon processor namespace for extensions. + */ +#define XSLT_SAXON_NAMESPACE ((xmlChar *) "http://icl.com/saxon") + +/** + * XSLT_XT_NAMESPACE: + * + * This is James Clark's XT processor namespace for extensions. + */ +#define XSLT_XT_NAMESPACE ((xmlChar *) "http://www.jclark.com/xt") + +/** + * XSLT_XALAN_NAMESPACE: + * + * This is the Apache project XALAN processor namespace for extensions. + */ +#define XSLT_XALAN_NAMESPACE ((xmlChar *) \ + "org.apache.xalan.xslt.extensions.Redirect") + +/** + * XSLT_NORM_SAXON_NAMESPACE: + * + * This is Norm's namespace for SAXON extensions. + */ +#define XSLT_NORM_SAXON_NAMESPACE ((xmlChar *) \ + "http://nwalsh.com/xslt/ext/com.nwalsh.saxon.CVS") + + +XSLTPUBFUN void XSLTCALL + xsltFunctionNodeSet (xmlXPathParserContextPtr ctxt, + int nargs); +XSLTPUBFUN void XSLTCALL + xsltDebug (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); + + +XSLTPUBFUN void XSLTCALL + xsltRegisterExtras (xsltTransformContextPtr ctxt); +XSLTPUBFUN void XSLTCALL + xsltRegisterAllExtras (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XSLT_EXTRA_H__ */ + diff --git a/libxslt/functions.c b/libxslt/functions.c new file mode 100644 index 0000000..a5e7021 --- /dev/null +++ b/libxslt/functions.c @@ -0,0 +1,988 @@ +/* + * functions.c: Implementation of the XSLT extra functions + * + * Reference: + * http://www.w3.org/TR/1999/REC-xslt-19991116 + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + * Bjorn Reese for number formatting + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_CTYPE_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "functions.h" +#include "extensions.h" +#include "numbersInternals.h" +#include "keys.h" +#include "documents.h" + +#ifdef WITH_XSLT_DEBUG +#define WITH_XSLT_DEBUG_FUNCTION +#endif + +/* + * Some versions of DocBook XSL use the vendor string to detect + * supporting chunking, this is a workaround to be considered + * in the list of decent XSLT processors + */ +#define DOCBOOK_XSL_HACK + +/** + * xsltXPathFunctionLookup: + * @ctxt: a void * but the XSLT transformation context actually + * @name: the function name + * @ns_uri: the function namespace URI + * + * This is the entry point when a function is needed by the XPath + * interpretor. + * + * Returns the callback function or NULL if not found + */ +xmlXPathFunction +xsltXPathFunctionLookup (xmlXPathContextPtr ctxt, + const xmlChar *name, const xmlChar *ns_uri) { + xmlXPathFunction ret; + + if ((ctxt == NULL) || (name == NULL) || (ns_uri == NULL)) + return (NULL); + +#ifdef WITH_XSLT_DEBUG_FUNCTION + xsltGenericDebug(xsltGenericDebugContext, + "Lookup function {%s}%s\n", ns_uri, name); +#endif + + /* give priority to context-level functions */ + /* + ret = (xmlXPathFunction) xmlHashLookup2(ctxt->funcHash, name, ns_uri); + */ + XML_CAST_FPTR(ret) = xmlHashLookup2(ctxt->funcHash, name, ns_uri); + + if (ret == NULL) + ret = xsltExtModuleFunctionLookup(name, ns_uri); + +#ifdef WITH_XSLT_DEBUG_FUNCTION + if (ret != NULL) + xsltGenericDebug(xsltGenericDebugContext, + "found function %s\n", name); +#endif + return(ret); +} + + +/************************************************************************ + * * + * Module interfaces * + * * + ************************************************************************/ + +static void +xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI) +{ + xsltTransformContextPtr tctxt; + xmlURIPtr uri; + xmlChar *fragment; + xsltDocumentPtr idoc; /* document info */ + xmlDocPtr doc; + xmlXPathContextPtr xptrctxt = NULL; + xmlXPathObjectPtr resObj = NULL; + + tctxt = xsltXPathGetTransformContext(ctxt); + if (tctxt == NULL) { + xsltTransformError(NULL, NULL, NULL, + "document() : internal error tctxt == NULL\n"); + valuePush(ctxt, xmlXPathNewNodeSet(NULL)); + return; + } + + uri = xmlParseURI((const char *) URI); + if (uri == NULL) { + xsltTransformError(tctxt, NULL, NULL, + "document() : failed to parse URI\n"); + valuePush(ctxt, xmlXPathNewNodeSet(NULL)); + return; + } + + /* + * check for and remove fragment identifier + */ + fragment = (xmlChar *)uri->fragment; + if (fragment != NULL) { + xmlChar *newURI; + uri->fragment = NULL; + newURI = xmlSaveUri(uri); + idoc = xsltLoadDocument(tctxt, newURI); + xmlFree(newURI); + } else + idoc = xsltLoadDocument(tctxt, URI); + xmlFreeURI(uri); + + if (idoc == NULL) { + if ((URI == NULL) || + (URI[0] == '#') || + ((tctxt->style->doc != NULL) && + (xmlStrEqual(tctxt->style->doc->URL, URI)))) + { + /* + * This selects the stylesheet's doc itself. + */ + doc = tctxt->style->doc; + } else { + valuePush(ctxt, xmlXPathNewNodeSet(NULL)); + + if (fragment != NULL) + xmlFree(fragment); + + return; + } + } else + doc = idoc->doc; + + if (fragment == NULL) { + valuePush(ctxt, xmlXPathNewNodeSet((xmlNodePtr) doc)); + return; + } + + /* use XPointer of HTML location for fragment ID */ +#ifdef LIBXML_XPTR_ENABLED + xptrctxt = xmlXPtrNewContext(doc, NULL, NULL); + if (xptrctxt == NULL) { + xsltTransformError(tctxt, NULL, NULL, + "document() : internal error xptrctxt == NULL\n"); + goto out_fragment; + } + + resObj = xmlXPtrEval(fragment, xptrctxt); + xmlXPathFreeContext(xptrctxt); +#endif + + if (resObj == NULL) + goto out_fragment; + + switch (resObj->type) { + case XPATH_NODESET: + break; + case XPATH_UNDEFINED: + case XPATH_BOOLEAN: + case XPATH_NUMBER: + case XPATH_STRING: + case XPATH_POINT: + case XPATH_USERS: + case XPATH_XSLT_TREE: + case XPATH_RANGE: + case XPATH_LOCATIONSET: + xsltTransformError(tctxt, NULL, NULL, + "document() : XPointer does not select a node set: #%s\n", + fragment); + goto out_object; + } + + valuePush(ctxt, resObj); + xmlFree(fragment); + return; + +out_object: + xmlXPathFreeObject(resObj); + +out_fragment: + valuePush(ctxt, xmlXPathNewNodeSet(NULL)); + xmlFree(fragment); +} + +/** + * xsltDocumentFunction: + * @ctxt: the XPath Parser context + * @nargs: the number of arguments + * + * Implement the document() XSLT function + * node-set document(object, node-set?) + */ +void +xsltDocumentFunction(xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlXPathObjectPtr obj, obj2 = NULL; + xmlChar *base = NULL, *URI; + + + if ((nargs < 1) || (nargs > 2)) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "document() : invalid number of args %d\n", + nargs); + ctxt->error = XPATH_INVALID_ARITY; + return; + } + if (ctxt->value == NULL) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "document() : invalid arg value\n"); + ctxt->error = XPATH_INVALID_TYPE; + return; + } + + if (nargs == 2) { + if (ctxt->value->type != XPATH_NODESET) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "document() : invalid arg expecting a nodeset\n"); + ctxt->error = XPATH_INVALID_TYPE; + return; + } + + obj2 = valuePop(ctxt); + } + + if (ctxt->value->type == XPATH_NODESET) { + int i; + xmlXPathObjectPtr newobj, ret; + + obj = valuePop(ctxt); + ret = xmlXPathNewNodeSet(NULL); + + if ((obj != NULL) && obj->nodesetval) { + for (i = 0; i < obj->nodesetval->nodeNr; i++) { + valuePush(ctxt, + xmlXPathNewNodeSet(obj->nodesetval->nodeTab[i])); + xmlXPathStringFunction(ctxt, 1); + if (nargs == 2) { + valuePush(ctxt, xmlXPathObjectCopy(obj2)); + } else { + valuePush(ctxt, + xmlXPathNewNodeSet(obj->nodesetval-> + nodeTab[i])); + } + xsltDocumentFunction(ctxt, 2); + newobj = valuePop(ctxt); + ret->nodesetval = xmlXPathNodeSetMerge(ret->nodesetval, + newobj->nodesetval); + xmlXPathFreeObject(newobj); + } + } + + if (obj != NULL) + xmlXPathFreeObject(obj); + if (obj2 != NULL) + xmlXPathFreeObject(obj2); + valuePush(ctxt, ret); + return; + } + /* + * Make sure it's converted to a string + */ + xmlXPathStringFunction(ctxt, 1); + if (ctxt->value->type != XPATH_STRING) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "document() : invalid arg expecting a string\n"); + ctxt->error = XPATH_INVALID_TYPE; + if (obj2 != NULL) + xmlXPathFreeObject(obj2); + return; + } + obj = valuePop(ctxt); + if (obj->stringval == NULL) { + valuePush(ctxt, xmlXPathNewNodeSet(NULL)); + } else { + xsltTransformContextPtr tctxt; + tctxt = xsltXPathGetTransformContext(ctxt); + if ((obj2 != NULL) && (obj2->nodesetval != NULL) && + (obj2->nodesetval->nodeNr > 0) && + IS_XSLT_REAL_NODE(obj2->nodesetval->nodeTab[0])) { + xmlNodePtr target; + + target = obj2->nodesetval->nodeTab[0]; + if ((target->type == XML_ATTRIBUTE_NODE) || + (target->type == XML_PI_NODE)) { + target = ((xmlAttrPtr) target)->parent; + } + base = xmlNodeGetBase(target->doc, target); + } else { + if ((tctxt != NULL) && (tctxt->inst != NULL)) { + base = xmlNodeGetBase(tctxt->inst->doc, tctxt->inst); + } else if ((tctxt != NULL) && (tctxt->style != NULL) && + (tctxt->style->doc != NULL)) { + base = xmlNodeGetBase(tctxt->style->doc, + (xmlNodePtr) tctxt->style->doc); + } + } + URI = xmlBuildURI(obj->stringval, base); + if (base != NULL) + xmlFree(base); + if (URI == NULL) { + if ((tctxt != NULL) && (tctxt->style != NULL) && + (tctxt->style->doc != NULL) && + (xmlStrEqual(URI, tctxt->style->doc->URL))) { + /* This selects the stylesheet's doc itself. */ + valuePush(ctxt, xmlXPathNewNodeSet((xmlNodePtr) tctxt->style->doc)); + } else { + valuePush(ctxt, xmlXPathNewNodeSet(NULL)); + } + } else { + xsltDocumentFunctionLoadDocument( ctxt, URI ); + xmlFree(URI); + } + } + xmlXPathFreeObject(obj); + if (obj2 != NULL) + xmlXPathFreeObject(obj2); +} + +/** + * xsltKeyFunction: + * @ctxt: the XPath Parser context + * @nargs: the number of arguments + * + * Implement the key() XSLT function + * node-set key(string, object) + */ +void +xsltKeyFunction(xmlXPathParserContextPtr ctxt, int nargs){ + xmlXPathObjectPtr obj1, obj2; + + if (nargs != 2) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "key() : expects two arguments\n"); + ctxt->error = XPATH_INVALID_ARITY; + return; + } + + /* + * Get the key's value. + */ + obj2 = valuePop(ctxt); + xmlXPathStringFunction(ctxt, 1); + if ((obj2 == NULL) || + (ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "key() : invalid arg expecting a string\n"); + ctxt->error = XPATH_INVALID_TYPE; + xmlXPathFreeObject(obj2); + + return; + } + /* + * Get the key's name. + */ + obj1 = valuePop(ctxt); + + if ((obj2->type == XPATH_NODESET) || (obj2->type == XPATH_XSLT_TREE)) { + int i; + xmlXPathObjectPtr newobj, ret; + + ret = xmlXPathNewNodeSet(NULL); + + if (obj2->nodesetval != NULL) { + for (i = 0; i < obj2->nodesetval->nodeNr; i++) { + valuePush(ctxt, xmlXPathObjectCopy(obj1)); + valuePush(ctxt, + xmlXPathNewNodeSet(obj2->nodesetval->nodeTab[i])); + xmlXPathStringFunction(ctxt, 1); + xsltKeyFunction(ctxt, 2); + newobj = valuePop(ctxt); + ret->nodesetval = xmlXPathNodeSetMerge(ret->nodesetval, + newobj->nodesetval); + xmlXPathFreeObject(newobj); + } + } + valuePush(ctxt, ret); + } else { + xmlNodeSetPtr nodelist = NULL; + xmlChar *key = NULL, *value; + const xmlChar *keyURI; + xsltTransformContextPtr tctxt; + xmlChar *qname, *prefix; + xmlXPathContextPtr xpctxt = ctxt->context; + xmlNodePtr tmpNode = NULL; + xsltDocumentPtr oldDocInfo; + + tctxt = xsltXPathGetTransformContext(ctxt); + + oldDocInfo = tctxt->document; + + if (xpctxt->node == NULL) { + xsltTransformError(tctxt, NULL, tctxt->inst, + "Internal error in xsltKeyFunction(): " + "The context node is not set on the XPath context.\n"); + tctxt->state = XSLT_STATE_STOPPED; + goto error; + } + /* + * Get the associated namespace URI if qualified name + */ + qname = obj1->stringval; + key = xmlSplitQName2(qname, &prefix); + if (key == NULL) { + key = xmlStrdup(obj1->stringval); + keyURI = NULL; + if (prefix != NULL) + xmlFree(prefix); + } else { + if (prefix != NULL) { + keyURI = xmlXPathNsLookup(xpctxt, prefix); + if (keyURI == NULL) { + xsltTransformError(tctxt, NULL, tctxt->inst, + "key() : prefix %s is not bound\n", prefix); + /* + * TODO: Shouldn't we stop here? + */ + } + xmlFree(prefix); + } else { + keyURI = NULL; + } + } + + /* + * Force conversion of first arg to string + */ + valuePush(ctxt, obj2); + xmlXPathStringFunction(ctxt, 1); + if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) { + xsltTransformError(tctxt, NULL, tctxt->inst, + "key() : invalid arg expecting a string\n"); + ctxt->error = XPATH_INVALID_TYPE; + goto error; + } + obj2 = valuePop(ctxt); + value = obj2->stringval; + + /* + * We need to ensure that ctxt->document is available for + * xsltGetKey(). + * First find the relevant doc, which is the context node's + * owner doc; using context->doc is not safe, since + * the doc could have been acquired via the document() function, + * or the doc might be a Result Tree Fragment. + * FUTURE INFO: In XSLT 2.0 the key() function takes an additional + * argument indicating the doc to use. + */ + if (xpctxt->node->type == XML_NAMESPACE_DECL) { + /* + * REVISIT: This is a libxml hack! Check xpath.c for details. + * The XPath module sets the owner element of a ns-node on + * the ns->next field. + */ + if ((((xmlNsPtr) xpctxt->node)->next != NULL) && + (((xmlNsPtr) xpctxt->node)->next->type == XML_ELEMENT_NODE)) + { + tmpNode = (xmlNodePtr) ((xmlNsPtr) xpctxt->node)->next; + } + } else + tmpNode = xpctxt->node; + + if ((tmpNode == NULL) || (tmpNode->doc == NULL)) { + xsltTransformError(tctxt, NULL, tctxt->inst, + "Internal error in xsltKeyFunction(): " + "Couldn't get the doc of the XPath context node.\n"); + goto error; + } + + if ((tctxt->document == NULL) || + (tctxt->document->doc != tmpNode->doc)) + { + if (tmpNode->doc->name && (tmpNode->doc->name[0] == ' ')) { + /* + * This is a Result Tree Fragment. + */ + if (tmpNode->doc->_private == NULL) { + tmpNode->doc->_private = xsltNewDocument(tctxt, tmpNode->doc); + if (tmpNode->doc->_private == NULL) + goto error; + } + tctxt->document = (xsltDocumentPtr) tmpNode->doc->_private; + } else { + /* + * May be the initial source doc or a doc acquired via the + * document() function. + */ + tctxt->document = xsltFindDocument(tctxt, tmpNode->doc); + } + if (tctxt->document == NULL) { + xsltTransformError(tctxt, NULL, tctxt->inst, + "Internal error in xsltKeyFunction(): " + "Could not get the document info of a context doc.\n"); + tctxt->state = XSLT_STATE_STOPPED; + goto error; + } + } + /* + * Get/compute the key value. + */ + nodelist = xsltGetKey(tctxt, key, keyURI, value); + +error: + tctxt->document = oldDocInfo; + valuePush(ctxt, xmlXPathWrapNodeSet( + xmlXPathNodeSetMerge(NULL, nodelist))); + if (key != NULL) + xmlFree(key); + } + + if (obj1 != NULL) + xmlXPathFreeObject(obj1); + if (obj2 != NULL) + xmlXPathFreeObject(obj2); +} + +/** + * xsltUnparsedEntityURIFunction: + * @ctxt: the XPath Parser context + * @nargs: the number of arguments + * + * Implement the unparsed-entity-uri() XSLT function + * string unparsed-entity-uri(string) + */ +void +xsltUnparsedEntityURIFunction(xmlXPathParserContextPtr ctxt, int nargs){ + xmlXPathObjectPtr obj; + xmlChar *str; + + if ((nargs != 1) || (ctxt->value == NULL)) { + xsltGenericError(xsltGenericErrorContext, + "unparsed-entity-uri() : expects one string arg\n"); + ctxt->error = XPATH_INVALID_ARITY; + return; + } + obj = valuePop(ctxt); + if (obj->type != XPATH_STRING) { + obj = xmlXPathConvertString(obj); + } + + str = obj->stringval; + if (str == NULL) { + valuePush(ctxt, xmlXPathNewString((const xmlChar *)"")); + } else { + xmlEntityPtr entity; + + entity = xmlGetDocEntity(ctxt->context->doc, str); + if (entity == NULL) { + valuePush(ctxt, xmlXPathNewString((const xmlChar *)"")); + } else { + if (entity->URI != NULL) + valuePush(ctxt, xmlXPathNewString(entity->URI)); + else + valuePush(ctxt, xmlXPathNewString((const xmlChar *)"")); + } + } + xmlXPathFreeObject(obj); +} + +/** + * xsltFormatNumberFunction: + * @ctxt: the XPath Parser context + * @nargs: the number of arguments + * + * Implement the format-number() XSLT function + * string format-number(number, string, string?) + */ +void +xsltFormatNumberFunction(xmlXPathParserContextPtr ctxt, int nargs) +{ + xmlXPathObjectPtr numberObj = NULL; + xmlXPathObjectPtr formatObj = NULL; + xmlXPathObjectPtr decimalObj = NULL; + xsltStylesheetPtr sheet; + xsltDecimalFormatPtr formatValues; + xmlChar *result; + xsltTransformContextPtr tctxt; + + tctxt = xsltXPathGetTransformContext(ctxt); + if (tctxt == NULL) + return; + sheet = tctxt->style; + if (sheet == NULL) + return; + formatValues = sheet->decimalFormat; + + switch (nargs) { + case 3: + CAST_TO_STRING; + decimalObj = valuePop(ctxt); + formatValues = xsltDecimalFormatGetByName(sheet, decimalObj->stringval); + if (formatValues == NULL) { + xsltTransformError(tctxt, NULL, NULL, + "format-number() : undeclared decimal format '%s'\n", + decimalObj->stringval); + } + /* Intentional fall-through */ + case 2: + CAST_TO_STRING; + formatObj = valuePop(ctxt); + CAST_TO_NUMBER; + numberObj = valuePop(ctxt); + break; + default: + XP_ERROR(XPATH_INVALID_ARITY); + } + + if (formatValues != NULL) { + if (xsltFormatNumberConversion(formatValues, + formatObj->stringval, + numberObj->floatval, + &result) == XPATH_EXPRESSION_OK) { + valuePush(ctxt, xmlXPathNewString(result)); + xmlFree(result); + } + } + + xmlXPathFreeObject(numberObj); + xmlXPathFreeObject(formatObj); + xmlXPathFreeObject(decimalObj); +} + +/** + * xsltGenerateIdFunction: + * @ctxt: the XPath Parser context + * @nargs: the number of arguments + * + * Implement the generate-id() XSLT function + * string generate-id(node-set?) + */ +void +xsltGenerateIdFunction(xmlXPathParserContextPtr ctxt, int nargs){ + static char base_address; + xmlNodePtr cur = NULL; + xmlXPathObjectPtr obj = NULL; + long val; + xmlChar str[30]; + + if (nargs == 0) { + cur = ctxt->context->node; + } else if (nargs == 1) { + xmlNodeSetPtr nodelist; + int i, ret; + + if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_NODESET)) { + ctxt->error = XPATH_INVALID_TYPE; + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "generate-id() : invalid arg expecting a node-set\n"); + return; + } + obj = valuePop(ctxt); + nodelist = obj->nodesetval; + if ((nodelist == NULL) || (nodelist->nodeNr <= 0)) { + xmlXPathFreeObject(obj); + valuePush(ctxt, xmlXPathNewCString("")); + return; + } + cur = nodelist->nodeTab[0]; + for (i = 1;i < nodelist->nodeNr;i++) { + ret = xmlXPathCmpNodes(cur, nodelist->nodeTab[i]); + if (ret == -1) + cur = nodelist->nodeTab[i]; + } + } else { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "generate-id() : invalid number of args %d\n", nargs); + ctxt->error = XPATH_INVALID_ARITY; + return; + } + + if (obj) + xmlXPathFreeObject(obj); + + val = (long)((char *)cur - (char *)&base_address); + if (val >= 0) { + snprintf((char *)str, sizeof(str), "idp%ld", val); + } else { + snprintf((char *)str, sizeof(str), "idm%ld", -val); + } + valuePush(ctxt, xmlXPathNewString(str)); +} + +/** + * xsltSystemPropertyFunction: + * @ctxt: the XPath Parser context + * @nargs: the number of arguments + * + * Implement the system-property() XSLT function + * object system-property(string) + */ +void +xsltSystemPropertyFunction(xmlXPathParserContextPtr ctxt, int nargs){ + xmlXPathObjectPtr obj; + xmlChar *prefix, *name; + const xmlChar *nsURI = NULL; + + if (nargs != 1) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "system-property() : expects one string arg\n"); + ctxt->error = XPATH_INVALID_ARITY; + return; + } + if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "system-property() : invalid arg expecting a string\n"); + ctxt->error = XPATH_INVALID_TYPE; + return; + } + obj = valuePop(ctxt); + if (obj->stringval == NULL) { + valuePush(ctxt, xmlXPathNewString((const xmlChar *)"")); + } else { + name = xmlSplitQName2(obj->stringval, &prefix); + if (name == NULL) { + name = xmlStrdup(obj->stringval); + } else { + nsURI = xmlXPathNsLookup(ctxt->context, prefix); + if (nsURI == NULL) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "system-property() : prefix %s is not bound\n", prefix); + } + } + + if (xmlStrEqual(nsURI, XSLT_NAMESPACE)) { +#ifdef DOCBOOK_XSL_HACK + if (xmlStrEqual(name, (const xmlChar *)"vendor")) { + xsltStylesheetPtr sheet; + xsltTransformContextPtr tctxt; + + tctxt = xsltXPathGetTransformContext(ctxt); + if ((tctxt != NULL) && (tctxt->inst != NULL) && + (xmlStrEqual(tctxt->inst->name, BAD_CAST "variable")) && + (tctxt->inst->parent != NULL) && + (xmlStrEqual(tctxt->inst->parent->name, + BAD_CAST "template"))) + sheet = tctxt->style; + else + sheet = NULL; + if ((sheet != NULL) && (sheet->doc != NULL) && + (sheet->doc->URL != NULL) && + (xmlStrstr(sheet->doc->URL, + (const xmlChar *)"chunk") != NULL)) { + valuePush(ctxt, xmlXPathNewString( + (const xmlChar *)"libxslt (SAXON 6.2 compatible)")); + + } else { + valuePush(ctxt, xmlXPathNewString( + (const xmlChar *)XSLT_DEFAULT_VENDOR)); + } + } else +#else + if (xmlStrEqual(name, (const xmlChar *)"vendor")) { + valuePush(ctxt, xmlXPathNewString( + (const xmlChar *)XSLT_DEFAULT_VENDOR)); + } else +#endif + if (xmlStrEqual(name, (const xmlChar *)"version")) { + valuePush(ctxt, xmlXPathNewString( + (const xmlChar *)XSLT_DEFAULT_VERSION)); + } else if (xmlStrEqual(name, (const xmlChar *)"vendor-url")) { + valuePush(ctxt, xmlXPathNewString( + (const xmlChar *)XSLT_DEFAULT_URL)); + } else { + valuePush(ctxt, xmlXPathNewString((const xmlChar *)"")); + } + } else { + valuePush(ctxt, xmlXPathNewString((const xmlChar *)"")); + } + if (name != NULL) + xmlFree(name); + if (prefix != NULL) + xmlFree(prefix); + } + xmlXPathFreeObject(obj); +} + +/** + * xsltElementAvailableFunction: + * @ctxt: the XPath Parser context + * @nargs: the number of arguments + * + * Implement the element-available() XSLT function + * boolean element-available(string) + */ +void +xsltElementAvailableFunction(xmlXPathParserContextPtr ctxt, int nargs){ + xmlXPathObjectPtr obj; + xmlChar *prefix, *name; + const xmlChar *nsURI = NULL; + xsltTransformContextPtr tctxt; + + if (nargs != 1) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "element-available() : expects one string arg\n"); + ctxt->error = XPATH_INVALID_ARITY; + return; + } + xmlXPathStringFunction(ctxt, 1); + if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "element-available() : invalid arg expecting a string\n"); + ctxt->error = XPATH_INVALID_TYPE; + return; + } + obj = valuePop(ctxt); + tctxt = xsltXPathGetTransformContext(ctxt); + if (tctxt == NULL) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "element-available() : internal error tctxt == NULL\n"); + xmlXPathFreeObject(obj); + valuePush(ctxt, xmlXPathNewBoolean(0)); + return; + } + + + name = xmlSplitQName2(obj->stringval, &prefix); + if (name == NULL) { + xmlNsPtr ns; + + name = xmlStrdup(obj->stringval); + ns = xmlSearchNs(tctxt->inst->doc, tctxt->inst, NULL); + if (ns != NULL) nsURI = xmlStrdup(ns->href); + } else { + nsURI = xmlXPathNsLookup(ctxt->context, prefix); + if (nsURI == NULL) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "element-available() : prefix %s is not bound\n", prefix); + } + } + + if (xsltExtElementLookup(tctxt, name, nsURI) != NULL) { + valuePush(ctxt, xmlXPathNewBoolean(1)); + } else { + valuePush(ctxt, xmlXPathNewBoolean(0)); + } + + xmlXPathFreeObject(obj); + if (name != NULL) + xmlFree(name); + if (prefix != NULL) + xmlFree(prefix); +} + +/** + * xsltFunctionAvailableFunction: + * @ctxt: the XPath Parser context + * @nargs: the number of arguments + * + * Implement the function-available() XSLT function + * boolean function-available(string) + */ +void +xsltFunctionAvailableFunction(xmlXPathParserContextPtr ctxt, int nargs){ + xmlXPathObjectPtr obj; + xmlChar *prefix, *name; + const xmlChar *nsURI = NULL; + + if (nargs != 1) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "function-available() : expects one string arg\n"); + ctxt->error = XPATH_INVALID_ARITY; + return; + } + xmlXPathStringFunction(ctxt, 1); + if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "function-available() : invalid arg expecting a string\n"); + ctxt->error = XPATH_INVALID_TYPE; + return; + } + obj = valuePop(ctxt); + + name = xmlSplitQName2(obj->stringval, &prefix); + if (name == NULL) { + name = xmlStrdup(obj->stringval); + } else { + nsURI = xmlXPathNsLookup(ctxt->context, prefix); + if (nsURI == NULL) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "function-available() : prefix %s is not bound\n", prefix); + } + } + + if (xmlXPathFunctionLookupNS(ctxt->context, name, nsURI) != NULL) { + valuePush(ctxt, xmlXPathNewBoolean(1)); + } else { + valuePush(ctxt, xmlXPathNewBoolean(0)); + } + + xmlXPathFreeObject(obj); + if (name != NULL) + xmlFree(name); + if (prefix != NULL) + xmlFree(prefix); +} + +/** + * xsltCurrentFunction: + * @ctxt: the XPath Parser context + * @nargs: the number of arguments + * + * Implement the current() XSLT function + * node-set current() + */ +static void +xsltCurrentFunction(xmlXPathParserContextPtr ctxt, int nargs){ + xsltTransformContextPtr tctxt; + + if (nargs != 0) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "current() : function uses no argument\n"); + ctxt->error = XPATH_INVALID_ARITY; + return; + } + tctxt = xsltXPathGetTransformContext(ctxt); + if (tctxt == NULL) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "current() : internal error tctxt == NULL\n"); + valuePush(ctxt, xmlXPathNewNodeSet(NULL)); + } else { + valuePush(ctxt, xmlXPathNewNodeSet(tctxt->node)); /* current */ + } +} + +/************************************************************************ + * * + * Registration of XSLT and libxslt functions * + * * + ************************************************************************/ + +/** + * xsltRegisterAllFunctions: + * @ctxt: the XPath context + * + * Registers all default XSLT functions in this context + */ +void +xsltRegisterAllFunctions(xmlXPathContextPtr ctxt) +{ + xmlXPathRegisterFunc(ctxt, (const xmlChar *) "current", + xsltCurrentFunction); + xmlXPathRegisterFunc(ctxt, (const xmlChar *) "document", + xsltDocumentFunction); + xmlXPathRegisterFunc(ctxt, (const xmlChar *) "key", xsltKeyFunction); + xmlXPathRegisterFunc(ctxt, (const xmlChar *) "unparsed-entity-uri", + xsltUnparsedEntityURIFunction); + xmlXPathRegisterFunc(ctxt, (const xmlChar *) "format-number", + xsltFormatNumberFunction); + xmlXPathRegisterFunc(ctxt, (const xmlChar *) "generate-id", + xsltGenerateIdFunction); + xmlXPathRegisterFunc(ctxt, (const xmlChar *) "system-property", + xsltSystemPropertyFunction); + xmlXPathRegisterFunc(ctxt, (const xmlChar *) "element-available", + xsltElementAvailableFunction); + xmlXPathRegisterFunc(ctxt, (const xmlChar *) "function-available", + xsltFunctionAvailableFunction); +} diff --git a/libxslt/functions.h b/libxslt/functions.h new file mode 100644 index 0000000..e0e0bf9 --- /dev/null +++ b/libxslt/functions.h @@ -0,0 +1,78 @@ +/* + * Summary: interface for the XSLT functions not from XPath + * Description: a set of extra functions coming from XSLT but not in XPath + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard and Bjorn Reese + */ + +#ifndef __XML_XSLT_FUNCTIONS_H__ +#define __XML_XSLT_FUNCTIONS_H__ + +#include +#include +#include "xsltexports.h" +#include "xsltInternals.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * XSLT_REGISTER_FUNCTION_LOOKUP: + * + * Registering macro, not general purpose at all but used in different modules. + */ +#define XSLT_REGISTER_FUNCTION_LOOKUP(ctxt) \ + xmlXPathRegisterFuncLookup((ctxt)->xpathCtxt, \ + (xmlXPathFuncLookupFunc) xsltXPathFunctionLookup, \ + (void *)(ctxt->xpathCtxt)); + +XSLTPUBFUN xmlXPathFunction XSLTCALL + xsltXPathFunctionLookup (xmlXPathContextPtr ctxt, + const xmlChar *name, + const xmlChar *ns_uri); + +/* + * Interfaces for the functions implementations. + */ + +XSLTPUBFUN void XSLTCALL + xsltDocumentFunction (xmlXPathParserContextPtr ctxt, + int nargs); +XSLTPUBFUN void XSLTCALL + xsltKeyFunction (xmlXPathParserContextPtr ctxt, + int nargs); +XSLTPUBFUN void XSLTCALL + xsltUnparsedEntityURIFunction (xmlXPathParserContextPtr ctxt, + int nargs); +XSLTPUBFUN void XSLTCALL + xsltFormatNumberFunction (xmlXPathParserContextPtr ctxt, + int nargs); +XSLTPUBFUN void XSLTCALL + xsltGenerateIdFunction (xmlXPathParserContextPtr ctxt, + int nargs); +XSLTPUBFUN void XSLTCALL + xsltSystemPropertyFunction (xmlXPathParserContextPtr ctxt, + int nargs); +XSLTPUBFUN void XSLTCALL + xsltElementAvailableFunction (xmlXPathParserContextPtr ctxt, + int nargs); +XSLTPUBFUN void XSLTCALL + xsltFunctionAvailableFunction (xmlXPathParserContextPtr ctxt, + int nargs); + +/* + * And the registration + */ + +XSLTPUBFUN void XSLTCALL + xsltRegisterAllFunctions (xmlXPathContextPtr ctxt); + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XSLT_FUNCTIONS_H__ */ + diff --git a/libxslt/imports.c b/libxslt/imports.c new file mode 100644 index 0000000..7262aab --- /dev/null +++ b/libxslt/imports.c @@ -0,0 +1,414 @@ +/* + * imports.c: Implementation of the XSLT imports + * + * Reference: + * http://www.w3.org/TR/1999/REC-xslt-19991116 + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_MATH_H +#include +#endif +#ifdef HAVE_FLOAT_H +#include +#endif +#ifdef HAVE_IEEEFP_H +#include +#endif +#ifdef HAVE_NAN_H +#include +#endif +#ifdef HAVE_CTYPE_H +#include +#endif + +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "preproc.h" +#include "imports.h" +#include "documents.h" +#include "security.h" +#include "pattern.h" + + +/************************************************************************ + * * + * Module interfaces * + * * + ************************************************************************/ +/** + * xsltFixImportedCompSteps: + * @master: the "master" stylesheet + * @style: the stylesheet being imported by the master + * + * normalize the comp steps for the stylesheet being imported + * by the master, together with any imports within that. + * + */ +static void xsltFixImportedCompSteps(xsltStylesheetPtr master, + xsltStylesheetPtr style) { + xsltStylesheetPtr res; + xmlHashScan(style->templatesHash, + (xmlHashScanner) xsltNormalizeCompSteps, master); + master->extrasNr += style->extrasNr; + for (res = style->imports; res != NULL; res = res->next) { + xsltFixImportedCompSteps(master, res); + } +} + +/** + * xsltParseStylesheetImport: + * @style: the XSLT stylesheet + * @cur: the import element + * + * parse an XSLT stylesheet import element + * + * Returns 0 in case of success -1 in case of failure. + */ + +int +xsltParseStylesheetImport(xsltStylesheetPtr style, xmlNodePtr cur) { + int ret = -1; + xmlDocPtr import = NULL; + xmlChar *base = NULL; + xmlChar *uriRef = NULL; + xmlChar *URI = NULL; + xsltStylesheetPtr res; + xsltSecurityPrefsPtr sec; + + if ((cur == NULL) || (style == NULL)) + return (ret); + + uriRef = xmlGetNsProp(cur, (const xmlChar *)"href", NULL); + if (uriRef == NULL) { + xsltTransformError(NULL, style, cur, + "xsl:import : missing href attribute\n"); + goto error; + } + + base = xmlNodeGetBase(style->doc, cur); + URI = xmlBuildURI(uriRef, base); + if (URI == NULL) { + xsltTransformError(NULL, style, cur, + "xsl:import : invalid URI reference %s\n", uriRef); + goto error; + } + + res = style; + while (res != NULL) { + if (res->doc == NULL) + break; + if (xmlStrEqual(res->doc->URL, URI)) { + xsltTransformError(NULL, style, cur, + "xsl:import : recursion detected on imported URL %s\n", URI); + goto error; + } + res = res->parent; + } + + /* + * Security framework check + */ + sec = xsltGetDefaultSecurityPrefs(); + if (sec != NULL) { + int secres; + + secres = xsltCheckRead(sec, NULL, URI); + if (secres == 0) { + xsltTransformError(NULL, NULL, NULL, + "xsl:import: read rights for %s denied\n", + URI); + goto error; + } + } + + import = xsltDocDefaultLoader(URI, style->dict, XSLT_PARSE_OPTIONS, + (void *) style, XSLT_LOAD_STYLESHEET); + if (import == NULL) { + xsltTransformError(NULL, style, cur, + "xsl:import : unable to load %s\n", URI); + goto error; + } + + res = xsltParseStylesheetImportedDoc(import, style); + if (res != NULL) { + res->next = style->imports; + style->imports = res; + if (style->parent == NULL) { + xsltFixImportedCompSteps(style, res); + } + ret = 0; + } else { + xmlFreeDoc(import); + } + +error: + if (uriRef != NULL) + xmlFree(uriRef); + if (base != NULL) + xmlFree(base); + if (URI != NULL) + xmlFree(URI); + + return (ret); +} + +/** + * xsltParseStylesheetInclude: + * @style: the XSLT stylesheet + * @cur: the include node + * + * parse an XSLT stylesheet include element + * + * Returns 0 in case of success -1 in case of failure + */ + +int +xsltParseStylesheetInclude(xsltStylesheetPtr style, xmlNodePtr cur) { + int ret = -1; + xmlDocPtr oldDoc; + xmlChar *base = NULL; + xmlChar *uriRef = NULL; + xmlChar *URI = NULL; + xsltStylesheetPtr result; + xsltDocumentPtr include; + xsltDocumentPtr docptr; + int oldNopreproc; + + if ((cur == NULL) || (style == NULL)) + return (ret); + + uriRef = xmlGetNsProp(cur, (const xmlChar *)"href", NULL); + if (uriRef == NULL) { + xsltTransformError(NULL, style, cur, + "xsl:include : missing href attribute\n"); + goto error; + } + + base = xmlNodeGetBase(style->doc, cur); + URI = xmlBuildURI(uriRef, base); + if (URI == NULL) { + xsltTransformError(NULL, style, cur, + "xsl:include : invalid URI reference %s\n", uriRef); + goto error; + } + + /* + * in order to detect recursion, we check all previously included + * stylesheets. + */ + docptr = style->includes; + while (docptr != NULL) { + if (xmlStrEqual(docptr->doc->URL, URI)) { + xsltTransformError(NULL, style, cur, + "xsl:include : recursion detected on included URL %s\n", URI); + goto error; + } + docptr = docptr->includes; + } + + include = xsltLoadStyleDocument(style, URI); + if (include == NULL) { + xsltTransformError(NULL, style, cur, + "xsl:include : unable to load %s\n", URI); + goto error; + } +#ifdef XSLT_REFACTORED + if (IS_XSLT_ELEM_FAST(cur) && (cur->psvi != NULL)) { + ((xsltStyleItemIncludePtr) cur->psvi)->include = include; + } else { + xsltTransformError(NULL, style, cur, + "Internal error: (xsltParseStylesheetInclude) " + "The xsl:include element was not compiled.\n", URI); + style->errors++; + } +#endif + oldDoc = style->doc; + style->doc = include->doc; + /* chain to stylesheet for recursion checking */ + include->includes = style->includes; + style->includes = include; + oldNopreproc = style->nopreproc; + style->nopreproc = include->preproc; + /* + * TODO: This will change some values of the + * including stylesheet with every included module + * (e.g. excluded-result-prefixes) + * We need to strictly seperate such stylesheet-owned values. + */ + result = xsltParseStylesheetProcess(style, include->doc); + style->nopreproc = oldNopreproc; + include->preproc = 1; + style->includes = include->includes; + style->doc = oldDoc; + if (result == NULL) { + ret = -1; + goto error; + } + ret = 0; + +error: + if (uriRef != NULL) + xmlFree(uriRef); + if (base != NULL) + xmlFree(base); + if (URI != NULL) + xmlFree(URI); + + return (ret); +} + +/** + * xsltNextImport: + * @cur: the current XSLT stylesheet + * + * Find the next stylesheet in import precedence. + * + * Returns the next stylesheet or NULL if it was the last one + */ + +xsltStylesheetPtr +xsltNextImport(xsltStylesheetPtr cur) { + if (cur == NULL) + return(NULL); + if (cur->imports != NULL) + return(cur->imports); + if (cur->next != NULL) + return(cur->next) ; + do { + cur = cur->parent; + if (cur == NULL) break; + if (cur->next != NULL) return(cur->next); + } while (cur != NULL); + return(cur); +} + +/** + * xsltNeedElemSpaceHandling: + * @ctxt: an XSLT transformation context + * + * Checks whether that stylesheet requires white-space stripping + * + * Returns 1 if space should be stripped, 0 if not + */ + +int +xsltNeedElemSpaceHandling(xsltTransformContextPtr ctxt) { + xsltStylesheetPtr style; + + if (ctxt == NULL) + return(0); + style = ctxt->style; + while (style != NULL) { + if (style->stripSpaces != NULL) + return(1); + style = xsltNextImport(style); + } + return(0); +} + +/** + * xsltFindElemSpaceHandling: + * @ctxt: an XSLT transformation context + * @node: an XML node + * + * Find strip-space or preserve-space informations for an element + * respect the import precedence or the wildcards + * + * Returns 1 if space should be stripped, 0 if not, and 2 if everything + * should be CDTATA wrapped. + */ + +int +xsltFindElemSpaceHandling(xsltTransformContextPtr ctxt, xmlNodePtr node) { + xsltStylesheetPtr style; + const xmlChar *val; + + if ((ctxt == NULL) || (node == NULL)) + return(0); + style = ctxt->style; + while (style != NULL) { + if (node->ns != NULL) { + val = (const xmlChar *) + xmlHashLookup2(style->stripSpaces, node->name, node->ns->href); + if (val == NULL) { + val = (const xmlChar *) + xmlHashLookup2(style->stripSpaces, BAD_CAST "*", + node->ns->href); + } + } else { + val = (const xmlChar *) + xmlHashLookup2(style->stripSpaces, node->name, NULL); + } + if (val != NULL) { + if (xmlStrEqual(val, (xmlChar *) "strip")) + return(1); + if (xmlStrEqual(val, (xmlChar *) "preserve")) + return(0); + } + if (style->stripAll == 1) + return(1); + if (style->stripAll == -1) + return(0); + + style = xsltNextImport(style); + } + return(0); +} + +/** + * xsltFindTemplate: + * @ctxt: an XSLT transformation context + * @name: the template name + * @nameURI: the template name URI + * + * Finds the named template, apply import precedence rule. + * REVISIT TODO: We'll change the nameURI fields of + * templates to be in the string dict, so if the + * specified @nameURI is in the same dict, then use pointer + * comparison. Check if this can be done in a sane way. + * Maybe this function is not needed internally at + * transformation-time if we hard-wire the called templates + * to the caller. + * + * Returns the xsltTemplatePtr or NULL if not found + */ +xsltTemplatePtr +xsltFindTemplate(xsltTransformContextPtr ctxt, const xmlChar *name, + const xmlChar *nameURI) { + xsltTemplatePtr cur; + xsltStylesheetPtr style; + + if ((ctxt == NULL) || (name == NULL)) + return(NULL); + style = ctxt->style; + while (style != NULL) { + if (style->namedTemplates != NULL) { + cur = (xsltTemplatePtr) + xmlHashLookup2(style->namedTemplates, name, nameURI); + if (cur != NULL) + return(cur); + } + + style = xsltNextImport(style); + } + return(NULL); +} + diff --git a/libxslt/imports.h b/libxslt/imports.h new file mode 100644 index 0000000..95e44e5 --- /dev/null +++ b/libxslt/imports.h @@ -0,0 +1,75 @@ +/* + * Summary: interface for the XSLT import support + * Description: macros and fuctions needed to implement and + * access the import tree + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XSLT_IMPORTS_H__ +#define __XML_XSLT_IMPORTS_H__ + +#include +#include "xsltexports.h" +#include "xsltInternals.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * XSLT_GET_IMPORT_PTR: + * + * A macro to import pointers from the stylesheet cascading order. + */ +#define XSLT_GET_IMPORT_PTR(res, style, name) { \ + xsltStylesheetPtr st = style; \ + res = NULL; \ + while (st != NULL) { \ + if (st->name != NULL) { res = st->name; break; } \ + st = xsltNextImport(st); \ + }} + +/** + * XSLT_GET_IMPORT_INT: + * + * A macro to import intergers from the stylesheet cascading order. + */ +#define XSLT_GET_IMPORT_INT(res, style, name) { \ + xsltStylesheetPtr st = style; \ + res = -1; \ + while (st != NULL) { \ + if (st->name != -1) { res = st->name; break; } \ + st = xsltNextImport(st); \ + }} + +/* + * Module interfaces + */ +XSLTPUBFUN int XSLTCALL + xsltParseStylesheetImport(xsltStylesheetPtr style, + xmlNodePtr cur); +XSLTPUBFUN int XSLTCALL + xsltParseStylesheetInclude + (xsltStylesheetPtr style, + xmlNodePtr cur); +XSLTPUBFUN xsltStylesheetPtr XSLTCALL + xsltNextImport (xsltStylesheetPtr style); +XSLTPUBFUN int XSLTCALL + xsltNeedElemSpaceHandling(xsltTransformContextPtr ctxt); +XSLTPUBFUN int XSLTCALL + xsltFindElemSpaceHandling(xsltTransformContextPtr ctxt, + xmlNodePtr node); +XSLTPUBFUN xsltTemplatePtr XSLTCALL + xsltFindTemplate (xsltTransformContextPtr ctxt, + const xmlChar *name, + const xmlChar *nameURI); + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XSLT_IMPORTS_H__ */ + diff --git a/libxslt/keys.c b/libxslt/keys.c new file mode 100644 index 0000000..43a343e --- /dev/null +++ b/libxslt/keys.c @@ -0,0 +1,935 @@ +/* + * keys.c: Implemetation of the keys support + * + * Reference: + * http://www.w3.org/TR/1999/REC-xslt-19991116 + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "imports.h" +#include "templates.h" +#include "keys.h" + +#ifdef WITH_XSLT_DEBUG +#define WITH_XSLT_DEBUG_KEYS +#endif + +static int +xsltInitDocKeyTable(xsltTransformContextPtr ctxt, const xmlChar *name, + const xmlChar *nameURI); + +/************************************************************************ + * * + * Type functions * + * * + ************************************************************************/ + +/** + * xsltNewKeyDef: + * @name: the key name or NULL + * @nameURI: the name URI or NULL + * + * Create a new XSLT KeyDef + * + * Returns the newly allocated xsltKeyDefPtr or NULL in case of error + */ +static xsltKeyDefPtr +xsltNewKeyDef(const xmlChar *name, const xmlChar *nameURI) { + xsltKeyDefPtr cur; + + cur = (xsltKeyDefPtr) xmlMalloc(sizeof(xsltKeyDef)); + if (cur == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltNewKeyDef : malloc failed\n"); + return(NULL); + } + memset(cur, 0, sizeof(xsltKeyDef)); + if (name != NULL) + cur->name = xmlStrdup(name); + if (nameURI != NULL) + cur->nameURI = xmlStrdup(nameURI); + cur->nsList = NULL; + return(cur); +} + +/** + * xsltFreeKeyDef: + * @keyd: an XSLT key definition + * + * Free up the memory allocated by @keyd + */ +static void +xsltFreeKeyDef(xsltKeyDefPtr keyd) { + if (keyd == NULL) + return; + if (keyd->comp != NULL) + xmlXPathFreeCompExpr(keyd->comp); + if (keyd->usecomp != NULL) + xmlXPathFreeCompExpr(keyd->usecomp); + if (keyd->name != NULL) + xmlFree(keyd->name); + if (keyd->nameURI != NULL) + xmlFree(keyd->nameURI); + if (keyd->match != NULL) + xmlFree(keyd->match); + if (keyd->use != NULL) + xmlFree(keyd->use); + if (keyd->nsList != NULL) + xmlFree(keyd->nsList); + memset(keyd, -1, sizeof(xsltKeyDef)); + xmlFree(keyd); +} + +/** + * xsltFreeKeyDefList: + * @keyd: an XSLT key definition list + * + * Free up the memory allocated by all the elements of @keyd + */ +static void +xsltFreeKeyDefList(xsltKeyDefPtr keyd) { + xsltKeyDefPtr cur; + + while (keyd != NULL) { + cur = keyd; + keyd = keyd->next; + xsltFreeKeyDef(cur); + } +} + +/** + * xsltNewKeyTable: + * @name: the key name or NULL + * @nameURI: the name URI or NULL + * + * Create a new XSLT KeyTable + * + * Returns the newly allocated xsltKeyTablePtr or NULL in case of error + */ +static xsltKeyTablePtr +xsltNewKeyTable(const xmlChar *name, const xmlChar *nameURI) { + xsltKeyTablePtr cur; + + cur = (xsltKeyTablePtr) xmlMalloc(sizeof(xsltKeyTable)); + if (cur == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltNewKeyTable : malloc failed\n"); + return(NULL); + } + memset(cur, 0, sizeof(xsltKeyTable)); + if (name != NULL) + cur->name = xmlStrdup(name); + if (nameURI != NULL) + cur->nameURI = xmlStrdup(nameURI); + cur->keys = xmlHashCreate(0); + return(cur); +} + +/** + * xsltFreeKeyTable: + * @keyt: an XSLT key table + * + * Free up the memory allocated by @keyt + */ +static void +xsltFreeKeyTable(xsltKeyTablePtr keyt) { + if (keyt == NULL) + return; + if (keyt->name != NULL) + xmlFree(keyt->name); + if (keyt->nameURI != NULL) + xmlFree(keyt->nameURI); + if (keyt->keys != NULL) + xmlHashFree(keyt->keys, + (xmlHashDeallocator) xmlXPathFreeNodeSet); + memset(keyt, -1, sizeof(xsltKeyTable)); + xmlFree(keyt); +} + +/** + * xsltFreeKeyTableList: + * @keyt: an XSLT key table list + * + * Free up the memory allocated by all the elements of @keyt + */ +static void +xsltFreeKeyTableList(xsltKeyTablePtr keyt) { + xsltKeyTablePtr cur; + + while (keyt != NULL) { + cur = keyt; + keyt = keyt->next; + xsltFreeKeyTable(cur); + } +} + +/************************************************************************ + * * + * The interpreter for the precompiled patterns * + * * + ************************************************************************/ + + +/** + * xsltFreeKeys: + * @style: an XSLT stylesheet + * + * Free up the memory used by XSLT keys in a stylesheet + */ +void +xsltFreeKeys(xsltStylesheetPtr style) { + if (style->keys) + xsltFreeKeyDefList((xsltKeyDefPtr) style->keys); +} + +/** + * skipString: + * @cur: the current pointer + * @end: the current offset + * + * skip a string delimited by " or ' + * + * Returns the byte after the string or -1 in case of error + */ +static int +skipString(const xmlChar *cur, int end) { + xmlChar limit; + + if ((cur == NULL) || (end < 0)) return(-1); + if ((cur[end] == '\'') || (cur[end] == '"')) limit = cur[end]; + else return(end); + end++; + while (cur[end] != 0) { + if (cur[end] == limit) + return(end + 1); + end++; + } + return(-1); +} + +/** + * skipPredicate: + * @cur: the current pointer + * @end: the current offset + * + * skip a predicate + * + * Returns the byte after the predicate or -1 in case of error + */ +static int +skipPredicate(const xmlChar *cur, int end) { + if ((cur == NULL) || (end < 0)) return(-1); + if (cur[end] != '[') return(end); + end++; + while (cur[end] != 0) { + if ((cur[end] == '\'') || (cur[end] == '"')) { + end = skipString(cur, end); + if (end <= 0) + return(-1); + continue; + } else if (cur[end] == '[') { + end = skipPredicate(cur, end); + if (end <= 0) + return(-1); + continue; + } else if (cur[end] == ']') + return(end + 1); + end++; + } + return(-1); +} + +/** + * xsltAddKey: + * @style: an XSLT stylesheet + * @name: the key name or NULL + * @nameURI: the name URI or NULL + * @match: the match value + * @use: the use value + * @inst: the key instruction + * + * add a key definition to a stylesheet + * + * Returns 0 in case of success, and -1 in case of failure. + */ +int +xsltAddKey(xsltStylesheetPtr style, const xmlChar *name, + const xmlChar *nameURI, const xmlChar *match, + const xmlChar *use, xmlNodePtr inst) { + xsltKeyDefPtr key; + xmlChar *pattern = NULL; + int current, end, start, i = 0; + + if ((style == NULL) || (name == NULL) || (match == NULL) || (use == NULL)) + return(-1); + +#ifdef WITH_XSLT_DEBUG_KEYS + xsltGenericDebug(xsltGenericDebugContext, + "Add key %s, match %s, use %s\n", name, match, use); +#endif + + key = xsltNewKeyDef(name, nameURI); + key->match = xmlStrdup(match); + key->use = xmlStrdup(use); + key->inst = inst; + key->nsList = xmlGetNsList(inst->doc, inst); + if (key->nsList != NULL) { + while (key->nsList[i] != NULL) + i++; + } + key->nsNr = i; + + /* + * Split the | and register it as as many keys + */ + current = end = 0; + while (match[current] != 0) { + start = current; + while (IS_BLANK_CH(match[current])) + current++; + end = current; + while ((match[end] != 0) && (match[end] != '|')) { + if (match[end] == '[') { + end = skipPredicate(match, end); + if (end <= 0) { + xsltTransformError(NULL, style, inst, + "xsl:key : 'match' pattern is malformed: %s", + key->match); + if (style != NULL) style->errors++; + goto error; + } + } else + end++; + } + if (current == end) { + xsltTransformError(NULL, style, inst, + "xsl:key : 'match' pattern is empty\n"); + if (style != NULL) style->errors++; + goto error; + } + if (match[start] != '/') { + pattern = xmlStrcat(pattern, (xmlChar *)"//"); + if (pattern == NULL) { + if (style != NULL) style->errors++; + goto error; + } + } + pattern = xmlStrncat(pattern, &match[start], end - start); + if (pattern == NULL) { + if (style != NULL) style->errors++; + goto error; + } + + if (match[end] == '|') { + pattern = xmlStrcat(pattern, (xmlChar *)"|"); + end++; + } + current = end; + } + if (pattern == NULL) { + xsltTransformError(NULL, style, inst, + "xsl:key : 'match' pattern is empty\n"); + if (style != NULL) style->errors++; + goto error; + } +#ifdef WITH_XSLT_DEBUG_KEYS + xsltGenericDebug(xsltGenericDebugContext, + " resulting pattern %s\n", pattern); +#endif + /* + * XSLT-1: "It is an error for the value of either the use + * attribute or the match attribute to contain a + * VariableReference." + * TODO: We should report a variable-reference at compile-time. + * Maybe a search for "$", if it occurs outside of quotation + * marks, could be sufficient. + */ +#ifdef XML_XPATH_NOVAR + key->comp = xsltXPathCompileFlags(style, pattern, XML_XPATH_NOVAR); +#else + key->comp = xsltXPathCompile(style, pattern); +#endif + if (key->comp == NULL) { + xsltTransformError(NULL, style, inst, + "xsl:key : 'match' pattern compilation failed '%s'\n", + pattern); + if (style != NULL) style->errors++; + } +#ifdef XML_XPATH_NOVAR + key->usecomp = xsltXPathCompileFlags(style, use, XML_XPATH_NOVAR); +#else + key->usecomp = xsltXPathCompile(style, use); +#endif + if (key->usecomp == NULL) { + xsltTransformError(NULL, style, inst, + "xsl:key : 'use' expression compilation failed '%s'\n", + use); + if (style != NULL) style->errors++; + } + + /* + * Sometimes the stylesheet writer use the order to ease the + * resolution of keys when they are dependant, keep the provided + * order so add the new one at the end. + */ + if (style->keys == NULL) { + style->keys = key; + } else { + xsltKeyDefPtr prev = style->keys; + + while (prev->next != NULL) + prev = prev->next; + + prev->next = key; + } + key->next = NULL; + +error: + if (pattern != NULL) + xmlFree(pattern); + return(0); +} + +/** + * xsltGetKey: + * @ctxt: an XSLT transformation context + * @name: the key name or NULL + * @nameURI: the name URI or NULL + * @value: the key value to look for + * + * Looks up a key of the in current source doc (the document info + * on @ctxt->document). Computes the key if not already done + * for the current source doc. + * + * Returns the nodeset resulting from the query or NULL + */ +xmlNodeSetPtr +xsltGetKey(xsltTransformContextPtr ctxt, const xmlChar *name, + const xmlChar *nameURI, const xmlChar *value) { + xmlNodeSetPtr ret; + xsltKeyTablePtr table; + int init_table = 0; + + if ((ctxt == NULL) || (name == NULL) || (value == NULL) || + (ctxt->document == NULL)) + return(NULL); + +#ifdef WITH_XSLT_DEBUG_KEYS + xsltGenericDebug(xsltGenericDebugContext, + "Get key %s, value %s\n", name, value); +#endif + + /* + * keys are computed only on-demand on first key access for a document + */ + if ((ctxt->document->nbKeysComputed < ctxt->nbKeys) && + (ctxt->keyInitLevel == 0)) { + /* + * If non-recursive behaviour, just try to initialize all keys + */ + if (xsltInitAllDocKeys(ctxt)) + return(NULL); + } + +retry: + table = (xsltKeyTablePtr) ctxt->document->keys; + while (table != NULL) { + if (((nameURI != NULL) == (table->nameURI != NULL)) && + xmlStrEqual(table->name, name) && + xmlStrEqual(table->nameURI, nameURI)) + { + ret = (xmlNodeSetPtr)xmlHashLookup(table->keys, value); + return(ret); + } + table = table->next; + } + + if ((ctxt->keyInitLevel != 0) && (init_table == 0)) { + /* + * Apparently one key is recursive and this one is needed, + * initialize just it, that time and retry + */ + xsltInitDocKeyTable(ctxt, name, nameURI); + init_table = 1; + goto retry; + } + + return(NULL); +} + + +/** + * xsltInitDocKeyTable: + * + * INTERNAL ROUTINE ONLY + * + * Check if any keys on the current document need to be computed + */ +static int +xsltInitDocKeyTable(xsltTransformContextPtr ctxt, const xmlChar *name, + const xmlChar *nameURI) +{ + xsltStylesheetPtr style; + xsltKeyDefPtr keyd = NULL; + int found = 0; + +#ifdef KEY_INIT_DEBUG +fprintf(stderr, "xsltInitDocKeyTable %s\n", name); +#endif + + style = ctxt->style; + while (style != NULL) { + keyd = (xsltKeyDefPtr) style->keys; + while (keyd != NULL) { + if (((keyd->nameURI != NULL) == + (nameURI != NULL)) && + xmlStrEqual(keyd->name, name) && + xmlStrEqual(keyd->nameURI, nameURI)) + { + xsltInitCtxtKey(ctxt, ctxt->document, keyd); + if (ctxt->document->nbKeysComputed == ctxt->nbKeys) + return(0); + found = 1; + } + keyd = keyd->next; + } + style = xsltNextImport(style); + } + if (found == 0) { +#ifdef WITH_XSLT_DEBUG_KEYS + XSLT_TRACE(ctxt,XSLT_TRACE_KEYS,xsltGenericDebug(xsltGenericDebugContext, + "xsltInitDocKeyTable: did not found %s\n", name)); +#endif + xsltTransformError(ctxt, NULL, keyd? keyd->inst : NULL, + "Failed to find key definition for %s\n", name); + ctxt->state = XSLT_STATE_STOPPED; + return(-1); + } +#ifdef KEY_INIT_DEBUG +fprintf(stderr, "xsltInitDocKeyTable %s done\n", name); +#endif + return(0); +} + +/** + * xsltInitAllDocKeys: + * @ctxt: transformation context + * + * INTERNAL ROUTINE ONLY + * + * Check if any keys on the current document need to be computed + * + * Returns 0 in case of success, -1 in case of failure + */ +int +xsltInitAllDocKeys(xsltTransformContextPtr ctxt) +{ + xsltStylesheetPtr style; + xsltKeyDefPtr keyd; + xsltKeyTablePtr table; + + if (ctxt == NULL) + return(-1); + +#ifdef KEY_INIT_DEBUG +fprintf(stderr, "xsltInitAllDocKeys %d %d\n", + ctxt->document->nbKeysComputed, ctxt->nbKeys); +#endif + + if (ctxt->document->nbKeysComputed == ctxt->nbKeys) + return(0); + + + /* + * TODO: This could be further optimized + */ + style = ctxt->style; + while (style) { + keyd = (xsltKeyDefPtr) style->keys; + while (keyd != NULL) { +#ifdef KEY_INIT_DEBUG +fprintf(stderr, "Init key %s\n", keyd->name); +#endif + /* + * Check if keys with this QName have been already + * computed. + */ + table = (xsltKeyTablePtr) ctxt->document->keys; + while (table) { + if (((keyd->nameURI != NULL) == (table->nameURI != NULL)) && + xmlStrEqual(keyd->name, table->name) && + xmlStrEqual(keyd->nameURI, table->nameURI)) + { + break; + } + table = table->next; + } + if (table == NULL) { + /* + * Keys with this QName have not been yet computed. + */ + xsltInitDocKeyTable(ctxt, keyd->name, keyd->nameURI); + } + keyd = keyd->next; + } + style = xsltNextImport(style); + } +#ifdef KEY_INIT_DEBUG +fprintf(stderr, "xsltInitAllDocKeys: done\n"); +#endif + return(0); +} + +/** + * xsltInitCtxtKey: + * @ctxt: an XSLT transformation context + * @idoc: the document information (holds key values) + * @keyDef: the key definition + * + * Computes the key tables this key and for the current input document. + * + * Returns: 0 on success, -1 on error + */ +int +xsltInitCtxtKey(xsltTransformContextPtr ctxt, xsltDocumentPtr idoc, + xsltKeyDefPtr keyDef) +{ + int i, len, k; + xmlNodeSetPtr matchList = NULL, keylist; + xmlXPathObjectPtr matchRes = NULL, useRes = NULL; + xmlChar *str = NULL; + xsltKeyTablePtr table; + xmlNodePtr oldInst, cur; + xmlNodePtr oldContextNode; + xsltDocumentPtr oldDocInfo; + int oldXPPos, oldXPSize; + xmlDocPtr oldXPDoc; + int oldXPNsNr; + xmlNsPtr *oldXPNamespaces; + xmlXPathContextPtr xpctxt; + +#ifdef KEY_INIT_DEBUG +fprintf(stderr, "xsltInitCtxtKey %s : %d\n", keyDef->name, ctxt->keyInitLevel); +#endif + + if ((keyDef->comp == NULL) || (keyDef->usecomp == NULL)) + return(-1); + + /* + * Detect recursive keys + */ + if (ctxt->keyInitLevel > ctxt->nbKeys) { +#ifdef WITH_XSLT_DEBUG_KEYS + XSLT_TRACE(ctxt,XSLT_TRACE_KEYS, + xsltGenericDebug(xsltGenericDebugContext, + "xsltInitCtxtKey: key definition of %s is recursive\n", + keyDef->name)); +#endif + xsltTransformError(ctxt, NULL, keyDef->inst, + "Key definition for %s is recursive\n", keyDef->name); + ctxt->state = XSLT_STATE_STOPPED; + return(-1); + } + ctxt->keyInitLevel++; + + xpctxt = ctxt->xpathCtxt; + idoc->nbKeysComputed++; + /* + * Save context state. + */ + oldInst = ctxt->inst; + oldDocInfo = ctxt->document; + oldContextNode = ctxt->node; + + oldXPDoc = xpctxt->doc; + oldXPPos = xpctxt->proximityPosition; + oldXPSize = xpctxt->contextSize; + oldXPNsNr = xpctxt->nsNr; + oldXPNamespaces = xpctxt->namespaces; + + /* + * Set up contexts. + */ + ctxt->document = idoc; + ctxt->node = (xmlNodePtr) idoc->doc; + ctxt->inst = keyDef->inst; + + xpctxt->doc = idoc->doc; + xpctxt->node = (xmlNodePtr) idoc->doc; + /* TODO : clarify the use of namespaces in keys evaluation */ + xpctxt->namespaces = keyDef->nsList; + xpctxt->nsNr = keyDef->nsNr; + + /* + * Evaluate the 'match' expression of the xsl:key. + * TODO: The 'match' is a *pattern*. + */ + matchRes = xmlXPathCompiledEval(keyDef->comp, xpctxt); + if (matchRes == NULL) { + +#ifdef WITH_XSLT_DEBUG_KEYS + XSLT_TRACE(ctxt,XSLT_TRACE_KEYS,xsltGenericDebug(xsltGenericDebugContext, + "xsltInitCtxtKey: %s evaluation failed\n", keyDef->match)); +#endif + xsltTransformError(ctxt, NULL, keyDef->inst, + "Failed to evaluate the 'match' expression.\n"); + ctxt->state = XSLT_STATE_STOPPED; + goto error; + } else { + if (matchRes->type == XPATH_NODESET) { + matchList = matchRes->nodesetval; + +#ifdef WITH_XSLT_DEBUG_KEYS + if (matchList != NULL) + XSLT_TRACE(ctxt,XSLT_TRACE_KEYS,xsltGenericDebug(xsltGenericDebugContext, + "xsltInitCtxtKey: %s evaluates to %d nodes\n", + keyDef->match, matchList->nodeNr)); +#endif + } else { + /* + * Is not a node set, but must be. + */ +#ifdef WITH_XSLT_DEBUG_KEYS + XSLT_TRACE(ctxt,XSLT_TRACE_KEYS,xsltGenericDebug(xsltGenericDebugContext, + "xsltInitCtxtKey: %s is not a node set\n", keyDef->match)); +#endif + xsltTransformError(ctxt, NULL, keyDef->inst, + "The 'match' expression did not evaluate to a node set.\n"); + ctxt->state = XSLT_STATE_STOPPED; + goto error; + } + } + if ((matchList == NULL) || (matchList->nodeNr <= 0)) + goto exit; + + /** + * Multiple key definitions for the same name are allowed, so + * we must check if the key is already present for this doc + */ + table = (xsltKeyTablePtr) idoc->keys; + while (table != NULL) { + if (xmlStrEqual(table->name, keyDef->name) && + (((keyDef->nameURI == NULL) && (table->nameURI == NULL)) || + ((keyDef->nameURI != NULL) && (table->nameURI != NULL) && + (xmlStrEqual(table->nameURI, keyDef->nameURI))))) + break; + table = table->next; + } + /** + * If the key was not previously defined, create it now and + * chain it to the list of keys for the doc + */ + if (table == NULL) { + table = xsltNewKeyTable(keyDef->name, keyDef->nameURI); + if (table == NULL) + goto error; + table->next = idoc->keys; + idoc->keys = table; + } + + /* + * SPEC XSLT 1.0 (XSLT 2.0 does not clarify the context size!) + * "...the use attribute of the xsl:key element is evaluated with x as + " the current node and with a node list containing just x as the + * current node list" + */ + xpctxt->contextSize = 1; + xpctxt->proximityPosition = 1; + + for (i = 0; i < matchList->nodeNr; i++) { + cur = matchList->nodeTab[i]; + if (! IS_XSLT_REAL_NODE(cur)) + continue; + ctxt->node = cur; + xpctxt->node = cur; + /* + * Process the 'use' of the xsl:key. + * SPEC XSLT 1.0: + * "The use attribute is an expression specifying the values of + * the key; the expression is evaluated once for each node that + * matches the pattern." + */ + if (useRes != NULL) + xmlXPathFreeObject(useRes); + useRes = xmlXPathCompiledEval(keyDef->usecomp, xpctxt); + if (useRes == NULL) { + xsltTransformError(ctxt, NULL, keyDef->inst, + "Failed to evaluate the 'use' expression.\n"); + ctxt->state = XSLT_STATE_STOPPED; + break; + } + if (useRes->type == XPATH_NODESET) { + if ((useRes->nodesetval != NULL) && + (useRes->nodesetval->nodeNr != 0)) + { + len = useRes->nodesetval->nodeNr; + str = xmlXPathCastNodeToString(useRes->nodesetval->nodeTab[0]); + } else { + continue; + } + } else { + len = 1; + if (useRes->type == XPATH_STRING) { + /* + * Consume the string value. + */ + str = useRes->stringval; + useRes->stringval = NULL; + } else { + str = xmlXPathCastToString(useRes); + } + } + /* + * Process all strings. + */ + k = 0; + while (1) { + if (str == NULL) + goto next_string; + +#ifdef WITH_XSLT_DEBUG_KEYS + XSLT_TRACE(ctxt,XSLT_TRACE_KEYS,xsltGenericDebug(xsltGenericDebugContext, + "xsl:key : node associated to ('%s', '%s')\n", keyDef->name, str)); +#endif + + keylist = xmlHashLookup(table->keys, str); + if (keylist == NULL) { + keylist = xmlXPathNodeSetCreate(cur); + if (keylist == NULL) + goto error; + xmlHashAddEntry(table->keys, str, keylist); + } else { + /* + * TODO: How do we know if this function failed? + */ + xmlXPathNodeSetAdd(keylist, cur); + } + switch (cur->type) { + case XML_ELEMENT_NODE: + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_PI_NODE: + case XML_COMMENT_NODE: + cur->psvi = keyDef; + break; + case XML_ATTRIBUTE_NODE: + ((xmlAttrPtr) cur)->psvi = keyDef; + break; + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + ((xmlDocPtr) cur)->psvi = keyDef; + break; + default: + break; + } + xmlFree(str); + str = NULL; + +next_string: + k++; + if (k >= len) + break; + str = xmlXPathCastNodeToString(useRes->nodesetval->nodeTab[k]); + } + } + +exit: +error: + ctxt->keyInitLevel--; + /* + * Restore context state. + */ + xpctxt->doc = oldXPDoc; + xpctxt->nsNr = oldXPNsNr; + xpctxt->namespaces = oldXPNamespaces; + xpctxt->proximityPosition = oldXPPos; + xpctxt->contextSize = oldXPSize; + + ctxt->node = oldContextNode; + ctxt->document = oldDocInfo; + ctxt->inst = oldInst; + + if (str) + xmlFree(str); + if (useRes != NULL) + xmlXPathFreeObject(useRes); + if (matchRes != NULL) + xmlXPathFreeObject(matchRes); + return(0); +} + +/** + * xsltInitCtxtKeys: + * @ctxt: an XSLT transformation context + * @idoc: a document info + * + * Computes all the keys tables for the current input document. + * Should be done before global varibales are initialized. + * NOTE: Not used anymore in the refactored code. + */ +void +xsltInitCtxtKeys(xsltTransformContextPtr ctxt, xsltDocumentPtr idoc) { + xsltStylesheetPtr style; + xsltKeyDefPtr keyDef; + + if ((ctxt == NULL) || (idoc == NULL)) + return; + +#ifdef KEY_INIT_DEBUG +fprintf(stderr, "xsltInitCtxtKeys on document\n"); +#endif + +#ifdef WITH_XSLT_DEBUG_KEYS + if ((idoc->doc != NULL) && (idoc->doc->URL != NULL)) + XSLT_TRACE(ctxt,XSLT_TRACE_KEYS,xsltGenericDebug(xsltGenericDebugContext, "Initializing keys on %s\n", + idoc->doc->URL)); +#endif + style = ctxt->style; + while (style != NULL) { + keyDef = (xsltKeyDefPtr) style->keys; + while (keyDef != NULL) { + xsltInitCtxtKey(ctxt, idoc, keyDef); + + keyDef = keyDef->next; + } + + style = xsltNextImport(style); + } + +#ifdef KEY_INIT_DEBUG +fprintf(stderr, "xsltInitCtxtKeys on document: done\n"); +#endif + +} + +/** + * xsltFreeDocumentKeys: + * @idoc: a XSLT document + * + * Free the keys associated to a document + */ +void +xsltFreeDocumentKeys(xsltDocumentPtr idoc) { + if (idoc != NULL) + xsltFreeKeyTableList(idoc->keys); +} + diff --git a/libxslt/keys.h b/libxslt/keys.h new file mode 100644 index 0000000..757d122 --- /dev/null +++ b/libxslt/keys.h @@ -0,0 +1,53 @@ +/* + * Summary: interface for the key matching used in key() and template matches. + * Description: implementation of the key mechanims. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XSLT_KEY_H__ +#define __XML_XSLT_KEY_H__ + +#include +#include "xsltexports.h" +#include "xsltInternals.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * NODE_IS_KEYED: + * + * check for bit 15 set + */ +#define NODE_IS_KEYED (1 >> 15) + +XSLTPUBFUN int XSLTCALL + xsltAddKey (xsltStylesheetPtr style, + const xmlChar *name, + const xmlChar *nameURI, + const xmlChar *match, + const xmlChar *use, + xmlNodePtr inst); +XSLTPUBFUN xmlNodeSetPtr XSLTCALL + xsltGetKey (xsltTransformContextPtr ctxt, + const xmlChar *name, + const xmlChar *nameURI, + const xmlChar *value); +XSLTPUBFUN void XSLTCALL + xsltInitCtxtKeys (xsltTransformContextPtr ctxt, + xsltDocumentPtr doc); +XSLTPUBFUN void XSLTCALL + xsltFreeKeys (xsltStylesheetPtr style); +XSLTPUBFUN void XSLTCALL + xsltFreeDocumentKeys (xsltDocumentPtr doc); + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XSLT_H__ */ + diff --git a/libxslt/libxslt.3 b/libxslt/libxslt.3 new file mode 100644 index 0000000..06f256d --- /dev/null +++ b/libxslt/libxslt.3 @@ -0,0 +1,31 @@ +.TH libxslt 3 "30 August 2001" +.SH NAME +libxslt \- library used to do XSL transformations on XML documents +.SH DESCRIPTION +The +.I libxslt +library is used to do XSL transformations on XML documents that +have been loaded into memory with functions from +.I libxml. +.LP +.SH FILES +.TP 2.2i +.B /usr/lib/libxslt_1.0.0/libxslt.a +static library +.TP +.B /usr/lib/libxslt_1.0.0/libxslt.so +sharable library +.TP +.B /usr/package/libxslt_1.0.0/bin/xsltproc +binary application to do XSL transformations on the command line +.SH AUTHORS +Daniel Veillard (daniel@veillard.com). +If you download and install this package look at instructions on the +Web site http://xmlsoft.org/XSLT/ . +Manual page by Heiko W. Rupp (hwr@pilhuhn.de) +.SH SEE ALSO +.IR libexslt (3), +.IR libxml (3), +.IR xsltproc (1), +.IR xmllint (1) +.\" end of manual page diff --git a/libxslt/libxslt.h b/libxslt/libxslt.h new file mode 100644 index 0000000..e6d4c83 --- /dev/null +++ b/libxslt/libxslt.h @@ -0,0 +1,36 @@ +/* + * Summary: internal header only used during the compilation of libxslt + * Description: internal header only used during the compilation of libxslt + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XSLT_LIBXSLT_H__ +#define __XSLT_LIBXSLT_H__ + +#if defined(WIN32) && !defined (__CYGWIN__) && !defined (__MINGW32__) +#include +#else +#include "config.h" +#endif + +#include +#include + +#if !defined LIBXSLT_PUBLIC +#if (defined (__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBXSLT && !defined LIBXSLT_STATIC +#define LIBXSLT_PUBLIC __declspec(dllimport) +#else +#define LIBXSLT_PUBLIC +#endif +#endif + +#if defined(_MSC_VER) || defined(__MINGW32__) +#include +#include +#define mkdir(p,m) _mkdir(p) +#endif + +#endif /* ! __XSLT_LIBXSLT_H__ */ diff --git a/libxslt/libxslt.syms b/libxslt/libxslt.syms new file mode 100644 index 0000000..3d9b5c6 --- /dev/null +++ b/libxslt/libxslt.syms @@ -0,0 +1,490 @@ +# +# Officially exported symbols, for which header +# file definitions are installed in /usr/include/libxslt +# +# Automatically generated from symbols.xml and syms.xsl +# +# Versions here are *fixed* to match the libxslt version +# at which the symbol was introduced. This ensures that +# a new client app requiring symbol foo() can't accidentally +# run with old libxslt.so not providing foo() - the global +# soname version info can't enforce this since we never +# change the soname +# + +LIBXML2_1.0.11 { + global: + +# attributes + xsltApplyAttributeSet; + xsltFreeAttributeSetsHashes; + xsltParseStylesheetAttributeSet; + +# documents + xsltFindDocument; + xsltFreeDocuments; + xsltFreeStyleDocuments; + xsltLoadDocument; + xsltLoadStyleDocument; + xsltNewDocument; + xsltNewStyleDocument; + +# extensions + xsltCheckExtPrefix; + xsltExtElementLookup; + xsltExtModuleElementLookup; + xsltExtModuleFunctionLookup; + xsltExtModuleTopLevelLookup; + xsltFreeCtxtExts; + xsltFreeExts; + xsltGetExtData; + xsltInitCtxtExts; + xsltInitElemPreComp; + xsltNewElemPreComp; + xsltPreComputeExtModuleElement; + xsltRegisterExtElement; + xsltRegisterExtFunction; + xsltRegisterExtModuleElement; + xsltRegisterExtModuleFull; + xsltRegisterExtModuleFunction; + xsltRegisterExtModule; + xsltRegisterExtModuleTopLevel; + xsltRegisterExtPrefix; + xsltRegisterTestModule; + xsltShutdownCtxtExts; + xsltShutdownExts; + xsltStyleGetExtData; + xsltUnregisterExtModuleElement; + xsltUnregisterExtModuleFunction; + xsltUnregisterExtModule; + xsltUnregisterExtModuleTopLevel; + +# extra + xsltDebug; + xsltFunctionNodeSet; + xsltRegisterAllExtras; + xsltRegisterExtras; + +# functions + xsltDocumentFunction; + xsltElementAvailableFunction; + xsltFormatNumberFunction; + xsltFunctionAvailableFunction; + xsltGenerateIdFunction; + xsltKeyFunction; + xsltRegisterAllFunctions; + xsltSystemPropertyFunction; + xsltUnparsedEntityURIFunction; + xsltXPathFunctionLookup; + +# imports + xsltFindElemSpaceHandling; + xsltFindTemplate; + xsltNeedElemSpaceHandling; + xsltNextImport; + xsltParseStylesheetImport; + xsltParseStylesheetInclude; + +# keys + xsltAddKey; + xsltFreeDocumentKeys; + xsltFreeKeys; + xsltGetKey; + xsltInitCtxtKeys; + +# namespaces + xsltCopyNamespaceList; + xsltCopyNamespace; + xsltFreeNamespaceAliasHashes; + xsltGetNamespace; + xsltGetSpecialNamespace; + xsltNamespaceAlias; + +# pattern + xsltAddTemplate; + xsltCleanupTemplates; + xsltCompilePattern; + xsltFreeCompMatchList; + xsltFreeTemplateHashes; + xsltGetTemplate; + xsltMatchPattern; + xsltTestCompMatchList; + +# preproc + xsltDocumentComp; + xsltFreeStylePreComps; + xsltStylePreCompute; + +# templates + xsltAttrListTemplateProcess; + xsltAttrTemplateProcess; + xsltAttrTemplateValueProcess; + xsltEvalAttrValueTemplate; + xsltEvalStaticAttrValueTemplate; + xsltEvalTemplateString; + xsltEvalXPathPredicate; + xsltEvalXPathString; + xsltTemplateProcess; + +# transform + xslHandleDebugger; + xsltApplyImports; + xsltApplyOneTemplate; + xsltApplyStripSpaces; + xsltApplyStylesheet; + xsltApplyStylesheetUser; + xsltApplyTemplates; + xsltAttribute; + xsltCallTemplate; + xsltChoose; + xsltComment; + xsltCopyOf; + xsltCopy; + xsltDocumentElem; + xsltElement; + xsltForEach; + xsltFreeTransformContext; + xsltGetXIncludeDefault; + xsltIf; + xsltNewTransformContext; + xsltNumber; + xsltProcessingInstruction; + xsltProfileStylesheet; + xsltRegisterAllElement; + xsltRunStylesheet; + xsltSetXIncludeDefault; + xsltSort; + xsltText; + xsltValueOf; + +# variables + xsltAddStackElemList; + xsltEvalGlobalVariables; + xsltEvalOneUserParam; + xsltEvalUserParams; + xsltFreeGlobalVariables; + xsltParseGlobalParam; + xsltParseGlobalVariable; + xsltParseStylesheetCallerParam; + xsltParseStylesheetParam; + xsltParseStylesheetVariable; + xsltQuoteOneUserParam; + xsltQuoteUserParams; + xsltVariableLookup; + xsltXPathVariableLookup; + +# xsltInternals + xsltDecimalFormatGetByName; + xsltFormatNumberConversion; + xsltFreeStackElemList; + xsltFreeStylesheet; + xsltIsBlank; + xsltLoadStylesheetPI; + xsltNewStylesheet; + xsltNumberFormat; + xsltParseStylesheetDoc; + xsltParseStylesheetFile; + xsltParseStylesheetOutput; + xsltParseStylesheetProcess; + xsltParseTemplateContent; + +# xsltutils + xslAddCall; + xslDropCall; + xsltCalibrateAdjust; + xsltDocumentSortFunction; + xsltDoSortFunction; + xsltGetNsProp; + xsltGetQNameURI; + xsltMessage; + xsltPrintErrorContext; + xsltSaveProfiling; + xsltSaveResultToFd; + xsltSaveResultToFilename; + xsltSaveResultToFile; + xsltSaveResultTo; + xsltSetDebuggerCallbacks; + xsltSetGenericDebugFunc; + xsltSetGenericErrorFunc; + xsltTimestamp; + +# xslt + xsltCleanupGlobals; +} ; + +LIBXML2_1.0.12 { + global: + +# xsltInternals + xsltAllocateExtraCtxt; + xsltAllocateExtra; +} LIBXML2_1.0.11; + +LIBXML2_1.0.13 { + global: + +# extensions + xsltExtModuleElementPreComputeLookup; + xsltXPathGetTransformContext; +} LIBXML2_1.0.12; + +LIBXML2_1.0.16 { + global: + +# attributes + xsltResolveStylesheetAttributeSet; +} LIBXML2_1.0.13; + +LIBXML2_1.0.17 { + global: + +# transform + xsltRunStylesheetUser; +} LIBXML2_1.0.16; + +LIBXML2_1.0.18 { + global: + +# extensions + xsltDebugDumpExtensions; + +# xsltutils + xsltSaveResultToString; +} LIBXML2_1.0.17; + +LIBXML2_1.0.22 { + global: + +# templates + xsltAttrTemplateValueProcessNode; + +# security + xsltCheckRead; + xsltCheckWrite; + +# templates + xsltEvalXPathStringNs; + +# security + xsltFreeSecurityPrefs; + xsltGetDefaultSecurityPrefs; + xsltGetSecurityPrefs; + xsltNewSecurityPrefs; + xsltSecurityAllow; + xsltSecurityForbid; + xsltSetCtxtSecurityPrefs; + xsltSetDefaultSecurityPrefs; + xsltSetSecurityPrefs; + +# xsltutils + xsltSetTransformErrorFunc; + xsltTransformError; +} LIBXML2_1.0.18; + +LIBXML2_1.0.24 { + global: + +# xsltutils + xslDebugStatus; # variable + xsltComputeSortResult; + xsltDefaultSortFunction; + +# xslt + xsltEngineVersion; # variable + +# preproc + xsltExtMarker; # variable + +# xsltutils + xsltGenericDebugContext; # variable + xsltGenericDebug; # variable + xsltGenericErrorContext; # variable + xsltGenericError; # variable + xsltGetProfileInformation; + xsltGetUTF8Char; + +# xslt + xsltLibxmlVersion; # variable + xsltLibxsltVersion; # variable + xsltMaxDepth; # variable + xsltMaxVars; # variable + +# xsltInternals + xsltParseStylesheetImportedDoc; + +# xsltutils + xsltSetCtxtSortFunc; + xsltSetSortFunc; +} LIBXML2_1.0.22; + +LIBXML2_1.0.30 { + global: + +# xsltInternals + xsltCreateRVT; + xsltFreeRVTs; + xsltRegisterPersistRVT; + xsltRegisterTmpRVT; +} LIBXML2_1.0.24; + +LIBXML2_1.0.32 { + global: + +# transform + xsltCopyTextString; + +# extensions + xsltGetExtInfo; +} LIBXML2_1.0.30; + +LIBXML2_1.0.33 { + global: + +# pattern + xsltNormalizeCompSteps; +} LIBXML2_1.0.32; + +LIBXML2_1.1.0 { + global: + +# xsltutils + xsltGetDebuggerStatus; + xsltSetDebuggerStatus; +} LIBXML2_1.0.33; + +LIBXML2_1.1.1 { + global: + +# xsltutils + xsltDebugGetDefaultTrace; + xsltDebugSetDefaultTrace; +} LIBXML2_1.1.0; + +LIBXML2_1.1.2 { + global: + +# xsltutils + xsltSetCtxtParseOptions; +} LIBXML2_1.1.1; + +LIBXML2_1.1.3 { + global: + +# xsltInternals + xsltCompileAttr; + xsltEvalAVT; + xsltFreeAVTList; + +# xsltutils + xsltGetCNsProp; + xsltSplitQName; + xsltXPathCompile; +} LIBXML2_1.1.2; + +LIBXML2_1.1.5 { + global: + +# xsltutils + xsltGetQNameURI2; +} LIBXML2_1.1.3; + +LIBXML2_1.1.7 { + global: + +# namespaces + xsltGetPlainNamespace; +} LIBXML2_1.1.5; + +LIBXML2_1.1.9 { + global: + +# documents + xsltDocDefaultLoader; # variable + xsltSetLoaderFunc; +} LIBXML2_1.1.7; + +LIBXML2_1.1.18 { + global: + +# xsltInternals + xsltConstNamespaceNameXSLT; # variable + xsltExtensionInstructionResultFinalize; + xsltExtensionInstructionResultRegister; + xsltInitCtxtKey; + +# xslt + xsltInit; + +# xsltInternals + xsltParseAnyXSLTElem; + xsltParseSequenceConstructor; + xsltPointerListAddSize; + xsltPointerListClear; + xsltPointerListCreate; + xsltPointerListFree; + xsltRegisterLocalRVT; + xsltReleaseRVT; + xsltRestoreDocumentNamespaces; + +# extensions + xsltStyleStylesheetLevelGetExtData; + +# xsltInternals +# xsltTransStorageAdd; removed in 1.1.28 +# xsltTransStorageRemove; removed in 1.1.28 + xsltUninit; + xsltXSLTAttrMarker; # variable +} LIBXML2_1.1.9; + +LIBXML2_1.1.20 { + global: + +# transform + xsltLocalVariablePop; + xsltLocalVariablePush; +} LIBXML2_1.1.18; + +LIBXML2_1.1.23 { + global: + +# xsltInternals + xsltInitAllDocKeys; +} LIBXML2_1.1.20; + +LIBXML2_1.1.24 { + global: + +# extensions + xsltCheckExtURI; +} LIBXML2_1.1.23; + +LIBXML2_1.1.25 { + global: + +# xsltlocale + xsltFreeLocale; + xsltLocaleStrcmp; + xsltNewLocale; + xsltStrxfrm; + +# extensions + xsltInitGlobals; +} LIBXML2_1.1.24; + +LIBXML2_1.1.26 { + global: + +# transform + xsltProcessOneNode; +} LIBXML2_1.1.25; + +LIBXML2_1.1.27 { + global: + +# xsltlocale + xsltFreeLocales; + +# xsltutils + xsltXPathCompileFlags; +} LIBXML2_1.1.26; + diff --git a/libxslt/namespaces.c b/libxslt/namespaces.c new file mode 100644 index 0000000..07a7705 --- /dev/null +++ b/libxslt/namespaces.c @@ -0,0 +1,853 @@ +/* + * namespaces.c: Implementation of the XSLT namespaces handling + * + * Reference: + * http://www.w3.org/TR/1999/REC-xslt-19991116 + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_MATH_H +#include +#endif +#ifdef HAVE_FLOAT_H +#include +#endif +#ifdef HAVE_IEEEFP_H +#include +#endif +#ifdef HAVE_NAN_H +#include +#endif +#ifdef HAVE_CTYPE_H +#include +#endif +#ifndef XSLT_NEED_TRIO +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "namespaces.h" +#include "imports.h" + +/************************************************************************ + * * + * Module interfaces * + * * + ************************************************************************/ + +#ifdef XSLT_REFACTORED +static xsltNsAliasPtr +xsltNewNsAlias(xsltCompilerCtxtPtr cctxt) +{ + xsltNsAliasPtr ret; + + if (cctxt == NULL) + return(NULL); + + ret = (xsltNsAliasPtr) xmlMalloc(sizeof(xsltNsAlias)); + if (ret == NULL) { + xsltTransformError(NULL, cctxt->style, NULL, + "Internal error in xsltNewNsAlias(): Memory allocation failed.\n"); + cctxt->style->errors++; + return(NULL); + } + memset(ret, 0, sizeof(xsltNsAlias)); + /* + * TODO: Store the item at current stylesheet-level. + */ + ret->next = cctxt->nsAliases; + cctxt->nsAliases = ret; + + return(ret); +} +#endif /* XSLT_REFACTORED */ +/** + * xsltNamespaceAlias: + * @style: the XSLT stylesheet + * @node: the xsl:namespace-alias node + * + * Read the stylesheet-prefix and result-prefix attributes, register + * them as well as the corresponding namespace. + */ +void +xsltNamespaceAlias(xsltStylesheetPtr style, xmlNodePtr node) +{ + xmlChar *resultPrefix = NULL; + xmlChar *stylePrefix = NULL; + xmlNsPtr literalNs = NULL; + xmlNsPtr targetNs = NULL; + +#ifdef XSLT_REFACTORED + xsltNsAliasPtr alias; + + if ((style == NULL) || (node == NULL)) + return; + + /* + * SPEC XSLT 1.0: + * "If a namespace URI is declared to be an alias for multiple + * different namespace URIs, then the declaration with the highest + * import precedence is used. It is an error if there is more than + * one such declaration. An XSLT processor may signal the error; + * if it does not signal the error, it must recover by choosing, + * from amongst the declarations with the highest import precedence, + * the one that occurs last in the stylesheet." + * + * SPEC TODO: Check for the errors mentioned above. + */ + /* + * NOTE that the XSLT 2.0 also *does* use the NULL namespace if + * "#default" is used and there's no default namespace is scope. + * I.e., this is *not* an error. + * Most XSLT 1.0 implementations work this way. + * The XSLT 1.0 spec has nothing to say on the subject. + */ + /* + * Attribute "stylesheet-prefix". + */ + stylePrefix = xmlGetNsProp(node, (const xmlChar *)"stylesheet-prefix", NULL); + if (stylePrefix == NULL) { + xsltTransformError(NULL, style, node, + "The attribute 'stylesheet-prefix' is missing.\n"); + return; + } + if (xmlStrEqual(stylePrefix, (const xmlChar *)"#default")) + literalNs = xmlSearchNs(node->doc, node, NULL); + else { + literalNs = xmlSearchNs(node->doc, node, stylePrefix); + if (literalNs == NULL) { + xsltTransformError(NULL, style, node, + "Attribute 'stylesheet-prefix': There's no namespace " + "declaration in scope for the prefix '%s'.\n", + stylePrefix); + goto error; + } + } + /* + * Attribute "result-prefix". + */ + resultPrefix = xmlGetNsProp(node, (const xmlChar *)"result-prefix", NULL); + if (resultPrefix == NULL) { + xsltTransformError(NULL, style, node, + "The attribute 'result-prefix' is missing.\n"); + goto error; + } + if (xmlStrEqual(resultPrefix, (const xmlChar *)"#default")) + targetNs = xmlSearchNs(node->doc, node, NULL); + else { + targetNs = xmlSearchNs(node->doc, node, resultPrefix); + + if (targetNs == NULL) { + xsltTransformError(NULL, style, node, + "Attribute 'result-prefix': There's no namespace " + "declaration in scope for the prefix '%s'.\n", + stylePrefix); + goto error; + } + } + /* + * + * Same alias for multiple different target namespace URIs: + * TODO: The one with the highest import precedence is used. + * Example: + * + * + * + * + * Same target namespace URI for multiple different aliases: + * All alias-definitions will be used. + * Example: + * + * + * + * Cases using #default: + * + * TODO: Has this an effect at all? + * + * + * From namespace to no namespace. + * + * + * From no namespace to namespace. + */ + + + /* + * Store the ns-node in the alias-object. + */ + alias = xsltNewNsAlias(XSLT_CCTXT(style)); + if (alias == NULL) + return; + alias->literalNs = literalNs; + alias->targetNs = targetNs; + XSLT_CCTXT(style)->hasNsAliases = 1; + + +#else /* XSLT_REFACTORED */ + const xmlChar *literalNsName; + const xmlChar *targetNsName; + + + if ((style == NULL) || (node == NULL)) + return; + + stylePrefix = xmlGetNsProp(node, (const xmlChar *)"stylesheet-prefix", NULL); + if (stylePrefix == NULL) { + xsltTransformError(NULL, style, node, + "namespace-alias: stylesheet-prefix attribute missing\n"); + return; + } + resultPrefix = xmlGetNsProp(node, (const xmlChar *)"result-prefix", NULL); + if (resultPrefix == NULL) { + xsltTransformError(NULL, style, node, + "namespace-alias: result-prefix attribute missing\n"); + goto error; + } + + if (xmlStrEqual(stylePrefix, (const xmlChar *)"#default")) { + literalNs = xmlSearchNs(node->doc, node, NULL); + if (literalNs == NULL) { + literalNsName = NULL; + } else + literalNsName = literalNs->href; /* Yes - set for nsAlias table */ + } else { + literalNs = xmlSearchNs(node->doc, node, stylePrefix); + + if ((literalNs == NULL) || (literalNs->href == NULL)) { + xsltTransformError(NULL, style, node, + "namespace-alias: prefix %s not bound to any namespace\n", + stylePrefix); + goto error; + } else + literalNsName = literalNs->href; + } + + /* + * When "#default" is used for result, if a default namespace has not + * been explicitly declared the special value UNDEFINED_DEFAULT_NS is + * put into the nsAliases table + */ + if (xmlStrEqual(resultPrefix, (const xmlChar *)"#default")) { + targetNs = xmlSearchNs(node->doc, node, NULL); + if (targetNs == NULL) { + targetNsName = UNDEFINED_DEFAULT_NS; + } else + targetNsName = targetNs->href; + } else { + targetNs = xmlSearchNs(node->doc, node, resultPrefix); + + if ((targetNs == NULL) || (targetNs->href == NULL)) { + xsltTransformError(NULL, style, node, + "namespace-alias: prefix %s not bound to any namespace\n", + resultPrefix); + goto error; + } else + targetNsName = targetNs->href; + } + /* + * Special case: if #default is used for + * the stylesheet-prefix (literal namespace) and there's no default + * namespace in scope, we'll use style->defaultAlias for this. + */ + if (literalNsName == NULL) { + if (targetNs != NULL) { + /* + * BUG TODO: Is it not sufficient to have only 1 field for + * this, since subsequently alias declarations will + * overwrite this. + * Example: + * + * + * The mapping for "foo" won't be visible anymore. + */ + style->defaultAlias = targetNs->href; + } + } else { + if (style->nsAliases == NULL) + style->nsAliases = xmlHashCreate(10); + if (style->nsAliases == NULL) { + xsltTransformError(NULL, style, node, + "namespace-alias: cannot create hash table\n"); + goto error; + } + xmlHashAddEntry((xmlHashTablePtr) style->nsAliases, + literalNsName, (void *) targetNsName); + } +#endif /* else of XSLT_REFACTORED */ + +error: + if (stylePrefix != NULL) + xmlFree(stylePrefix); + if (resultPrefix != NULL) + xmlFree(resultPrefix); +} + +/** + * xsltGetSpecialNamespace: + * @ctxt: the transformation context + * @invocNode: the invoking node; e.g. a literal result element/attr; + * only used for error reports + * @nsName: the namespace name (or NULL) + * @nsPrefix: the suggested namespace prefix (or NULL) + * @target: the result element on which to anchor a namespace + * + * Find a matching (prefix and ns-name) ns-declaration + * for the requested @nsName and @nsPrefix in the result tree. + * If none is found then a new ns-declaration will be + * added to @resultElem. If, in this case, the given prefix is + * already in use, then a ns-declaration with a modified ns-prefix + * be we created. Note that this function's priority is to + * preserve ns-prefixes; it will only change a prefix if there's + * a namespace clash. + * If both @nsName and @nsPrefix are NULL, then this will try to + * "undeclare" a default namespace by declaring an xmlns="". + * + * Returns a namespace declaration or NULL. + */ +xmlNsPtr +xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode, + const xmlChar *nsName, const xmlChar *nsPrefix, + xmlNodePtr target) +{ + xmlNsPtr ns; + int prefixOccupied = 0; + + if ((ctxt == NULL) || (target == NULL) || + (target->type != XML_ELEMENT_NODE)) + return(NULL); + + /* + * NOTE: Namespace exclusion and ns-aliasing is performed at + * compilation-time in the refactored code; so this need not be done + * here (it was in the old code). + * NOTE: @invocNode was named @cur in the old code and was documented to + * be an input node; since it was only used to anchor an error report + * somewhere, we can safely change this to @invocNode, which now + * will be the XSLT instruction (also a literal result element/attribute), + * which was responsible for this call. + */ + /* + * OPTIMIZE TODO: This all could be optimized by keeping track of + * the ns-decls currently in-scope via a specialized context. + */ + if ((nsPrefix == NULL) && ((nsName == NULL) || (nsName[0] == 0))) { + /* + * NOTE: the "undeclaration" of the default namespace was + * part of the logic of the old xsltGetSpecialNamespace() code, + * so we'll keep that mechanism. + * Related to the old code: bug #302020: + */ + /* + * OPTIMIZE TODO: This all could be optimized by keeping track of + * the ns-decls currently in-scope via a specialized context. + */ + /* + * Search on the result element itself. + */ + if (target->nsDef != NULL) { + ns = target->nsDef; + do { + if (ns->prefix == NULL) { + if ((ns->href != NULL) && (ns->href[0] != 0)) { + /* + * Raise a namespace normalization error. + */ + xsltTransformError(ctxt, NULL, invocNode, + "Namespace normalization error: Cannot undeclare " + "the default namespace, since the default namespace " + "'%s' is already declared on the result element " + "'%s'.\n", ns->href, target->name); + return(NULL); + } else { + /* + * The default namespace was undeclared on the + * result element. + */ + return(NULL); + } + break; + } + ns = ns->next; + } while (ns != NULL); + } + if ((target->parent != NULL) && + (target->parent->type == XML_ELEMENT_NODE)) + { + /* + * The parent element is in no namespace, so assume + * that there is no default namespace in scope. + */ + if (target->parent->ns == NULL) + return(NULL); + + ns = xmlSearchNs(target->doc, target->parent, + NULL); + /* + * Fine if there's no default ns is scope, or if the + * default ns was undeclared. + */ + if ((ns == NULL) || (ns->href == NULL) || (ns->href[0] == 0)) + return(NULL); + + /* + * Undeclare the default namespace. + */ + xmlNewNs(target, BAD_CAST "", NULL); + /* TODO: Check result */ + return(NULL); + } + return(NULL); + } + /* + * Handle the XML namespace. + * QUESTION: Is this faster than using xmlStrEqual() anyway? + */ + if ((nsPrefix != NULL) && + (nsPrefix[0] == 'x') && (nsPrefix[1] == 'm') && + (nsPrefix[2] == 'l') && (nsPrefix[3] == 0)) + { + return(xmlSearchNs(target->doc, target, nsPrefix)); + } + /* + * First: search on the result element itself. + */ + if (target->nsDef != NULL) { + ns = target->nsDef; + do { + if ((ns->prefix == NULL) == (nsPrefix == NULL)) { + if (ns->prefix == nsPrefix) { + if (xmlStrEqual(ns->href, nsName)) + return(ns); + prefixOccupied = 1; + break; + } else if (xmlStrEqual(ns->prefix, nsPrefix)) { + if (xmlStrEqual(ns->href, nsName)) + return(ns); + prefixOccupied = 1; + break; + } + } + ns = ns->next; + } while (ns != NULL); + } + if (prefixOccupied) { + /* + * If the ns-prefix is occupied by an other ns-decl on the + * result element, then this means: + * 1) The desired prefix is shadowed + * 2) There's no way around changing the prefix + * + * Try a desperate search for an in-scope ns-decl + * with a matching ns-name before we use the last option, + * which is to recreate the ns-decl with a modified prefix. + */ + ns = xmlSearchNsByHref(target->doc, target, nsName); + if (ns != NULL) + return(ns); + + /* + * Fallback to changing the prefix. + */ + } else if ((target->parent != NULL) && + (target->parent->type == XML_ELEMENT_NODE)) + { + /* + * Try to find a matching ns-decl in the ancestor-axis. + * + * Check the common case: The parent element of the current + * result element is in the same namespace (with an equal ns-prefix). + */ + if ((target->parent->ns != NULL) && + ((target->parent->ns->prefix != NULL) == (nsPrefix != NULL))) + { + ns = target->parent->ns; + + if (nsPrefix == NULL) { + if (xmlStrEqual(ns->href, nsName)) + return(ns); + } else if (xmlStrEqual(ns->prefix, nsPrefix) && + xmlStrEqual(ns->href, nsName)) + { + return(ns); + } + } + /* + * Lookup the remaining in-scope namespaces. + */ + ns = xmlSearchNs(target->doc, target->parent, nsPrefix); + if (ns != NULL) { + if (xmlStrEqual(ns->href, nsName)) + return(ns); + /* + * Now check for a nasty case: We need to ensure that the new + * ns-decl won't shadow a prefix in-use by an existing attribute. + * + * + * + * val-b + * + * + */ + if (target->properties) { + xmlAttrPtr attr = target->properties; + do { + if ((attr->ns) && + xmlStrEqual(attr->ns->prefix, nsPrefix)) + { + /* + * Bad, this prefix is already in use. + * Since we'll change the prefix anyway, try + * a search for a matching ns-decl based on the + * namespace name. + */ + ns = xmlSearchNsByHref(target->doc, target, nsName); + if (ns != NULL) + return(ns); + goto declare_new_prefix; + } + attr = attr->next; + } while (attr != NULL); + } + } else { + /* + * Either no matching ns-prefix was found or the namespace is + * shadowed. + * Create a new ns-decl on the current result element. + * + * Hmm, we could also try to reuse an in-scope + * namespace with a matching ns-name but a different + * ns-prefix. + * What has higher priority? + * 1) If keeping the prefix: create a new ns-decl. + * 2) If reusal: first lookup ns-names; then fallback + * to creation of a new ns-decl. + * REVISIT: this currently uses case 1) although + * the old way was use xmlSearchNsByHref() and to let change + * the prefix. + */ +#if 0 + ns = xmlSearchNsByHref(target->doc, target, nsName); + if (ns != NULL) + return(ns); +#endif + } + /* + * Create the ns-decl on the current result element. + */ + ns = xmlNewNs(target, nsName, nsPrefix); + /* TODO: check errors */ + return(ns); + } else { + /* + * This is either the root of the tree or something weird is going on. + */ + ns = xmlNewNs(target, nsName, nsPrefix); + /* TODO: Check result */ + return(ns); + } + +declare_new_prefix: + /* + * Fallback: we need to generate a new prefix and declare the namespace + * on the result element. + */ + { + xmlChar pref[30]; + int counter = 1; + + if (nsPrefix == NULL) { + nsPrefix = BAD_CAST "ns"; + } + + do { + snprintf((char *) pref, 30, "%s_%d", nsPrefix, counter++); + ns = xmlSearchNs(target->doc, target, BAD_CAST pref); + if (counter > 1000) { + xsltTransformError(ctxt, NULL, invocNode, + "Internal error in xsltAcquireResultInScopeNs(): " + "Failed to compute a unique ns-prefix for the " + "generated element"); + return(NULL); + } + } while (ns != NULL); + ns = xmlNewNs(target, nsName, BAD_CAST pref); + /* TODO: Check result */ + return(ns); + } + return(NULL); +} + +/** + * xsltGetNamespace: + * @ctxt: a transformation context + * @cur: the input node + * @ns: the namespace + * @out: the output node (or its parent) + * + * Find a matching (prefix and ns-name) ns-declaration + * for the requested @ns->prefix and @ns->href in the result tree. + * If none is found then a new ns-declaration will be + * added to @resultElem. If, in this case, the given prefix is + * already in use, then a ns-declaration with a modified ns-prefix + * be we created. + * + * Called by: + * - xsltCopyPropList() (*not* anymore) + * - xsltShallowCopyElement() + * - xsltCopyTreeInternal() (*not* anymore) + * - xsltApplySequenceConstructor() (*not* in the refactored code), + * - xsltElement() (*not* anymore) + * + * Returns a namespace declaration or NULL in case of + * namespace fixup failures or API or internal errors. + */ +xmlNsPtr +xsltGetNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, xmlNsPtr ns, + xmlNodePtr out) +{ + + if (ns == NULL) + return(NULL); + +#ifdef XSLT_REFACTORED + /* + * Namespace exclusion and ns-aliasing is performed at + * compilation-time in the refactored code. + * Additionally, aliasing is not intended for non Literal + * Result Elements. + */ + return(xsltGetSpecialNamespace(ctxt, cur, ns->href, ns->prefix, out)); +#else + { + xsltStylesheetPtr style; + const xmlChar *URI = NULL; /* the replacement URI */ + + if ((ctxt == NULL) || (cur == NULL) || (out == NULL)) + return(NULL); + + style = ctxt->style; + while (style != NULL) { + if (style->nsAliases != NULL) + URI = (const xmlChar *) + xmlHashLookup(style->nsAliases, ns->href); + if (URI != NULL) + break; + + style = xsltNextImport(style); + } + + + if (URI == UNDEFINED_DEFAULT_NS) { + return(xsltGetSpecialNamespace(ctxt, cur, NULL, NULL, out)); +#if 0 + /* + * TODO: Removed, since wrong. If there was no default + * namespace in the stylesheet then this must resolve to + * the NULL namespace. + */ + xmlNsPtr dflt; + dflt = xmlSearchNs(cur->doc, cur, NULL); + if (dflt != NULL) + URI = dflt->href; + else + return NULL; +#endif + } else if (URI == NULL) + URI = ns->href; + + return(xsltGetSpecialNamespace(ctxt, cur, URI, ns->prefix, out)); + } +#endif +} + +/** + * xsltGetPlainNamespace: + * @ctxt: a transformation context + * @cur: the input node + * @ns: the namespace + * @out: the result element + * + * Obsolete. + * *Not* called by any Libxslt/Libexslt function. + * Exaclty the same as xsltGetNamespace(). + * + * Returns a namespace declaration or NULL in case of + * namespace fixup failures or API or internal errors. + */ +xmlNsPtr +xsltGetPlainNamespace(xsltTransformContextPtr ctxt, xmlNodePtr cur, + xmlNsPtr ns, xmlNodePtr out) +{ + return(xsltGetNamespace(ctxt, cur, ns, out)); +} + +/** + * xsltCopyNamespaceList: + * @ctxt: a transformation context + * @node: the target node + * @cur: the first namespace + * + * Do a copy of an namespace list. If @node is non-NULL the + * new namespaces are added automatically. This handles namespaces + * aliases. + * This function is intended only for *internal* use at + * transformation-time for copying ns-declarations of Literal + * Result Elements. + * + * Called by: + * xsltCopyTreeInternal() (transform.c) + * xsltShallowCopyElem() (transform.c) + * + * REVISIT: This function won't be used in the refactored code. + * + * Returns: a new xmlNsPtr, or NULL in case of error. + */ +xmlNsPtr +xsltCopyNamespaceList(xsltTransformContextPtr ctxt, xmlNodePtr node, + xmlNsPtr cur) { + xmlNsPtr ret = NULL, tmp; + xmlNsPtr p = NULL,q; + + if (cur == NULL) + return(NULL); + if (cur->type != XML_NAMESPACE_DECL) + return(NULL); + + /* + * One can add namespaces only on element nodes + */ + if ((node != NULL) && (node->type != XML_ELEMENT_NODE)) + node = NULL; + + while (cur != NULL) { + if (cur->type != XML_NAMESPACE_DECL) + break; + + /* + * Avoid duplicating namespace declarations in the tree if + * a matching declaration is in scope. + */ + if (node != NULL) { + if ((node->ns != NULL) && + (xmlStrEqual(node->ns->prefix, cur->prefix)) && + (xmlStrEqual(node->ns->href, cur->href))) { + cur = cur->next; + continue; + } + tmp = xmlSearchNs(node->doc, node, cur->prefix); + if ((tmp != NULL) && (xmlStrEqual(tmp->href, cur->href))) { + cur = cur->next; + continue; + } + } +#ifdef XSLT_REFACTORED + /* + * Namespace exclusion and ns-aliasing is performed at + * compilation-time in the refactored code. + */ + q = xmlNewNs(node, cur->href, cur->prefix); + if (p == NULL) { + ret = p = q; + } else { + p->next = q; + p = q; + } +#else + /* + * TODO: Remove this if the refactored code gets enabled. + */ + if (!xmlStrEqual(cur->href, XSLT_NAMESPACE)) { + const xmlChar *URI; + /* TODO apply cascading */ + URI = (const xmlChar *) xmlHashLookup(ctxt->style->nsAliases, + cur->href); + if (URI == UNDEFINED_DEFAULT_NS) { + cur = cur->next; + continue; + } + if (URI != NULL) { + q = xmlNewNs(node, URI, cur->prefix); + } else { + q = xmlNewNs(node, cur->href, cur->prefix); + } + if (p == NULL) { + ret = p = q; + } else { + p->next = q; + p = q; + } + } +#endif + cur = cur->next; + } + return(ret); +} + +/** + * xsltCopyNamespace: + * @ctxt: a transformation context + * @elem: the target element node + * @ns: the namespace node + * + * Copies a namespace node (declaration). If @elem is not NULL, + * then the new namespace will be declared on @elem. + * + * Returns: a new xmlNsPtr, or NULL in case of an error. + */ +xmlNsPtr +xsltCopyNamespace(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, + xmlNodePtr elem, xmlNsPtr ns) +{ + if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL)) + return(NULL); + /* + * One can add namespaces only on element nodes + */ + if ((elem != NULL) && (elem->type != XML_ELEMENT_NODE)) + return(xmlNewNs(NULL, ns->href, ns->prefix)); + else + return(xmlNewNs(elem, ns->href, ns->prefix)); +} + + +/** + * xsltFreeNamespaceAliasHashes: + * @style: an XSLT stylesheet + * + * Free up the memory used by namespaces aliases + */ +void +xsltFreeNamespaceAliasHashes(xsltStylesheetPtr style) { + if (style->nsAliases != NULL) + xmlHashFree((xmlHashTablePtr) style->nsAliases, NULL); + style->nsAliases = NULL; +} diff --git a/libxslt/namespaces.h b/libxslt/namespaces.h new file mode 100644 index 0000000..fa2d3b4 --- /dev/null +++ b/libxslt/namespaces.h @@ -0,0 +1,68 @@ +/* + * Summary: interface for the XSLT namespace handling + * Description: set of function easing the processing and generation + * of namespace nodes in XSLT. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XSLT_NAMESPACES_H__ +#define __XML_XSLT_NAMESPACES_H__ + +#include +#include "xsltexports.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Used within nsAliases hashtable when the default namespace is required + * but it's not been explicitly defined + */ +/** + * UNDEFINED_DEFAULT_NS: + * + * Special value for undefined namespace, internal + */ +#define UNDEFINED_DEFAULT_NS (const xmlChar *) -1L + +XSLTPUBFUN void XSLTCALL + xsltNamespaceAlias (xsltStylesheetPtr style, + xmlNodePtr node); +XSLTPUBFUN xmlNsPtr XSLTCALL + xsltGetNamespace (xsltTransformContextPtr ctxt, + xmlNodePtr cur, + xmlNsPtr ns, + xmlNodePtr out); +XSLTPUBFUN xmlNsPtr XSLTCALL + xsltGetPlainNamespace (xsltTransformContextPtr ctxt, + xmlNodePtr cur, + xmlNsPtr ns, + xmlNodePtr out); +XSLTPUBFUN xmlNsPtr XSLTCALL + xsltGetSpecialNamespace (xsltTransformContextPtr ctxt, + xmlNodePtr cur, + const xmlChar *URI, + const xmlChar *prefix, + xmlNodePtr out); +XSLTPUBFUN xmlNsPtr XSLTCALL + xsltCopyNamespace (xsltTransformContextPtr ctxt, + xmlNodePtr elem, + xmlNsPtr ns); +XSLTPUBFUN xmlNsPtr XSLTCALL + xsltCopyNamespaceList (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNsPtr cur); +XSLTPUBFUN void XSLTCALL + xsltFreeNamespaceAliasHashes + (xsltStylesheetPtr style); + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XSLT_NAMESPACES_H__ */ + diff --git a/libxslt/numbers.c b/libxslt/numbers.c new file mode 100644 index 0000000..e769c42 --- /dev/null +++ b/libxslt/numbers.c @@ -0,0 +1,1369 @@ +/* + * numbers.c: Implementation of the XSLT number functions + * + * Reference: + * http://www.w3.org/TR/1999/REC-xslt-19991116 + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + * Bjorn Reese + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include "xsltutils.h" +#include "pattern.h" +#include "templates.h" +#include "transform.h" +#include "numbersInternals.h" + +#ifndef FALSE +# define FALSE (0 == 1) +# define TRUE (1 == 1) +#endif + +#define SYMBOL_QUOTE ((xmlChar)'\'') + +#define DEFAULT_TOKEN (xmlChar)'0' +#define DEFAULT_SEPARATOR "." + +#define MAX_TOKENS 1024 + +typedef struct _xsltFormatToken xsltFormatToken; +typedef xsltFormatToken *xsltFormatTokenPtr; +struct _xsltFormatToken { + xmlChar *separator; + xmlChar token; + int width; +}; + +typedef struct _xsltFormat xsltFormat; +typedef xsltFormat *xsltFormatPtr; +struct _xsltFormat { + xmlChar *start; + xsltFormatToken tokens[MAX_TOKENS]; + int nTokens; + xmlChar *end; +}; + +static char alpha_upper_list[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +static char alpha_lower_list[] = "abcdefghijklmnopqrstuvwxyz"; +static xsltFormatToken default_token; + +/* + * **** Start temp insert **** + * + * The following two routines (xsltUTF8Size and xsltUTF8Charcmp) + * will be replaced with calls to the corresponding libxml routines + * at a later date (when other inter-library dependencies require it) + */ + +/** + * xsltUTF8Size: + * @utf: pointer to the UTF8 character + * + * returns the numbers of bytes in the character, -1 on format error + */ +static int +xsltUTF8Size(xmlChar *utf) { + xmlChar mask; + int len; + + if (utf == NULL) + return -1; + if (*utf < 0x80) + return 1; + /* check valid UTF8 character */ + if (!(*utf & 0x40)) + return -1; + /* determine number of bytes in char */ + len = 2; + for (mask=0x20; mask != 0; mask>>=1) { + if (!(*utf & mask)) + return len; + len++; + } + return -1; +} + +/** + * xsltUTF8Charcmp + * @utf1: pointer to first UTF8 char + * @utf2: pointer to second UTF8 char + * + * returns result of comparing the two UCS4 values + * as with xmlStrncmp + */ +static int +xsltUTF8Charcmp(xmlChar *utf1, xmlChar *utf2) { + + if (utf1 == NULL ) { + if (utf2 == NULL) + return 0; + return -1; + } + return xmlStrncmp(utf1, utf2, xsltUTF8Size(utf1)); +} + +/***** Stop temp insert *****/ +/************************************************************************ + * * + * Utility functions * + * * + ************************************************************************/ + +#define IS_SPECIAL(self,letter) \ + ((xsltUTF8Charcmp((letter), (self)->zeroDigit) == 0) || \ + (xsltUTF8Charcmp((letter), (self)->digit) == 0) || \ + (xsltUTF8Charcmp((letter), (self)->decimalPoint) == 0) || \ + (xsltUTF8Charcmp((letter), (self)->grouping) == 0) || \ + (xsltUTF8Charcmp((letter), (self)->patternSeparator) == 0)) + +#define IS_DIGIT_ZERO(x) xsltIsDigitZero(x) +#define IS_DIGIT_ONE(x) xsltIsDigitZero((xmlChar)(x)-1) + +static int +xsltIsDigitZero(unsigned int ch) +{ + /* + * Reference: ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt + */ + switch (ch) { + case 0x0030: case 0x0660: case 0x06F0: case 0x0966: + case 0x09E6: case 0x0A66: case 0x0AE6: case 0x0B66: + case 0x0C66: case 0x0CE6: case 0x0D66: case 0x0E50: + case 0x0E60: case 0x0F20: case 0x1040: case 0x17E0: + case 0x1810: case 0xFF10: + return TRUE; + default: + return FALSE; + } +} + +static void +xsltNumberFormatDecimal(xmlBufferPtr buffer, + double number, + int digit_zero, + int width, + int digitsPerGroup, + int groupingCharacter, + int groupingCharacterLen) +{ + /* + * This used to be + * xmlChar temp_string[sizeof(double) * CHAR_BIT * sizeof(xmlChar) + 4]; + * which would be length 68 on x86 arch. It was changed to be a longer, + * fixed length in order to try to cater for (reasonable) UTF8 + * separators and numeric characters. The max UTF8 char size will be + * 6 or less, so the value used [500] should be *much* larger than needed + */ + xmlChar temp_string[500]; + xmlChar *pointer; + xmlChar temp_char[6]; + int i; + int val; + int len; + + /* Build buffer from back */ + pointer = &temp_string[sizeof(temp_string)] - 1; /* last char */ + *pointer = 0; + i = 0; + while (pointer > temp_string) { + if ((i >= width) && (fabs(number) < 1.0)) + break; /* for */ + if ((i > 0) && (groupingCharacter != 0) && + (digitsPerGroup > 0) && + ((i % digitsPerGroup) == 0)) { + if (pointer - groupingCharacterLen < temp_string) { + i = -1; /* flag error */ + break; + } + pointer -= groupingCharacterLen; + xmlCopyCharMultiByte(pointer, groupingCharacter); + } + + val = digit_zero + (int)fmod(number, 10.0); + if (val < 0x80) { /* shortcut if ASCII */ + if (pointer <= temp_string) { /* Check enough room */ + i = -1; + break; + } + *(--pointer) = val; + } + else { + /* + * Here we have a multibyte character. It's a little messy, + * because until we generate the char we don't know how long + * it is. So, we generate it into the buffer temp_char, then + * copy from there into temp_string. + */ + len = xmlCopyCharMultiByte(temp_char, val); + if ( (pointer - len) < temp_string ) { + i = -1; + break; + } + pointer -= len; + memcpy(pointer, temp_char, len); + } + number /= 10.0; + ++i; + } + if (i < 0) + xsltGenericError(xsltGenericErrorContext, + "xsltNumberFormatDecimal: Internal buffer size exceeded"); + xmlBufferCat(buffer, pointer); +} + +static void +xsltNumberFormatAlpha(xsltNumberDataPtr data, + xmlBufferPtr buffer, + double number, + int is_upper) +{ + char temp_string[sizeof(double) * CHAR_BIT * sizeof(xmlChar) + 1]; + char *pointer; + int i; + char *alpha_list; + double alpha_size = (double)(sizeof(alpha_upper_list) - 1); + + /* + * XSLT 1.0 isn't clear on how to handle zero, but XSLT 2.0 says: + * + * For all format tokens other than the first kind above (one that + * consists of decimal digits), there may be implementation-defined + * lower and upper bounds on the range of numbers that can be + * formatted using this format token; indeed, for some numbering + * sequences there may be intrinsic limits. [...] Numbers that fall + * outside this range must be formatted using the format token 1. + * + * The "a" token has an intrinsic lower limit of 1. + */ + if (number < 1.0) { + xsltNumberFormatDecimal(buffer, number, '0', 1, + data->digitsPerGroup, + data->groupingCharacter, + data->groupingCharacterLen); + return; + } + + /* Build buffer from back */ + pointer = &temp_string[sizeof(temp_string)]; + *(--pointer) = 0; + alpha_list = (is_upper) ? alpha_upper_list : alpha_lower_list; + + for (i = 1; i < (int)sizeof(temp_string); i++) { + number--; + *(--pointer) = alpha_list[((int)fmod(number, alpha_size))]; + number /= alpha_size; + if (number < 1.0) + break; /* for */ + } + xmlBufferCCat(buffer, pointer); +} + +static void +xsltNumberFormatRoman(xsltNumberDataPtr data, + xmlBufferPtr buffer, + double number, + int is_upper) +{ + /* + * See discussion in xsltNumberFormatAlpha. Also use a reasonable upper + * bound to avoid denial of service. + */ + if (number < 1.0 || number > 5000.0) { + xsltNumberFormatDecimal(buffer, number, '0', 1, + data->digitsPerGroup, + data->groupingCharacter, + data->groupingCharacterLen); + return; + } + + /* + * Based on an example by Jim Walsh + */ + while (number >= 1000.0) { + xmlBufferCCat(buffer, (is_upper) ? "M" : "m"); + number -= 1000.0; + } + if (number >= 900.0) { + xmlBufferCCat(buffer, (is_upper) ? "CM" : "cm"); + number -= 900.0; + } + while (number >= 500.0) { + xmlBufferCCat(buffer, (is_upper) ? "D" : "d"); + number -= 500.0; + } + if (number >= 400.0) { + xmlBufferCCat(buffer, (is_upper) ? "CD" : "cd"); + number -= 400.0; + } + while (number >= 100.0) { + xmlBufferCCat(buffer, (is_upper) ? "C" : "c"); + number -= 100.0; + } + if (number >= 90.0) { + xmlBufferCCat(buffer, (is_upper) ? "XC" : "xc"); + number -= 90.0; + } + while (number >= 50.0) { + xmlBufferCCat(buffer, (is_upper) ? "L" : "l"); + number -= 50.0; + } + if (number >= 40.0) { + xmlBufferCCat(buffer, (is_upper) ? "XL" : "xl"); + number -= 40.0; + } + while (number >= 10.0) { + xmlBufferCCat(buffer, (is_upper) ? "X" : "x"); + number -= 10.0; + } + if (number >= 9.0) { + xmlBufferCCat(buffer, (is_upper) ? "IX" : "ix"); + number -= 9.0; + } + while (number >= 5.0) { + xmlBufferCCat(buffer, (is_upper) ? "V" : "v"); + number -= 5.0; + } + if (number >= 4.0) { + xmlBufferCCat(buffer, (is_upper) ? "IV" : "iv"); + number -= 4.0; + } + while (number >= 1.0) { + xmlBufferCCat(buffer, (is_upper) ? "I" : "i"); + number--; + } +} + +static void +xsltNumberFormatTokenize(const xmlChar *format, + xsltFormatPtr tokens) +{ + int ix = 0; + int j; + int val; + int len; + + default_token.token = DEFAULT_TOKEN; + default_token.width = 1; + default_token.separator = BAD_CAST(DEFAULT_SEPARATOR); + + + tokens->start = NULL; + tokens->tokens[0].separator = NULL; + tokens->end = NULL; + + /* + * Insert initial non-alphanumeric token. + * There is always such a token in the list, even if NULL + */ + while (! (IS_LETTER(val=xmlStringCurrentChar(NULL, format+ix, &len)) || + IS_DIGIT(val)) ) { + if (format[ix] == 0) /* if end of format string */ + break; /* while */ + ix += len; + } + if (ix > 0) + tokens->start = xmlStrndup(format, ix); + + + for (tokens->nTokens = 0; tokens->nTokens < MAX_TOKENS; + tokens->nTokens++) { + if (format[ix] == 0) + break; /* for */ + + /* + * separator has already been parsed (except for the first + * number) in tokens->end, recover it. + */ + if (tokens->nTokens > 0) { + tokens->tokens[tokens->nTokens].separator = tokens->end; + tokens->end = NULL; + } + + val = xmlStringCurrentChar(NULL, format+ix, &len); + if (IS_DIGIT_ONE(val) || + IS_DIGIT_ZERO(val)) { + tokens->tokens[tokens->nTokens].width = 1; + while (IS_DIGIT_ZERO(val)) { + tokens->tokens[tokens->nTokens].width++; + ix += len; + val = xmlStringCurrentChar(NULL, format+ix, &len); + } + if (IS_DIGIT_ONE(val)) { + tokens->tokens[tokens->nTokens].token = val - 1; + ix += len; + val = xmlStringCurrentChar(NULL, format+ix, &len); + } + } else if ( (val == (xmlChar)'A') || + (val == (xmlChar)'a') || + (val == (xmlChar)'I') || + (val == (xmlChar)'i') ) { + tokens->tokens[tokens->nTokens].token = val; + ix += len; + val = xmlStringCurrentChar(NULL, format+ix, &len); + } else { + /* XSLT section 7.7 + * "Any other format token indicates a numbering sequence + * that starts with that token. If an implementation does + * not support a numbering sequence that starts with that + * token, it must use a format token of 1." + */ + tokens->tokens[tokens->nTokens].token = (xmlChar)'0'; + tokens->tokens[tokens->nTokens].width = 1; + } + /* + * Skip over remaining alphanumeric characters from the Nd + * (Number, decimal digit), Nl (Number, letter), No (Number, + * other), Lu (Letter, uppercase), Ll (Letter, lowercase), Lt + * (Letters, titlecase), Lm (Letters, modifiers), and Lo + * (Letters, other (uncased)) Unicode categories. This happens + * to correspond to the Letter and Digit classes from XML (and + * one wonders why XSLT doesn't refer to these instead). + */ + while (IS_LETTER(val) || IS_DIGIT(val)) { + ix += len; + val = xmlStringCurrentChar(NULL, format+ix, &len); + } + + /* + * Insert temporary non-alphanumeric final tooken. + */ + j = ix; + while (! (IS_LETTER(val) || IS_DIGIT(val))) { + if (val == 0) + break; /* while */ + ix += len; + val = xmlStringCurrentChar(NULL, format+ix, &len); + } + if (ix > j) + tokens->end = xmlStrndup(&format[j], ix - j); + } +} + +static void +xsltNumberFormatInsertNumbers(xsltNumberDataPtr data, + double *numbers, + int numbers_max, + xsltFormatPtr tokens, + xmlBufferPtr buffer) +{ + int i = 0; + double number; + xsltFormatTokenPtr token; + + /* + * Handle initial non-alphanumeric token + */ + if (tokens->start != NULL) + xmlBufferCat(buffer, tokens->start); + + for (i = 0; i < numbers_max; i++) { + /* Insert number */ + number = numbers[(numbers_max - 1) - i]; + /* Round to nearest like XSLT 2.0 */ + number = floor(number + 0.5); + /* + * XSLT 1.0 isn't clear on how to handle negative numbers, but XSLT + * 2.0 says: + * + * It is a non-recoverable dynamic error if any undiscarded item + * in the atomized sequence supplied as the value of the value + * attribute of xsl:number cannot be converted to an integer, or + * if the resulting integer is less than 0 (zero). + */ + if (number < 0.0) { + xsltTransformError(NULL, NULL, NULL, + "xsl-number : negative value\n"); + /* Recover by treating negative values as zero. */ + number = 0.0; + } + if (i < tokens->nTokens) { + /* + * The "n"th format token will be used to format the "n"th + * number in the list + */ + token = &(tokens->tokens[i]); + } else if (tokens->nTokens > 0) { + /* + * If there are more numbers than format tokens, then the + * last format token will be used to format the remaining + * numbers. + */ + token = &(tokens->tokens[tokens->nTokens - 1]); + } else { + /* + * If there are no format tokens, then a format token of + * 1 is used to format all numbers. + */ + token = &default_token; + } + + /* Print separator, except for the first number */ + if (i > 0) { + if (token->separator != NULL) + xmlBufferCat(buffer, token->separator); + else + xmlBufferCCat(buffer, DEFAULT_SEPARATOR); + } + + switch (xmlXPathIsInf(number)) { + case -1: + xmlBufferCCat(buffer, "-Infinity"); + break; + case 1: + xmlBufferCCat(buffer, "Infinity"); + break; + default: + if (xmlXPathIsNaN(number)) { + xmlBufferCCat(buffer, "NaN"); + } else { + + switch (token->token) { + case 'A': + xsltNumberFormatAlpha(data, buffer, number, TRUE); + break; + case 'a': + xsltNumberFormatAlpha(data, buffer, number, FALSE); + break; + case 'I': + xsltNumberFormatRoman(data, buffer, number, TRUE); + break; + case 'i': + xsltNumberFormatRoman(data, buffer, number, FALSE); + break; + default: + if (IS_DIGIT_ZERO(token->token)) { + xsltNumberFormatDecimal(buffer, + number, + token->token, + token->width, + data->digitsPerGroup, + data->groupingCharacter, + data->groupingCharacterLen); + } + break; + } + } + + } + } + + /* + * Handle final non-alphanumeric token + */ + if (tokens->end != NULL) + xmlBufferCat(buffer, tokens->end); + +} + +static int +xsltTestCompMatchCount(xsltTransformContextPtr context, + xmlNodePtr node, + xsltCompMatchPtr countPat, + xmlNodePtr cur) +{ + if (countPat != NULL) { + return xsltTestCompMatchList(context, node, countPat); + } + else { + /* + * 7.7 Numbering + * + * If count attribute is not specified, then it defaults to the + * pattern that matches any node with the same node type as the + * current node and, if the current node has an expanded-name, with + * the same expanded-name as the current node. + */ + if (node->type != cur->type) + return 0; + if (node->type == XML_NAMESPACE_DECL) + /* + * Namespace nodes have no preceding siblings and no parents + * that are namespace nodes. This means that node == cur. + */ + return 1; + /* TODO: Skip node types without expanded names like text nodes. */ + if (!xmlStrEqual(node->name, cur->name)) + return 0; + if (node->ns == cur->ns) + return 1; + if ((node->ns == NULL) || (cur->ns == NULL)) + return 0; + return (xmlStrEqual(node->ns->href, cur->ns->href)); + } +} + +static int +xsltNumberFormatGetAnyLevel(xsltTransformContextPtr context, + xmlNodePtr node, + xsltCompMatchPtr countPat, + xsltCompMatchPtr fromPat, + double *array) +{ + int amount = 0; + int cnt = 0; + xmlNodePtr cur; + + /* select the starting node */ + switch (node->type) { + case XML_ELEMENT_NODE: + cur = node; + break; + case XML_ATTRIBUTE_NODE: + cur = ((xmlAttrPtr) node)->parent; + break; + case XML_TEXT_NODE: + case XML_PI_NODE: + case XML_COMMENT_NODE: + cur = node->parent; + break; + default: + cur = NULL; + break; + } + + while (cur != NULL) { + /* process current node */ + if (xsltTestCompMatchCount(context, cur, countPat, node)) + cnt++; + if ((fromPat != NULL) && + xsltTestCompMatchList(context, cur, fromPat)) { + break; /* while */ + } + + /* Skip to next preceding or ancestor */ + if ((cur->type == XML_DOCUMENT_NODE) || +#ifdef LIBXML_DOCB_ENABLED + (cur->type == XML_DOCB_DOCUMENT_NODE) || +#endif + (cur->type == XML_HTML_DOCUMENT_NODE)) + break; /* while */ + + while ((cur->prev != NULL) && ((cur->prev->type == XML_DTD_NODE) || + (cur->prev->type == XML_XINCLUDE_START) || + (cur->prev->type == XML_XINCLUDE_END))) + cur = cur->prev; + if (cur->prev != NULL) { + for (cur = cur->prev; cur->last != NULL; cur = cur->last); + } else { + cur = cur->parent; + } + + } + + array[amount++] = (double) cnt; + + return(amount); +} + +static int +xsltNumberFormatGetMultipleLevel(xsltTransformContextPtr context, + xmlNodePtr node, + xsltCompMatchPtr countPat, + xsltCompMatchPtr fromPat, + double *array, + int max) +{ + int amount = 0; + int cnt; + xmlNodePtr ancestor; + xmlNodePtr preceding; + xmlXPathParserContextPtr parser; + + context->xpathCtxt->node = node; + parser = xmlXPathNewParserContext(NULL, context->xpathCtxt); + if (parser) { + /* ancestor-or-self::*[count] */ + for (ancestor = node; + (ancestor != NULL) && (ancestor->type != XML_DOCUMENT_NODE); + ancestor = xmlXPathNextAncestor(parser, ancestor)) { + + if ((fromPat != NULL) && + xsltTestCompMatchList(context, ancestor, fromPat)) + break; /* for */ + + if (xsltTestCompMatchCount(context, ancestor, countPat, node)) { + /* count(preceding-sibling::*) */ + cnt = 1; + for (preceding = + xmlXPathNextPrecedingSibling(parser, ancestor); + preceding != NULL; + preceding = + xmlXPathNextPrecedingSibling(parser, preceding)) { + + if (xsltTestCompMatchCount(context, preceding, countPat, + node)) + cnt++; + } + array[amount++] = (double)cnt; + if (amount >= max) + break; /* for */ + } + } + xmlXPathFreeParserContext(parser); + } + return amount; +} + +static int +xsltNumberFormatGetValue(xmlXPathContextPtr context, + xmlNodePtr node, + const xmlChar *value, + double *number) +{ + int amount = 0; + xmlBufferPtr pattern; + xmlXPathObjectPtr obj; + + pattern = xmlBufferCreate(); + if (pattern != NULL) { + xmlBufferCCat(pattern, "number("); + xmlBufferCat(pattern, value); + xmlBufferCCat(pattern, ")"); + context->node = node; + obj = xmlXPathEvalExpression(xmlBufferContent(pattern), + context); + if (obj != NULL) { + *number = obj->floatval; + amount++; + xmlXPathFreeObject(obj); + } + xmlBufferFree(pattern); + } + return amount; +} + +/** + * xsltNumberFormat: + * @ctxt: the XSLT transformation context + * @data: the formatting informations + * @node: the data to format + * + * Convert one number. + */ +void +xsltNumberFormat(xsltTransformContextPtr ctxt, + xsltNumberDataPtr data, + xmlNodePtr node) +{ + xmlBufferPtr output = NULL; + int amount, i; + double number; + xsltFormat tokens; + + if (data->format != NULL) { + xsltNumberFormatTokenize(data->format, &tokens); + } + else { + xmlChar *format; + + /* The format needs to be recomputed each time */ + if (data->has_format == 0) + return; + format = xsltEvalAttrValueTemplate(ctxt, data->node, + (const xmlChar *) "format", + XSLT_NAMESPACE); + if (format == NULL) + return; + xsltNumberFormatTokenize(format, &tokens); + xmlFree(format); + } + + output = xmlBufferCreate(); + if (output == NULL) + goto XSLT_NUMBER_FORMAT_END; + + /* + * Evaluate the XPath expression to find the value(s) + */ + if (data->value) { + amount = xsltNumberFormatGetValue(ctxt->xpathCtxt, + node, + data->value, + &number); + if (amount == 1) { + xsltNumberFormatInsertNumbers(data, + &number, + 1, + &tokens, + output); + } + + } else if (data->level) { + + if (xmlStrEqual(data->level, (const xmlChar *) "single")) { + amount = xsltNumberFormatGetMultipleLevel(ctxt, + node, + data->countPat, + data->fromPat, + &number, + 1); + if (amount == 1) { + xsltNumberFormatInsertNumbers(data, + &number, + 1, + &tokens, + output); + } + } else if (xmlStrEqual(data->level, (const xmlChar *) "multiple")) { + double numarray[1024]; + int max = sizeof(numarray)/sizeof(numarray[0]); + amount = xsltNumberFormatGetMultipleLevel(ctxt, + node, + data->countPat, + data->fromPat, + numarray, + max); + if (amount > 0) { + xsltNumberFormatInsertNumbers(data, + numarray, + amount, + &tokens, + output); + } + } else if (xmlStrEqual(data->level, (const xmlChar *) "any")) { + amount = xsltNumberFormatGetAnyLevel(ctxt, + node, + data->countPat, + data->fromPat, + &number); + if (amount > 0) { + xsltNumberFormatInsertNumbers(data, + &number, + 1, + &tokens, + output); + } + } + } + /* Insert number as text node */ + xsltCopyTextString(ctxt, ctxt->insert, xmlBufferContent(output), 0); + + xmlBufferFree(output); + +XSLT_NUMBER_FORMAT_END: + if (tokens.start != NULL) + xmlFree(tokens.start); + if (tokens.end != NULL) + xmlFree(tokens.end); + for (i = 0;i < tokens.nTokens;i++) { + if (tokens.tokens[i].separator != NULL) + xmlFree(tokens.tokens[i].separator); + } +} + +static int +xsltFormatNumberPreSuffix(xsltDecimalFormatPtr self, xmlChar **format, xsltFormatNumberInfoPtr info) +{ + int count=0; /* will hold total length of prefix/suffix */ + int len; + + while (1) { + /* + * prefix / suffix ends at end of string or at + * first 'special' character + */ + if (**format == 0) + return count; + /* if next character 'escaped' just count it */ + if (**format == SYMBOL_QUOTE) { + if (*++(*format) == 0) + return -1; + } + else if (IS_SPECIAL(self, *format)) + return count; + /* + * else treat percent/per-mille as special cases, + * depending on whether +ve or -ve + */ + else { + /* + * for +ve prefix/suffix, allow only a + * single occurence of either + */ + if (xsltUTF8Charcmp(*format, self->percent) == 0) { + if (info->is_multiplier_set) + return -1; + info->multiplier = 100; + info->is_multiplier_set = TRUE; + } else if (xsltUTF8Charcmp(*format, self->permille) == 0) { + if (info->is_multiplier_set) + return -1; + info->multiplier = 1000; + info->is_multiplier_set = TRUE; + } + } + + if ((len=xsltUTF8Size(*format)) < 1) + return -1; + count += len; + *format += len; + } +} + +/** + * xsltFormatNumberConversion: + * @self: the decimal format + * @format: the format requested + * @number: the value to format + * @result: the place to ouput the result + * + * format-number() uses the JDK 1.1 DecimalFormat class: + * + * http://java.sun.com/products/jdk/1.1/docs/api/java.text.DecimalFormat.html + * + * Structure: + * + * pattern := subpattern{;subpattern} + * subpattern := {prefix}integer{.fraction}{suffix} + * prefix := '\\u0000'..'\\uFFFD' - specialCharacters + * suffix := '\\u0000'..'\\uFFFD' - specialCharacters + * integer := '#'* '0'* '0' + * fraction := '0'* '#'* + * + * Notation: + * X* 0 or more instances of X + * (X | Y) either X or Y. + * X..Y any character from X up to Y, inclusive. + * S - T characters in S, except those in T + * + * Special Characters: + * + * Symbol Meaning + * 0 a digit + * # a digit, zero shows as absent + * . placeholder for decimal separator + * , placeholder for grouping separator. + * ; separates formats. + * - default negative prefix. + * % multiply by 100 and show as percentage + * ? multiply by 1000 and show as per mille + * X any other characters can be used in the prefix or suffix + * ' used to quote special characters in a prefix or suffix. + * + * Returns a possible XPath error + */ +xmlXPathError +xsltFormatNumberConversion(xsltDecimalFormatPtr self, + xmlChar *format, + double number, + xmlChar **result) +{ + xmlXPathError status = XPATH_EXPRESSION_OK; + xmlBufferPtr buffer; + xmlChar *the_format, *prefix = NULL, *suffix = NULL; + xmlChar *nprefix, *nsuffix = NULL; + xmlChar pchar; + int prefix_length, suffix_length = 0, nprefix_length, nsuffix_length; + double scale; + int j, len; + int self_grouping_len; + xsltFormatNumberInfo format_info; + /* + * delayed_multiplier allows a 'trailing' percent or + * permille to be treated as suffix + */ + int delayed_multiplier = 0; + /* flag to show no -ve format present for -ve number */ + char default_sign = 0; + /* flag to show error found, should use default format */ + char found_error = 0; + + if (xmlStrlen(format) <= 0) { + xsltTransformError(NULL, NULL, NULL, + "xsltFormatNumberConversion : " + "Invalid format (0-length)\n"); + } + *result = NULL; + switch (xmlXPathIsInf(number)) { + case -1: + if (self->minusSign == NULL) + *result = xmlStrdup(BAD_CAST "-"); + else + *result = xmlStrdup(self->minusSign); + /* no-break on purpose */ + case 1: + if ((self == NULL) || (self->infinity == NULL)) + *result = xmlStrcat(*result, BAD_CAST "Infinity"); + else + *result = xmlStrcat(*result, self->infinity); + return(status); + default: + if (xmlXPathIsNaN(number)) { + if ((self == NULL) || (self->noNumber == NULL)) + *result = xmlStrdup(BAD_CAST "NaN"); + else + *result = xmlStrdup(self->noNumber); + return(status); + } + } + + buffer = xmlBufferCreate(); + if (buffer == NULL) { + return XPATH_MEMORY_ERROR; + } + + format_info.integer_hash = 0; + format_info.integer_digits = 0; + format_info.frac_digits = 0; + format_info.frac_hash = 0; + format_info.group = -1; + format_info.multiplier = 1; + format_info.add_decimal = FALSE; + format_info.is_multiplier_set = FALSE; + format_info.is_negative_pattern = FALSE; + + the_format = format; + + /* + * First we process the +ve pattern to get percent / permille, + * as well as main format + */ + prefix = the_format; + prefix_length = xsltFormatNumberPreSuffix(self, &the_format, &format_info); + if (prefix_length < 0) { + found_error = 1; + goto OUTPUT_NUMBER; + } + + /* + * Here we process the "number" part of the format. It gets + * a little messy because of the percent/per-mille - if that + * appears at the end, it may be part of the suffix instead + * of part of the number, so the variable delayed_multiplier + * is used to handle it + */ + self_grouping_len = xmlStrlen(self->grouping); + while ((*the_format != 0) && + (xsltUTF8Charcmp(the_format, self->decimalPoint) != 0) && + (xsltUTF8Charcmp(the_format, self->patternSeparator) != 0)) { + + if (delayed_multiplier != 0) { + format_info.multiplier = delayed_multiplier; + format_info.is_multiplier_set = TRUE; + delayed_multiplier = 0; + } + if (xsltUTF8Charcmp(the_format, self->digit) == 0) { + if (format_info.integer_digits > 0) { + found_error = 1; + goto OUTPUT_NUMBER; + } + format_info.integer_hash++; + if (format_info.group >= 0) + format_info.group++; + } else if (xsltUTF8Charcmp(the_format, self->zeroDigit) == 0) { + format_info.integer_digits++; + if (format_info.group >= 0) + format_info.group++; + } else if ((self_grouping_len > 0) && + (!xmlStrncmp(the_format, self->grouping, self_grouping_len))) { + /* Reset group count */ + format_info.group = 0; + the_format += self_grouping_len; + continue; + } else if (xsltUTF8Charcmp(the_format, self->percent) == 0) { + if (format_info.is_multiplier_set) { + found_error = 1; + goto OUTPUT_NUMBER; + } + delayed_multiplier = 100; + } else if (xsltUTF8Charcmp(the_format, self->permille) == 0) { + if (format_info.is_multiplier_set) { + found_error = 1; + goto OUTPUT_NUMBER; + } + delayed_multiplier = 1000; + } else + break; /* while */ + + if ((len=xsltUTF8Size(the_format)) < 1) { + found_error = 1; + goto OUTPUT_NUMBER; + } + the_format += len; + + } + + /* We have finished the integer part, now work on fraction */ + if (xsltUTF8Charcmp(the_format, self->decimalPoint) == 0) { + format_info.add_decimal = TRUE; + the_format += xsltUTF8Size(the_format); /* Skip over the decimal */ + } + + while (*the_format != 0) { + + if (xsltUTF8Charcmp(the_format, self->zeroDigit) == 0) { + if (format_info.frac_hash != 0) { + found_error = 1; + goto OUTPUT_NUMBER; + } + format_info.frac_digits++; + } else if (xsltUTF8Charcmp(the_format, self->digit) == 0) { + format_info.frac_hash++; + } else if (xsltUTF8Charcmp(the_format, self->percent) == 0) { + if (format_info.is_multiplier_set) { + found_error = 1; + goto OUTPUT_NUMBER; + } + delayed_multiplier = 100; + if ((len = xsltUTF8Size(the_format)) < 1) { + found_error = 1; + goto OUTPUT_NUMBER; + } + the_format += len; + continue; /* while */ + } else if (xsltUTF8Charcmp(the_format, self->permille) == 0) { + if (format_info.is_multiplier_set) { + found_error = 1; + goto OUTPUT_NUMBER; + } + delayed_multiplier = 1000; + if ((len = xsltUTF8Size(the_format)) < 1) { + found_error = 1; + goto OUTPUT_NUMBER; + } + the_format += len; + continue; /* while */ + } else if (xsltUTF8Charcmp(the_format, self->grouping) != 0) { + break; /* while */ + } + if ((len = xsltUTF8Size(the_format)) < 1) { + found_error = 1; + goto OUTPUT_NUMBER; + } + the_format += len; + if (delayed_multiplier != 0) { + format_info.multiplier = delayed_multiplier; + delayed_multiplier = 0; + format_info.is_multiplier_set = TRUE; + } + } + + /* + * If delayed_multiplier is set after processing the + * "number" part, should be in suffix + */ + if (delayed_multiplier != 0) { + the_format -= len; + delayed_multiplier = 0; + } + + suffix = the_format; + suffix_length = xsltFormatNumberPreSuffix(self, &the_format, &format_info); + if ( (suffix_length < 0) || + ((*the_format != 0) && + (xsltUTF8Charcmp(the_format, self->patternSeparator) != 0)) ) { + found_error = 1; + goto OUTPUT_NUMBER; + } + + /* + * We have processed the +ve prefix, number part and +ve suffix. + * If the number is -ve, we must substitute the -ve prefix / suffix + */ + if (number < 0) { + /* + * Note that j is the number of UTF8 chars before the separator, + * not the number of bytes! (bug 151975) + */ + j = xmlUTF8Strloc(format, self->patternSeparator); + if (j < 0) { + /* No -ve pattern present, so use default signing */ + default_sign = 1; + } + else { + /* Skip over pattern separator (accounting for UTF8) */ + the_format = (xmlChar *)xmlUTF8Strpos(format, j + 1); + /* + * Flag changes interpretation of percent/permille + * in -ve pattern + */ + format_info.is_negative_pattern = TRUE; + format_info.is_multiplier_set = FALSE; + + /* First do the -ve prefix */ + nprefix = the_format; + nprefix_length = xsltFormatNumberPreSuffix(self, + &the_format, &format_info); + if (nprefix_length<0) { + found_error = 1; + goto OUTPUT_NUMBER; + } + + while (*the_format != 0) { + if ( (xsltUTF8Charcmp(the_format, (self)->percent) == 0) || + (xsltUTF8Charcmp(the_format, (self)->permille)== 0) ) { + if (format_info.is_multiplier_set) { + found_error = 1; + goto OUTPUT_NUMBER; + } + format_info.is_multiplier_set = TRUE; + delayed_multiplier = 1; + } + else if (IS_SPECIAL(self, the_format)) + delayed_multiplier = 0; + else + break; /* while */ + if ((len = xsltUTF8Size(the_format)) < 1) { + found_error = 1; + goto OUTPUT_NUMBER; + } + the_format += len; + } + if (delayed_multiplier != 0) { + format_info.is_multiplier_set = FALSE; + the_format -= len; + } + + /* Finally do the -ve suffix */ + if (*the_format != 0) { + nsuffix = the_format; + nsuffix_length = xsltFormatNumberPreSuffix(self, + &the_format, &format_info); + if (nsuffix_length < 0) { + found_error = 1; + goto OUTPUT_NUMBER; + } + } + else + nsuffix_length = 0; + if (*the_format != 0) { + found_error = 1; + goto OUTPUT_NUMBER; + } + /* + * Here's another Java peculiarity: + * if -ve prefix/suffix == +ve ones, discard & use default + */ + if ((nprefix_length != prefix_length) || + (nsuffix_length != suffix_length) || + ((nprefix_length > 0) && + (xmlStrncmp(nprefix, prefix, prefix_length) !=0 )) || + ((nsuffix_length > 0) && + (xmlStrncmp(nsuffix, suffix, suffix_length) !=0 ))) { + prefix = nprefix; + prefix_length = nprefix_length; + suffix = nsuffix; + suffix_length = nsuffix_length; + } /* else { + default_sign = 1; + } + */ + } + } + +OUTPUT_NUMBER: + if (found_error != 0) { + xsltTransformError(NULL, NULL, NULL, + "xsltFormatNumberConversion : " + "error in format string '%s', using default\n", format); + default_sign = (number < 0.0) ? 1 : 0; + prefix_length = suffix_length = 0; + format_info.integer_hash = 0; + format_info.integer_digits = 1; + format_info.frac_digits = 1; + format_info.frac_hash = 4; + format_info.group = -1; + format_info.multiplier = 1; + format_info.add_decimal = TRUE; + } + + /* Ready to output our number. First see if "default sign" is required */ + if (default_sign != 0) + xmlBufferAdd(buffer, self->minusSign, xsltUTF8Size(self->minusSign)); + + /* Put the prefix into the buffer */ + for (j = 0; j < prefix_length; j++) { + if ((pchar = *prefix++) == SYMBOL_QUOTE) { + len = xsltUTF8Size(prefix); + xmlBufferAdd(buffer, prefix, len); + prefix += len; + j += len - 1; /* length of symbol less length of quote */ + } else + xmlBufferAdd(buffer, &pchar, 1); + } + + /* Next do the integer part of the number */ + number = fabs(number) * (double)format_info.multiplier; + scale = pow(10.0, (double)(format_info.frac_digits + format_info.frac_hash)); + number = floor((scale * number + 0.5)) / scale; + if ((self->grouping != NULL) && + (self->grouping[0] != 0)) { + + len = xmlStrlen(self->grouping); + pchar = xsltGetUTF8Char(self->grouping, &len); + xsltNumberFormatDecimal(buffer, floor(number), self->zeroDigit[0], + format_info.integer_digits, + format_info.group, + pchar, len); + } else + xsltNumberFormatDecimal(buffer, floor(number), self->zeroDigit[0], + format_info.integer_digits, + format_info.group, + ',', 1); + + /* Special case: java treats '.#' like '.0', '.##' like '.0#', etc. */ + if ((format_info.integer_digits + format_info.integer_hash + + format_info.frac_digits == 0) && (format_info.frac_hash > 0)) { + ++format_info.frac_digits; + --format_info.frac_hash; + } + + /* Add leading zero, if required */ + if ((floor(number) == 0) && + (format_info.integer_digits + format_info.frac_digits == 0)) { + xmlBufferAdd(buffer, self->zeroDigit, xsltUTF8Size(self->zeroDigit)); + } + + /* Next the fractional part, if required */ + if (format_info.frac_digits + format_info.frac_hash == 0) { + if (format_info.add_decimal) + xmlBufferAdd(buffer, self->decimalPoint, + xsltUTF8Size(self->decimalPoint)); + } + else { + number -= floor(number); + if ((number != 0) || (format_info.frac_digits != 0)) { + xmlBufferAdd(buffer, self->decimalPoint, + xsltUTF8Size(self->decimalPoint)); + number = floor(scale * number + 0.5); + for (j = format_info.frac_hash; j > 0; j--) { + if (fmod(number, 10.0) >= 1.0) + break; /* for */ + number /= 10.0; + } + xsltNumberFormatDecimal(buffer, floor(number), self->zeroDigit[0], + format_info.frac_digits + j, + 0, 0, 0); + } + } + /* Put the suffix into the buffer */ + for (j = 0; j < suffix_length; j++) { + if ((pchar = *suffix++) == SYMBOL_QUOTE) { + len = xsltUTF8Size(suffix); + xmlBufferAdd(buffer, suffix, len); + suffix += len; + j += len - 1; /* length of symbol less length of escape */ + } else + xmlBufferAdd(buffer, &pchar, 1); + } + + *result = xmlStrdup(xmlBufferContent(buffer)); + xmlBufferFree(buffer); + return status; +} + diff --git a/libxslt/numbersInternals.h b/libxslt/numbersInternals.h new file mode 100644 index 0000000..8524592 --- /dev/null +++ b/libxslt/numbersInternals.h @@ -0,0 +1,73 @@ +/* + * Summary: Implementation of the XSLT number functions + * Description: Implementation of the XSLT number functions + * + * Copy: See Copyright for the status of this software. + * + * Author: Bjorn Reese and Daniel Veillard + */ + +#ifndef __XML_XSLT_NUMBERSINTERNALS_H__ +#define __XML_XSLT_NUMBERSINTERNALS_H__ + +#include +#include "xsltexports.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct _xsltCompMatch; + +/** + * xsltNumberData: + * + * This data structure is just a wrapper to pass xsl:number data in. + */ +typedef struct _xsltNumberData xsltNumberData; +typedef xsltNumberData *xsltNumberDataPtr; + +struct _xsltNumberData { + const xmlChar *level; + const xmlChar *count; + const xmlChar *from; + const xmlChar *value; + const xmlChar *format; + int has_format; + int digitsPerGroup; + int groupingCharacter; + int groupingCharacterLen; + xmlDocPtr doc; + xmlNodePtr node; + struct _xsltCompMatch *countPat; + struct _xsltCompMatch *fromPat; + + /* + * accelerators + */ +}; + +/** + * xsltFormatNumberInfo,: + * + * This data structure lists the various parameters needed to format numbers. + */ +typedef struct _xsltFormatNumberInfo xsltFormatNumberInfo; +typedef xsltFormatNumberInfo *xsltFormatNumberInfoPtr; + +struct _xsltFormatNumberInfo { + int integer_hash; /* Number of '#' in integer part */ + int integer_digits; /* Number of '0' in integer part */ + int frac_digits; /* Number of '0' in fractional part */ + int frac_hash; /* Number of '#' in fractional part */ + int group; /* Number of chars per display 'group' */ + int multiplier; /* Scaling for percent or permille */ + char add_decimal; /* Flag for whether decimal point appears in pattern */ + char is_multiplier_set; /* Flag to catch multiple occurences of percent/permille */ + char is_negative_pattern;/* Flag for processing -ve prefix/suffix */ +}; + +#ifdef __cplusplus +} +#endif +#endif /* __XML_XSLT_NUMBERSINTERNALS_H__ */ diff --git a/libxslt/pattern.c b/libxslt/pattern.c new file mode 100644 index 0000000..e211a01 --- /dev/null +++ b/libxslt/pattern.c @@ -0,0 +1,2593 @@ +/* + * pattern.c: Implemetation of the template match compilation and lookup + * + * Reference: + * http://www.w3.org/TR/1999/REC-xslt-19991116 + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +/* + * TODO: handle pathological cases like *[*[@a="b"]] + * TODO: detect [number] at compilation, optimize accordingly + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "imports.h" +#include "templates.h" +#include "keys.h" +#include "pattern.h" +#include "documents.h" + +#ifdef WITH_XSLT_DEBUG +#define WITH_XSLT_DEBUG_PATTERN +#endif + +/* + * Types are private: + */ + +typedef enum { + XSLT_OP_END=0, + XSLT_OP_ROOT, + XSLT_OP_ELEM, + XSLT_OP_ATTR, + XSLT_OP_PARENT, + XSLT_OP_ANCESTOR, + XSLT_OP_ID, + XSLT_OP_KEY, + XSLT_OP_NS, + XSLT_OP_ALL, + XSLT_OP_PI, + XSLT_OP_COMMENT, + XSLT_OP_TEXT, + XSLT_OP_NODE, + XSLT_OP_PREDICATE +} xsltOp; + +typedef enum { + AXIS_CHILD=1, + AXIS_ATTRIBUTE +} xsltAxis; + +typedef struct _xsltStepState xsltStepState; +typedef xsltStepState *xsltStepStatePtr; +struct _xsltStepState { + int step; + xmlNodePtr node; +}; + +typedef struct _xsltStepStates xsltStepStates; +typedef xsltStepStates *xsltStepStatesPtr; +struct _xsltStepStates { + int nbstates; + int maxstates; + xsltStepStatePtr states; +}; + +typedef struct _xsltStepOp xsltStepOp; +typedef xsltStepOp *xsltStepOpPtr; +struct _xsltStepOp { + xsltOp op; + xmlChar *value; + xmlChar *value2; + xmlChar *value3; + xmlXPathCompExprPtr comp; + /* + * Optimisations for count + */ + int previousExtra; + int indexExtra; + int lenExtra; +}; + +struct _xsltCompMatch { + struct _xsltCompMatch *next; /* siblings in the name hash */ + float priority; /* the priority */ + const xmlChar *pattern; /* the pattern */ + const xmlChar *mode; /* the mode */ + const xmlChar *modeURI; /* the mode URI */ + xsltTemplatePtr template; /* the associated template */ + + int direct; + /* TODO fix the statically allocated size steps[] */ + int nbStep; + int maxStep; + xmlNsPtr *nsList; /* the namespaces in scope */ + int nsNr; /* the number of namespaces in scope */ + xsltStepOpPtr steps; /* ops for computation */ +}; + +typedef struct _xsltParserContext xsltParserContext; +typedef xsltParserContext *xsltParserContextPtr; +struct _xsltParserContext { + xsltStylesheetPtr style; /* the stylesheet */ + xsltTransformContextPtr ctxt; /* the transformation or NULL */ + const xmlChar *cur; /* the current char being parsed */ + const xmlChar *base; /* the full expression */ + xmlDocPtr doc; /* the source document */ + xmlNodePtr elem; /* the source element */ + int error; /* error code */ + xsltCompMatchPtr comp; /* the result */ +}; + +/************************************************************************ + * * + * Type functions * + * * + ************************************************************************/ + +/** + * xsltNewCompMatch: + * + * Create a new XSLT CompMatch + * + * Returns the newly allocated xsltCompMatchPtr or NULL in case of error + */ +static xsltCompMatchPtr +xsltNewCompMatch(void) { + xsltCompMatchPtr cur; + + cur = (xsltCompMatchPtr) xmlMalloc(sizeof(xsltCompMatch)); + if (cur == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltNewCompMatch : out of memory error\n"); + return(NULL); + } + memset(cur, 0, sizeof(xsltCompMatch)); + cur->maxStep = 10; + cur->nbStep = 0; + cur-> steps = (xsltStepOpPtr) xmlMalloc(sizeof(xsltStepOp) * + cur->maxStep); + if (cur->steps == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltNewCompMatch : out of memory error\n"); + xmlFree(cur); + return(NULL); + } + cur->nsNr = 0; + cur->nsList = NULL; + cur->direct = 0; + return(cur); +} + +/** + * xsltFreeCompMatch: + * @comp: an XSLT comp + * + * Free up the memory allocated by @comp + */ +static void +xsltFreeCompMatch(xsltCompMatchPtr comp) { + xsltStepOpPtr op; + int i; + + if (comp == NULL) + return; + if (comp->pattern != NULL) + xmlFree((xmlChar *)comp->pattern); + if (comp->nsList != NULL) + xmlFree(comp->nsList); + for (i = 0;i < comp->nbStep;i++) { + op = &comp->steps[i]; + if (op->value != NULL) + xmlFree(op->value); + if (op->value2 != NULL) + xmlFree(op->value2); + if (op->value3 != NULL) + xmlFree(op->value3); + if (op->comp != NULL) + xmlXPathFreeCompExpr(op->comp); + } + xmlFree(comp->steps); + memset(comp, -1, sizeof(xsltCompMatch)); + xmlFree(comp); +} + +/** + * xsltFreeCompMatchList: + * @comp: an XSLT comp list + * + * Free up the memory allocated by all the elements of @comp + */ +void +xsltFreeCompMatchList(xsltCompMatchPtr comp) { + xsltCompMatchPtr cur; + + while (comp != NULL) { + cur = comp; + comp = comp->next; + xsltFreeCompMatch(cur); + } +} + +/** + * xsltNormalizeCompSteps: + * @payload: pointer to template hash table entry + * @data: pointer to the stylesheet + * @name: template match name + * + * This is a hashtable scanner function to normalize the compiled + * steps of an imported stylesheet. + */ +void xsltNormalizeCompSteps(void *payload, + void *data, const xmlChar *name ATTRIBUTE_UNUSED) { + xsltCompMatchPtr comp = payload; + xsltStylesheetPtr style = data; + int ix; + + for (ix = 0; ix < comp->nbStep; ix++) { + comp->steps[ix].previousExtra += style->extrasNr; + comp->steps[ix].indexExtra += style->extrasNr; + comp->steps[ix].lenExtra += style->extrasNr; + } +} + +/** + * xsltNewParserContext: + * @style: the stylesheet + * @ctxt: the transformation context, if done at run-time + * + * Create a new XSLT ParserContext + * + * Returns the newly allocated xsltParserContextPtr or NULL in case of error + */ +static xsltParserContextPtr +xsltNewParserContext(xsltStylesheetPtr style, xsltTransformContextPtr ctxt) { + xsltParserContextPtr cur; + + cur = (xsltParserContextPtr) xmlMalloc(sizeof(xsltParserContext)); + if (cur == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltNewParserContext : malloc failed\n"); + return(NULL); + } + memset(cur, 0, sizeof(xsltParserContext)); + cur->style = style; + cur->ctxt = ctxt; + return(cur); +} + +/** + * xsltFreeParserContext: + * @ctxt: an XSLT parser context + * + * Free up the memory allocated by @ctxt + */ +static void +xsltFreeParserContext(xsltParserContextPtr ctxt) { + if (ctxt == NULL) + return; + memset(ctxt, -1, sizeof(xsltParserContext)); + xmlFree(ctxt); +} + +/** + * xsltCompMatchAdd: + * @comp: the compiled match expression + * @op: an op + * @value: the first value + * @value2: the second value + * @novar: flag to set XML_XPATH_NOVAR + * + * Add an step to an XSLT Compiled Match + * + * Returns -1 in case of failure, 0 otherwise. + */ +static int +xsltCompMatchAdd(xsltParserContextPtr ctxt, xsltCompMatchPtr comp, + xsltOp op, xmlChar * value, xmlChar * value2, int novar) +{ + if (comp->nbStep >= comp->maxStep) { + xsltStepOpPtr tmp; + + tmp = (xsltStepOpPtr) xmlRealloc(comp->steps, comp->maxStep * 2 * + sizeof(xsltStepOp)); + if (tmp == NULL) { + xsltGenericError(xsltGenericErrorContext, + "xsltCompMatchAdd: memory re-allocation failure.\n"); + if (ctxt->style != NULL) + ctxt->style->errors++; + if (value) + xmlFree(value); + if (value2) + xmlFree(value2); + return (-1); + } + comp->maxStep *= 2; + comp->steps = tmp; + } + comp->steps[comp->nbStep].op = op; + comp->steps[comp->nbStep].value = value; + comp->steps[comp->nbStep].value2 = value2; + comp->steps[comp->nbStep].value3 = NULL; + comp->steps[comp->nbStep].comp = NULL; + if (ctxt->ctxt != NULL) { + comp->steps[comp->nbStep].previousExtra = + xsltAllocateExtraCtxt(ctxt->ctxt); + comp->steps[comp->nbStep].indexExtra = + xsltAllocateExtraCtxt(ctxt->ctxt); + comp->steps[comp->nbStep].lenExtra = + xsltAllocateExtraCtxt(ctxt->ctxt); + } else { + comp->steps[comp->nbStep].previousExtra = + xsltAllocateExtra(ctxt->style); + comp->steps[comp->nbStep].indexExtra = + xsltAllocateExtra(ctxt->style); + comp->steps[comp->nbStep].lenExtra = + xsltAllocateExtra(ctxt->style); + } + if (op == XSLT_OP_PREDICATE) { + xmlXPathContextPtr xctxt; + + if (ctxt->style != NULL) + xctxt = xmlXPathNewContext(ctxt->style->doc); + else + xctxt = xmlXPathNewContext(NULL); +#ifdef XML_XPATH_NOVAR + if (novar != 0) + xctxt->flags = XML_XPATH_NOVAR; +#endif + if (ctxt->style != NULL) + xctxt->dict = ctxt->style->dict; + comp->steps[comp->nbStep].comp = xmlXPathCtxtCompile(xctxt, value); + xmlXPathFreeContext(xctxt); + if (comp->steps[comp->nbStep].comp == NULL) { + xsltTransformError(NULL, ctxt->style, ctxt->elem, + "Failed to compile predicate\n"); + if (ctxt->style != NULL) + ctxt->style->errors++; + } + } + comp->nbStep++; + return (0); +} + +/** + * xsltSwapTopCompMatch: + * @comp: the compiled match expression + * + * reverse the two top steps. + */ +static void +xsltSwapTopCompMatch(xsltCompMatchPtr comp) { + int i; + int j = comp->nbStep - 1; + + if (j > 0) { + register xmlChar *tmp; + register xsltOp op; + register xmlXPathCompExprPtr expr; + register int t; + i = j - 1; + tmp = comp->steps[i].value; + comp->steps[i].value = comp->steps[j].value; + comp->steps[j].value = tmp; + tmp = comp->steps[i].value2; + comp->steps[i].value2 = comp->steps[j].value2; + comp->steps[j].value2 = tmp; + tmp = comp->steps[i].value3; + comp->steps[i].value3 = comp->steps[j].value3; + comp->steps[j].value3 = tmp; + op = comp->steps[i].op; + comp->steps[i].op = comp->steps[j].op; + comp->steps[j].op = op; + expr = comp->steps[i].comp; + comp->steps[i].comp = comp->steps[j].comp; + comp->steps[j].comp = expr; + t = comp->steps[i].previousExtra; + comp->steps[i].previousExtra = comp->steps[j].previousExtra; + comp->steps[j].previousExtra = t; + t = comp->steps[i].indexExtra; + comp->steps[i].indexExtra = comp->steps[j].indexExtra; + comp->steps[j].indexExtra = t; + t = comp->steps[i].lenExtra; + comp->steps[i].lenExtra = comp->steps[j].lenExtra; + comp->steps[j].lenExtra = t; + } +} + +/** + * xsltReverseCompMatch: + * @ctxt: the parser context + * @comp: the compiled match expression + * + * reverse all the stack of expressions + */ +static void +xsltReverseCompMatch(xsltParserContextPtr ctxt, xsltCompMatchPtr comp) { + int i = 0; + int j = comp->nbStep - 1; + + while (j > i) { + register xmlChar *tmp; + register xsltOp op; + register xmlXPathCompExprPtr expr; + register int t; + + tmp = comp->steps[i].value; + comp->steps[i].value = comp->steps[j].value; + comp->steps[j].value = tmp; + tmp = comp->steps[i].value2; + comp->steps[i].value2 = comp->steps[j].value2; + comp->steps[j].value2 = tmp; + tmp = comp->steps[i].value3; + comp->steps[i].value3 = comp->steps[j].value3; + comp->steps[j].value3 = tmp; + op = comp->steps[i].op; + comp->steps[i].op = comp->steps[j].op; + comp->steps[j].op = op; + expr = comp->steps[i].comp; + comp->steps[i].comp = comp->steps[j].comp; + comp->steps[j].comp = expr; + t = comp->steps[i].previousExtra; + comp->steps[i].previousExtra = comp->steps[j].previousExtra; + comp->steps[j].previousExtra = t; + t = comp->steps[i].indexExtra; + comp->steps[i].indexExtra = comp->steps[j].indexExtra; + comp->steps[j].indexExtra = t; + t = comp->steps[i].lenExtra; + comp->steps[i].lenExtra = comp->steps[j].lenExtra; + comp->steps[j].lenExtra = t; + j--; + i++; + } + xsltCompMatchAdd(ctxt, comp, XSLT_OP_END, NULL, NULL, 0); + + /* + * Detect consecutive XSLT_OP_PREDICATE and predicates on ops which + * haven't been optimized yet indicating a direct matching should be done. + */ + for (i = 0;i < comp->nbStep - 1;i++) { + xsltOp op = comp->steps[i].op; + + if ((op != XSLT_OP_ELEM) && + (op != XSLT_OP_ALL) && + (comp->steps[i + 1].op == XSLT_OP_PREDICATE)) { + + comp->direct = 1; + if (comp->pattern[0] != '/') { + xmlChar *query; + + query = xmlStrdup((const xmlChar *)"//"); + query = xmlStrcat(query, comp->pattern); + + xmlFree((xmlChar *) comp->pattern); + comp->pattern = query; + } + break; + } + } +} + +/************************************************************************ + * * + * The interpreter for the precompiled patterns * + * * + ************************************************************************/ + +static int +xsltPatPushState(xsltTransformContextPtr ctxt, xsltStepStates *states, + int step, xmlNodePtr node) { + if ((states->states == NULL) || (states->maxstates <= 0)) { + states->maxstates = 4; + states->nbstates = 0; + states->states = xmlMalloc(4 * sizeof(xsltStepState)); + } + else if (states->maxstates <= states->nbstates) { + xsltStepState *tmp; + + tmp = (xsltStepStatePtr) xmlRealloc(states->states, + 2 * states->maxstates * sizeof(xsltStepState)); + if (tmp == NULL) { + xsltGenericError(xsltGenericErrorContext, + "xsltPatPushState: memory re-allocation failure.\n"); + ctxt->state = XSLT_STATE_STOPPED; + return(-1); + } + states->states = tmp; + states->maxstates *= 2; + } + states->states[states->nbstates].step = step; + states->states[states->nbstates++].node = node; +#if 0 + fprintf(stderr, "Push: %d, %s\n", step, node->name); +#endif + return(0); +} + +/** + * xsltTestCompMatchDirect: + * @ctxt: a XSLT process context + * @comp: the precompiled pattern + * @node: a node + * @nsList: the namespaces in scope + * @nsNr: the number of namespaces in scope + * + * Test whether the node matches the pattern, do a direct evalutation + * and not a step by step evaluation. + * + * Returns 1 if it matches, 0 if it doesn't and -1 in case of failure + */ +static int +xsltTestCompMatchDirect(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, + xmlNodePtr node, xmlNsPtr *nsList, int nsNr) { + xsltStepOpPtr sel = NULL; + xmlDocPtr prevdoc; + xmlDocPtr doc; + xmlXPathObjectPtr list; + int ix, j; + int nocache = 0; + int isRVT; + + doc = node->doc; + if (XSLT_IS_RES_TREE_FRAG(doc)) + isRVT = 1; + else + isRVT = 0; + sel = &comp->steps[0]; /* store extra in first step arbitrarily */ + + prevdoc = (xmlDocPtr) + XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr); + ix = XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival); + list = (xmlXPathObjectPtr) + XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra); + + if ((list == NULL) || (prevdoc != doc)) { + xmlXPathObjectPtr newlist; + xmlNodePtr parent = node->parent; + xmlDocPtr olddoc; + xmlNodePtr oldnode; + int oldNsNr, oldContextSize, oldProximityPosition; + xmlNsPtr *oldNamespaces; + + oldnode = ctxt->xpathCtxt->node; + olddoc = ctxt->xpathCtxt->doc; + oldNsNr = ctxt->xpathCtxt->nsNr; + oldNamespaces = ctxt->xpathCtxt->namespaces; + oldContextSize = ctxt->xpathCtxt->contextSize; + oldProximityPosition = ctxt->xpathCtxt->proximityPosition; + ctxt->xpathCtxt->node = node; + ctxt->xpathCtxt->doc = doc; + ctxt->xpathCtxt->namespaces = nsList; + ctxt->xpathCtxt->nsNr = nsNr; + newlist = xmlXPathEval(comp->pattern, ctxt->xpathCtxt); + ctxt->xpathCtxt->node = oldnode; + ctxt->xpathCtxt->doc = olddoc; + ctxt->xpathCtxt->namespaces = oldNamespaces; + ctxt->xpathCtxt->nsNr = oldNsNr; + ctxt->xpathCtxt->contextSize = oldContextSize; + ctxt->xpathCtxt->proximityPosition = oldProximityPosition; + if (newlist == NULL) + return(-1); + if (newlist->type != XPATH_NODESET) { + xmlXPathFreeObject(newlist); + return(-1); + } + ix = 0; + + if ((parent == NULL) || (node->doc == NULL) || isRVT) + nocache = 1; + + if (nocache == 0) { + if (list != NULL) + xmlXPathFreeObject(list); + list = newlist; + + XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra) = + (void *) list; + XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr) = + (void *) doc; + XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) = + 0; + XSLT_RUNTIME_EXTRA_FREE(ctxt, sel->lenExtra) = + (xmlFreeFunc) xmlXPathFreeObject; + } else + list = newlist; + } + if ((list->nodesetval == NULL) || + (list->nodesetval->nodeNr <= 0)) { + if (nocache == 1) + xmlXPathFreeObject(list); + return(0); + } + /* TODO: store the index and use it for the scan */ + if (ix == 0) { + for (j = 0;j < list->nodesetval->nodeNr;j++) { + if (list->nodesetval->nodeTab[j] == node) { + if (nocache == 1) + xmlXPathFreeObject(list); + return(1); + } + } + } else { + } + if (nocache == 1) + xmlXPathFreeObject(list); + return(0); +} + +/** + * xsltTestPredicateMatch: + * @ctxt: a XSLT process context + * @comp: the precompiled pattern + * @node: a node + * @step: the predicate step + * @sel: the previous step + * + * Test whether the node matches the predicate + * + * Returns 1 if it matches, 0 if it doesn't and -1 in case of failure + */ +static int +xsltTestPredicateMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, + xmlNodePtr node, xsltStepOpPtr step, + xsltStepOpPtr sel) { + xmlNodePtr oldNode; + xmlDocPtr doc; + int oldCS, oldCP; + int pos = 0, len = 0; + int isRVT; + int match; + + if (step->value == NULL) + return(0); + if (step->comp == NULL) + return(0); + + doc = node->doc; + if (XSLT_IS_RES_TREE_FRAG(doc)) + isRVT = 1; + else + isRVT = 0; + + /* + * Recompute contextSize and proximityPosition. + * + * TODO: Make this work for additional ops. Currently, only XSLT_OP_ELEM + * and XSLT_OP_ALL are supported. + */ + oldCS = ctxt->xpathCtxt->contextSize; + oldCP = ctxt->xpathCtxt->proximityPosition; + if ((sel != NULL) && + (sel->op == XSLT_OP_ELEM) && + (sel->value != NULL) && + (node->type == XML_ELEMENT_NODE) && + (node->parent != NULL)) { + xmlNodePtr previous; + int nocache = 0; + + previous = (xmlNodePtr) + XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr); + if ((previous != NULL) && + (previous->parent == node->parent)) { + /* + * just walk back to adjust the index + */ + int indx = 0; + xmlNodePtr sibling = node; + + while (sibling != NULL) { + if (sibling == previous) + break; + if ((sibling->type == XML_ELEMENT_NODE) && + (previous->name != NULL) && + (sibling->name != NULL) && + (previous->name[0] == sibling->name[0]) && + (xmlStrEqual(previous->name, sibling->name))) + { + if ((sel->value2 == NULL) || + ((sibling->ns != NULL) && + (xmlStrEqual(sel->value2, sibling->ns->href)))) + indx++; + } + sibling = sibling->prev; + } + if (sibling == NULL) { + /* hum going backward in document order ... */ + indx = 0; + sibling = node; + while (sibling != NULL) { + if (sibling == previous) + break; + if ((sibling->type == XML_ELEMENT_NODE) && + (previous->name != NULL) && + (sibling->name != NULL) && + (previous->name[0] == sibling->name[0]) && + (xmlStrEqual(previous->name, sibling->name))) + { + if ((sel->value2 == NULL) || + ((sibling->ns != NULL) && + (xmlStrEqual(sel->value2, + sibling->ns->href)))) + { + indx--; + } + } + sibling = sibling->next; + } + } + if (sibling != NULL) { + pos = XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) + indx; + /* + * If the node is in a Value Tree we need to + * save len, but cannot cache the node! + * (bugs 153137 and 158840) + */ + if (node->doc != NULL) { + len = XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra, ival); + if (!isRVT) { + XSLT_RUNTIME_EXTRA(ctxt, + sel->previousExtra, ptr) = node; + XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) = pos; + } + } + } else + pos = 0; + } else { + /* + * recompute the index + */ + xmlNodePtr parent = node->parent; + xmlNodePtr siblings = NULL; + + if (parent) siblings = parent->children; + + while (siblings != NULL) { + if (siblings->type == XML_ELEMENT_NODE) { + if (siblings == node) { + len++; + pos = len; + } else if ((node->name != NULL) && + (siblings->name != NULL) && + (node->name[0] == siblings->name[0]) && + (xmlStrEqual(node->name, siblings->name))) { + if ((sel->value2 == NULL) || + ((siblings->ns != NULL) && + (xmlStrEqual(sel->value2, siblings->ns->href)))) + len++; + } + } + siblings = siblings->next; + } + if ((parent == NULL) || (node->doc == NULL)) + nocache = 1; + else { + while (parent->parent != NULL) + parent = parent->parent; + if (((parent->type != XML_DOCUMENT_NODE) && + (parent->type != XML_HTML_DOCUMENT_NODE)) || + (parent != (xmlNodePtr) node->doc)) + nocache = 1; + } + } + if (pos != 0) { + ctxt->xpathCtxt->contextSize = len; + ctxt->xpathCtxt->proximityPosition = pos; + /* + * If the node is in a Value Tree we cannot + * cache it ! + */ + if ((!isRVT) && (node->doc != NULL) && + (nocache == 0)) { + XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr) = node; + XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) = pos; + XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra, ival) = len; + } + } + } else if ((sel != NULL) && (sel->op == XSLT_OP_ALL) && + (node->type == XML_ELEMENT_NODE)) { + xmlNodePtr previous; + int nocache = 0; + + previous = (xmlNodePtr) + XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr); + if ((previous != NULL) && + (previous->parent == node->parent)) { + /* + * just walk back to adjust the index + */ + int indx = 0; + xmlNodePtr sibling = node; + + while (sibling != NULL) { + if (sibling == previous) + break; + if (sibling->type == XML_ELEMENT_NODE) + indx++; + sibling = sibling->prev; + } + if (sibling == NULL) { + /* hum going backward in document order ... */ + indx = 0; + sibling = node; + while (sibling != NULL) { + if (sibling == previous) + break; + if (sibling->type == XML_ELEMENT_NODE) + indx--; + sibling = sibling->next; + } + } + if (sibling != NULL) { + pos = XSLT_RUNTIME_EXTRA(ctxt, + sel->indexExtra, ival) + indx; + /* + * If the node is in a Value Tree we cannot + * cache it ! + */ + if ((node->doc != NULL) && !isRVT) { + len = XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra, ival); + XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr) = node; + XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) = pos; + } + } else + pos = 0; + } else { + /* + * recompute the index + */ + xmlNodePtr parent = node->parent; + xmlNodePtr siblings = NULL; + + if (parent) siblings = parent->children; + + while (siblings != NULL) { + if (siblings->type == XML_ELEMENT_NODE) { + len++; + if (siblings == node) { + pos = len; + } + } + siblings = siblings->next; + } + if ((parent == NULL) || (node->doc == NULL)) + nocache = 1; + else { + while (parent->parent != NULL) + parent = parent->parent; + if (((parent->type != XML_DOCUMENT_NODE) && + (parent->type != XML_HTML_DOCUMENT_NODE)) || + (parent != (xmlNodePtr) node->doc)) + nocache = 1; + } + } + if (pos != 0) { + ctxt->xpathCtxt->contextSize = len; + ctxt->xpathCtxt->proximityPosition = pos; + /* + * If the node is in a Value Tree we cannot + * cache it ! + */ + if ((node->doc != NULL) && (nocache == 0) && !isRVT) { + XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr) = node; + XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) = pos; + XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra, ival) = len; + } + } + } + + oldNode = ctxt->node; + ctxt->node = node; + + match = xsltEvalXPathPredicate(ctxt, step->comp, comp->nsList, comp->nsNr); + + if (pos != 0) { + ctxt->xpathCtxt->contextSize = oldCS; + ctxt->xpathCtxt->proximityPosition = oldCP; + } + ctxt->node = oldNode; + + return match; +} + +/** + * xsltTestCompMatch: + * @ctxt: a XSLT process context + * @comp: the precompiled pattern + * @node: a node + * @mode: the mode name or NULL + * @modeURI: the mode URI or NULL + * + * Test whether the node matches the pattern + * + * Returns 1 if it matches, 0 if it doesn't and -1 in case of failure + */ +static int +xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp, + xmlNodePtr matchNode, const xmlChar *mode, + const xmlChar *modeURI) { + int i; + xmlNodePtr node = matchNode; + xsltStepOpPtr step, sel = NULL; + xsltStepStates states = {0, 0, NULL}; /* // may require backtrack */ + + if ((comp == NULL) || (node == NULL) || (ctxt == NULL)) { + xsltTransformError(ctxt, NULL, node, + "xsltTestCompMatch: null arg\n"); + return(-1); + } + if (mode != NULL) { + if (comp->mode == NULL) + return(0); + /* + * both mode strings must be interned on the stylesheet dictionary + */ + if (comp->mode != mode) + return(0); + } else { + if (comp->mode != NULL) + return(0); + } + if (modeURI != NULL) { + if (comp->modeURI == NULL) + return(0); + /* + * both modeURI strings must be interned on the stylesheet dictionary + */ + if (comp->modeURI != modeURI) + return(0); + } else { + if (comp->modeURI != NULL) + return(0); + } + + i = 0; +restart: + for (;i < comp->nbStep;i++) { + step = &comp->steps[i]; + if (step->op != XSLT_OP_PREDICATE) + sel = step; + switch (step->op) { + case XSLT_OP_END: + goto found; + case XSLT_OP_ROOT: + if ((node->type == XML_DOCUMENT_NODE) || +#ifdef LIBXML_DOCB_ENABLED + (node->type == XML_DOCB_DOCUMENT_NODE) || +#endif + (node->type == XML_HTML_DOCUMENT_NODE)) + continue; + if ((node->type == XML_ELEMENT_NODE) && (node->name[0] == ' ')) + continue; + goto rollback; + case XSLT_OP_ELEM: + if (node->type != XML_ELEMENT_NODE) + goto rollback; + if (step->value == NULL) + continue; + if (step->value[0] != node->name[0]) + goto rollback; + if (!xmlStrEqual(step->value, node->name)) + goto rollback; + + /* Namespace test */ + if (node->ns == NULL) { + if (step->value2 != NULL) + goto rollback; + } else if (node->ns->href != NULL) { + if (step->value2 == NULL) + goto rollback; + if (!xmlStrEqual(step->value2, node->ns->href)) + goto rollback; + } + continue; + case XSLT_OP_ATTR: + if (node->type != XML_ATTRIBUTE_NODE) + goto rollback; + if (step->value != NULL) { + if (step->value[0] != node->name[0]) + goto rollback; + if (!xmlStrEqual(step->value, node->name)) + goto rollback; + } + /* Namespace test */ + if (node->ns == NULL) { + if (step->value2 != NULL) + goto rollback; + } else if (step->value2 != NULL) { + if (!xmlStrEqual(step->value2, node->ns->href)) + goto rollback; + } + continue; + case XSLT_OP_PARENT: + if ((node->type == XML_DOCUMENT_NODE) || + (node->type == XML_HTML_DOCUMENT_NODE) || +#ifdef LIBXML_DOCB_ENABLED + (node->type == XML_DOCB_DOCUMENT_NODE) || +#endif + (node->type == XML_NAMESPACE_DECL)) + goto rollback; + node = node->parent; + if (node == NULL) + goto rollback; + if (step->value == NULL) + continue; + if (step->value[0] != node->name[0]) + goto rollback; + if (!xmlStrEqual(step->value, node->name)) + goto rollback; + /* Namespace test */ + if (node->ns == NULL) { + if (step->value2 != NULL) + goto rollback; + } else if (node->ns->href != NULL) { + if (step->value2 == NULL) + goto rollback; + if (!xmlStrEqual(step->value2, node->ns->href)) + goto rollback; + } + continue; + case XSLT_OP_ANCESTOR: + /* TODO: implement coalescing of ANCESTOR/NODE ops */ + if (step->value == NULL) { + step = &comp->steps[i+1]; + if (step->op == XSLT_OP_ROOT) + goto found; + /* added NS, ID and KEY as a result of bug 168208 */ + if ((step->op != XSLT_OP_ELEM) && + (step->op != XSLT_OP_ALL) && + (step->op != XSLT_OP_NS) && + (step->op != XSLT_OP_ID) && + (step->op != XSLT_OP_KEY)) + goto rollback; + } + if (node == NULL) + goto rollback; + if ((node->type == XML_DOCUMENT_NODE) || + (node->type == XML_HTML_DOCUMENT_NODE) || +#ifdef LIBXML_DOCB_ENABLED + (node->type == XML_DOCB_DOCUMENT_NODE) || +#endif + (node->type == XML_NAMESPACE_DECL)) + goto rollback; + node = node->parent; + if ((step->op != XSLT_OP_ELEM) && step->op != XSLT_OP_ALL) { + xsltPatPushState(ctxt, &states, i, node); + continue; + } + i++; + if (step->value == NULL) { + xsltPatPushState(ctxt, &states, i - 1, node); + continue; + } + while (node != NULL) { + if ((node->type == XML_ELEMENT_NODE) && + (step->value[0] == node->name[0]) && + (xmlStrEqual(step->value, node->name))) { + /* Namespace test */ + if (node->ns == NULL) { + if (step->value2 == NULL) + break; + } else if (node->ns->href != NULL) { + if ((step->value2 != NULL) && + (xmlStrEqual(step->value2, node->ns->href))) + break; + } + } + node = node->parent; + } + if (node == NULL) + goto rollback; + xsltPatPushState(ctxt, &states, i - 1, node); + continue; + case XSLT_OP_ID: { + /* TODO Handle IDs decently, must be done differently */ + xmlAttrPtr id; + + if (node->type != XML_ELEMENT_NODE) + goto rollback; + + id = xmlGetID(node->doc, step->value); + if ((id == NULL) || (id->parent != node)) + goto rollback; + break; + } + case XSLT_OP_KEY: { + xmlNodeSetPtr list; + int indx; + + list = xsltGetKey(ctxt, step->value, + step->value3, step->value2); + if (list == NULL) + goto rollback; + for (indx = 0;indx < list->nodeNr;indx++) + if (list->nodeTab[indx] == node) + break; + if (indx >= list->nodeNr) + goto rollback; + break; + } + case XSLT_OP_NS: + if (node->type != XML_ELEMENT_NODE) + goto rollback; + if (node->ns == NULL) { + if (step->value != NULL) + goto rollback; + } else if (node->ns->href != NULL) { + if (step->value == NULL) + goto rollback; + if (!xmlStrEqual(step->value, node->ns->href)) + goto rollback; + } + break; + case XSLT_OP_ALL: + if (node->type != XML_ELEMENT_NODE) + goto rollback; + break; + case XSLT_OP_PREDICATE: { + /* + * When there is cascading XSLT_OP_PREDICATE or a predicate + * after an op which hasn't been optimized yet, then use a + * direct computation approach. It's not done directly + * at the beginning of the routine to filter out as much + * as possible this costly computation. + */ + if (comp->direct) { + if (states.states != NULL) { + /* Free the rollback states */ + xmlFree(states.states); + } + return(xsltTestCompMatchDirect(ctxt, comp, matchNode, + comp->nsList, comp->nsNr)); + } + + if (!xsltTestPredicateMatch(ctxt, comp, node, step, sel)) + goto rollback; + + break; + } + case XSLT_OP_PI: + if (node->type != XML_PI_NODE) + goto rollback; + if (step->value != NULL) { + if (!xmlStrEqual(step->value, node->name)) + goto rollback; + } + break; + case XSLT_OP_COMMENT: + if (node->type != XML_COMMENT_NODE) + goto rollback; + break; + case XSLT_OP_TEXT: + if ((node->type != XML_TEXT_NODE) && + (node->type != XML_CDATA_SECTION_NODE)) + goto rollback; + break; + case XSLT_OP_NODE: + switch (node->type) { + case XML_ELEMENT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_PI_NODE: + case XML_COMMENT_NODE: + case XML_TEXT_NODE: + break; + default: + goto rollback; + } + break; + } + } +found: + if (states.states != NULL) { + /* Free the rollback states */ + xmlFree(states.states); + } + return(1); +rollback: + /* got an error try to rollback */ + if (states.states == NULL) + return(0); + if (states.nbstates <= 0) { + xmlFree(states.states); + return(0); + } + states.nbstates--; + i = states.states[states.nbstates].step; + node = states.states[states.nbstates].node; +#if 0 + fprintf(stderr, "Pop: %d, %s\n", i, node->name); +#endif + goto restart; +} + +/** + * xsltTestCompMatchList: + * @ctxt: a XSLT process context + * @node: a node + * @comp: the precompiled pattern list + * + * Test whether the node matches one of the patterns in the list + * + * Returns 1 if it matches, 0 if it doesn't and -1 in case of failure + */ +int +xsltTestCompMatchList(xsltTransformContextPtr ctxt, xmlNodePtr node, + xsltCompMatchPtr comp) { + int ret; + + if ((ctxt == NULL) || (node == NULL)) + return(-1); + while (comp != NULL) { + ret = xsltTestCompMatch(ctxt, comp, node, NULL, NULL); + if (ret == 1) + return(1); + comp = comp->next; + } + return(0); +} + +/************************************************************************ + * * + * Dedicated parser for templates * + * * + ************************************************************************/ + +#define CUR (*ctxt->cur) +#define SKIP(val) ctxt->cur += (val) +#define NXT(val) ctxt->cur[(val)] +#define CUR_PTR ctxt->cur + +#define SKIP_BLANKS \ + while (IS_BLANK_CH(CUR)) NEXT + +#define CURRENT (*ctxt->cur) +#define NEXT ((*ctxt->cur) ? ctxt->cur++: ctxt->cur) + + +#define PUSH(op, val, val2, novar) \ + if (xsltCompMatchAdd(ctxt, ctxt->comp, (op), (val), (val2), (novar))) goto error; + +#define SWAP() \ + xsltSwapTopCompMatch(ctxt->comp); + +#define XSLT_ERROR(X) \ + { xsltError(ctxt, __FILE__, __LINE__, X); \ + ctxt->error = (X); return; } + +#define XSLT_ERROR0(X) \ + { xsltError(ctxt, __FILE__, __LINE__, X); \ + ctxt->error = (X); return(0); } + +/** + * xsltScanLiteral: + * @ctxt: the XPath Parser context + * + * Parse an XPath Litteral: + * + * [29] Literal ::= '"' [^"]* '"' + * | "'" [^']* "'" + * + * Returns the Literal parsed or NULL + */ + +static xmlChar * +xsltScanLiteral(xsltParserContextPtr ctxt) { + const xmlChar *q, *cur; + xmlChar *ret = NULL; + int val, len; + + SKIP_BLANKS; + if (CUR == '"') { + NEXT; + cur = q = CUR_PTR; + val = xmlStringCurrentChar(NULL, cur, &len); + while ((IS_CHAR(val)) && (val != '"')) { + cur += len; + val = xmlStringCurrentChar(NULL, cur, &len); + } + if (!IS_CHAR(val)) { + ctxt->error = 1; + return(NULL); + } else { + ret = xmlStrndup(q, cur - q); + } + cur += len; + CUR_PTR = cur; + } else if (CUR == '\'') { + NEXT; + cur = q = CUR_PTR; + val = xmlStringCurrentChar(NULL, cur, &len); + while ((IS_CHAR(val)) && (val != '\'')) { + cur += len; + val = xmlStringCurrentChar(NULL, cur, &len); + } + if (!IS_CHAR(val)) { + ctxt->error = 1; + return(NULL); + } else { + ret = xmlStrndup(q, cur - q); + } + cur += len; + CUR_PTR = cur; + } else { + /* XP_ERROR(XPATH_START_LITERAL_ERROR); */ + ctxt->error = 1; + return(NULL); + } + return(ret); +} + +/** + * xsltScanNCName: + * @ctxt: the XPath Parser context + * + * Parses a non qualified name + * + * Returns the Name parsed or NULL + */ + +static xmlChar * +xsltScanNCName(xsltParserContextPtr ctxt) { + const xmlChar *q, *cur; + xmlChar *ret = NULL; + int val, len; + + SKIP_BLANKS; + + cur = q = CUR_PTR; + val = xmlStringCurrentChar(NULL, cur, &len); + if (!IS_LETTER(val) && (val != '_')) + return(NULL); + + while ((IS_LETTER(val)) || (IS_DIGIT(val)) || + (val == '.') || (val == '-') || + (val == '_') || + (IS_COMBINING(val)) || + (IS_EXTENDER(val))) { + cur += len; + val = xmlStringCurrentChar(NULL, cur, &len); + } + ret = xmlStrndup(q, cur - q); + CUR_PTR = cur; + return(ret); +} + +/* + * xsltCompileIdKeyPattern: + * @ctxt: the compilation context + * @name: a preparsed name + * @aid: whether id/key are allowed there + * @novar: flag to prohibit xslt var + * + * Compile the XSLT LocationIdKeyPattern + * [3] IdKeyPattern ::= 'id' '(' Literal ')' + * | 'key' '(' Literal ',' Literal ')' + * + * also handle NodeType and PI from: + * + * [7] NodeTest ::= NameTest + * | NodeType '(' ')' + * | 'processing-instruction' '(' Literal ')' + */ +static void +xsltCompileIdKeyPattern(xsltParserContextPtr ctxt, xmlChar *name, + int aid, int novar, xsltAxis axis) { + xmlChar *lit = NULL; + xmlChar *lit2 = NULL; + + if (CUR != '(') { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : ( expected\n"); + ctxt->error = 1; + return; + } + if ((aid) && (xmlStrEqual(name, (const xmlChar *)"id"))) { + if (axis != 0) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : NodeTest expected\n"); + ctxt->error = 1; + return; + } + NEXT; + SKIP_BLANKS; + lit = xsltScanLiteral(ctxt); + if (ctxt->error) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : Literal expected\n"); + return; + } + SKIP_BLANKS; + if (CUR != ')') { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : ) expected\n"); + xmlFree(lit); + ctxt->error = 1; + return; + } + NEXT; + PUSH(XSLT_OP_ID, lit, NULL, novar); + lit = NULL; + } else if ((aid) && (xmlStrEqual(name, (const xmlChar *)"key"))) { + if (axis != 0) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : NodeTest expected\n"); + ctxt->error = 1; + return; + } + NEXT; + SKIP_BLANKS; + lit = xsltScanLiteral(ctxt); + if (ctxt->error) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : Literal expected\n"); + return; + } + SKIP_BLANKS; + if (CUR != ',') { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : , expected\n"); + xmlFree(lit); + ctxt->error = 1; + return; + } + NEXT; + SKIP_BLANKS; + lit2 = xsltScanLiteral(ctxt); + if (ctxt->error) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : Literal expected\n"); + xmlFree(lit); + return; + } + SKIP_BLANKS; + if (CUR != ')') { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : ) expected\n"); + xmlFree(lit); + xmlFree(lit2); + ctxt->error = 1; + return; + } + NEXT; + /* URGENT TODO: support namespace in keys */ + PUSH(XSLT_OP_KEY, lit, lit2, novar); + lit = NULL; + lit2 = NULL; + } else if (xmlStrEqual(name, (const xmlChar *)"processing-instruction")) { + NEXT; + SKIP_BLANKS; + if (CUR != ')') { + lit = xsltScanLiteral(ctxt); + if (ctxt->error) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : Literal expected\n"); + return; + } + SKIP_BLANKS; + if (CUR != ')') { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : ) expected\n"); + ctxt->error = 1; + return; + } + } + NEXT; + PUSH(XSLT_OP_PI, lit, NULL, novar); + lit = NULL; + } else if (xmlStrEqual(name, (const xmlChar *)"text")) { + NEXT; + SKIP_BLANKS; + if (CUR != ')') { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : ) expected\n"); + ctxt->error = 1; + return; + } + NEXT; + PUSH(XSLT_OP_TEXT, NULL, NULL, novar); + } else if (xmlStrEqual(name, (const xmlChar *)"comment")) { + NEXT; + SKIP_BLANKS; + if (CUR != ')') { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : ) expected\n"); + ctxt->error = 1; + return; + } + NEXT; + PUSH(XSLT_OP_COMMENT, NULL, NULL, novar); + } else if (xmlStrEqual(name, (const xmlChar *)"node")) { + NEXT; + SKIP_BLANKS; + if (CUR != ')') { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : ) expected\n"); + ctxt->error = 1; + return; + } + NEXT; + if (axis == AXIS_ATTRIBUTE) { + PUSH(XSLT_OP_ATTR, NULL, NULL, novar); + } + else { + PUSH(XSLT_OP_NODE, NULL, NULL, novar); + } + } else if (aid) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : expecting 'key' or 'id' or node type\n"); + ctxt->error = 1; + return; + } else { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileIdKeyPattern : node type\n"); + ctxt->error = 1; + return; + } +error: + return; +} + +/** + * xsltCompileStepPattern: + * @ctxt: the compilation context + * @token: a posible precompiled name + * @novar: flag to prohibit xslt variables from pattern + * + * Compile the XSLT StepPattern and generates a precompiled + * form suitable for fast matching. + * + * [5] StepPattern ::= ChildOrAttributeAxisSpecifier NodeTest Predicate* + * [6] ChildOrAttributeAxisSpecifier ::= AbbreviatedAxisSpecifier + * | ('child' | 'attribute') '::' + * from XPath + * [7] NodeTest ::= NameTest + * | NodeType '(' ')' + * | 'processing-instruction' '(' Literal ')' + * [8] Predicate ::= '[' PredicateExpr ']' + * [9] PredicateExpr ::= Expr + * [13] AbbreviatedAxisSpecifier ::= '@'? + * [37] NameTest ::= '*' | NCName ':' '*' | QName + */ + +static void +xsltCompileStepPattern(xsltParserContextPtr ctxt, xmlChar *token, int novar) { + xmlChar *name = NULL; + const xmlChar *URI = NULL; + xmlChar *URL = NULL; + int level; + xsltAxis axis = 0; + + SKIP_BLANKS; + if ((token == NULL) && (CUR == '@')) { + NEXT; + axis = AXIS_ATTRIBUTE; + } +parse_node_test: + if (token == NULL) + token = xsltScanNCName(ctxt); + if (token == NULL) { + if (CUR == '*') { + NEXT; + if (axis == AXIS_ATTRIBUTE) { + PUSH(XSLT_OP_ATTR, NULL, NULL, novar); + } + else { + PUSH(XSLT_OP_ALL, NULL, NULL, novar); + } + goto parse_predicate; + } else { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileStepPattern : Name expected\n"); + ctxt->error = 1; + goto error; + } + } + + + SKIP_BLANKS; + if (CUR == '(') { + xsltCompileIdKeyPattern(ctxt, token, 0, novar, axis); + xmlFree(token); + token = NULL; + if (ctxt->error) + goto error; + } else if (CUR == ':') { + NEXT; + if (CUR != ':') { + xmlChar *prefix = token; + xmlNsPtr ns; + + /* + * This is a namespace match + */ + token = xsltScanNCName(ctxt); + ns = xmlSearchNs(ctxt->doc, ctxt->elem, prefix); + if (ns == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileStepPattern : no namespace bound to prefix %s\n", + prefix); + xmlFree(prefix); + prefix=NULL; + ctxt->error = 1; + goto error; + } else { + URL = xmlStrdup(ns->href); + } + xmlFree(prefix); + prefix=NULL; + if (token == NULL) { + if (CUR == '*') { + NEXT; + if (axis == AXIS_ATTRIBUTE) { + PUSH(XSLT_OP_ATTR, NULL, URL, novar); + URL = NULL; + } + else { + PUSH(XSLT_OP_NS, URL, NULL, novar); + URL = NULL; + } + } else { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileStepPattern : Name expected\n"); + ctxt->error = 1; + goto error; + } + } else { + if (axis == AXIS_ATTRIBUTE) { + PUSH(XSLT_OP_ATTR, token, URL, novar); + token = NULL; + URL = NULL; + } + else { + PUSH(XSLT_OP_ELEM, token, URL, novar); + token = NULL; + URL = NULL; + } + } + } else { + if (axis != 0) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileStepPattern : NodeTest expected\n"); + ctxt->error = 1; + goto error; + } + NEXT; + if (xmlStrEqual(token, (const xmlChar *) "child")) { + axis = AXIS_CHILD; + } else if (xmlStrEqual(token, (const xmlChar *) "attribute")) { + axis = AXIS_ATTRIBUTE; + } else { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileStepPattern : 'child' or 'attribute' expected\n"); + ctxt->error = 1; + goto error; + } + xmlFree(token); + token = NULL; + SKIP_BLANKS; + token = xsltScanNCName(ctxt); + goto parse_node_test; + } + } else { + URI = xsltGetQNameURI(ctxt->elem, &token); + if (token == NULL) { + ctxt->error = 1; + goto error; + } + if (URI != NULL) + URL = xmlStrdup(URI); + if (axis == AXIS_ATTRIBUTE) { + PUSH(XSLT_OP_ATTR, token, URL, novar); + token = NULL; + URL = NULL; + } + else { + PUSH(XSLT_OP_ELEM, token, URL, novar); + token = NULL; + URL = NULL; + } + } +parse_predicate: + SKIP_BLANKS; + level = 0; + while (CUR == '[') { + const xmlChar *q; + xmlChar *ret = NULL; + + level++; + NEXT; + q = CUR_PTR; + while (CUR != 0) { + /* Skip over nested predicates */ + if (CUR == '[') + level++; + else if (CUR == ']') { + level--; + if (level == 0) + break; + } else if (CUR == '"') { + NEXT; + while ((CUR != 0) && (CUR != '"')) + NEXT; + } else if (CUR == '\'') { + NEXT; + while ((CUR != 0) && (CUR != '\'')) + NEXT; + } + NEXT; + } + if (CUR == 0) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileStepPattern : ']' expected\n"); + ctxt->error = 1; + return; + } + ret = xmlStrndup(q, CUR_PTR - q); + PUSH(XSLT_OP_PREDICATE, ret, NULL, novar); + ret = NULL; + /* push the predicate lower than local test */ + SWAP(); + NEXT; + SKIP_BLANKS; + } + return; +error: + if (token != NULL) + xmlFree(token); + if (name != NULL) + xmlFree(name); +} + +/** + * xsltCompileRelativePathPattern: + * @comp: the compilation context + * @token: a posible precompiled name + * @novar: flag to prohibit xslt variables + * + * Compile the XSLT RelativePathPattern and generates a precompiled + * form suitable for fast matching. + * + * [4] RelativePathPattern ::= StepPattern + * | RelativePathPattern '/' StepPattern + * | RelativePathPattern '//' StepPattern + */ +static void +xsltCompileRelativePathPattern(xsltParserContextPtr ctxt, xmlChar *token, int novar) { + xsltCompileStepPattern(ctxt, token, novar); + if (ctxt->error) + goto error; + SKIP_BLANKS; + while ((CUR != 0) && (CUR != '|')) { + if ((CUR == '/') && (NXT(1) == '/')) { + PUSH(XSLT_OP_ANCESTOR, NULL, NULL, novar); + NEXT; + NEXT; + SKIP_BLANKS; + xsltCompileStepPattern(ctxt, NULL, novar); + } else if (CUR == '/') { + PUSH(XSLT_OP_PARENT, NULL, NULL, novar); + NEXT; + SKIP_BLANKS; + if ((CUR != 0) && (CUR != '|')) { + xsltCompileRelativePathPattern(ctxt, NULL, novar); + } + } else { + ctxt->error = 1; + } + if (ctxt->error) + goto error; + SKIP_BLANKS; + } +error: + return; +} + +/** + * xsltCompileLocationPathPattern: + * @ctxt: the compilation context + * @novar: flag to prohibit xslt variables + * + * Compile the XSLT LocationPathPattern and generates a precompiled + * form suitable for fast matching. + * + * [2] LocationPathPattern ::= '/' RelativePathPattern? + * | IdKeyPattern (('/' | '//') RelativePathPattern)? + * | '//'? RelativePathPattern + */ +static void +xsltCompileLocationPathPattern(xsltParserContextPtr ctxt, int novar) { + SKIP_BLANKS; + if ((CUR == '/') && (NXT(1) == '/')) { + /* + * since we reverse the query + * a leading // can be safely ignored + */ + NEXT; + NEXT; + ctxt->comp->priority = 0.5; /* '//' means not 0 priority */ + xsltCompileRelativePathPattern(ctxt, NULL, novar); + } else if (CUR == '/') { + /* + * We need to find root as the parent + */ + NEXT; + SKIP_BLANKS; + PUSH(XSLT_OP_ROOT, NULL, NULL, novar); + if ((CUR != 0) && (CUR != '|')) { + PUSH(XSLT_OP_PARENT, NULL, NULL, novar); + xsltCompileRelativePathPattern(ctxt, NULL, novar); + } + } else if (CUR == '*') { + xsltCompileRelativePathPattern(ctxt, NULL, novar); + } else if (CUR == '@') { + xsltCompileRelativePathPattern(ctxt, NULL, novar); + } else { + xmlChar *name; + name = xsltScanNCName(ctxt); + if (name == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltCompileLocationPathPattern : Name expected\n"); + ctxt->error = 1; + return; + } + SKIP_BLANKS; + if ((CUR == '(') && !xmlXPathIsNodeType(name)) { + xsltCompileIdKeyPattern(ctxt, name, 1, novar, 0); + xmlFree(name); + name = NULL; + if ((CUR == '/') && (NXT(1) == '/')) { + PUSH(XSLT_OP_ANCESTOR, NULL, NULL, novar); + NEXT; + NEXT; + SKIP_BLANKS; + xsltCompileRelativePathPattern(ctxt, NULL, novar); + } else if (CUR == '/') { + PUSH(XSLT_OP_PARENT, NULL, NULL, novar); + NEXT; + SKIP_BLANKS; + xsltCompileRelativePathPattern(ctxt, NULL, novar); + } + return; + } + xsltCompileRelativePathPattern(ctxt, name, novar); + } +error: + return; +} + +/** + * xsltCompilePatternInternal: + * @pattern: an XSLT pattern + * @doc: the containing document + * @node: the containing element + * @style: the stylesheet + * @runtime: the transformation context, if done at run-time + * @novar: flag to prohibit xslt variables + * + * Compile the XSLT pattern and generates a list of precompiled form suitable + * for fast matching. + * + * [1] Pattern ::= LocationPathPattern | Pattern '|' LocationPathPattern + * + * Returns the generated pattern list or NULL in case of failure + */ + +static xsltCompMatchPtr +xsltCompilePatternInternal(const xmlChar *pattern, xmlDocPtr doc, + xmlNodePtr node, xsltStylesheetPtr style, + xsltTransformContextPtr runtime, int novar) { + xsltParserContextPtr ctxt = NULL; + xsltCompMatchPtr element, first = NULL, previous = NULL; + int current, start, end, level, j; + + if (pattern == NULL) { + xsltTransformError(NULL, NULL, node, + "xsltCompilePattern : NULL pattern\n"); + return(NULL); + } + + ctxt = xsltNewParserContext(style, runtime); + if (ctxt == NULL) + return(NULL); + ctxt->doc = doc; + ctxt->elem = node; + current = end = 0; + while (pattern[current] != 0) { + start = current; + while (IS_BLANK_CH(pattern[current])) + current++; + end = current; + level = 0; + while ((pattern[end] != 0) && ((pattern[end] != '|') || (level != 0))) { + if (pattern[end] == '[') + level++; + else if (pattern[end] == ']') + level--; + else if (pattern[end] == '\'') { + end++; + while ((pattern[end] != 0) && (pattern[end] != '\'')) + end++; + } else if (pattern[end] == '"') { + end++; + while ((pattern[end] != 0) && (pattern[end] != '"')) + end++; + } + if (pattern[end] == 0) + break; + end++; + } + if (current == end) { + xsltTransformError(NULL, NULL, node, + "xsltCompilePattern : NULL pattern\n"); + goto error; + } + element = xsltNewCompMatch(); + if (element == NULL) { + goto error; + } + if (first == NULL) + first = element; + else if (previous != NULL) + previous->next = element; + previous = element; + + ctxt->comp = element; + ctxt->base = xmlStrndup(&pattern[start], end - start); + if (ctxt->base == NULL) + goto error; + ctxt->cur = &(ctxt->base)[current - start]; + element->pattern = ctxt->base; + element->nsList = xmlGetNsList(doc, node); + j = 0; + if (element->nsList != NULL) { + while (element->nsList[j] != NULL) + j++; + } + element->nsNr = j; + + +#ifdef WITH_XSLT_DEBUG_PATTERN + xsltGenericDebug(xsltGenericDebugContext, + "xsltCompilePattern : parsing '%s'\n", + element->pattern); +#endif + /* + Preset default priority to be zero. + This may be changed by xsltCompileLocationPathPattern. + */ + element->priority = 0; + xsltCompileLocationPathPattern(ctxt, novar); + if (ctxt->error) { + xsltTransformError(NULL, style, node, + "xsltCompilePattern : failed to compile '%s'\n", + element->pattern); + if (style != NULL) style->errors++; + goto error; + } + + /* + * Reverse for faster interpretation. + */ + xsltReverseCompMatch(ctxt, element); + + /* + * Set-up the priority + */ + if (element->priority == 0) { /* if not yet determined */ + if (((element->steps[0].op == XSLT_OP_ELEM) || + (element->steps[0].op == XSLT_OP_ATTR) || + (element->steps[0].op == XSLT_OP_PI)) && + (element->steps[0].value != NULL) && + (element->steps[1].op == XSLT_OP_END)) { + ; /* previously preset */ + } else if ((element->steps[0].op == XSLT_OP_ATTR) && + (element->steps[0].value2 != NULL) && + (element->steps[1].op == XSLT_OP_END)) { + element->priority = -0.25; + } else if ((element->steps[0].op == XSLT_OP_NS) && + (element->steps[0].value != NULL) && + (element->steps[1].op == XSLT_OP_END)) { + element->priority = -0.25; + } else if ((element->steps[0].op == XSLT_OP_ATTR) && + (element->steps[0].value == NULL) && + (element->steps[0].value2 == NULL) && + (element->steps[1].op == XSLT_OP_END)) { + element->priority = -0.5; + } else if (((element->steps[0].op == XSLT_OP_PI) || + (element->steps[0].op == XSLT_OP_TEXT) || + (element->steps[0].op == XSLT_OP_ALL) || + (element->steps[0].op == XSLT_OP_NODE) || + (element->steps[0].op == XSLT_OP_COMMENT)) && + (element->steps[1].op == XSLT_OP_END)) { + element->priority = -0.5; + } else { + element->priority = 0.5; + } + } +#ifdef WITH_XSLT_DEBUG_PATTERN + xsltGenericDebug(xsltGenericDebugContext, + "xsltCompilePattern : parsed %s, default priority %f\n", + element->pattern, element->priority); +#endif + if (pattern[end] == '|') + end++; + current = end; + } + if (end == 0) { + xsltTransformError(NULL, style, node, + "xsltCompilePattern : NULL pattern\n"); + if (style != NULL) style->errors++; + goto error; + } + + xsltFreeParserContext(ctxt); + return(first); + +error: + if (ctxt != NULL) + xsltFreeParserContext(ctxt); + if (first != NULL) + xsltFreeCompMatchList(first); + return(NULL); +} + +/** + * xsltCompilePattern: + * @pattern: an XSLT pattern + * @doc: the containing document + * @node: the containing element + * @style: the stylesheet + * @runtime: the transformation context, if done at run-time + * + * Compile the XSLT pattern and generates a list of precompiled form suitable + * for fast matching. + * + * [1] Pattern ::= LocationPathPattern | Pattern '|' LocationPathPattern + * + * Returns the generated pattern list or NULL in case of failure + */ + +xsltCompMatchPtr +xsltCompilePattern(const xmlChar *pattern, xmlDocPtr doc, + xmlNodePtr node, xsltStylesheetPtr style, + xsltTransformContextPtr runtime) { + return (xsltCompilePatternInternal(pattern, doc, node, style, runtime, 0)); +} + +/************************************************************************ + * * + * Module interfaces * + * * + ************************************************************************/ + +/** + * xsltAddTemplate: + * @style: an XSLT stylesheet + * @cur: an XSLT template + * @mode: the mode name or NULL + * @modeURI: the mode URI or NULL + * + * Register the XSLT pattern associated to @cur + * + * Returns -1 in case of error, 0 otherwise + */ +int +xsltAddTemplate(xsltStylesheetPtr style, xsltTemplatePtr cur, + const xmlChar *mode, const xmlChar *modeURI) { + xsltCompMatchPtr pat, list, next; + /* + * 'top' will point to style->xxxMatch ptr - declaring as 'void' + * avoids gcc 'type-punned pointer' warning. + */ + void **top = NULL; + const xmlChar *name = NULL; + float priority; /* the priority */ + + if ((style == NULL) || (cur == NULL)) + return(-1); + + /* Register named template */ + if (cur->name != NULL) { + if (style->namedTemplates == NULL) { + style->namedTemplates = xmlHashCreate(10); + if (style->namedTemplates == NULL) + return(-1); + } + else { + void *dup = xmlHashLookup2(style->namedTemplates, cur->name, + cur->nameURI); + if (dup != NULL) { + xsltTransformError(NULL, style, cur->elem, + "xsl:template: error duplicate name '%s'\n", + cur->name); + style->errors++; + return(-1); + } + } + + xmlHashAddEntry2(style->namedTemplates, cur->name, cur->nameURI, cur); + } + + if (cur->match == NULL) + return(0); + + priority = cur->priority; + pat = xsltCompilePatternInternal(cur->match, style->doc, cur->elem, + style, NULL, 1); + if (pat == NULL) + return(-1); + while (pat) { + next = pat->next; + pat->next = NULL; + name = NULL; + + pat->template = cur; + if (mode != NULL) + pat->mode = xmlDictLookup(style->dict, mode, -1); + if (modeURI != NULL) + pat->modeURI = xmlDictLookup(style->dict, modeURI, -1); + if (priority != XSLT_PAT_NO_PRIORITY) + pat->priority = priority; + + /* + * insert it in the hash table list corresponding to its lookup name + */ + switch (pat->steps[0].op) { + case XSLT_OP_ATTR: + if (pat->steps[0].value != NULL) + name = pat->steps[0].value; + else + top = &(style->attrMatch); + break; + case XSLT_OP_PARENT: + case XSLT_OP_ANCESTOR: + top = &(style->elemMatch); + break; + case XSLT_OP_ROOT: + top = &(style->rootMatch); + break; + case XSLT_OP_KEY: + top = &(style->keyMatch); + break; + case XSLT_OP_ID: + /* TODO optimize ID !!! */ + case XSLT_OP_NS: + case XSLT_OP_ALL: + top = &(style->elemMatch); + break; + case XSLT_OP_END: + case XSLT_OP_PREDICATE: + xsltTransformError(NULL, style, NULL, + "xsltAddTemplate: invalid compiled pattern\n"); + xsltFreeCompMatch(pat); + return(-1); + /* + * TODO: some flags at the top level about type based patterns + * would be faster than inclusion in the hash table. + */ + case XSLT_OP_PI: + if (pat->steps[0].value != NULL) + name = pat->steps[0].value; + else + top = &(style->piMatch); + break; + case XSLT_OP_COMMENT: + top = &(style->commentMatch); + break; + case XSLT_OP_TEXT: + top = &(style->textMatch); + break; + case XSLT_OP_ELEM: + case XSLT_OP_NODE: + if (pat->steps[0].value != NULL) + name = pat->steps[0].value; + else + top = &(style->elemMatch); + break; + } + if (name != NULL) { + if (style->templatesHash == NULL) { + style->templatesHash = xmlHashCreate(1024); + if (style->templatesHash == NULL) { + xsltFreeCompMatch(pat); + return(-1); + } + xmlHashAddEntry3(style->templatesHash, name, mode, modeURI, pat); + } else { + list = (xsltCompMatchPtr) xmlHashLookup3(style->templatesHash, + name, mode, modeURI); + if (list == NULL) { + xmlHashAddEntry3(style->templatesHash, name, + mode, modeURI, pat); + } else { + /* + * Note '<=' since one must choose among the matching + * template rules that are left, the one that occurs + * last in the stylesheet + */ + if (list->priority <= pat->priority) { + pat->next = list; + xmlHashUpdateEntry3(style->templatesHash, name, + mode, modeURI, pat, NULL); + } else { + while (list->next != NULL) { + if (list->next->priority <= pat->priority) + break; + list = list->next; + } + pat->next = list->next; + list->next = pat; + } + } + } + } else if (top != NULL) { + list = *top; + if (list == NULL) { + *top = pat; + pat->next = NULL; + } else if (list->priority <= pat->priority) { + pat->next = list; + *top = pat; + } else { + while (list->next != NULL) { + if (list->next->priority <= pat->priority) + break; + list = list->next; + } + pat->next = list->next; + list->next = pat; + } + } else { + xsltTransformError(NULL, style, NULL, + "xsltAddTemplate: invalid compiled pattern\n"); + xsltFreeCompMatch(pat); + return(-1); + } +#ifdef WITH_XSLT_DEBUG_PATTERN + if (mode) + xsltGenericDebug(xsltGenericDebugContext, + "added pattern : '%s' mode '%s' priority %f\n", + pat->pattern, pat->mode, pat->priority); + else + xsltGenericDebug(xsltGenericDebugContext, + "added pattern : '%s' priority %f\n", + pat->pattern, pat->priority); +#endif + + pat = next; + } + return(0); +} + +static int +xsltComputeAllKeys(xsltTransformContextPtr ctxt, xmlNodePtr contextNode) +{ + if ((ctxt == NULL) || (contextNode == NULL)) { + xsltTransformError(ctxt, NULL, ctxt->inst, + "Internal error in xsltComputeAllKeys(): " + "Bad arguments.\n"); + return(-1); + } + + if (ctxt->document == NULL) { + /* + * The document info will only be NULL if we have a RTF. + */ + if (contextNode->doc->_private != NULL) + goto doc_info_mismatch; + /* + * On-demand creation of the document info (needed for keys). + */ + ctxt->document = xsltNewDocument(ctxt, contextNode->doc); + if (ctxt->document == NULL) + return(-1); + } + return xsltInitAllDocKeys(ctxt); + +doc_info_mismatch: + xsltTransformError(ctxt, NULL, ctxt->inst, + "Internal error in xsltComputeAllKeys(): " + "The context's document info doesn't match the " + "document info of the current result tree.\n"); + ctxt->state = XSLT_STATE_STOPPED; + return(-1); +} + +/** + * xsltGetTemplate: + * @ctxt: a XSLT process context + * @node: the node being processed + * @style: the current style + * + * Finds the template applying to this node, if @style is non-NULL + * it means one needs to look for the next imported template in scope. + * + * Returns the xsltTemplatePtr or NULL if not found + */ +xsltTemplatePtr +xsltGetTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node, + xsltStylesheetPtr style) +{ + xsltStylesheetPtr curstyle; + xsltTemplatePtr ret = NULL; + const xmlChar *name = NULL; + xsltCompMatchPtr list = NULL; + float priority; + int keyed = 0; + + if ((ctxt == NULL) || (node == NULL)) + return(NULL); + + if (style == NULL) { + curstyle = ctxt->style; + } else { + curstyle = xsltNextImport(style); + } + + while ((curstyle != NULL) && (curstyle != style)) { + priority = XSLT_PAT_NO_PRIORITY; + /* TODO : handle IDs/keys here ! */ + if (curstyle->templatesHash != NULL) { + /* + * Use the top name as selector + */ + switch (node->type) { + case XML_ELEMENT_NODE: + if (node->name[0] == ' ') + break; + case XML_ATTRIBUTE_NODE: + case XML_PI_NODE: + name = node->name; + break; + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_COMMENT_NODE: + case XML_ENTITY_REF_NODE: + case XML_ENTITY_NODE: + case XML_DOCUMENT_TYPE_NODE: + case XML_DOCUMENT_FRAG_NODE: + case XML_NOTATION_NODE: + case XML_DTD_NODE: + case XML_ELEMENT_DECL: + case XML_ATTRIBUTE_DECL: + case XML_ENTITY_DECL: + case XML_NAMESPACE_DECL: + case XML_XINCLUDE_START: + case XML_XINCLUDE_END: + break; + default: + return(NULL); + + } + } + if (name != NULL) { + /* + * find the list of applicable expressions based on the name + */ + list = (xsltCompMatchPtr) xmlHashLookup3(curstyle->templatesHash, + name, ctxt->mode, ctxt->modeURI); + } else + list = NULL; + while (list != NULL) { + if (xsltTestCompMatch(ctxt, list, node, + ctxt->mode, ctxt->modeURI)) { + ret = list->template; + priority = list->priority; + break; + } + list = list->next; + } + list = NULL; + + /* + * find alternate generic matches + */ + switch (node->type) { + case XML_ELEMENT_NODE: + if (node->name[0] == ' ') + list = curstyle->rootMatch; + else + list = curstyle->elemMatch; + if (node->psvi != NULL) keyed = 1; + break; + case XML_ATTRIBUTE_NODE: { + xmlAttrPtr attr; + + list = curstyle->attrMatch; + attr = (xmlAttrPtr) node; + if (attr->psvi != NULL) keyed = 1; + break; + } + case XML_PI_NODE: + list = curstyle->piMatch; + if (node->psvi != NULL) keyed = 1; + break; + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: { + xmlDocPtr doc; + + list = curstyle->rootMatch; + doc = (xmlDocPtr) node; + if (doc->psvi != NULL) keyed = 1; + break; + } + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + list = curstyle->textMatch; + if (node->psvi != NULL) keyed = 1; + break; + case XML_COMMENT_NODE: + list = curstyle->commentMatch; + if (node->psvi != NULL) keyed = 1; + break; + case XML_ENTITY_REF_NODE: + case XML_ENTITY_NODE: + case XML_DOCUMENT_TYPE_NODE: + case XML_DOCUMENT_FRAG_NODE: + case XML_NOTATION_NODE: + case XML_DTD_NODE: + case XML_ELEMENT_DECL: + case XML_ATTRIBUTE_DECL: + case XML_ENTITY_DECL: + case XML_NAMESPACE_DECL: + case XML_XINCLUDE_START: + case XML_XINCLUDE_END: + break; + default: + break; + } + while ((list != NULL) && + ((ret == NULL) || (list->priority > priority))) { + if (xsltTestCompMatch(ctxt, list, node, + ctxt->mode, ctxt->modeURI)) { + ret = list->template; + priority = list->priority; + break; + } + list = list->next; + } + /* + * Some of the tests for elements can also apply to documents + */ + if ((node->type == XML_DOCUMENT_NODE) || + (node->type == XML_HTML_DOCUMENT_NODE) || + (node->type == XML_TEXT_NODE)) { + list = curstyle->elemMatch; + while ((list != NULL) && + ((ret == NULL) || (list->priority > priority))) { + if (xsltTestCompMatch(ctxt, list, node, + ctxt->mode, ctxt->modeURI)) { + ret = list->template; + priority = list->priority; + break; + } + list = list->next; + } + } else if ((node->type == XML_PI_NODE) || + (node->type == XML_COMMENT_NODE)) { + list = curstyle->elemMatch; + while ((list != NULL) && + ((ret == NULL) || (list->priority > priority))) { + if (xsltTestCompMatch(ctxt, list, node, + ctxt->mode, ctxt->modeURI)) { + ret = list->template; + priority = list->priority; + break; + } + list = list->next; + } + } + +keyed_match: + if (keyed) { + list = curstyle->keyMatch; + while ((list != NULL) && + ((ret == NULL) || (list->priority > priority))) { + if (xsltTestCompMatch(ctxt, list, node, + ctxt->mode, ctxt->modeURI)) { + ret = list->template; + priority = list->priority; + break; + } + list = list->next; + } + } + else if (ctxt->hasTemplKeyPatterns && + ((ctxt->document == NULL) || + (ctxt->document->nbKeysComputed < ctxt->nbKeys))) + { + /* + * Compute all remaining keys for this document. + * + * REVISIT TODO: I think this could be further optimized. + */ + if (xsltComputeAllKeys(ctxt, node) == -1) + goto error; + + switch (node->type) { + case XML_ELEMENT_NODE: + if (node->psvi != NULL) keyed = 1; + break; + case XML_ATTRIBUTE_NODE: + if (((xmlAttrPtr) node)->psvi != NULL) keyed = 1; + break; + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_COMMENT_NODE: + case XML_PI_NODE: + if (node->psvi != NULL) keyed = 1; + break; + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + if (((xmlDocPtr) node)->psvi != NULL) keyed = 1; + break; + default: + break; + } + if (keyed) + goto keyed_match; + } + if (ret != NULL) + return(ret); + + /* + * Cycle on next curstylesheet import. + */ + curstyle = xsltNextImport(curstyle); + } + +error: + return(NULL); +} + +/** + * xsltCleanupTemplates: + * @style: an XSLT stylesheet + * + * Cleanup the state of the templates used by the stylesheet and + * the ones it imports. + */ +void +xsltCleanupTemplates(xsltStylesheetPtr style ATTRIBUTE_UNUSED) { +} + +/** + * xsltFreeTemplateHashes: + * @style: an XSLT stylesheet + * + * Free up the memory used by xsltAddTemplate/xsltGetTemplate mechanism + */ +void +xsltFreeTemplateHashes(xsltStylesheetPtr style) { + if (style->templatesHash != NULL) + xmlHashFree((xmlHashTablePtr) style->templatesHash, + (xmlHashDeallocator) xsltFreeCompMatchList); + if (style->rootMatch != NULL) + xsltFreeCompMatchList(style->rootMatch); + if (style->keyMatch != NULL) + xsltFreeCompMatchList(style->keyMatch); + if (style->elemMatch != NULL) + xsltFreeCompMatchList(style->elemMatch); + if (style->attrMatch != NULL) + xsltFreeCompMatchList(style->attrMatch); + if (style->parentMatch != NULL) + xsltFreeCompMatchList(style->parentMatch); + if (style->textMatch != NULL) + xsltFreeCompMatchList(style->textMatch); + if (style->piMatch != NULL) + xsltFreeCompMatchList(style->piMatch); + if (style->commentMatch != NULL) + xsltFreeCompMatchList(style->commentMatch); + if (style->namedTemplates != NULL) + xmlHashFree(style->namedTemplates, NULL); +} + diff --git a/libxslt/pattern.h b/libxslt/pattern.h new file mode 100644 index 0000000..eb21be3 --- /dev/null +++ b/libxslt/pattern.h @@ -0,0 +1,81 @@ +/* + * Summary: interface for the pattern matching used in template matches. + * Description: the implementation of the lookup of the right template + * for a given node must be really fast in order to keep + * decent performances. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XSLT_PATTERN_H__ +#define __XML_XSLT_PATTERN_H__ + +#include "xsltInternals.h" +#include "xsltexports.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xsltCompMatch: + * + * Data structure used for the implementation of patterns. + * It is kept private (in pattern.c). + */ +typedef struct _xsltCompMatch xsltCompMatch; +typedef xsltCompMatch *xsltCompMatchPtr; + +/* + * Pattern related interfaces. + */ + +XSLTPUBFUN xsltCompMatchPtr XSLTCALL + xsltCompilePattern (const xmlChar *pattern, + xmlDocPtr doc, + xmlNodePtr node, + xsltStylesheetPtr style, + xsltTransformContextPtr runtime); +XSLTPUBFUN void XSLTCALL + xsltFreeCompMatchList (xsltCompMatchPtr comp); +XSLTPUBFUN int XSLTCALL + xsltTestCompMatchList (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xsltCompMatchPtr comp); +XSLTPUBFUN void XSLTCALL + xsltNormalizeCompSteps (void *payload, + void *data, + const xmlChar *name); + +/* + * Template related interfaces. + */ +XSLTPUBFUN int XSLTCALL + xsltAddTemplate (xsltStylesheetPtr style, + xsltTemplatePtr cur, + const xmlChar *mode, + const xmlChar *modeURI); +XSLTPUBFUN xsltTemplatePtr XSLTCALL + xsltGetTemplate (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xsltStylesheetPtr style); +XSLTPUBFUN void XSLTCALL + xsltFreeTemplateHashes (xsltStylesheetPtr style); +XSLTPUBFUN void XSLTCALL + xsltCleanupTemplates (xsltStylesheetPtr style); + +#if 0 +int xsltMatchPattern (xsltTransformContextPtr ctxt, + xmlNodePtr node, + const xmlChar *pattern, + xmlDocPtr ctxtdoc, + xmlNodePtr ctxtnode); +#endif +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XSLT_PATTERN_H__ */ + diff --git a/libxslt/preproc.c b/libxslt/preproc.c new file mode 100644 index 0000000..955b3b0 --- /dev/null +++ b/libxslt/preproc.c @@ -0,0 +1,2379 @@ +/* + * preproc.c: Preprocessing of style operations + * + * References: + * http://www.w3.org/TR/1999/REC-xslt-19991116 + * + * Michael Kay "XSLT Programmer's Reference" pp 637-643 + * Writing Multiple Output Files + * + * XSLT-1.1 Working Draft + * http://www.w3.org/TR/xslt11#multiple-output + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltutils.h" +#include "xsltInternals.h" +#include "transform.h" +#include "templates.h" +#include "variables.h" +#include "numbersInternals.h" +#include "preproc.h" +#include "extra.h" +#include "imports.h" +#include "extensions.h" +#include "pattern.h" + +#ifdef WITH_XSLT_DEBUG +#define WITH_XSLT_DEBUG_PREPROC +#endif + +const xmlChar *xsltExtMarker = (const xmlChar *) "Extension Element"; + +/************************************************************************ + * * + * Grammar checks * + * * + ************************************************************************/ + +#ifdef XSLT_REFACTORED + /* + * Grammar checks are now performed in xslt.c. + */ +#else +/** + * xsltCheckTopLevelElement: + * @style: the XSLT stylesheet + * @inst: the XSLT instruction + * @err: raise an error or not + * + * Check that the instruction is instanciated as a top level element. + * + * Returns -1 in case of error, 0 if failed and 1 in case of success + */ +static int +xsltCheckTopLevelElement(xsltStylesheetPtr style, xmlNodePtr inst, int err) { + xmlNodePtr parent; + if ((style == NULL) || (inst == NULL) || (inst->ns == NULL)) + return(-1); + + parent = inst->parent; + if (parent == NULL) { + if (err) { + xsltTransformError(NULL, style, inst, + "internal problem: element has no parent\n"); + style->errors++; + } + return(0); + } + if ((parent->ns == NULL) || (parent->type != XML_ELEMENT_NODE) || + ((parent->ns != inst->ns) && + (!xmlStrEqual(parent->ns->href, inst->ns->href))) || + ((!xmlStrEqual(parent->name, BAD_CAST "stylesheet")) && + (!xmlStrEqual(parent->name, BAD_CAST "transform")))) { + if (err) { + xsltTransformError(NULL, style, inst, + "element %s only allowed as child of stylesheet\n", + inst->name); + style->errors++; + } + return(0); + } + return(1); +} + +/** + * xsltCheckInstructionElement: + * @style: the XSLT stylesheet + * @inst: the XSLT instruction + * + * Check that the instruction is instanciated as an instruction element. + */ +static void +xsltCheckInstructionElement(xsltStylesheetPtr style, xmlNodePtr inst) { + xmlNodePtr parent; + int has_ext; + + if ((style == NULL) || (inst == NULL) || (inst->ns == NULL) || + (style->literal_result)) + return; + + has_ext = (style->extInfos != NULL); + + parent = inst->parent; + if (parent == NULL) { + xsltTransformError(NULL, style, inst, + "internal problem: element has no parent\n"); + style->errors++; + return; + } + while ((parent != NULL) && (parent->type != XML_DOCUMENT_NODE)) { + if (((parent->ns == inst->ns) || + ((parent->ns != NULL) && + (xmlStrEqual(parent->ns->href, inst->ns->href)))) && + ((xmlStrEqual(parent->name, BAD_CAST "template")) || + (xmlStrEqual(parent->name, BAD_CAST "param")) || + (xmlStrEqual(parent->name, BAD_CAST "attribute")) || + (xmlStrEqual(parent->name, BAD_CAST "variable")))) { + return; + } + + /* + * if we are within an extension element all bets are off + * about the semantic there e.g. xsl:param within func:function + */ + if ((has_ext) && (parent->ns != NULL) && + (xmlHashLookup(style->extInfos, parent->ns->href) != NULL)) + return; + + parent = parent->parent; + } + xsltTransformError(NULL, style, inst, + "element %s only allowed within a template, variable or param\n", + inst->name); + style->errors++; +} + +/** + * xsltCheckParentElement: + * @style: the XSLT stylesheet + * @inst: the XSLT instruction + * @allow1: allowed parent1 + * @allow2: allowed parent2 + * + * Check that the instruction is instanciated as the childre of one of the + * possible parents. + */ +static void +xsltCheckParentElement(xsltStylesheetPtr style, xmlNodePtr inst, + const xmlChar *allow1, const xmlChar *allow2) { + xmlNodePtr parent; + + if ((style == NULL) || (inst == NULL) || (inst->ns == NULL) || + (style->literal_result)) + return; + + parent = inst->parent; + if (parent == NULL) { + xsltTransformError(NULL, style, inst, + "internal problem: element has no parent\n"); + style->errors++; + return; + } + if (((parent->ns == inst->ns) || + ((parent->ns != NULL) && + (xmlStrEqual(parent->ns->href, inst->ns->href)))) && + ((xmlStrEqual(parent->name, allow1)) || + (xmlStrEqual(parent->name, allow2)))) { + return; + } + + if (style->extInfos != NULL) { + while ((parent != NULL) && (parent->type != XML_DOCUMENT_NODE)) { + /* + * if we are within an extension element all bets are off + * about the semantic there e.g. xsl:param within func:function + */ + if ((parent->ns != NULL) && + (xmlHashLookup(style->extInfos, parent->ns->href) != NULL)) + return; + + parent = parent->parent; + } + } + xsltTransformError(NULL, style, inst, + "element %s is not allowed within that context\n", + inst->name); + style->errors++; +} +#endif + +/************************************************************************ + * * + * handling of precomputed data * + * * + ************************************************************************/ + +/** + * xsltNewStylePreComp: + * @style: the XSLT stylesheet + * @type: the construct type + * + * Create a new XSLT Style precomputed block + * + * Returns the newly allocated specialized structure + * or NULL in case of error + */ +static xsltStylePreCompPtr +xsltNewStylePreComp(xsltStylesheetPtr style, xsltStyleType type) { + xsltStylePreCompPtr cur; +#ifdef XSLT_REFACTORED + size_t size; +#endif + + if (style == NULL) + return(NULL); + +#ifdef XSLT_REFACTORED + /* + * URGENT TODO: Use specialized factory functions in order + * to avoid this ugliness. + */ + switch (type) { + case XSLT_FUNC_COPY: + size = sizeof(xsltStyleItemCopy); break; + case XSLT_FUNC_SORT: + size = sizeof(xsltStyleItemSort); break; + case XSLT_FUNC_TEXT: + size = sizeof(xsltStyleItemText); break; + case XSLT_FUNC_ELEMENT: + size = sizeof(xsltStyleItemElement); break; + case XSLT_FUNC_ATTRIBUTE: + size = sizeof(xsltStyleItemAttribute); break; + case XSLT_FUNC_COMMENT: + size = sizeof(xsltStyleItemComment); break; + case XSLT_FUNC_PI: + size = sizeof(xsltStyleItemPI); break; + case XSLT_FUNC_COPYOF: + size = sizeof(xsltStyleItemCopyOf); break; + case XSLT_FUNC_VALUEOF: + size = sizeof(xsltStyleItemValueOf); break;; + case XSLT_FUNC_NUMBER: + size = sizeof(xsltStyleItemNumber); break; + case XSLT_FUNC_APPLYIMPORTS: + size = sizeof(xsltStyleItemApplyImports); break; + case XSLT_FUNC_CALLTEMPLATE: + size = sizeof(xsltStyleItemCallTemplate); break; + case XSLT_FUNC_APPLYTEMPLATES: + size = sizeof(xsltStyleItemApplyTemplates); break; + case XSLT_FUNC_CHOOSE: + size = sizeof(xsltStyleItemChoose); break; + case XSLT_FUNC_IF: + size = sizeof(xsltStyleItemIf); break; + case XSLT_FUNC_FOREACH: + size = sizeof(xsltStyleItemForEach); break; + case XSLT_FUNC_DOCUMENT: + size = sizeof(xsltStyleItemDocument); break; + case XSLT_FUNC_WITHPARAM: + size = sizeof(xsltStyleItemWithParam); break; + case XSLT_FUNC_PARAM: + size = sizeof(xsltStyleItemParam); break; + case XSLT_FUNC_VARIABLE: + size = sizeof(xsltStyleItemVariable); break; + case XSLT_FUNC_WHEN: + size = sizeof(xsltStyleItemWhen); break; + case XSLT_FUNC_OTHERWISE: + size = sizeof(xsltStyleItemOtherwise); break; + default: + xsltTransformError(NULL, style, NULL, + "xsltNewStylePreComp : invalid type %d\n", type); + style->errors++; + return(NULL); + } + /* + * Create the structure. + */ + cur = (xsltStylePreCompPtr) xmlMalloc(size); + if (cur == NULL) { + xsltTransformError(NULL, style, NULL, + "xsltNewStylePreComp : malloc failed\n"); + style->errors++; + return(NULL); + } + memset(cur, 0, size); + +#else /* XSLT_REFACTORED */ + /* + * Old behaviour. + */ + cur = (xsltStylePreCompPtr) xmlMalloc(sizeof(xsltStylePreComp)); + if (cur == NULL) { + xsltTransformError(NULL, style, NULL, + "xsltNewStylePreComp : malloc failed\n"); + style->errors++; + return(NULL); + } + memset(cur, 0, sizeof(xsltStylePreComp)); +#endif /* XSLT_REFACTORED */ + + /* + * URGENT TODO: Better to move this to spezialized factory functions. + */ + cur->type = type; + switch (cur->type) { + case XSLT_FUNC_COPY: + cur->func = (xsltTransformFunction) xsltCopy;break; + case XSLT_FUNC_SORT: + cur->func = (xsltTransformFunction) xsltSort;break; + case XSLT_FUNC_TEXT: + cur->func = (xsltTransformFunction) xsltText;break; + case XSLT_FUNC_ELEMENT: + cur->func = (xsltTransformFunction) xsltElement;break; + case XSLT_FUNC_ATTRIBUTE: + cur->func = (xsltTransformFunction) xsltAttribute;break; + case XSLT_FUNC_COMMENT: + cur->func = (xsltTransformFunction) xsltComment;break; + case XSLT_FUNC_PI: + cur->func = (xsltTransformFunction) xsltProcessingInstruction; + break; + case XSLT_FUNC_COPYOF: + cur->func = (xsltTransformFunction) xsltCopyOf;break; + case XSLT_FUNC_VALUEOF: + cur->func = (xsltTransformFunction) xsltValueOf;break; + case XSLT_FUNC_NUMBER: + cur->func = (xsltTransformFunction) xsltNumber;break; + case XSLT_FUNC_APPLYIMPORTS: + cur->func = (xsltTransformFunction) xsltApplyImports;break; + case XSLT_FUNC_CALLTEMPLATE: + cur->func = (xsltTransformFunction) xsltCallTemplate;break; + case XSLT_FUNC_APPLYTEMPLATES: + cur->func = (xsltTransformFunction) xsltApplyTemplates;break; + case XSLT_FUNC_CHOOSE: + cur->func = (xsltTransformFunction) xsltChoose;break; + case XSLT_FUNC_IF: + cur->func = (xsltTransformFunction) xsltIf;break; + case XSLT_FUNC_FOREACH: + cur->func = (xsltTransformFunction) xsltForEach;break; + case XSLT_FUNC_DOCUMENT: + cur->func = (xsltTransformFunction) xsltDocumentElem;break; + case XSLT_FUNC_WITHPARAM: + case XSLT_FUNC_PARAM: + case XSLT_FUNC_VARIABLE: + case XSLT_FUNC_WHEN: + break; + default: + if (cur->func == NULL) { + xsltTransformError(NULL, style, NULL, + "xsltNewStylePreComp : no function for type %d\n", type); + style->errors++; + } + } + cur->next = style->preComps; + style->preComps = (xsltElemPreCompPtr) cur; + + return(cur); +} + +/** + * xsltFreeStylePreComp: + * @comp: an XSLT Style precomputed block + * + * Free up the memory allocated by @comp + */ +static void +xsltFreeStylePreComp(xsltStylePreCompPtr comp) { + if (comp == NULL) + return; +#ifdef XSLT_REFACTORED + /* + * URGENT TODO: Implement destructors. + */ + switch (comp->type) { + case XSLT_FUNC_LITERAL_RESULT_ELEMENT: + break; + case XSLT_FUNC_COPY: + break; + case XSLT_FUNC_SORT: { + xsltStyleItemSortPtr item = (xsltStyleItemSortPtr) comp; + if (item->locale != (xsltLocale)0) + xsltFreeLocale(item->locale); + if (item->comp != NULL) + xmlXPathFreeCompExpr(item->comp); + } + break; + case XSLT_FUNC_TEXT: + break; + case XSLT_FUNC_ELEMENT: + break; + case XSLT_FUNC_ATTRIBUTE: + break; + case XSLT_FUNC_COMMENT: + break; + case XSLT_FUNC_PI: + break; + case XSLT_FUNC_COPYOF: { + xsltStyleItemCopyOfPtr item = (xsltStyleItemCopyOfPtr) comp; + if (item->comp != NULL) + xmlXPathFreeCompExpr(item->comp); + } + break; + case XSLT_FUNC_VALUEOF: { + xsltStyleItemValueOfPtr item = (xsltStyleItemValueOfPtr) comp; + if (item->comp != NULL) + xmlXPathFreeCompExpr(item->comp); + } + break; + case XSLT_FUNC_NUMBER: { + xsltStyleItemNumberPtr item = (xsltStyleItemNumberPtr) comp; + if (item->numdata.countPat != NULL) + xsltFreeCompMatchList(item->numdata.countPat); + if (item->numdata.fromPat != NULL) + xsltFreeCompMatchList(item->numdata.fromPat); + } + break; + case XSLT_FUNC_APPLYIMPORTS: + break; + case XSLT_FUNC_CALLTEMPLATE: + break; + case XSLT_FUNC_APPLYTEMPLATES: { + xsltStyleItemApplyTemplatesPtr item = + (xsltStyleItemApplyTemplatesPtr) comp; + if (item->comp != NULL) + xmlXPathFreeCompExpr(item->comp); + } + break; + case XSLT_FUNC_CHOOSE: + break; + case XSLT_FUNC_IF: { + xsltStyleItemIfPtr item = (xsltStyleItemIfPtr) comp; + if (item->comp != NULL) + xmlXPathFreeCompExpr(item->comp); + } + break; + case XSLT_FUNC_FOREACH: { + xsltStyleItemForEachPtr item = + (xsltStyleItemForEachPtr) comp; + if (item->comp != NULL) + xmlXPathFreeCompExpr(item->comp); + } + break; + case XSLT_FUNC_DOCUMENT: + break; + case XSLT_FUNC_WITHPARAM: { + xsltStyleItemWithParamPtr item = + (xsltStyleItemWithParamPtr) comp; + if (item->comp != NULL) + xmlXPathFreeCompExpr(item->comp); + } + break; + case XSLT_FUNC_PARAM: { + xsltStyleItemParamPtr item = + (xsltStyleItemParamPtr) comp; + if (item->comp != NULL) + xmlXPathFreeCompExpr(item->comp); + } + break; + case XSLT_FUNC_VARIABLE: { + xsltStyleItemVariablePtr item = + (xsltStyleItemVariablePtr) comp; + if (item->comp != NULL) + xmlXPathFreeCompExpr(item->comp); + } + break; + case XSLT_FUNC_WHEN: { + xsltStyleItemWhenPtr item = + (xsltStyleItemWhenPtr) comp; + if (item->comp != NULL) + xmlXPathFreeCompExpr(item->comp); + } + break; + case XSLT_FUNC_OTHERWISE: + case XSLT_FUNC_FALLBACK: + case XSLT_FUNC_MESSAGE: + case XSLT_FUNC_INCLUDE: + case XSLT_FUNC_ATTRSET: + + break; + default: + /* TODO: Raise error. */ + break; + } +#else + if (comp->locale != (xsltLocale)0) + xsltFreeLocale(comp->locale); + if (comp->comp != NULL) + xmlXPathFreeCompExpr(comp->comp); + if (comp->numdata.countPat != NULL) + xsltFreeCompMatchList(comp->numdata.countPat); + if (comp->numdata.fromPat != NULL) + xsltFreeCompMatchList(comp->numdata.fromPat); + if (comp->nsList != NULL) + xmlFree(comp->nsList); +#endif + + xmlFree(comp); +} + + +/************************************************************************ + * * + * XSLT-1.1 extensions * + * * + ************************************************************************/ + +/** + * xsltDocumentComp: + * @style: the XSLT stylesheet + * @inst: the instruction in the stylesheet + * @function: unused + * + * Pre process an XSLT-1.1 document element + * + * Returns a precompiled data structure for the element + */ +xsltElemPreCompPtr +xsltDocumentComp(xsltStylesheetPtr style, xmlNodePtr inst, + xsltTransformFunction function ATTRIBUTE_UNUSED) { +#ifdef XSLT_REFACTORED + xsltStyleItemDocumentPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + const xmlChar *filename = NULL; + + /* + * As of 2006-03-30, this function is currently defined in Libxslt + * to be used for: + * (in libxslt/extra.c) + * "output" in XSLT_SAXON_NAMESPACE + * "write" XSLT_XALAN_NAMESPACE + * "document" XSLT_XT_NAMESPACE + * "document" XSLT_NAMESPACE (from the abandoned old working + * draft of XSLT 1.1) + * (in libexslt/common.c) + * "document" in EXSLT_COMMON_NAMESPACE + */ +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemDocumentPtr) + xsltNewStylePreComp(style, XSLT_FUNC_DOCUMENT); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_DOCUMENT); +#endif + + if (comp == NULL) + return (NULL); + comp->inst = inst; + comp->ver11 = 0; + + if (xmlStrEqual(inst->name, (const xmlChar *) "output")) { +#ifdef WITH_XSLT_DEBUG_EXTRA + xsltGenericDebug(xsltGenericDebugContext, + "Found saxon:output extension\n"); +#endif + /* + * The element "output" is in the namespace XSLT_SAXON_NAMESPACE + * (http://icl.com/saxon) + * The @file is in no namespace; it is an AVT. + * (http://www.computerwizards.com/saxon/doc/extensions.html#saxon:output) + * + * TODO: Do we need not to check the namespace here? + */ + filename = xsltEvalStaticAttrValueTemplate(style, inst, + (const xmlChar *)"file", + NULL, &comp->has_filename); + } else if (xmlStrEqual(inst->name, (const xmlChar *) "write")) { +#ifdef WITH_XSLT_DEBUG_EXTRA + xsltGenericDebug(xsltGenericDebugContext, + "Found xalan:write extension\n"); +#endif + /* the filename need to be interpreted */ + /* + * TODO: Is "filename need to be interpreted" meant to be a todo? + * Where will be the filename of xalan:write be processed? + * + * TODO: Do we need not to check the namespace here? + * The extension ns is "http://xml.apache.org/xalan/redirect". + * See http://xml.apache.org/xalan-j/extensionslib.html. + */ + } else if (xmlStrEqual(inst->name, (const xmlChar *) "document")) { + if (inst->ns != NULL) { + if (xmlStrEqual(inst->ns->href, XSLT_NAMESPACE)) { + /* + * Mark the instruction as being of + * XSLT version 1.1 (abandoned). + */ + comp->ver11 = 1; +#ifdef WITH_XSLT_DEBUG_EXTRA + xsltGenericDebug(xsltGenericDebugContext, + "Found xslt11:document construct\n"); +#endif + } else { + if (xmlStrEqual(inst->ns->href, + (const xmlChar *)"http://exslt.org/common")) { + /* EXSLT. */ +#ifdef WITH_XSLT_DEBUG_EXTRA + xsltGenericDebug(xsltGenericDebugContext, + "Found exslt:document extension\n"); +#endif + } else if (xmlStrEqual(inst->ns->href, XSLT_XT_NAMESPACE)) { + /* James Clark's XT. */ +#ifdef WITH_XSLT_DEBUG_EXTRA + xsltGenericDebug(xsltGenericDebugContext, + "Found xt:document extension\n"); +#endif + } + } + } + /* + * The element "document" is used in conjunction with the + * following namespaces: + * + * 1) XSLT_NAMESPACE (http://www.w3.org/1999/XSL/Transform version 1.1) + * + * + * TODO: is @href is an AVT? + * + * In all cases @href is in no namespace. + */ + filename = xsltEvalStaticAttrValueTemplate(style, inst, + (const xmlChar *)"href", NULL, &comp->has_filename); + } + if (!comp->has_filename) { + goto error; + } + comp->filename = filename; + +error: + return ((xsltElemPreCompPtr) comp); +} + +/************************************************************************ + * * + * Most of the XSLT-1.0 transformations * + * * + ************************************************************************/ + +/** + * xsltSortComp: + * @style: the XSLT stylesheet + * @inst: the xslt sort node + * + * Process the xslt sort node on the source node + */ +static void +xsltSortComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemSortPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemSortPtr) xsltNewStylePreComp(style, XSLT_FUNC_SORT); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_SORT); +#endif + + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; + + comp->stype = xsltEvalStaticAttrValueTemplate(style, inst, + (const xmlChar *)"data-type", + NULL, &comp->has_stype); + if (comp->stype != NULL) { + if (xmlStrEqual(comp->stype, (const xmlChar *) "text")) + comp->number = 0; + else if (xmlStrEqual(comp->stype, (const xmlChar *) "number")) + comp->number = 1; + else { + xsltTransformError(NULL, style, inst, + "xsltSortComp: no support for data-type = %s\n", comp->stype); + comp->number = 0; /* use default */ + if (style != NULL) style->warnings++; + } + } + comp->order = xsltEvalStaticAttrValueTemplate(style, inst, + (const xmlChar *)"order", + NULL, &comp->has_order); + if (comp->order != NULL) { + if (xmlStrEqual(comp->order, (const xmlChar *) "ascending")) + comp->descending = 0; + else if (xmlStrEqual(comp->order, (const xmlChar *) "descending")) + comp->descending = 1; + else { + xsltTransformError(NULL, style, inst, + "xsltSortComp: invalid value %s for order\n", comp->order); + comp->descending = 0; /* use default */ + if (style != NULL) style->warnings++; + } + } + comp->case_order = xsltEvalStaticAttrValueTemplate(style, inst, + (const xmlChar *)"case-order", + NULL, &comp->has_use); + if (comp->case_order != NULL) { + if (xmlStrEqual(comp->case_order, (const xmlChar *) "upper-first")) + comp->lower_first = 0; + else if (xmlStrEqual(comp->case_order, (const xmlChar *) "lower-first")) + comp->lower_first = 1; + else { + xsltTransformError(NULL, style, inst, + "xsltSortComp: invalid value %s for order\n", comp->order); + comp->lower_first = 0; /* use default */ + if (style != NULL) style->warnings++; + } + } + + comp->lang = xsltEvalStaticAttrValueTemplate(style, inst, + (const xmlChar *)"lang", + NULL, &comp->has_lang); + if (comp->lang != NULL) { + comp->locale = xsltNewLocale(comp->lang); + } + else { + comp->locale = (xsltLocale)0; + } + + comp->select = xsltGetCNsProp(style, inst,(const xmlChar *)"select", XSLT_NAMESPACE); + if (comp->select == NULL) { + /* + * The default value of the select attribute is ., which will + * cause the string-value of the current node to be used as + * the sort key. + */ + comp->select = xmlDictLookup(style->dict, BAD_CAST ".", 1); + } + comp->comp = xsltXPathCompile(style, comp->select); + if (comp->comp == NULL) { + xsltTransformError(NULL, style, inst, + "xsltSortComp: could not compile select expression '%s'\n", + comp->select); + if (style != NULL) style->errors++; + } + if (inst->children != NULL) { + xsltTransformError(NULL, style, inst, + "xsl:sort : is not empty\n"); + if (style != NULL) style->errors++; + } +} + +/** + * xsltCopyComp: + * @style: the XSLT stylesheet + * @inst: the xslt copy node + * + * Process the xslt copy node on the source node + */ +static void +xsltCopyComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemCopyPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemCopyPtr) xsltNewStylePreComp(style, XSLT_FUNC_COPY); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_COPY); +#endif + + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; + + + comp->use = xsltGetCNsProp(style, inst, (const xmlChar *)"use-attribute-sets", + XSLT_NAMESPACE); + if (comp->use == NULL) + comp->has_use = 0; + else + comp->has_use = 1; +} + +#ifdef XSLT_REFACTORED + /* Enable if ever needed for xsl:text. */ +#else +/** + * xsltTextComp: + * @style: an XSLT compiled stylesheet + * @inst: the xslt text node + * + * TODO: This function is obsolete, since xsl:text won't + * be compiled, but removed from the tree. + * + * Process the xslt text node on the source node + */ +static void +xsltTextComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemTextPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + const xmlChar *prop; + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemTextPtr) xsltNewStylePreComp(style, XSLT_FUNC_TEXT); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_TEXT); +#endif + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; + comp->noescape = 0; + + prop = xsltGetCNsProp(style, inst, + (const xmlChar *)"disable-output-escaping", + XSLT_NAMESPACE); + if (prop != NULL) { + if (xmlStrEqual(prop, (const xmlChar *)"yes")) { + comp->noescape = 1; + } else if (!xmlStrEqual(prop, + (const xmlChar *)"no")){ + xsltTransformError(NULL, style, inst, + "xsl:text: disable-output-escaping allows only yes or no\n"); + if (style != NULL) style->warnings++; + } + } +} +#endif /* else of XSLT_REFACTORED */ + +/** + * xsltElementComp: + * @style: an XSLT compiled stylesheet + * @inst: the xslt element node + * + * Process the xslt element node on the source node + */ +static void +xsltElementComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemElementPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + /* + * + * + * + */ + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemElementPtr) xsltNewStylePreComp(style, XSLT_FUNC_ELEMENT); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_ELEMENT); +#endif + + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; + + /* + * Attribute "name". + */ + /* + * TODO: Precompile the AVT. See bug #344894. + */ + comp->name = xsltEvalStaticAttrValueTemplate(style, inst, + (const xmlChar *)"name", NULL, &comp->has_name); + if (! comp->has_name) { + xsltTransformError(NULL, style, inst, + "xsl:element: The attribute 'name' is missing.\n"); + style->errors++; + goto error; + } + /* + * Attribute "namespace". + */ + /* + * TODO: Precompile the AVT. See bug #344894. + */ + comp->ns = xsltEvalStaticAttrValueTemplate(style, inst, + (const xmlChar *)"namespace", NULL, &comp->has_ns); + + if (comp->name != NULL) { + if (xmlValidateQName(comp->name, 0)) { + xsltTransformError(NULL, style, inst, + "xsl:element: The value '%s' of the attribute 'name' is " + "not a valid QName.\n", comp->name); + style->errors++; + } else { + const xmlChar *prefix = NULL, *name; + + name = xsltSplitQName(style->dict, comp->name, &prefix); + if (comp->has_ns == 0) { + xmlNsPtr ns; + + /* + * SPEC XSLT 1.0: + * "If the namespace attribute is not present, then the QName is + * expanded into an expanded-name using the namespace declarations + * in effect for the xsl:element element, including any default + * namespace declaration. + */ + ns = xmlSearchNs(inst->doc, inst, prefix); + if (ns != NULL) { + comp->ns = xmlDictLookup(style->dict, ns->href, -1); + comp->has_ns = 1; +#ifdef XSLT_REFACTORED + comp->nsPrefix = prefix; + comp->name = name; +#else + (void)name; /* Suppress unused variable warning. */ +#endif + } else if (prefix != NULL) { + xsltTransformError(NULL, style, inst, + "xsl:element: The prefixed QName '%s' " + "has no namespace binding in scope in the " + "stylesheet; this is an error, since the namespace was " + "not specified by the instruction itself.\n", comp->name); + style->errors++; + } + } + if ((prefix != NULL) && + (!xmlStrncasecmp(prefix, (xmlChar *)"xml", 3))) + { + /* + * Mark is to be skipped. + */ + comp->has_name = 0; + } + } + } + /* + * Attribute "use-attribute-sets", + */ + comp->use = xsltEvalStaticAttrValueTemplate(style, inst, + (const xmlChar *)"use-attribute-sets", + NULL, &comp->has_use); + +error: + return; +} + +/** + * xsltAttributeComp: + * @style: an XSLT compiled stylesheet + * @inst: the xslt attribute node + * + * Process the xslt attribute node on the source node + */ +static void +xsltAttributeComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemAttributePtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + /* + * + * + * + */ + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemAttributePtr) xsltNewStylePreComp(style, + XSLT_FUNC_ATTRIBUTE); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_ATTRIBUTE); +#endif + + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; + + /* + * Attribute "name". + */ + /* + * TODO: Precompile the AVT. See bug #344894. + */ + comp->name = xsltEvalStaticAttrValueTemplate(style, inst, + (const xmlChar *)"name", + NULL, &comp->has_name); + if (! comp->has_name) { + xsltTransformError(NULL, style, inst, + "XSLT-attribute: The attribute 'name' is missing.\n"); + style->errors++; + return; + } + /* + * Attribute "namespace". + */ + /* + * TODO: Precompile the AVT. See bug #344894. + */ + comp->ns = xsltEvalStaticAttrValueTemplate(style, inst, + (const xmlChar *)"namespace", + NULL, &comp->has_ns); + + if (comp->name != NULL) { + if (xmlValidateQName(comp->name, 0)) { + xsltTransformError(NULL, style, inst, + "xsl:attribute: The value '%s' of the attribute 'name' is " + "not a valid QName.\n", comp->name); + style->errors++; + } else if (xmlStrEqual(comp->name, BAD_CAST "xmlns")) { + xsltTransformError(NULL, style, inst, + "xsl:attribute: The attribute name 'xmlns' is not allowed.\n"); + style->errors++; + } else { + const xmlChar *prefix = NULL, *name; + + name = xsltSplitQName(style->dict, comp->name, &prefix); + if (prefix != NULL) { + if (comp->has_ns == 0) { + xmlNsPtr ns; + + /* + * SPEC XSLT 1.0: + * "If the namespace attribute is not present, then the + * QName is expanded into an expanded-name using the + * namespace declarations in effect for the xsl:element + * element, including any default namespace declaration. + */ + ns = xmlSearchNs(inst->doc, inst, prefix); + if (ns != NULL) { + comp->ns = xmlDictLookup(style->dict, ns->href, -1); + comp->has_ns = 1; +#ifdef XSLT_REFACTORED + comp->nsPrefix = prefix; + comp->name = name; +#else + (void)name; /* Suppress unused variable warning. */ +#endif + } else { + xsltTransformError(NULL, style, inst, + "xsl:attribute: The prefixed QName '%s' " + "has no namespace binding in scope in the " + "stylesheet; this is an error, since the " + "namespace was not specified by the instruction " + "itself.\n", comp->name); + style->errors++; + } + } + } + } + } +} + +/** + * xsltCommentComp: + * @style: an XSLT compiled stylesheet + * @inst: the xslt comment node + * + * Process the xslt comment node on the source node + */ +static void +xsltCommentComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemCommentPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemCommentPtr) xsltNewStylePreComp(style, XSLT_FUNC_COMMENT); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_COMMENT); +#endif + + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; +} + +/** + * xsltProcessingInstructionComp: + * @style: an XSLT compiled stylesheet + * @inst: the xslt processing-instruction node + * + * Process the xslt processing-instruction node on the source node + */ +static void +xsltProcessingInstructionComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemPIPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemPIPtr) xsltNewStylePreComp(style, XSLT_FUNC_PI); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_PI); +#endif + + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; + + comp->name = xsltEvalStaticAttrValueTemplate(style, inst, + (const xmlChar *)"name", + XSLT_NAMESPACE, &comp->has_name); +} + +/** + * xsltCopyOfComp: + * @style: an XSLT compiled stylesheet + * @inst: the xslt copy-of node + * + * Process the xslt copy-of node on the source node + */ +static void +xsltCopyOfComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemCopyOfPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemCopyOfPtr) xsltNewStylePreComp(style, XSLT_FUNC_COPYOF); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_COPYOF); +#endif + + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; + + comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select", + XSLT_NAMESPACE); + if (comp->select == NULL) { + xsltTransformError(NULL, style, inst, + "xsl:copy-of : select is missing\n"); + if (style != NULL) style->errors++; + return; + } + comp->comp = xsltXPathCompile(style, comp->select); + if (comp->comp == NULL) { + xsltTransformError(NULL, style, inst, + "xsl:copy-of : could not compile select expression '%s'\n", + comp->select); + if (style != NULL) style->errors++; + } +} + +/** + * xsltValueOfComp: + * @style: an XSLT compiled stylesheet + * @inst: the xslt value-of node + * + * Process the xslt value-of node on the source node + */ +static void +xsltValueOfComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemValueOfPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + const xmlChar *prop; + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemValueOfPtr) xsltNewStylePreComp(style, XSLT_FUNC_VALUEOF); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_VALUEOF); +#endif + + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; + + prop = xsltGetCNsProp(style, inst, + (const xmlChar *)"disable-output-escaping", + XSLT_NAMESPACE); + if (prop != NULL) { + if (xmlStrEqual(prop, (const xmlChar *)"yes")) { + comp->noescape = 1; + } else if (!xmlStrEqual(prop, + (const xmlChar *)"no")){ + xsltTransformError(NULL, style, inst, +"xsl:value-of : disable-output-escaping allows only yes or no\n"); + if (style != NULL) style->warnings++; + } + } + comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select", + XSLT_NAMESPACE); + if (comp->select == NULL) { + xsltTransformError(NULL, style, inst, + "xsl:value-of : select is missing\n"); + if (style != NULL) style->errors++; + return; + } + comp->comp = xsltXPathCompile(style, comp->select); + if (comp->comp == NULL) { + xsltTransformError(NULL, style, inst, + "xsl:value-of : could not compile select expression '%s'\n", + comp->select); + if (style != NULL) style->errors++; + } +} + +static void +xsltGetQNameProperty(xsltStylesheetPtr style, xmlNodePtr inst, + const xmlChar *propName, + int mandatory, + int *hasProp, const xmlChar **nsName, + const xmlChar** localName) +{ + const xmlChar *prop; + + if (nsName) + *nsName = NULL; + if (localName) + *localName = NULL; + if (hasProp) + *hasProp = 0; + + prop = xsltGetCNsProp(style, inst, propName, XSLT_NAMESPACE); + if (prop == NULL) { + if (mandatory) { + xsltTransformError(NULL, style, inst, + "The attribute '%s' is missing.\n", propName); + style->errors++; + return; + } + } else { + const xmlChar *URI; + + if (xmlValidateQName(prop, 0)) { + xsltTransformError(NULL, style, inst, + "The value '%s' of the attribute " + "'%s' is not a valid QName.\n", prop, propName); + style->errors++; + return; + } else { + /* + * @prop will be in the string dict afterwards, @URI not. + */ + URI = xsltGetQNameURI2(style, inst, &prop); + if (prop == NULL) { + style->errors++; + } else { + if (localName) + *localName = prop; + if (hasProp) + *hasProp = 1; + if (URI != NULL) { + /* + * Fixes bug #308441: Put the ns-name in the dict + * in order to pointer compare names during XPath's + * variable lookup. + */ + if (nsName) + *nsName = xmlDictLookup(style->dict, URI, -1); + /* comp->has_ns = 1; */ + } + } + } + } + return; +} + +/** + * xsltWithParamComp: + * @style: an XSLT compiled stylesheet + * @inst: the xslt with-param node + * + * Process the xslt with-param node on the source node + * Allowed parents: xsl:call-template, xsl:apply-templates. + * + * + * + */ +static void +xsltWithParamComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemWithParamPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemWithParamPtr) xsltNewStylePreComp(style, XSLT_FUNC_WITHPARAM); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_WITHPARAM); +#endif + + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; + + /* + * Attribute "name". + */ + xsltGetQNameProperty(style, inst, BAD_CAST "name", + 1, &(comp->has_name), &(comp->ns), &(comp->name)); + if (comp->ns) + comp->has_ns = 1; + /* + * Attribute "select". + */ + comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select", + XSLT_NAMESPACE); + if (comp->select != NULL) { + comp->comp = xsltXPathCompile(style, comp->select); + if (comp->comp == NULL) { + xsltTransformError(NULL, style, inst, + "XSLT-with-param: Failed to compile select " + "expression '%s'\n", comp->select); + style->errors++; + } + if (inst->children != NULL) { + xsltTransformError(NULL, style, inst, + "XSLT-with-param: The content should be empty since " + "the attribute select is present.\n"); + style->warnings++; + } + } +} + +/** + * xsltNumberComp: + * @style: an XSLT compiled stylesheet + * @cur: the xslt number node + * + * Process the xslt number node on the source node + */ +static void +xsltNumberComp(xsltStylesheetPtr style, xmlNodePtr cur) { +#ifdef XSLT_REFACTORED + xsltStyleItemNumberPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + const xmlChar *prop; + + if ((style == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemNumberPtr) xsltNewStylePreComp(style, XSLT_FUNC_NUMBER); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_NUMBER); +#endif + + if (comp == NULL) + return; + cur->psvi = comp; + + if ((style == NULL) || (cur == NULL)) + return; + + comp->numdata.doc = cur->doc; + comp->numdata.node = cur; + comp->numdata.value = xsltGetCNsProp(style, cur, (const xmlChar *)"value", + XSLT_NAMESPACE); + + prop = xsltEvalStaticAttrValueTemplate(style, cur, + (const xmlChar *)"format", + XSLT_NAMESPACE, &comp->numdata.has_format); + if (comp->numdata.has_format == 0) { + comp->numdata.format = xmlDictLookup(style->dict, BAD_CAST "" , 0); + } else { + comp->numdata.format = prop; + } + + comp->numdata.count = xsltGetCNsProp(style, cur, (const xmlChar *)"count", + XSLT_NAMESPACE); + comp->numdata.from = xsltGetCNsProp(style, cur, (const xmlChar *)"from", + XSLT_NAMESPACE); + + prop = xsltGetCNsProp(style, cur, (const xmlChar *)"count", XSLT_NAMESPACE); + if (prop != NULL) { + comp->numdata.countPat = xsltCompilePattern(prop, cur->doc, cur, style, + NULL); + } + + prop = xsltGetCNsProp(style, cur, (const xmlChar *)"from", XSLT_NAMESPACE); + if (prop != NULL) { + comp->numdata.fromPat = xsltCompilePattern(prop, cur->doc, cur, style, + NULL); + } + + prop = xsltGetCNsProp(style, cur, (const xmlChar *)"level", XSLT_NAMESPACE); + if (prop != NULL) { + if (xmlStrEqual(prop, BAD_CAST("single")) || + xmlStrEqual(prop, BAD_CAST("multiple")) || + xmlStrEqual(prop, BAD_CAST("any"))) { + comp->numdata.level = prop; + } else { + xsltTransformError(NULL, style, cur, + "xsl:number : invalid value %s for level\n", prop); + if (style != NULL) style->warnings++; + } + } + + prop = xsltGetCNsProp(style, cur, (const xmlChar *)"lang", XSLT_NAMESPACE); + if (prop != NULL) { + xsltTransformError(NULL, style, cur, + "xsl:number : lang attribute not implemented\n"); + XSLT_TODO; /* xsl:number lang attribute */ + } + + prop = xsltGetCNsProp(style, cur, (const xmlChar *)"letter-value", XSLT_NAMESPACE); + if (prop != NULL) { + if (xmlStrEqual(prop, BAD_CAST("alphabetic"))) { + xsltTransformError(NULL, style, cur, + "xsl:number : letter-value 'alphabetic' not implemented\n"); + if (style != NULL) style->warnings++; + XSLT_TODO; /* xsl:number letter-value attribute alphabetic */ + } else if (xmlStrEqual(prop, BAD_CAST("traditional"))) { + xsltTransformError(NULL, style, cur, + "xsl:number : letter-value 'traditional' not implemented\n"); + if (style != NULL) style->warnings++; + XSLT_TODO; /* xsl:number letter-value attribute traditional */ + } else { + xsltTransformError(NULL, style, cur, + "xsl:number : invalid value %s for letter-value\n", prop); + if (style != NULL) style->warnings++; + } + } + + prop = xsltGetCNsProp(style, cur, (const xmlChar *)"grouping-separator", + XSLT_NAMESPACE); + if (prop != NULL) { + comp->numdata.groupingCharacterLen = xmlStrlen(prop); + comp->numdata.groupingCharacter = + xsltGetUTF8Char(prop, &(comp->numdata.groupingCharacterLen)); + } + + prop = xsltGetCNsProp(style, cur, (const xmlChar *)"grouping-size", XSLT_NAMESPACE); + if (prop != NULL) { + sscanf((char *)prop, "%d", &comp->numdata.digitsPerGroup); + } else { + comp->numdata.groupingCharacter = 0; + } + + /* Set default values */ + if (comp->numdata.value == NULL) { + if (comp->numdata.level == NULL) { + comp->numdata.level = xmlDictLookup(style->dict, + BAD_CAST"single", 6); + } + } + +} + +/** + * xsltApplyImportsComp: + * @style: an XSLT compiled stylesheet + * @inst: the xslt apply-imports node + * + * Process the xslt apply-imports node on the source node + */ +static void +xsltApplyImportsComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemApplyImportsPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemApplyImportsPtr) xsltNewStylePreComp(style, XSLT_FUNC_APPLYIMPORTS); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_APPLYIMPORTS); +#endif + + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; +} + +/** + * xsltCallTemplateComp: + * @style: an XSLT compiled stylesheet + * @inst: the xslt call-template node + * + * Process the xslt call-template node on the source node + */ +static void +xsltCallTemplateComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemCallTemplatePtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemCallTemplatePtr) + xsltNewStylePreComp(style, XSLT_FUNC_CALLTEMPLATE); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_CALLTEMPLATE); +#endif + + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; + + /* + * Attribute "name". + */ + xsltGetQNameProperty(style, inst, BAD_CAST "name", + 1, &(comp->has_name), &(comp->ns), &(comp->name)); + if (comp->ns) + comp->has_ns = 1; +} + +/** + * xsltApplyTemplatesComp: + * @style: an XSLT compiled stylesheet + * @inst: the apply-templates node + * + * Process the apply-templates node on the source node + */ +static void +xsltApplyTemplatesComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemApplyTemplatesPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemApplyTemplatesPtr) + xsltNewStylePreComp(style, XSLT_FUNC_APPLYTEMPLATES); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_APPLYTEMPLATES); +#endif + + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; + + /* + * Attribute "mode". + */ + xsltGetQNameProperty(style, inst, BAD_CAST "mode", + 0, NULL, &(comp->modeURI), &(comp->mode)); + /* + * Attribute "select". + */ + comp->select = xsltGetCNsProp(style, inst, BAD_CAST "select", + XSLT_NAMESPACE); + if (comp->select != NULL) { + comp->comp = xsltXPathCompile(style, comp->select); + if (comp->comp == NULL) { + xsltTransformError(NULL, style, inst, + "XSLT-apply-templates: could not compile select " + "expression '%s'\n", comp->select); + style->errors++; + } + } + /* TODO: handle (or skip) the xsl:sort and xsl:with-param */ +} + +/** + * xsltChooseComp: + * @style: an XSLT compiled stylesheet + * @inst: the xslt choose node + * + * Process the xslt choose node on the source node + */ +static void +xsltChooseComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemChoosePtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemChoosePtr) + xsltNewStylePreComp(style, XSLT_FUNC_CHOOSE); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_CHOOSE); +#endif + + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; +} + +/** + * xsltIfComp: + * @style: an XSLT compiled stylesheet + * @inst: the xslt if node + * + * Process the xslt if node on the source node + */ +static void +xsltIfComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemIfPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemIfPtr) + xsltNewStylePreComp(style, XSLT_FUNC_IF); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_IF); +#endif + + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; + + comp->test = xsltGetCNsProp(style, inst, (const xmlChar *)"test", XSLT_NAMESPACE); + if (comp->test == NULL) { + xsltTransformError(NULL, style, inst, + "xsl:if : test is not defined\n"); + if (style != NULL) style->errors++; + return; + } + comp->comp = xsltXPathCompile(style, comp->test); + if (comp->comp == NULL) { + xsltTransformError(NULL, style, inst, + "xsl:if : could not compile test expression '%s'\n", + comp->test); + if (style != NULL) style->errors++; + } +} + +/** + * xsltWhenComp: + * @style: an XSLT compiled stylesheet + * @inst: the xslt if node + * + * Process the xslt if node on the source node + */ +static void +xsltWhenComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemWhenPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemWhenPtr) + xsltNewStylePreComp(style, XSLT_FUNC_WHEN); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_WHEN); +#endif + + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; + + comp->test = xsltGetCNsProp(style, inst, (const xmlChar *)"test", XSLT_NAMESPACE); + if (comp->test == NULL) { + xsltTransformError(NULL, style, inst, + "xsl:when : test is not defined\n"); + if (style != NULL) style->errors++; + return; + } + comp->comp = xsltXPathCompile(style, comp->test); + if (comp->comp == NULL) { + xsltTransformError(NULL, style, inst, + "xsl:when : could not compile test expression '%s'\n", + comp->test); + if (style != NULL) style->errors++; + } +} + +/** + * xsltForEachComp: + * @style: an XSLT compiled stylesheet + * @inst: the xslt for-each node + * + * Process the xslt for-each node on the source node + */ +static void +xsltForEachComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemForEachPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemForEachPtr) + xsltNewStylePreComp(style, XSLT_FUNC_FOREACH); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_FOREACH); +#endif + + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; + + comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select", + XSLT_NAMESPACE); + if (comp->select == NULL) { + xsltTransformError(NULL, style, inst, + "xsl:for-each : select is missing\n"); + if (style != NULL) style->errors++; + } else { + comp->comp = xsltXPathCompile(style, comp->select); + if (comp->comp == NULL) { + xsltTransformError(NULL, style, inst, + "xsl:for-each : could not compile select expression '%s'\n", + comp->select); + if (style != NULL) style->errors++; + } + } + /* TODO: handle and skip the xsl:sort */ +} + +/** + * xsltVariableComp: + * @style: an XSLT compiled stylesheet + * @inst: the xslt variable node + * + * Process the xslt variable node on the source node + */ +static void +xsltVariableComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemVariablePtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemVariablePtr) + xsltNewStylePreComp(style, XSLT_FUNC_VARIABLE); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_VARIABLE); +#endif + + if (comp == NULL) + return; + + inst->psvi = comp; + comp->inst = inst; + /* + * The full template resolution can be done statically + */ + + /* + * Attribute "name". + */ + xsltGetQNameProperty(style, inst, BAD_CAST "name", + 1, &(comp->has_name), &(comp->ns), &(comp->name)); + if (comp->ns) + comp->has_ns = 1; + /* + * Attribute "select". + */ + comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select", + XSLT_NAMESPACE); + if (comp->select != NULL) { +#ifndef XSLT_REFACTORED + xmlNodePtr cur; +#endif + comp->comp = xsltXPathCompile(style, comp->select); + if (comp->comp == NULL) { + xsltTransformError(NULL, style, inst, + "XSLT-variable: Failed to compile the XPath expression '%s'.\n", + comp->select); + style->errors++; + } +#ifdef XSLT_REFACTORED + if (inst->children != NULL) { + xsltTransformError(NULL, style, inst, + "XSLT-variable: There must be no child nodes, since the " + "attribute 'select' was specified.\n"); + style->errors++; + } +#else + for (cur = inst->children; cur != NULL; cur = cur->next) { + if (cur->type != XML_COMMENT_NODE && + (cur->type != XML_TEXT_NODE || !xsltIsBlank(cur->content))) + { + xsltTransformError(NULL, style, inst, + "XSLT-variable: There must be no child nodes, since the " + "attribute 'select' was specified.\n"); + style->errors++; + } + } +#endif + } +} + +/** + * xsltParamComp: + * @style: an XSLT compiled stylesheet + * @inst: the xslt param node + * + * Process the xslt param node on the source node + */ +static void +xsltParamComp(xsltStylesheetPtr style, xmlNodePtr inst) { +#ifdef XSLT_REFACTORED + xsltStyleItemParamPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + comp = (xsltStyleItemParamPtr) + xsltNewStylePreComp(style, XSLT_FUNC_PARAM); +#else + comp = xsltNewStylePreComp(style, XSLT_FUNC_PARAM); +#endif + + if (comp == NULL) + return; + inst->psvi = comp; + comp->inst = inst; + + /* + * Attribute "name". + */ + xsltGetQNameProperty(style, inst, BAD_CAST "name", + 1, &(comp->has_name), &(comp->ns), &(comp->name)); + if (comp->ns) + comp->has_ns = 1; + /* + * Attribute "select". + */ + comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select", + XSLT_NAMESPACE); + if (comp->select != NULL) { + comp->comp = xsltXPathCompile(style, comp->select); + if (comp->comp == NULL) { + xsltTransformError(NULL, style, inst, + "XSLT-param: could not compile select expression '%s'.\n", + comp->select); + style->errors++; + } + if (inst->children != NULL) { + xsltTransformError(NULL, style, inst, + "XSLT-param: The content should be empty since the " + "attribute 'select' is present.\n"); + style->warnings++; + } + } +} + +/************************************************************************ + * * + * Generic interface * + * * + ************************************************************************/ + +/** + * xsltFreeStylePreComps: + * @style: an XSLT transformation context + * + * Free up the memory allocated by all precomputed blocks + */ +void +xsltFreeStylePreComps(xsltStylesheetPtr style) { + xsltElemPreCompPtr cur, next; + + if (style == NULL) + return; + + cur = style->preComps; + while (cur != NULL) { + next = cur->next; + if (cur->type == XSLT_FUNC_EXTENSION) + cur->free(cur); + else + xsltFreeStylePreComp((xsltStylePreCompPtr) cur); + cur = next; + } +} + +#ifdef XSLT_REFACTORED + +/** + * xsltStylePreCompute: + * @style: the XSLT stylesheet + * @node: the element in the XSLT namespace + * + * Precompute an XSLT element. + * This expects the type of the element to be already + * set in style->compCtxt->inode->type; + */ +void +xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr node) { + /* + * The xsltXSLTElemMarker marker was set beforehand by + * the parsing mechanism for all elements in the XSLT namespace. + */ + if (style == NULL) { + if ((node != NULL) && (node->type == XML_ELEMENT_NODE)) + node->psvi = NULL; + return; + } + if (node == NULL) + return; + if (! IS_XSLT_ELEM_FAST(node)) + return; + + node->psvi = NULL; + if (XSLT_CCTXT(style)->inode->type != 0) { + switch (XSLT_CCTXT(style)->inode->type) { + case XSLT_FUNC_APPLYTEMPLATES: + xsltApplyTemplatesComp(style, node); + break; + case XSLT_FUNC_WITHPARAM: + xsltWithParamComp(style, node); + break; + case XSLT_FUNC_VALUEOF: + xsltValueOfComp(style, node); + break; + case XSLT_FUNC_COPY: + xsltCopyComp(style, node); + break; + case XSLT_FUNC_COPYOF: + xsltCopyOfComp(style, node); + break; + case XSLT_FUNC_IF: + xsltIfComp(style, node); + break; + case XSLT_FUNC_CHOOSE: + xsltChooseComp(style, node); + break; + case XSLT_FUNC_WHEN: + xsltWhenComp(style, node); + break; + case XSLT_FUNC_OTHERWISE: + /* NOP yet */ + return; + case XSLT_FUNC_FOREACH: + xsltForEachComp(style, node); + break; + case XSLT_FUNC_APPLYIMPORTS: + xsltApplyImportsComp(style, node); + break; + case XSLT_FUNC_ATTRIBUTE: + xsltAttributeComp(style, node); + break; + case XSLT_FUNC_ELEMENT: + xsltElementComp(style, node); + break; + case XSLT_FUNC_SORT: + xsltSortComp(style, node); + break; + case XSLT_FUNC_COMMENT: + xsltCommentComp(style, node); + break; + case XSLT_FUNC_NUMBER: + xsltNumberComp(style, node); + break; + case XSLT_FUNC_PI: + xsltProcessingInstructionComp(style, node); + break; + case XSLT_FUNC_CALLTEMPLATE: + xsltCallTemplateComp(style, node); + break; + case XSLT_FUNC_PARAM: + xsltParamComp(style, node); + break; + case XSLT_FUNC_VARIABLE: + xsltVariableComp(style, node); + break; + case XSLT_FUNC_FALLBACK: + /* NOP yet */ + return; + case XSLT_FUNC_DOCUMENT: + /* The extra one */ + node->psvi = (void *) xsltDocumentComp(style, node, + (xsltTransformFunction) xsltDocumentElem); + break; + case XSLT_FUNC_MESSAGE: + /* NOP yet */ + return; + default: + /* + * NOTE that xsl:text, xsl:template, xsl:stylesheet, + * xsl:transform, xsl:import, xsl:include are not expected + * to be handed over to this function. + */ + xsltTransformError(NULL, style, node, + "Internal error: (xsltStylePreCompute) cannot handle " + "the XSLT element '%s'.\n", node->name); + style->errors++; + return; + } + } else { + /* + * Fallback to string comparison. + */ + if (IS_XSLT_NAME(node, "apply-templates")) { + xsltApplyTemplatesComp(style, node); + } else if (IS_XSLT_NAME(node, "with-param")) { + xsltWithParamComp(style, node); + } else if (IS_XSLT_NAME(node, "value-of")) { + xsltValueOfComp(style, node); + } else if (IS_XSLT_NAME(node, "copy")) { + xsltCopyComp(style, node); + } else if (IS_XSLT_NAME(node, "copy-of")) { + xsltCopyOfComp(style, node); + } else if (IS_XSLT_NAME(node, "if")) { + xsltIfComp(style, node); + } else if (IS_XSLT_NAME(node, "choose")) { + xsltChooseComp(style, node); + } else if (IS_XSLT_NAME(node, "when")) { + xsltWhenComp(style, node); + } else if (IS_XSLT_NAME(node, "otherwise")) { + /* NOP yet */ + return; + } else if (IS_XSLT_NAME(node, "for-each")) { + xsltForEachComp(style, node); + } else if (IS_XSLT_NAME(node, "apply-imports")) { + xsltApplyImportsComp(style, node); + } else if (IS_XSLT_NAME(node, "attribute")) { + xsltAttributeComp(style, node); + } else if (IS_XSLT_NAME(node, "element")) { + xsltElementComp(style, node); + } else if (IS_XSLT_NAME(node, "sort")) { + xsltSortComp(style, node); + } else if (IS_XSLT_NAME(node, "comment")) { + xsltCommentComp(style, node); + } else if (IS_XSLT_NAME(node, "number")) { + xsltNumberComp(style, node); + } else if (IS_XSLT_NAME(node, "processing-instruction")) { + xsltProcessingInstructionComp(style, node); + } else if (IS_XSLT_NAME(node, "call-template")) { + xsltCallTemplateComp(style, node); + } else if (IS_XSLT_NAME(node, "param")) { + xsltParamComp(style, node); + } else if (IS_XSLT_NAME(node, "variable")) { + xsltVariableComp(style, node); + } else if (IS_XSLT_NAME(node, "fallback")) { + /* NOP yet */ + return; + } else if (IS_XSLT_NAME(node, "document")) { + /* The extra one */ + node->psvi = (void *) xsltDocumentComp(style, node, + (xsltTransformFunction) xsltDocumentElem); + } else if (IS_XSLT_NAME(node, "output")) { + /* Top-level */ + return; + } else if (IS_XSLT_NAME(node, "preserve-space")) { + /* Top-level */ + return; + } else if (IS_XSLT_NAME(node, "strip-space")) { + /* Top-level */ + return; + } else if (IS_XSLT_NAME(node, "key")) { + /* Top-level */ + return; + } else if (IS_XSLT_NAME(node, "message")) { + return; + } else if (IS_XSLT_NAME(node, "attribute-set")) { + /* Top-level */ + return; + } else if (IS_XSLT_NAME(node, "namespace-alias")) { + /* Top-level */ + return; + } else if (IS_XSLT_NAME(node, "decimal-format")) { + /* Top-level */ + return; + } else if (IS_XSLT_NAME(node, "include")) { + /* Top-level */ + } else { + /* + * NOTE that xsl:text, xsl:template, xsl:stylesheet, + * xsl:transform, xsl:import, xsl:include are not expected + * to be handed over to this function. + */ + xsltTransformError(NULL, style, node, + "Internal error: (xsltStylePreCompute) cannot handle " + "the XSLT element '%s'.\n", node->name); + style->errors++; + return; + } + } + /* + * Assign the current list of in-scope namespaces to the + * item. This is needed for XPath expressions. + */ + if (node->psvi != NULL) { + ((xsltStylePreCompPtr) node->psvi)->inScopeNs = + XSLT_CCTXT(style)->inode->inScopeNs; + } +} + +#else + +/** + * xsltStylePreCompute: + * @style: the XSLT stylesheet + * @inst: the instruction in the stylesheet + * + * Precompute an XSLT stylesheet element + */ +void +xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr inst) { + /* + * URGENT TODO: Normally inst->psvi Should never be reserved here, + * BUT: since if we include the same stylesheet from + * multiple imports, then the stylesheet will be parsed + * again. We simply must not try to compute the stylesheet again. + * TODO: Get to the point where we don't need to query the + * namespace- and local-name of the node, but can evaluate this + * using cctxt->style->inode->category; + */ + if ((inst == NULL) || (inst->type != XML_ELEMENT_NODE) || + (inst->psvi != NULL)) + return; + + if (IS_XSLT_ELEM(inst)) { + xsltStylePreCompPtr cur; + + if (IS_XSLT_NAME(inst, "apply-templates")) { + xsltCheckInstructionElement(style, inst); + xsltApplyTemplatesComp(style, inst); + } else if (IS_XSLT_NAME(inst, "with-param")) { + xsltCheckParentElement(style, inst, BAD_CAST "apply-templates", + BAD_CAST "call-template"); + xsltWithParamComp(style, inst); + } else if (IS_XSLT_NAME(inst, "value-of")) { + xsltCheckInstructionElement(style, inst); + xsltValueOfComp(style, inst); + } else if (IS_XSLT_NAME(inst, "copy")) { + xsltCheckInstructionElement(style, inst); + xsltCopyComp(style, inst); + } else if (IS_XSLT_NAME(inst, "copy-of")) { + xsltCheckInstructionElement(style, inst); + xsltCopyOfComp(style, inst); + } else if (IS_XSLT_NAME(inst, "if")) { + xsltCheckInstructionElement(style, inst); + xsltIfComp(style, inst); + } else if (IS_XSLT_NAME(inst, "when")) { + xsltCheckParentElement(style, inst, BAD_CAST "choose", NULL); + xsltWhenComp(style, inst); + } else if (IS_XSLT_NAME(inst, "choose")) { + xsltCheckInstructionElement(style, inst); + xsltChooseComp(style, inst); + } else if (IS_XSLT_NAME(inst, "for-each")) { + xsltCheckInstructionElement(style, inst); + xsltForEachComp(style, inst); + } else if (IS_XSLT_NAME(inst, "apply-imports")) { + xsltCheckInstructionElement(style, inst); + xsltApplyImportsComp(style, inst); + } else if (IS_XSLT_NAME(inst, "attribute")) { + xmlNodePtr parent = inst->parent; + + if ((parent == NULL) || + (parent->type != XML_ELEMENT_NODE) || (parent->ns == NULL) || + ((parent->ns != inst->ns) && + (!xmlStrEqual(parent->ns->href, inst->ns->href))) || + (!xmlStrEqual(parent->name, BAD_CAST "attribute-set"))) { + xsltCheckInstructionElement(style, inst); + } + xsltAttributeComp(style, inst); + } else if (IS_XSLT_NAME(inst, "element")) { + xsltCheckInstructionElement(style, inst); + xsltElementComp(style, inst); + } else if (IS_XSLT_NAME(inst, "text")) { + xsltCheckInstructionElement(style, inst); + xsltTextComp(style, inst); + } else if (IS_XSLT_NAME(inst, "sort")) { + xsltCheckParentElement(style, inst, BAD_CAST "apply-templates", + BAD_CAST "for-each"); + xsltSortComp(style, inst); + } else if (IS_XSLT_NAME(inst, "comment")) { + xsltCheckInstructionElement(style, inst); + xsltCommentComp(style, inst); + } else if (IS_XSLT_NAME(inst, "number")) { + xsltCheckInstructionElement(style, inst); + xsltNumberComp(style, inst); + } else if (IS_XSLT_NAME(inst, "processing-instruction")) { + xsltCheckInstructionElement(style, inst); + xsltProcessingInstructionComp(style, inst); + } else if (IS_XSLT_NAME(inst, "call-template")) { + xsltCheckInstructionElement(style, inst); + xsltCallTemplateComp(style, inst); + } else if (IS_XSLT_NAME(inst, "param")) { + if (xsltCheckTopLevelElement(style, inst, 0) == 0) + xsltCheckInstructionElement(style, inst); + xsltParamComp(style, inst); + } else if (IS_XSLT_NAME(inst, "variable")) { + if (xsltCheckTopLevelElement(style, inst, 0) == 0) + xsltCheckInstructionElement(style, inst); + xsltVariableComp(style, inst); + } else if (IS_XSLT_NAME(inst, "otherwise")) { + xsltCheckParentElement(style, inst, BAD_CAST "choose", NULL); + xsltCheckInstructionElement(style, inst); + return; + } else if (IS_XSLT_NAME(inst, "template")) { + xsltCheckTopLevelElement(style, inst, 1); + return; + } else if (IS_XSLT_NAME(inst, "output")) { + xsltCheckTopLevelElement(style, inst, 1); + return; + } else if (IS_XSLT_NAME(inst, "preserve-space")) { + xsltCheckTopLevelElement(style, inst, 1); + return; + } else if (IS_XSLT_NAME(inst, "strip-space")) { + xsltCheckTopLevelElement(style, inst, 1); + return; + } else if ((IS_XSLT_NAME(inst, "stylesheet")) || + (IS_XSLT_NAME(inst, "transform"))) { + xmlNodePtr parent = inst->parent; + + if ((parent == NULL) || (parent->type != XML_DOCUMENT_NODE)) { + xsltTransformError(NULL, style, inst, + "element %s only allowed only as root element\n", + inst->name); + style->errors++; + } + return; + } else if (IS_XSLT_NAME(inst, "key")) { + xsltCheckTopLevelElement(style, inst, 1); + return; + } else if (IS_XSLT_NAME(inst, "message")) { + xsltCheckInstructionElement(style, inst); + return; + } else if (IS_XSLT_NAME(inst, "attribute-set")) { + xsltCheckTopLevelElement(style, inst, 1); + return; + } else if (IS_XSLT_NAME(inst, "namespace-alias")) { + xsltCheckTopLevelElement(style, inst, 1); + return; + } else if (IS_XSLT_NAME(inst, "include")) { + xsltCheckTopLevelElement(style, inst, 1); + return; + } else if (IS_XSLT_NAME(inst, "import")) { + xsltCheckTopLevelElement(style, inst, 1); + return; + } else if (IS_XSLT_NAME(inst, "decimal-format")) { + xsltCheckTopLevelElement(style, inst, 1); + return; + } else if (IS_XSLT_NAME(inst, "fallback")) { + xsltCheckInstructionElement(style, inst); + return; + } else if (IS_XSLT_NAME(inst, "document")) { + xsltCheckInstructionElement(style, inst); + inst->psvi = (void *) xsltDocumentComp(style, inst, + (xsltTransformFunction) xsltDocumentElem); + } else { + xsltTransformError(NULL, style, inst, + "xsltStylePreCompute: unknown xsl:%s\n", inst->name); + if (style != NULL) style->warnings++; + } + + cur = (xsltStylePreCompPtr) inst->psvi; + /* + * A ns-list is build for every XSLT item in the + * node-tree. This is needed for XPath expressions. + */ + if (cur != NULL) { + int i = 0; + + cur->nsList = xmlGetNsList(inst->doc, inst); + if (cur->nsList != NULL) { + while (cur->nsList[i] != NULL) + i++; + } + cur->nsNr = i; + } + } else { + inst->psvi = + (void *) xsltPreComputeExtModuleElement(style, inst); + + /* + * Unknown element, maybe registered at the context + * level. Mark it for later recognition. + */ + if (inst->psvi == NULL) + inst->psvi = (void *) xsltExtMarker; + } +} +#endif /* XSLT_REFACTORED */ diff --git a/libxslt/preproc.h b/libxslt/preproc.h new file mode 100644 index 0000000..caf464a --- /dev/null +++ b/libxslt/preproc.h @@ -0,0 +1,43 @@ +/* + * Summary: precomputing stylesheets + * Description: this is the compilation phase, where most of the + * stylesheet is "compiled" into faster to use data. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XSLT_PRECOMP_H__ +#define __XML_XSLT_PRECOMP_H__ + +#include +#include "xsltexports.h" +#include "xsltInternals.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Interfaces + */ +extern const xmlChar *xsltExtMarker; + +XSLTPUBFUN xsltElemPreCompPtr XSLTCALL + xsltDocumentComp (xsltStylesheetPtr style, + xmlNodePtr inst, + xsltTransformFunction function); + +XSLTPUBFUN void XSLTCALL + xsltStylePreCompute (xsltStylesheetPtr style, + xmlNodePtr inst); +XSLTPUBFUN void XSLTCALL + xsltFreeStylePreComps (xsltStylesheetPtr style); + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XSLT_PRECOMP_H__ */ + diff --git a/libxslt/security.c b/libxslt/security.c new file mode 100644 index 0000000..965175f --- /dev/null +++ b/libxslt/security.c @@ -0,0 +1,480 @@ +/* + * security.c: Implementation of the XSLT security framework + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif + +#ifdef HAVE_MATH_H +#include +#endif +#ifdef HAVE_FLOAT_H +#include +#endif +#ifdef HAVE_IEEEFP_H +#include +#endif +#ifdef HAVE_NAN_H +#include +#endif +#ifdef HAVE_CTYPE_H +#include +#endif + +#if defined(WIN32) && !defined(__CYGWIN__) +#include +#ifndef INVALID_FILE_ATTRIBUTES +#define INVALID_FILE_ATTRIBUTES ((DWORD)-1) +#endif +#endif + +#ifndef HAVE_STAT +# ifdef HAVE__STAT + /* MS C library seems to define stat and _stat. The definition + * is identical. Still, mapping them to each other causes a warning. */ +# ifndef _MSC_VER +# define stat(x,y) _stat(x,y) +# endif +# define HAVE_STAT +# endif +#endif + +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "extensions.h" +#include "security.h" + + +struct _xsltSecurityPrefs { + xsltSecurityCheck readFile; + xsltSecurityCheck createFile; + xsltSecurityCheck createDir; + xsltSecurityCheck readNet; + xsltSecurityCheck writeNet; +}; + +static xsltSecurityPrefsPtr xsltDefaultSecurityPrefs = NULL; + +/************************************************************************ + * * + * Module interfaces * + * * + ************************************************************************/ + +/** + * xsltNewSecurityPrefs: + * + * Create a new security preference block + * + * Returns a pointer to the new block or NULL in case of error + */ +xsltSecurityPrefsPtr +xsltNewSecurityPrefs(void) { + xsltSecurityPrefsPtr ret; + + xsltInitGlobals(); + + ret = (xsltSecurityPrefsPtr) xmlMalloc(sizeof(xsltSecurityPrefs)); + if (ret == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltNewSecurityPrefs : malloc failed\n"); + return(NULL); + } + memset(ret, 0, sizeof(xsltSecurityPrefs)); + return(ret); +} + +/** + * xsltFreeSecurityPrefs: + * @sec: the security block to free + * + * Free up a security preference block + */ +void +xsltFreeSecurityPrefs(xsltSecurityPrefsPtr sec) { + if (sec == NULL) + return; + xmlFree(sec); +} + +/** + * xsltSetSecurityPrefs: + * @sec: the security block to update + * @option: the option to update + * @func: the user callback to use for this option + * + * Update the security option to use the new callback checking function + * + * Returns -1 in case of error, 0 otherwise + */ +int +xsltSetSecurityPrefs(xsltSecurityPrefsPtr sec, xsltSecurityOption option, + xsltSecurityCheck func) { + xsltInitGlobals(); + if (sec == NULL) + return(-1); + switch (option) { + case XSLT_SECPREF_READ_FILE: + sec->readFile = func; return(0); + case XSLT_SECPREF_WRITE_FILE: + sec->createFile = func; return(0); + case XSLT_SECPREF_CREATE_DIRECTORY: + sec->createDir = func; return(0); + case XSLT_SECPREF_READ_NETWORK: + sec->readNet = func; return(0); + case XSLT_SECPREF_WRITE_NETWORK: + sec->writeNet = func; return(0); + } + return(-1); +} + +/** + * xsltGetSecurityPrefs: + * @sec: the security block to update + * @option: the option to lookup + * + * Lookup the security option to get the callback checking function + * + * Returns NULL if not found, the function otherwise + */ +xsltSecurityCheck +xsltGetSecurityPrefs(xsltSecurityPrefsPtr sec, xsltSecurityOption option) { + if (sec == NULL) + return(NULL); + switch (option) { + case XSLT_SECPREF_READ_FILE: + return(sec->readFile); + case XSLT_SECPREF_WRITE_FILE: + return(sec->createFile); + case XSLT_SECPREF_CREATE_DIRECTORY: + return(sec->createDir); + case XSLT_SECPREF_READ_NETWORK: + return(sec->readNet); + case XSLT_SECPREF_WRITE_NETWORK: + return(sec->writeNet); + } + return(NULL); +} + +/** + * xsltSetDefaultSecurityPrefs: + * @sec: the security block to use + * + * Set the default security preference application-wide + */ +void +xsltSetDefaultSecurityPrefs(xsltSecurityPrefsPtr sec) { + + xsltDefaultSecurityPrefs = sec; +} + +/** + * xsltGetDefaultSecurityPrefs: + * + * Get the default security preference application-wide + * + * Returns the current xsltSecurityPrefsPtr in use or NULL if none + */ +xsltSecurityPrefsPtr +xsltGetDefaultSecurityPrefs(void) { + return(xsltDefaultSecurityPrefs); +} + +/** + * xsltSetCtxtSecurityPrefs: + * @sec: the security block to use + * @ctxt: an XSLT transformation context + * + * Set the security preference for a specific transformation + * + * Returns -1 in case of error, 0 otherwise + */ +int +xsltSetCtxtSecurityPrefs(xsltSecurityPrefsPtr sec, + xsltTransformContextPtr ctxt) { + if (ctxt == NULL) + return(-1); + ctxt->sec = (void *) sec; + return(0); +} + + +/** + * xsltSecurityAllow: + * @sec: the security block to use + * @ctxt: an XSLT transformation context + * @value: unused + * + * Function used to always allow an operation + * + * Returns 1 always + */ +int +xsltSecurityAllow(xsltSecurityPrefsPtr sec ATTRIBUTE_UNUSED, + xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, + const char *value ATTRIBUTE_UNUSED) { + return(1); +} + +/** + * xsltSecurityForbid: + * @sec: the security block to use + * @ctxt: an XSLT transformation context + * @value: unused + * + * Function used to always forbid an operation + * + * Returns 0 always + */ +int +xsltSecurityForbid(xsltSecurityPrefsPtr sec ATTRIBUTE_UNUSED, + xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, + const char *value ATTRIBUTE_UNUSED) { + return(0); +} + +/************************************************************************ + * * + * Internal interfaces * + * * + ************************************************************************/ + +/** + * xsltCheckFilename + * @path: the path to check + * + * function checks to see if @path is a valid source + * (file, socket...) for XML. + * + * TODO: remove at some point !!! + * Local copy of xmlCheckFilename to avoid a hard dependency on + * a new version of libxml2 + * + * if stat is not available on the target machine, + * returns 1. if stat fails, returns 0 (if calling + * stat on the filename fails, it can't be right). + * if stat succeeds and the file is a directory, + * returns 2. otherwise returns 1. + */ + +static int +xsltCheckFilename (const char *path) +{ +#ifdef HAVE_STAT + struct stat stat_buffer; +#if defined(WIN32) && !defined(__CYGWIN__) + DWORD dwAttrs; + + dwAttrs = GetFileAttributes(path); + if (dwAttrs != INVALID_FILE_ATTRIBUTES) { + if (dwAttrs & FILE_ATTRIBUTE_DIRECTORY) { + return 2; + } + } +#endif + + if (stat(path, &stat_buffer) == -1) + return 0; + +#ifdef S_ISDIR + if (S_ISDIR(stat_buffer.st_mode)) { + return 2; + } +#endif +#endif + return 1; +} + +static int +xsltCheckWritePath(xsltSecurityPrefsPtr sec, + xsltTransformContextPtr ctxt, + const char *path) +{ + int ret; + xsltSecurityCheck check; + char *directory; + + check = xsltGetSecurityPrefs(sec, XSLT_SECPREF_WRITE_FILE); + if (check != NULL) { + ret = check(sec, ctxt, path); + if (ret == 0) { + xsltTransformError(ctxt, NULL, NULL, + "File write for %s refused\n", path); + return(0); + } + } + + directory = xmlParserGetDirectory (path); + + if (directory != NULL) { + ret = xsltCheckFilename(directory); + if (ret == 0) { + /* + * The directory doesn't exist check for creation + */ + check = xsltGetSecurityPrefs(sec, + XSLT_SECPREF_CREATE_DIRECTORY); + if (check != NULL) { + ret = check(sec, ctxt, directory); + if (ret == 0) { + xsltTransformError(ctxt, NULL, NULL, + "Directory creation for %s refused\n", + path); + xmlFree(directory); + return(0); + } + } + ret = xsltCheckWritePath(sec, ctxt, directory); + if (ret == 1) + ret = mkdir(directory, 0755); + } + xmlFree(directory); + if (ret < 0) + return(ret); + } + + return(1); +} + +/** + * xsltCheckWrite: + * @sec: the security options + * @ctxt: an XSLT transformation context + * @URL: the resource to be written + * + * Check if the resource is allowed to be written, if necessary makes + * some preliminary work like creating directories + * + * Return 1 if write is allowed, 0 if not and -1 in case or error. + */ +int +xsltCheckWrite(xsltSecurityPrefsPtr sec, + xsltTransformContextPtr ctxt, const xmlChar *URL) { + int ret; + xmlURIPtr uri; + xsltSecurityCheck check; + + uri = xmlParseURI((const char *)URL); + if (uri == NULL) { + uri = xmlCreateURI(); + if (uri == NULL) { + xsltTransformError(ctxt, NULL, NULL, + "xsltCheckWrite: out of memory for %s\n", URL); + return(-1); + } + uri->path = (char *)xmlStrdup(URL); + } + if ((uri->scheme == NULL) || + (xmlStrEqual(BAD_CAST uri->scheme, BAD_CAST "file"))) { + +#if defined(WIN32) && !defined(__CYGWIN__) + if ((uri->path)&&(uri->path[0]=='/')&& + (uri->path[1]!='\0')&&(uri->path[2]==':')) + ret = xsltCheckWritePath(sec, ctxt, uri->path+1); + else +#endif + + /* + * Check if we are allowed to write this file + */ + ret = xsltCheckWritePath(sec, ctxt, uri->path); + if (ret <= 0) { + xmlFreeURI(uri); + return(ret); + } + } else { + /* + * Check if we are allowed to write this network resource + */ + check = xsltGetSecurityPrefs(sec, XSLT_SECPREF_WRITE_NETWORK); + if (check != NULL) { + ret = check(sec, ctxt, (const char *)URL); + if (ret == 0) { + xsltTransformError(ctxt, NULL, NULL, + "File write for %s refused\n", URL); + xmlFreeURI(uri); + return(0); + } + } + } + xmlFreeURI(uri); + return(1); +} + + +/** + * xsltCheckRead: + * @sec: the security options + * @ctxt: an XSLT transformation context + * @URL: the resource to be read + * + * Check if the resource is allowed to be read + * + * Return 1 if read is allowed, 0 if not and -1 in case or error. + */ +int +xsltCheckRead(xsltSecurityPrefsPtr sec, + xsltTransformContextPtr ctxt, const xmlChar *URL) { + int ret; + xmlURIPtr uri; + xsltSecurityCheck check; + + uri = xmlParseURI((const char *)URL); + if (uri == NULL) { + xsltTransformError(ctxt, NULL, NULL, + "xsltCheckRead: URL parsing failed for %s\n", + URL); + return(-1); + } + if ((uri->scheme == NULL) || + (xmlStrEqual(BAD_CAST uri->scheme, BAD_CAST "file"))) { + + /* + * Check if we are allowed to read this file + */ + check = xsltGetSecurityPrefs(sec, XSLT_SECPREF_READ_FILE); + if (check != NULL) { + ret = check(sec, ctxt, uri->path); + if (ret == 0) { + xsltTransformError(ctxt, NULL, NULL, + "Local file read for %s refused\n", URL); + xmlFreeURI(uri); + return(0); + } + } + } else { + /* + * Check if we are allowed to write this network resource + */ + check = xsltGetSecurityPrefs(sec, XSLT_SECPREF_READ_NETWORK); + if (check != NULL) { + ret = check(sec, ctxt, (const char *)URL); + if (ret == 0) { + xsltTransformError(ctxt, NULL, NULL, + "Network file read for %s refused\n", URL); + xmlFreeURI(uri); + return(0); + } + } + } + xmlFreeURI(uri); + return(1); +} + diff --git a/libxslt/security.h b/libxslt/security.h new file mode 100644 index 0000000..bab5c8c --- /dev/null +++ b/libxslt/security.h @@ -0,0 +1,104 @@ +/* + * Summary: interface for the libxslt security framework + * Description: the libxslt security framework allow to restrict + * the access to new resources (file or URL) from + * the stylesheet at runtime. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XSLT_SECURITY_H__ +#define __XML_XSLT_SECURITY_H__ + +#include +#include "xsltexports.h" +#include "xsltInternals.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xsltSecurityPref: + * + * structure to indicate the preferences for security in the XSLT + * transformation. + */ +typedef struct _xsltSecurityPrefs xsltSecurityPrefs; +typedef xsltSecurityPrefs *xsltSecurityPrefsPtr; + +/** + * xsltSecurityOption: + * + * the set of option that can be configured + */ +typedef enum { + XSLT_SECPREF_READ_FILE = 1, + XSLT_SECPREF_WRITE_FILE, + XSLT_SECPREF_CREATE_DIRECTORY, + XSLT_SECPREF_READ_NETWORK, + XSLT_SECPREF_WRITE_NETWORK +} xsltSecurityOption; + +/** + * xsltSecurityCheck: + * + * User provided function to check the value of a string like a file + * path or an URL ... + */ +typedef int (*xsltSecurityCheck) (xsltSecurityPrefsPtr sec, + xsltTransformContextPtr ctxt, + const char *value); + +/* + * Module interfaces + */ +XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL + xsltNewSecurityPrefs (void); +XSLTPUBFUN void XSLTCALL + xsltFreeSecurityPrefs (xsltSecurityPrefsPtr sec); +XSLTPUBFUN int XSLTCALL + xsltSetSecurityPrefs (xsltSecurityPrefsPtr sec, + xsltSecurityOption option, + xsltSecurityCheck func); +XSLTPUBFUN xsltSecurityCheck XSLTCALL + xsltGetSecurityPrefs (xsltSecurityPrefsPtr sec, + xsltSecurityOption option); + +XSLTPUBFUN void XSLTCALL + xsltSetDefaultSecurityPrefs (xsltSecurityPrefsPtr sec); +XSLTPUBFUN xsltSecurityPrefsPtr XSLTCALL + xsltGetDefaultSecurityPrefs (void); + +XSLTPUBFUN int XSLTCALL + xsltSetCtxtSecurityPrefs (xsltSecurityPrefsPtr sec, + xsltTransformContextPtr ctxt); + +XSLTPUBFUN int XSLTCALL + xsltSecurityAllow (xsltSecurityPrefsPtr sec, + xsltTransformContextPtr ctxt, + const char *value); +XSLTPUBFUN int XSLTCALL + xsltSecurityForbid (xsltSecurityPrefsPtr sec, + xsltTransformContextPtr ctxt, + const char *value); +/* + * internal interfaces + */ +XSLTPUBFUN int XSLTCALL + xsltCheckWrite (xsltSecurityPrefsPtr sec, + xsltTransformContextPtr ctxt, + const xmlChar *URL); +XSLTPUBFUN int XSLTCALL + xsltCheckRead (xsltSecurityPrefsPtr sec, + xsltTransformContextPtr ctxt, + const xmlChar *URL); + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XSLT_SECURITY_H__ */ + diff --git a/libxslt/templates.c b/libxslt/templates.c new file mode 100644 index 0000000..02193f7 --- /dev/null +++ b/libxslt/templates.c @@ -0,0 +1,843 @@ +/* + * templates.c: Implementation of the template processing + * + * Reference: + * http://www.w3.org/TR/1999/REC-xslt-19991116 + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "variables.h" +#include "functions.h" +#include "templates.h" +#include "transform.h" +#include "namespaces.h" +#include "attributes.h" + +#ifdef WITH_XSLT_DEBUG +#define WITH_XSLT_DEBUG_TEMPLATES +#endif + +/************************************************************************ + * * + * Module interfaces * + * * + ************************************************************************/ + +/** + * xsltEvalXPathPredicate: + * @ctxt: the XSLT transformation context + * @comp: the XPath compiled expression + * @nsList: the namespaces in scope + * @nsNr: the number of namespaces in scope + * + * Process the expression using XPath and evaluate the result as + * an XPath predicate + * + * Returns 1 is the predicate was true, 0 otherwise + */ +int +xsltEvalXPathPredicate(xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp, + xmlNsPtr *nsList, int nsNr) { + int ret; + xmlXPathObjectPtr res; + int oldNsNr; + xmlNsPtr *oldNamespaces; + xmlNodePtr oldInst; + int oldProximityPosition, oldContextSize; + + oldContextSize = ctxt->xpathCtxt->contextSize; + oldProximityPosition = ctxt->xpathCtxt->proximityPosition; + oldNsNr = ctxt->xpathCtxt->nsNr; + oldNamespaces = ctxt->xpathCtxt->namespaces; + oldInst = ctxt->inst; + + ctxt->xpathCtxt->node = ctxt->node; + ctxt->xpathCtxt->namespaces = nsList; + ctxt->xpathCtxt->nsNr = nsNr; + + res = xmlXPathCompiledEval(comp, ctxt->xpathCtxt); + + if (res != NULL) { + ret = xmlXPathEvalPredicate(ctxt->xpathCtxt, res); + xmlXPathFreeObject(res); +#ifdef WITH_XSLT_DEBUG_TEMPLATES + XSLT_TRACE(ctxt,XSLT_TRACE_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext, + "xsltEvalXPathPredicate: returns %d\n", ret)); +#endif + } else { +#ifdef WITH_XSLT_DEBUG_TEMPLATES + XSLT_TRACE(ctxt,XSLT_TRACE_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext, + "xsltEvalXPathPredicate: failed\n")); +#endif + ctxt->state = XSLT_STATE_STOPPED; + ret = 0; + } + ctxt->xpathCtxt->nsNr = oldNsNr; + + ctxt->xpathCtxt->namespaces = oldNamespaces; + ctxt->inst = oldInst; + ctxt->xpathCtxt->contextSize = oldContextSize; + ctxt->xpathCtxt->proximityPosition = oldProximityPosition; + + return(ret); +} + +/** + * xsltEvalXPathStringNs: + * @ctxt: the XSLT transformation context + * @comp: the compiled XPath expression + * @nsNr: the number of namespaces in the list + * @nsList: the list of in-scope namespaces to use + * + * Process the expression using XPath, allowing to pass a namespace mapping + * context and get a string + * + * Returns the computed string value or NULL, must be deallocated by the + * caller. + */ +xmlChar * +xsltEvalXPathStringNs(xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp, + int nsNr, xmlNsPtr *nsList) { + xmlChar *ret = NULL; + xmlXPathObjectPtr res; + xmlNodePtr oldInst; + xmlNodePtr oldNode; + int oldPos, oldSize; + int oldNsNr; + xmlNsPtr *oldNamespaces; + + oldInst = ctxt->inst; + oldNode = ctxt->node; + oldPos = ctxt->xpathCtxt->proximityPosition; + oldSize = ctxt->xpathCtxt->contextSize; + oldNsNr = ctxt->xpathCtxt->nsNr; + oldNamespaces = ctxt->xpathCtxt->namespaces; + + ctxt->xpathCtxt->node = ctxt->node; + /* TODO: do we need to propagate the namespaces here ? */ + ctxt->xpathCtxt->namespaces = nsList; + ctxt->xpathCtxt->nsNr = nsNr; + res = xmlXPathCompiledEval(comp, ctxt->xpathCtxt); + if (res != NULL) { + if (res->type != XPATH_STRING) + res = xmlXPathConvertString(res); + if (res->type == XPATH_STRING) { + ret = res->stringval; + res->stringval = NULL; + } else { + xsltTransformError(ctxt, NULL, NULL, + "xpath : string() function didn't return a String\n"); + } + xmlXPathFreeObject(res); + } else { + ctxt->state = XSLT_STATE_STOPPED; + } +#ifdef WITH_XSLT_DEBUG_TEMPLATES + XSLT_TRACE(ctxt,XSLT_TRACE_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext, + "xsltEvalXPathString: returns %s\n", ret)); +#endif + ctxt->inst = oldInst; + ctxt->node = oldNode; + ctxt->xpathCtxt->contextSize = oldSize; + ctxt->xpathCtxt->proximityPosition = oldPos; + ctxt->xpathCtxt->nsNr = oldNsNr; + ctxt->xpathCtxt->namespaces = oldNamespaces; + return(ret); +} + +/** + * xsltEvalXPathString: + * @ctxt: the XSLT transformation context + * @comp: the compiled XPath expression + * + * Process the expression using XPath and get a string + * + * Returns the computed string value or NULL, must be deallocated by the + * caller. + */ +xmlChar * +xsltEvalXPathString(xsltTransformContextPtr ctxt, xmlXPathCompExprPtr comp) { + return(xsltEvalXPathStringNs(ctxt, comp, 0, NULL)); +} + +/** + * xsltEvalTemplateString: + * @ctxt: the XSLT transformation context + * @contextNode: the current node in the source tree + * @inst: the XSLT instruction (xsl:comment, xsl:processing-instruction) + * + * Processes the sequence constructor of the given instruction on + * @contextNode and converts the resulting tree to a string. + * This is needed by e.g. xsl:comment and xsl:processing-instruction. + * + * Returns the computed string value or NULL; it's up to the caller to + * free the result. + */ +xmlChar * +xsltEvalTemplateString(xsltTransformContextPtr ctxt, + xmlNodePtr contextNode, + xmlNodePtr inst) +{ + xmlNodePtr oldInsert, insert = NULL; + xmlChar *ret; + + if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL) || + (inst->type != XML_ELEMENT_NODE)) + return(NULL); + + if (inst->children == NULL) + return(NULL); + + /* + * This creates a temporary element-node to add the resulting + * text content to. + * OPTIMIZE TODO: Keep such an element-node in the transformation + * context to avoid creating it every time. + */ + insert = xmlNewDocNode(ctxt->output, NULL, + (const xmlChar *)"fake", NULL); + if (insert == NULL) { + xsltTransformError(ctxt, NULL, contextNode, + "Failed to create temporary node\n"); + return(NULL); + } + oldInsert = ctxt->insert; + ctxt->insert = insert; + /* + * OPTIMIZE TODO: if inst->children consists only of text-nodes. + */ + xsltApplyOneTemplate(ctxt, contextNode, inst->children, NULL, NULL); + + ctxt->insert = oldInsert; + + ret = xmlNodeGetContent(insert); + if (insert != NULL) + xmlFreeNode(insert); + return(ret); +} + +/** + * xsltAttrTemplateValueProcessNode: + * @ctxt: the XSLT transformation context + * @str: the attribute template node value + * @inst: the instruction (or LRE) in the stylesheet holding the + * attribute with an AVT + * + * Process the given string, allowing to pass a namespace mapping + * context and return the new string value. + * + * Called by: + * - xsltAttrTemplateValueProcess() (templates.c) + * - xsltEvalAttrValueTemplate() (templates.c) + * + * QUESTION: Why is this function public? It is not used outside + * of templates.c. + * + * Returns the computed string value or NULL, must be deallocated by the + * caller. + */ +xmlChar * +xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt, + const xmlChar *str, xmlNodePtr inst) +{ + xmlChar *ret = NULL; + const xmlChar *cur; + xmlChar *expr, *val; + xmlNsPtr *nsList = NULL; + int nsNr = 0; + + if (str == NULL) return(NULL); + if (*str == 0) + return(xmlStrndup((xmlChar *)"", 0)); + + cur = str; + while (*cur != 0) { + if (*cur == '{') { + if (*(cur+1) == '{') { /* escaped '{' */ + cur++; + ret = xmlStrncat(ret, str, cur - str); + cur++; + str = cur; + continue; + } + ret = xmlStrncat(ret, str, cur - str); + str = cur; + cur++; + while ((*cur != 0) && (*cur != '}')) { + /* Need to check for literal (bug539741) */ + if ((*cur == '\'') || (*cur == '"')) { + char delim = *(cur++); + while ((*cur != 0) && (*cur != delim)) + cur++; + if (*cur != 0) + cur++; /* skip the ending delimiter */ + } else + cur++; + } + if (*cur == 0) { + xsltTransformError(ctxt, NULL, inst, + "xsltAttrTemplateValueProcessNode: unmatched '{'\n"); + ret = xmlStrncat(ret, str, cur - str); + return(ret); + } + str++; + expr = xmlStrndup(str, cur - str); + if (expr == NULL) + return(ret); + else if (*expr == '{') { + ret = xmlStrcat(ret, expr); + xmlFree(expr); + } else { + xmlXPathCompExprPtr comp; + /* + * TODO: keep precompiled form around + */ + if ((nsList == NULL) && (inst != NULL)) { + int i = 0; + + nsList = xmlGetNsList(inst->doc, inst); + if (nsList != NULL) { + while (nsList[i] != NULL) + i++; + nsNr = i; + } + } + comp = xmlXPathCompile(expr); + val = xsltEvalXPathStringNs(ctxt, comp, nsNr, nsList); + xmlXPathFreeCompExpr(comp); + xmlFree(expr); + if (val != NULL) { + ret = xmlStrcat(ret, val); + xmlFree(val); + } + } + cur++; + str = cur; + } else if (*cur == '}') { + cur++; + if (*cur == '}') { /* escaped '}' */ + ret = xmlStrncat(ret, str, cur - str); + cur++; + str = cur; + continue; + } else { + xsltTransformError(ctxt, NULL, inst, + "xsltAttrTemplateValueProcessNode: unmatched '}'\n"); + } + } else + cur++; + } + if (cur != str) { + ret = xmlStrncat(ret, str, cur - str); + } + + if (nsList != NULL) + xmlFree(nsList); + + return(ret); +} + +/** + * xsltAttrTemplateValueProcess: + * @ctxt: the XSLT transformation context + * @str: the attribute template node value + * + * Process the given node and return the new string value. + * + * Returns the computed string value or NULL, must be deallocated by the + * caller. + */ +xmlChar * +xsltAttrTemplateValueProcess(xsltTransformContextPtr ctxt, const xmlChar *str) { + return(xsltAttrTemplateValueProcessNode(ctxt, str, NULL)); +} + +/** + * xsltEvalAttrValueTemplate: + * @ctxt: the XSLT transformation context + * @inst: the instruction (or LRE) in the stylesheet holding the + * attribute with an AVT + * @name: the attribute QName + * @ns: the attribute namespace URI + * + * Evaluate a attribute value template, i.e. the attribute value can + * contain expressions contained in curly braces ({}) and those are + * substituted by they computed value. + * + * Returns the computed string value or NULL, must be deallocated by the + * caller. + */ +xmlChar * +xsltEvalAttrValueTemplate(xsltTransformContextPtr ctxt, xmlNodePtr inst, + const xmlChar *name, const xmlChar *ns) +{ + xmlChar *ret; + xmlChar *expr; + + if ((ctxt == NULL) || (inst == NULL) || (name == NULL) || + (inst->type != XML_ELEMENT_NODE)) + return(NULL); + + expr = xsltGetNsProp(inst, name, ns); + if (expr == NULL) + return(NULL); + + /* + * TODO: though now {} is detected ahead, it would still be good to + * optimize both functions to keep the splitted value if the + * attribute content and the XPath precompiled expressions around + */ + + ret = xsltAttrTemplateValueProcessNode(ctxt, expr, inst); +#ifdef WITH_XSLT_DEBUG_TEMPLATES + XSLT_TRACE(ctxt,XSLT_TRACE_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext, + "xsltEvalAttrValueTemplate: %s returns %s\n", expr, ret)); +#endif + if (expr != NULL) + xmlFree(expr); + return(ret); +} + +/** + * xsltEvalStaticAttrValueTemplate: + * @style: the XSLT stylesheet + * @inst: the instruction (or LRE) in the stylesheet holding the + * attribute with an AVT + * @name: the attribute Name + * @ns: the attribute namespace URI + * @found: indicator whether the attribute is present + * + * Check if an attribute value template has a static value, i.e. the + * attribute value does not contain expressions contained in curly braces ({}) + * + * Returns the static string value or NULL, must be deallocated by the + * caller. + */ +const xmlChar * +xsltEvalStaticAttrValueTemplate(xsltStylesheetPtr style, xmlNodePtr inst, + const xmlChar *name, const xmlChar *ns, int *found) { + const xmlChar *ret; + xmlChar *expr; + + if ((style == NULL) || (inst == NULL) || (name == NULL) || + (inst->type != XML_ELEMENT_NODE)) + return(NULL); + + expr = xsltGetNsProp(inst, name, ns); + if (expr == NULL) { + *found = 0; + return(NULL); + } + *found = 1; + + ret = xmlStrchr(expr, '{'); + if (ret != NULL) { + xmlFree(expr); + return(NULL); + } + ret = xmlDictLookup(style->dict, expr, -1); + xmlFree(expr); + return(ret); +} + +/** + * xsltAttrTemplateProcess: + * @ctxt: the XSLT transformation context + * @target: the element where the attribute will be grafted + * @attr: the attribute node of a literal result element + * + * Process one attribute of a Literal Result Element (in the stylesheet). + * Evaluates Attribute Value Templates and copies the attribute over to + * the result element. + * This does *not* process attribute sets (xsl:use-attribute-set). + * + * + * Returns the generated attribute node. + */ +xmlAttrPtr +xsltAttrTemplateProcess(xsltTransformContextPtr ctxt, xmlNodePtr target, + xmlAttrPtr attr) +{ + const xmlChar *value; + xmlAttrPtr ret; + + if ((ctxt == NULL) || (attr == NULL) || (target == NULL) || + (target->type != XML_ELEMENT_NODE)) + return(NULL); + + if (attr->type != XML_ATTRIBUTE_NODE) + return(NULL); + + /* + * Skip all XSLT attributes. + */ +#ifdef XSLT_REFACTORED + if (attr->psvi == xsltXSLTAttrMarker) + return(NULL); +#else + if ((attr->ns != NULL) && xmlStrEqual(attr->ns->href, XSLT_NAMESPACE)) + return(NULL); +#endif + /* + * Get the value. + */ + if (attr->children != NULL) { + if ((attr->children->type != XML_TEXT_NODE) || + (attr->children->next != NULL)) + { + xsltTransformError(ctxt, NULL, attr->parent, + "Internal error: The children of an attribute node of a " + "literal result element are not in the expected form.\n"); + return(NULL); + } + value = attr->children->content; + if (value == NULL) + value = xmlDictLookup(ctxt->dict, BAD_CAST "", 0); + } else + value = xmlDictLookup(ctxt->dict, BAD_CAST "", 0); + /* + * Overwrite duplicates. + */ + ret = target->properties; + while (ret != NULL) { + if (((attr->ns != NULL) == (ret->ns != NULL)) && + xmlStrEqual(ret->name, attr->name) && + ((attr->ns == NULL) || xmlStrEqual(ret->ns->href, attr->ns->href))) + { + break; + } + ret = ret->next; + } + if (ret != NULL) { + /* free the existing value */ + xmlFreeNodeList(ret->children); + ret->children = ret->last = NULL; + /* + * Adjust ns-prefix if needed. + */ + if ((ret->ns != NULL) && + (! xmlStrEqual(ret->ns->prefix, attr->ns->prefix))) + { + ret->ns = xsltGetNamespace(ctxt, attr->parent, attr->ns, target); + } + } else { + /* create a new attribute */ + if (attr->ns != NULL) + ret = xmlNewNsProp(target, + xsltGetNamespace(ctxt, attr->parent, attr->ns, target), + attr->name, NULL); + else + ret = xmlNewNsProp(target, NULL, attr->name, NULL); + } + /* + * Set the value. + */ + if (ret != NULL) { + xmlNodePtr text; + + text = xmlNewText(NULL); + if (text != NULL) { + ret->last = ret->children = text; + text->parent = (xmlNodePtr) ret; + text->doc = ret->doc; + + if (attr->psvi != NULL) { + /* + * Evaluate the Attribute Value Template. + */ + xmlChar *val; + val = xsltEvalAVT(ctxt, attr->psvi, attr->parent); + if (val == NULL) { + /* + * TODO: Damn, we need an easy mechanism to report + * qualified names! + */ + if (attr->ns) { + xsltTransformError(ctxt, NULL, attr->parent, + "Internal error: Failed to evaluate the AVT " + "of attribute '{%s}%s'.\n", + attr->ns->href, attr->name); + } else { + xsltTransformError(ctxt, NULL, attr->parent, + "Internal error: Failed to evaluate the AVT " + "of attribute '%s'.\n", + attr->name); + } + text->content = xmlStrdup(BAD_CAST ""); + } else { + text->content = val; + } + } else if ((ctxt->internalized) && (target != NULL) && + (target->doc != NULL) && + (target->doc->dict == ctxt->dict) && + xmlDictOwns(ctxt->dict, value)) { + text->content = (xmlChar *) value; + } else { + text->content = xmlStrdup(value); + } + } + } else { + if (attr->ns) { + xsltTransformError(ctxt, NULL, attr->parent, + "Internal error: Failed to create attribute '{%s}%s'.\n", + attr->ns->href, attr->name); + } else { + xsltTransformError(ctxt, NULL, attr->parent, + "Internal error: Failed to create attribute '%s'.\n", + attr->name); + } + } + return(ret); +} + + +/** + * xsltAttrListTemplateProcess: + * @ctxt: the XSLT transformation context + * @target: the element where the attributes will be grafted + * @attrs: the first attribute + * + * Processes all attributes of a Literal Result Element. + * Attribute references are applied via xsl:use-attribute-set + * attributes. + * Copies all non XSLT-attributes over to the @target element + * and evaluates Attribute Value Templates. + * + * Called by xsltApplySequenceConstructor() (transform.c). + * + * Returns a new list of attribute nodes, or NULL in case of error. + * (Don't assign the result to @target->properties; if + * the result is NULL, you'll get memory leaks, since the + * attributes will be disattached.) + */ +xmlAttrPtr +xsltAttrListTemplateProcess(xsltTransformContextPtr ctxt, + xmlNodePtr target, xmlAttrPtr attrs) +{ + xmlAttrPtr attr, copy, last; + xmlNodePtr oldInsert, text; + xmlNsPtr origNs = NULL, copyNs = NULL; + const xmlChar *value; + xmlChar *valueAVT; + + if ((ctxt == NULL) || (target == NULL) || (attrs == NULL) || + (target->type != XML_ELEMENT_NODE)) + return(NULL); + + oldInsert = ctxt->insert; + ctxt->insert = target; + + /* + * Instantiate LRE-attributes. + */ + if (target->properties) { + last = target->properties; + while (last->next != NULL) + last = last->next; + } else { + last = NULL; + } + attr = attrs; + do { + /* + * Skip XSLT attributes. + */ +#ifdef XSLT_REFACTORED + if (attr->psvi == xsltXSLTAttrMarker) { + goto next_attribute; + } +#else + if ((attr->ns != NULL) && + xmlStrEqual(attr->ns->href, XSLT_NAMESPACE)) + { + goto next_attribute; + } +#endif + /* + * Get the value. + */ + if (attr->children != NULL) { + if ((attr->children->type != XML_TEXT_NODE) || + (attr->children->next != NULL)) + { + xsltTransformError(ctxt, NULL, attr->parent, + "Internal error: The children of an attribute node of a " + "literal result element are not in the expected form.\n"); + goto error; + } + value = attr->children->content; + if (value == NULL) + value = xmlDictLookup(ctxt->dict, BAD_CAST "", 0); + } else + value = xmlDictLookup(ctxt->dict, BAD_CAST "", 0); + + /* + * Create a new attribute. + */ + copy = xmlNewDocProp(target->doc, attr->name, NULL); + if (copy == NULL) { + if (attr->ns) { + xsltTransformError(ctxt, NULL, attr->parent, + "Internal error: Failed to create attribute '{%s}%s'.\n", + attr->ns->href, attr->name); + } else { + xsltTransformError(ctxt, NULL, attr->parent, + "Internal error: Failed to create attribute '%s'.\n", + attr->name); + } + goto error; + } + /* + * Attach it to the target element. + */ + copy->parent = target; + if (last == NULL) { + target->properties = copy; + last = copy; + } else { + last->next = copy; + copy->prev = last; + last = copy; + } + /* + * Set the namespace. Avoid lookups of same namespaces. + */ + if (attr->ns != origNs) { + origNs = attr->ns; + if (attr->ns != NULL) { +#ifdef XSLT_REFACTORED + copyNs = xsltGetSpecialNamespace(ctxt, attr->parent, + attr->ns->href, attr->ns->prefix, target); +#else + copyNs = xsltGetNamespace(ctxt, attr->parent, + attr->ns, target); +#endif + if (copyNs == NULL) + goto error; + } else + copyNs = NULL; + } + copy->ns = copyNs; + + /* + * Set the value. + */ + text = xmlNewText(NULL); + if (text != NULL) { + copy->last = copy->children = text; + text->parent = (xmlNodePtr) copy; + text->doc = copy->doc; + + if (attr->psvi != NULL) { + /* + * Evaluate the Attribute Value Template. + */ + valueAVT = xsltEvalAVT(ctxt, attr->psvi, attr->parent); + if (valueAVT == NULL) { + /* + * TODO: Damn, we need an easy mechanism to report + * qualified names! + */ + if (attr->ns) { + xsltTransformError(ctxt, NULL, attr->parent, + "Internal error: Failed to evaluate the AVT " + "of attribute '{%s}%s'.\n", + attr->ns->href, attr->name); + } else { + xsltTransformError(ctxt, NULL, attr->parent, + "Internal error: Failed to evaluate the AVT " + "of attribute '%s'.\n", + attr->name); + } + text->content = xmlStrdup(BAD_CAST ""); + goto error; + } else { + text->content = valueAVT; + } + } else if ((ctxt->internalized) && + (target->doc != NULL) && + (target->doc->dict == ctxt->dict) && + xmlDictOwns(ctxt->dict, value)) + { + text->content = (xmlChar *) value; + } else { + text->content = xmlStrdup(value); + } + if ((copy != NULL) && (text != NULL) && + (xmlIsID(copy->doc, copy->parent, copy))) + xmlAddID(NULL, copy->doc, text->content, copy); + } + +next_attribute: + attr = attr->next; + } while (attr != NULL); + + /* + * Apply attribute-sets. + * The creation of such attributes will not overwrite any existing + * attribute. + */ + attr = attrs; + do { +#ifdef XSLT_REFACTORED + if ((attr->psvi == xsltXSLTAttrMarker) && + xmlStrEqual(attr->name, (const xmlChar *)"use-attribute-sets")) + { + xsltApplyAttributeSet(ctxt, ctxt->node, (xmlNodePtr) attr, NULL); + } +#else + if ((attr->ns != NULL) && + xmlStrEqual(attr->name, (const xmlChar *)"use-attribute-sets") && + xmlStrEqual(attr->ns->href, XSLT_NAMESPACE)) + { + xsltApplyAttributeSet(ctxt, ctxt->node, (xmlNodePtr) attr, NULL); + } +#endif + attr = attr->next; + } while (attr != NULL); + + ctxt->insert = oldInsert; + return(target->properties); + +error: + ctxt->insert = oldInsert; + return(NULL); +} + + +/** + * xsltTemplateProcess: + * @ctxt: the XSLT transformation context + * @node: the attribute template node + * + * Obsolete. Don't use it. + * + * Returns NULL. + */ +xmlNodePtr * +xsltTemplateProcess(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, xmlNodePtr node) { + if (node == NULL) + return(NULL); + + return(0); +} + + diff --git a/libxslt/templates.h b/libxslt/templates.h new file mode 100644 index 0000000..84a9de4 --- /dev/null +++ b/libxslt/templates.h @@ -0,0 +1,77 @@ +/* + * Summary: interface for the template processing + * Description: This set of routine encapsulates XPath calls + * and Attribute Value Templates evaluation. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XSLT_TEMPLATES_H__ +#define __XML_XSLT_TEMPLATES_H__ + +#include +#include +#include "xsltexports.h" +#include "xsltInternals.h" + +#ifdef __cplusplus +extern "C" { +#endif + +XSLTPUBFUN int XSLTCALL + xsltEvalXPathPredicate (xsltTransformContextPtr ctxt, + xmlXPathCompExprPtr comp, + xmlNsPtr *nsList, + int nsNr); +XSLTPUBFUN xmlChar * XSLTCALL + xsltEvalTemplateString (xsltTransformContextPtr ctxt, + xmlNodePtr contextNode, + xmlNodePtr inst); +XSLTPUBFUN xmlChar * XSLTCALL + xsltEvalAttrValueTemplate (xsltTransformContextPtr ctxt, + xmlNodePtr node, + const xmlChar *name, + const xmlChar *ns); +XSLTPUBFUN const xmlChar * XSLTCALL + xsltEvalStaticAttrValueTemplate (xsltStylesheetPtr style, + xmlNodePtr node, + const xmlChar *name, + const xmlChar *ns, + int *found); + +/* TODO: this is obviously broken ... the namespaces should be passed too ! */ +XSLTPUBFUN xmlChar * XSLTCALL + xsltEvalXPathString (xsltTransformContextPtr ctxt, + xmlXPathCompExprPtr comp); +XSLTPUBFUN xmlChar * XSLTCALL + xsltEvalXPathStringNs (xsltTransformContextPtr ctxt, + xmlXPathCompExprPtr comp, + int nsNr, + xmlNsPtr *nsList); + +XSLTPUBFUN xmlNodePtr * XSLTCALL + xsltTemplateProcess (xsltTransformContextPtr ctxt, + xmlNodePtr node); +XSLTPUBFUN xmlAttrPtr XSLTCALL + xsltAttrListTemplateProcess (xsltTransformContextPtr ctxt, + xmlNodePtr target, + xmlAttrPtr cur); +XSLTPUBFUN xmlAttrPtr XSLTCALL + xsltAttrTemplateProcess (xsltTransformContextPtr ctxt, + xmlNodePtr target, + xmlAttrPtr attr); +XSLTPUBFUN xmlChar * XSLTCALL + xsltAttrTemplateValueProcess (xsltTransformContextPtr ctxt, + const xmlChar* attr); +XSLTPUBFUN xmlChar * XSLTCALL + xsltAttrTemplateValueProcessNode(xsltTransformContextPtr ctxt, + const xmlChar* str, + xmlNodePtr node); +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XSLT_TEMPLATES_H__ */ + diff --git a/libxslt/transform.c b/libxslt/transform.c new file mode 100644 index 0000000..8b86e2e --- /dev/null +++ b/libxslt/transform.c @@ -0,0 +1,6480 @@ +/* + * transform.c: Implementation of the XSL Transformation 1.0 engine + * transform part, i.e. applying a Stylesheet to a document + * + * References: + * http://www.w3.org/TR/1999/REC-xslt-19991116 + * + * Michael Kay "XSLT Programmer's Reference" pp 637-643 + * Writing Multiple Output Files + * + * XSLT-1.1 Working Draft + * http://www.w3.org/TR/xslt11#multiple-output + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "pattern.h" +#include "transform.h" +#include "variables.h" +#include "numbersInternals.h" +#include "namespaces.h" +#include "attributes.h" +#include "templates.h" +#include "imports.h" +#include "keys.h" +#include "documents.h" +#include "extensions.h" +#include "extra.h" +#include "preproc.h" +#include "security.h" + +#ifdef WITH_XSLT_DEBUG +#define WITH_XSLT_DEBUG_EXTRA +#define WITH_XSLT_DEBUG_PROCESS +#endif + +#define XSLT_GENERATE_HTML_DOCTYPE +#ifdef XSLT_GENERATE_HTML_DOCTYPE +static int xsltGetHTMLIDs(const xmlChar *version, const xmlChar **publicID, + const xmlChar **systemID); +#endif + +int xsltMaxDepth = 3000; +int xsltMaxVars = 15000; + +/* + * Useful macros + */ + +#ifndef FALSE +# define FALSE (0 == 1) +# define TRUE (!FALSE) +#endif + +#define IS_BLANK_NODE(n) \ + (((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content))) + + +/* +* Forward declarations +*/ + +static xmlNsPtr +xsltCopyNamespaceListInternal(xmlNodePtr node, xmlNsPtr cur); + +static xmlNodePtr +xsltCopyTreeInternal(xsltTransformContextPtr ctxt, + xmlNodePtr invocNode, + xmlNodePtr node, + xmlNodePtr insert, int isLRE, int topElemVisited); + +static void +xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, + xmlNodePtr contextNode, xmlNodePtr list, + xsltTemplatePtr templ); + +static void +xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt, + xmlNodePtr contextNode, + xmlNodePtr list, + xsltTemplatePtr templ, + xsltStackElemPtr withParams); + +/** + * templPush: + * @ctxt: the transformation context + * @value: the template to push on the stack + * + * Push a template on the stack + * + * Returns the new index in the stack or 0 in case of error + */ +static int +templPush(xsltTransformContextPtr ctxt, xsltTemplatePtr value) +{ + if (ctxt->templMax == 0) { + ctxt->templMax = 4; + ctxt->templTab = + (xsltTemplatePtr *) xmlMalloc(ctxt->templMax * + sizeof(ctxt->templTab[0])); + if (ctxt->templTab == NULL) { + xmlGenericError(xmlGenericErrorContext, "malloc failed !\n"); + return (0); + } + } + else if (ctxt->templNr >= ctxt->templMax) { + ctxt->templMax *= 2; + ctxt->templTab = + (xsltTemplatePtr *) xmlRealloc(ctxt->templTab, + ctxt->templMax * + sizeof(ctxt->templTab[0])); + if (ctxt->templTab == NULL) { + xmlGenericError(xmlGenericErrorContext, "realloc failed !\n"); + return (0); + } + } + ctxt->templTab[ctxt->templNr] = value; + ctxt->templ = value; + return (ctxt->templNr++); +} +/** + * templPop: + * @ctxt: the transformation context + * + * Pop a template value from the stack + * + * Returns the stored template value + */ +static xsltTemplatePtr +templPop(xsltTransformContextPtr ctxt) +{ + xsltTemplatePtr ret; + + if (ctxt->templNr <= 0) + return (0); + ctxt->templNr--; + if (ctxt->templNr > 0) + ctxt->templ = ctxt->templTab[ctxt->templNr - 1]; + else + ctxt->templ = (xsltTemplatePtr) 0; + ret = ctxt->templTab[ctxt->templNr]; + ctxt->templTab[ctxt->templNr] = 0; + return (ret); +} + +/** + * xsltLocalVariablePop: + * @ctxt: the transformation context + * @limitNr: number of variables which should remain + * @level: the depth in the xsl:template's tree + * + * Pops all variable values at the given @depth from the stack. + * + * Returns the stored variable value + * **NOTE:** + * This is an internal routine and should not be called by users! + */ +void +xsltLocalVariablePop(xsltTransformContextPtr ctxt, int limitNr, int level) +{ + xsltStackElemPtr variable; + + if (ctxt->varsNr <= 0) + return; + + do { + if (ctxt->varsNr <= limitNr) + break; + variable = ctxt->varsTab[ctxt->varsNr - 1]; + if (variable->level <= level) + break; + if (variable->level >= 0) + xsltFreeStackElemList(variable); + ctxt->varsNr--; + } while (ctxt->varsNr != 0); + if (ctxt->varsNr > 0) + ctxt->vars = ctxt->varsTab[ctxt->varsNr - 1]; + else + ctxt->vars = NULL; +} + +/** + * xsltTemplateParamsCleanup: + * + * Removes xsl:param and xsl:with-param items from the + * variable-stack. Only xsl:with-param items are not freed. + */ +static void +xsltTemplateParamsCleanup(xsltTransformContextPtr ctxt) +{ + xsltStackElemPtr param; + + for (; ctxt->varsNr > ctxt->varsBase; ctxt->varsNr--) { + param = ctxt->varsTab[ctxt->varsNr -1]; + /* + * Free xsl:param items. + * xsl:with-param items will have a level of -1 or -2. + */ + if (param->level >= 0) { + xsltFreeStackElemList(param); + } + } + if (ctxt->varsNr > 0) + ctxt->vars = ctxt->varsTab[ctxt->varsNr - 1]; + else + ctxt->vars = NULL; +} + +/** + * profPush: + * @ctxt: the transformation context + * @value: the profiling value to push on the stack + * + * Push a profiling value on the stack + * + * Returns the new index in the stack or 0 in case of error + */ +static int +profPush(xsltTransformContextPtr ctxt, long value) +{ + if (ctxt->profMax == 0) { + ctxt->profMax = 4; + ctxt->profTab = + (long *) xmlMalloc(ctxt->profMax * sizeof(ctxt->profTab[0])); + if (ctxt->profTab == NULL) { + xmlGenericError(xmlGenericErrorContext, "malloc failed !\n"); + return (0); + } + } + else if (ctxt->profNr >= ctxt->profMax) { + ctxt->profMax *= 2; + ctxt->profTab = + (long *) xmlRealloc(ctxt->profTab, + ctxt->profMax * sizeof(ctxt->profTab[0])); + if (ctxt->profTab == NULL) { + xmlGenericError(xmlGenericErrorContext, "realloc failed !\n"); + return (0); + } + } + ctxt->profTab[ctxt->profNr] = value; + ctxt->prof = value; + return (ctxt->profNr++); +} +/** + * profPop: + * @ctxt: the transformation context + * + * Pop a profiling value from the stack + * + * Returns the stored profiling value + */ +static long +profPop(xsltTransformContextPtr ctxt) +{ + long ret; + + if (ctxt->profNr <= 0) + return (0); + ctxt->profNr--; + if (ctxt->profNr > 0) + ctxt->prof = ctxt->profTab[ctxt->profNr - 1]; + else + ctxt->prof = (long) 0; + ret = ctxt->profTab[ctxt->profNr]; + ctxt->profTab[ctxt->profNr] = 0; + return (ret); +} + +static void +profCallgraphAdd(xsltTemplatePtr templ, xsltTemplatePtr parent) +{ + int i; + + if (templ->templMax == 0) { + templ->templMax = 4; + templ->templCalledTab = + (xsltTemplatePtr *) xmlMalloc(templ->templMax * + sizeof(templ->templCalledTab[0])); + templ->templCountTab = + (int *) xmlMalloc(templ->templMax * + sizeof(templ->templCountTab[0])); + if (templ->templCalledTab == NULL || templ->templCountTab == NULL) { + xmlGenericError(xmlGenericErrorContext, "malloc failed !\n"); + return; + } + } + else if (templ->templNr >= templ->templMax) { + templ->templMax *= 2; + templ->templCalledTab = + (xsltTemplatePtr *) xmlRealloc(templ->templCalledTab, + templ->templMax * + sizeof(templ->templCalledTab[0])); + templ->templCountTab = + (int *) xmlRealloc(templ->templCountTab, + templ->templMax * + sizeof(templ->templCountTab[0])); + if (templ->templCalledTab == NULL || templ->templCountTab == NULL) { + xmlGenericError(xmlGenericErrorContext, "realloc failed !\n"); + return; + } + } + + for (i = 0; i < templ->templNr; i++) { + if (templ->templCalledTab[i] == parent) { + templ->templCountTab[i]++; + break; + } + } + if (i == templ->templNr) { + /* not found, add new one */ + templ->templCalledTab[templ->templNr] = parent; + templ->templCountTab[templ->templNr] = 1; + templ->templNr++; + } +} + +/** + * xsltPreCompEval: + * @ctxt: transform context + * @node: context node + * @comp: precompiled expression + * + * Evaluate a precompiled XPath expression. + */ +static xmlXPathObjectPtr +xsltPreCompEval(xsltTransformContextPtr ctxt, xmlNodePtr node, + xsltStylePreCompPtr comp) { + xmlXPathObjectPtr res; + xmlXPathContextPtr xpctxt; + xmlNodePtr oldXPContextNode; + xmlNsPtr *oldXPNamespaces; + int oldXPProximityPosition, oldXPContextSize, oldXPNsNr; + + xpctxt = ctxt->xpathCtxt; + oldXPContextNode = xpctxt->node; + oldXPProximityPosition = xpctxt->proximityPosition; + oldXPContextSize = xpctxt->contextSize; + oldXPNsNr = xpctxt->nsNr; + oldXPNamespaces = xpctxt->namespaces; + + xpctxt->node = node; +#ifdef XSLT_REFACTORED + if (comp->inScopeNs != NULL) { + xpctxt->namespaces = comp->inScopeNs->list; + xpctxt->nsNr = comp->inScopeNs->xpathNumber; + } else { + xpctxt->namespaces = NULL; + xpctxt->nsNr = 0; + } +#else + xpctxt->namespaces = comp->nsList; + xpctxt->nsNr = comp->nsNr; +#endif + + res = xmlXPathCompiledEval(comp->comp, xpctxt); + + xpctxt->node = oldXPContextNode; + xpctxt->proximityPosition = oldXPProximityPosition; + xpctxt->contextSize = oldXPContextSize; + xpctxt->nsNr = oldXPNsNr; + xpctxt->namespaces = oldXPNamespaces; + + return(res); +} + +/** + * xsltPreCompEvalToBoolean: + * @ctxt: transform context + * @node: context node + * @comp: precompiled expression + * + * Evaluate a precompiled XPath expression as boolean. + */ +static int +xsltPreCompEvalToBoolean(xsltTransformContextPtr ctxt, xmlNodePtr node, + xsltStylePreCompPtr comp) { + int res; + xmlXPathContextPtr xpctxt; + xmlNodePtr oldXPContextNode; + xmlNsPtr *oldXPNamespaces; + int oldXPProximityPosition, oldXPContextSize, oldXPNsNr; + + xpctxt = ctxt->xpathCtxt; + oldXPContextNode = xpctxt->node; + oldXPProximityPosition = xpctxt->proximityPosition; + oldXPContextSize = xpctxt->contextSize; + oldXPNsNr = xpctxt->nsNr; + oldXPNamespaces = xpctxt->namespaces; + + xpctxt->node = node; +#ifdef XSLT_REFACTORED + if (comp->inScopeNs != NULL) { + xpctxt->namespaces = comp->inScopeNs->list; + xpctxt->nsNr = comp->inScopeNs->xpathNumber; + } else { + xpctxt->namespaces = NULL; + xpctxt->nsNr = 0; + } +#else + xpctxt->namespaces = comp->nsList; + xpctxt->nsNr = comp->nsNr; +#endif + + res = xmlXPathCompiledEvalToBoolean(comp->comp, xpctxt); + + xpctxt->node = oldXPContextNode; + xpctxt->proximityPosition = oldXPProximityPosition; + xpctxt->contextSize = oldXPContextSize; + xpctxt->nsNr = oldXPNsNr; + xpctxt->namespaces = oldXPNamespaces; + + return(res); +} + +/************************************************************************ + * * + * XInclude default settings * + * * + ************************************************************************/ + +static int xsltDoXIncludeDefault = 0; + +/** + * xsltSetXIncludeDefault: + * @xinclude: whether to do XInclude processing + * + * Set whether XInclude should be processed on document being loaded by default + */ +void +xsltSetXIncludeDefault(int xinclude) { + xsltDoXIncludeDefault = (xinclude != 0); +} + +/** + * xsltGetXIncludeDefault: + * + * Provides the default state for XInclude processing + * + * Returns 0 if there is no processing 1 otherwise + */ +int +xsltGetXIncludeDefault(void) { + return(xsltDoXIncludeDefault); +} + +unsigned long xsltDefaultTrace = (unsigned long) XSLT_TRACE_ALL; + +/** + * xsltDebugSetDefaultTrace: + * @val: tracing level mask + * + * Set the default debug tracing level mask + */ +void xsltDebugSetDefaultTrace(xsltDebugTraceCodes val) { + xsltDefaultTrace = val; +} + +/** + * xsltDebugGetDefaultTrace: + * + * Get the current default debug tracing level mask + * + * Returns the current default debug tracing level mask + */ +xsltDebugTraceCodes xsltDebugGetDefaultTrace() { + return xsltDefaultTrace; +} + +/************************************************************************ + * * + * Handling of Transformation Contexts * + * * + ************************************************************************/ + +static xsltTransformCachePtr +xsltTransformCacheCreate(void) +{ + xsltTransformCachePtr ret; + + ret = (xsltTransformCachePtr) xmlMalloc(sizeof(xsltTransformCache)); + if (ret == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltTransformCacheCreate : malloc failed\n"); + return(NULL); + } + memset(ret, 0, sizeof(xsltTransformCache)); + return(ret); +} + +static void +xsltTransformCacheFree(xsltTransformCachePtr cache) +{ + if (cache == NULL) + return; + /* + * Free tree fragments. + */ + if (cache->RVT) { + xmlDocPtr tmp, cur = cache->RVT; + while (cur) { + tmp = cur; + cur = (xmlDocPtr) cur->next; + if (tmp->_private != NULL) { + /* + * Tree the document info. + */ + xsltFreeDocumentKeys((xsltDocumentPtr) tmp->_private); + xmlFree(tmp->_private); + } + xmlFreeDoc(tmp); + } + } + /* + * Free vars/params. + */ + if (cache->stackItems) { + xsltStackElemPtr tmp, cur = cache->stackItems; + while (cur) { + tmp = cur; + cur = cur->next; + /* + * REVISIT TODO: Should be call a destruction-function + * instead? + */ + xmlFree(tmp); + } + } + xmlFree(cache); +} + +/** + * xsltNewTransformContext: + * @style: a parsed XSLT stylesheet + * @doc: the input document + * + * Create a new XSLT TransformContext + * + * Returns the newly allocated xsltTransformContextPtr or NULL in case of error + */ +xsltTransformContextPtr +xsltNewTransformContext(xsltStylesheetPtr style, xmlDocPtr doc) { + xsltTransformContextPtr cur; + xsltDocumentPtr docu; + int i; + + xsltInitGlobals(); + + cur = (xsltTransformContextPtr) xmlMalloc(sizeof(xsltTransformContext)); + if (cur == NULL) { + xsltTransformError(NULL, NULL, (xmlNodePtr)doc, + "xsltNewTransformContext : malloc failed\n"); + return(NULL); + } + memset(cur, 0, sizeof(xsltTransformContext)); + + cur->cache = xsltTransformCacheCreate(); + if (cur->cache == NULL) + goto internal_err; + /* + * setup of the dictionary must be done early as some of the + * processing later like key handling may need it. + */ + cur->dict = xmlDictCreateSub(style->dict); + cur->internalized = ((style->internalized) && (cur->dict != NULL)); +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "Creating sub-dictionary from stylesheet for transformation\n"); +#endif + + /* + * initialize the template stack + */ + cur->templTab = (xsltTemplatePtr *) + xmlMalloc(10 * sizeof(xsltTemplatePtr)); + if (cur->templTab == NULL) { + xsltTransformError(NULL, NULL, (xmlNodePtr) doc, + "xsltNewTransformContext: out of memory\n"); + goto internal_err; + } + cur->templNr = 0; + cur->templMax = 5; + cur->templ = NULL; + cur->maxTemplateDepth = xsltMaxDepth; + + /* + * initialize the variables stack + */ + cur->varsTab = (xsltStackElemPtr *) + xmlMalloc(10 * sizeof(xsltStackElemPtr)); + if (cur->varsTab == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xsltNewTransformContext: out of memory\n"); + goto internal_err; + } + cur->varsNr = 0; + cur->varsMax = 10; + cur->vars = NULL; + cur->varsBase = 0; + cur->maxTemplateVars = xsltMaxVars; + + /* + * the profiling stack is not initialized by default + */ + cur->profTab = NULL; + cur->profNr = 0; + cur->profMax = 0; + cur->prof = 0; + + cur->style = style; + xmlXPathInit(); + cur->xpathCtxt = xmlXPathNewContext(doc); + if (cur->xpathCtxt == NULL) { + xsltTransformError(NULL, NULL, (xmlNodePtr) doc, + "xsltNewTransformContext : xmlXPathNewContext failed\n"); + goto internal_err; + } + /* + * Create an XPath cache. + */ + if (xmlXPathContextSetCache(cur->xpathCtxt, 1, -1, 0) == -1) + goto internal_err; + /* + * Initialize the extras array + */ + if (style->extrasNr != 0) { + cur->extrasMax = style->extrasNr + 20; + cur->extras = (xsltRuntimeExtraPtr) + xmlMalloc(cur->extrasMax * sizeof(xsltRuntimeExtra)); + if (cur->extras == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xsltNewTransformContext: out of memory\n"); + goto internal_err; + } + cur->extrasNr = style->extrasNr; + for (i = 0;i < cur->extrasMax;i++) { + cur->extras[i].info = NULL; + cur->extras[i].deallocate = NULL; + cur->extras[i].val.ptr = NULL; + } + } else { + cur->extras = NULL; + cur->extrasNr = 0; + cur->extrasMax = 0; + } + + XSLT_REGISTER_VARIABLE_LOOKUP(cur); + XSLT_REGISTER_FUNCTION_LOOKUP(cur); + cur->xpathCtxt->nsHash = style->nsHash; + /* + * Initialize the registered external modules + */ + xsltInitCtxtExts(cur); + /* + * Setup document element ordering for later efficiencies + * (bug 133289) + */ + if (xslDebugStatus == XSLT_DEBUG_NONE) + xmlXPathOrderDocElems(doc); + /* + * Must set parserOptions before calling xsltNewDocument + * (bug 164530) + */ + cur->parserOptions = XSLT_PARSE_OPTIONS; + docu = xsltNewDocument(cur, doc); + if (docu == NULL) { + xsltTransformError(cur, NULL, (xmlNodePtr)doc, + "xsltNewTransformContext : xsltNewDocument failed\n"); + goto internal_err; + } + docu->main = 1; + cur->document = docu; + cur->inst = NULL; + cur->outputFile = NULL; + cur->sec = xsltGetDefaultSecurityPrefs(); + cur->debugStatus = xslDebugStatus; + cur->traceCode = (unsigned long*) &xsltDefaultTrace; + cur->xinclude = xsltGetXIncludeDefault(); + cur->keyInitLevel = 0; + + return(cur); + +internal_err: + if (cur != NULL) + xsltFreeTransformContext(cur); + return(NULL); +} + +/** + * xsltFreeTransformContext: + * @ctxt: an XSLT parser context + * + * Free up the memory allocated by @ctxt + */ +void +xsltFreeTransformContext(xsltTransformContextPtr ctxt) { + if (ctxt == NULL) + return; + + /* + * Shutdown the extension modules associated to the stylesheet + * used if needed. + */ + xsltShutdownCtxtExts(ctxt); + + if (ctxt->xpathCtxt != NULL) { + ctxt->xpathCtxt->nsHash = NULL; + xmlXPathFreeContext(ctxt->xpathCtxt); + } + if (ctxt->templTab != NULL) + xmlFree(ctxt->templTab); + if (ctxt->varsTab != NULL) + xmlFree(ctxt->varsTab); + if (ctxt->profTab != NULL) + xmlFree(ctxt->profTab); + if ((ctxt->extrasNr > 0) && (ctxt->extras != NULL)) { + int i; + + for (i = 0;i < ctxt->extrasNr;i++) { + if ((ctxt->extras[i].deallocate != NULL) && + (ctxt->extras[i].info != NULL)) + ctxt->extras[i].deallocate(ctxt->extras[i].info); + } + xmlFree(ctxt->extras); + } + xsltFreeGlobalVariables(ctxt); + xsltFreeDocuments(ctxt); + xsltFreeCtxtExts(ctxt); + xsltFreeRVTs(ctxt); + xsltTransformCacheFree(ctxt->cache); + xmlDictFree(ctxt->dict); +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "freeing transformation dictionary\n"); +#endif + memset(ctxt, -1, sizeof(xsltTransformContext)); + xmlFree(ctxt); +} + +/************************************************************************ + * * + * Copy of Nodes in an XSLT fashion * + * * + ************************************************************************/ + +xmlNodePtr xsltCopyTree(xsltTransformContextPtr ctxt, + xmlNodePtr node, xmlNodePtr insert, int literal); + +/** + * xsltAddChild: + * @parent: the parent node + * @cur: the child node + * + * Wrapper version of xmlAddChild with a more consistent behaviour on + * error. One expect the use to be child = xsltAddChild(parent, child); + * and the routine will take care of not leaking on errors or node merge + * + * Returns the child is successfully attached or NULL if merged or freed + */ +static xmlNodePtr +xsltAddChild(xmlNodePtr parent, xmlNodePtr cur) { + xmlNodePtr ret; + + if ((cur == NULL) || (parent == NULL)) + return(NULL); + if (parent == NULL) { + xmlFreeNode(cur); + return(NULL); + } + ret = xmlAddChild(parent, cur); + + return(ret); +} + +/** + * xsltAddTextString: + * @ctxt: a XSLT process context + * @target: the text node where the text will be attached + * @string: the text string + * @len: the string length in byte + * + * Extend the current text node with the new string, it handles coalescing + * + * Returns: the text node + */ +static xmlNodePtr +xsltAddTextString(xsltTransformContextPtr ctxt, xmlNodePtr target, + const xmlChar *string, int len) { + /* + * optimization + */ + if ((len <= 0) || (string == NULL) || (target == NULL)) + return(target); + + if (ctxt->lasttext == target->content) { + + if (ctxt->lasttuse + len >= ctxt->lasttsize) { + xmlChar *newbuf; + int size; + + size = ctxt->lasttsize + len + 100; + size *= 2; + newbuf = (xmlChar *) xmlRealloc(target->content,size); + if (newbuf == NULL) { + xsltTransformError(ctxt, NULL, target, + "xsltCopyText: text allocation failed\n"); + return(NULL); + } + ctxt->lasttsize = size; + ctxt->lasttext = newbuf; + target->content = newbuf; + } + memcpy(&(target->content[ctxt->lasttuse]), string, len); + ctxt->lasttuse += len; + target->content[ctxt->lasttuse] = 0; + } else { + xmlNodeAddContent(target, string); + ctxt->lasttext = target->content; + len = xmlStrlen(target->content); + ctxt->lasttsize = len; + ctxt->lasttuse = len; + } + return(target); +} + +/** + * xsltCopyTextString: + * @ctxt: a XSLT process context + * @target: the element where the text will be attached + * @string: the text string + * @noescape: should disable-escaping be activated for this text node. + * + * Adds @string to a newly created or an existent text node child of + * @target. + * + * Returns: the text node, where the text content of @cur is copied to. + * NULL in case of API or internal errors. + */ +xmlNodePtr +xsltCopyTextString(xsltTransformContextPtr ctxt, xmlNodePtr target, + const xmlChar *string, int noescape) +{ + xmlNodePtr copy; + int len; + + if (string == NULL) + return(NULL); + +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_COPY_TEXT,xsltGenericDebug(xsltGenericDebugContext, + "xsltCopyTextString: copy text %s\n", + string)); +#endif + + /* + * Play safe and reset the merging mechanism for every new + * target node. + */ + if ((target == NULL) || (target->children == NULL)) { + ctxt->lasttext = NULL; + } + + /* handle coalescing of text nodes here */ + len = xmlStrlen(string); + if ((ctxt->type == XSLT_OUTPUT_XML) && + (ctxt->style->cdataSection != NULL) && + (target != NULL) && + (target->type == XML_ELEMENT_NODE) && + (((target->ns == NULL) && + (xmlHashLookup2(ctxt->style->cdataSection, + target->name, NULL) != NULL)) || + ((target->ns != NULL) && + (xmlHashLookup2(ctxt->style->cdataSection, + target->name, target->ns->href) != NULL)))) + { + /* + * Process "cdata-section-elements". + */ + if ((target->last != NULL) && + (target->last->type == XML_CDATA_SECTION_NODE)) + { + return(xsltAddTextString(ctxt, target->last, string, len)); + } + copy = xmlNewCDataBlock(ctxt->output, string, len); + } else if (noescape) { + /* + * Process "disable-output-escaping". + */ + if ((target != NULL) && (target->last != NULL) && + (target->last->type == XML_TEXT_NODE) && + (target->last->name == xmlStringTextNoenc)) + { + return(xsltAddTextString(ctxt, target->last, string, len)); + } + copy = xmlNewTextLen(string, len); + if (copy != NULL) + copy->name = xmlStringTextNoenc; + } else { + /* + * Default processing. + */ + if ((target != NULL) && (target->last != NULL) && + (target->last->type == XML_TEXT_NODE) && + (target->last->name == xmlStringText)) { + return(xsltAddTextString(ctxt, target->last, string, len)); + } + copy = xmlNewTextLen(string, len); + } + if (copy != NULL && target != NULL) + copy = xsltAddChild(target, copy); + if (copy != NULL) { + ctxt->lasttext = copy->content; + ctxt->lasttsize = len; + ctxt->lasttuse = len; + } else { + xsltTransformError(ctxt, NULL, target, + "xsltCopyTextString: text copy failed\n"); + ctxt->lasttext = NULL; + } + return(copy); +} + +/** + * xsltCopyText: + * @ctxt: a XSLT process context + * @target: the element where the text will be attached + * @cur: the text or CDATA node + * @interned: the string is in the target doc dictionary + * + * Copy the text content of @cur and append it to @target's children. + * + * Returns: the text node, where the text content of @cur is copied to. + * NULL in case of API or internal errors. + */ +static xmlNodePtr +xsltCopyText(xsltTransformContextPtr ctxt, xmlNodePtr target, + xmlNodePtr cur, int interned) +{ + xmlNodePtr copy; + + if ((cur->type != XML_TEXT_NODE) && + (cur->type != XML_CDATA_SECTION_NODE)) + return(NULL); + if (cur->content == NULL) + return(NULL); + +#ifdef WITH_XSLT_DEBUG_PROCESS + if (cur->type == XML_CDATA_SECTION_NODE) { + XSLT_TRACE(ctxt,XSLT_TRACE_COPY_TEXT,xsltGenericDebug(xsltGenericDebugContext, + "xsltCopyText: copy CDATA text %s\n", + cur->content)); + } else if (cur->name == xmlStringTextNoenc) { + XSLT_TRACE(ctxt,XSLT_TRACE_COPY_TEXT,xsltGenericDebug(xsltGenericDebugContext, + "xsltCopyText: copy unescaped text %s\n", + cur->content)); + } else { + XSLT_TRACE(ctxt,XSLT_TRACE_COPY_TEXT,xsltGenericDebug(xsltGenericDebugContext, + "xsltCopyText: copy text %s\n", + cur->content)); + } +#endif + + /* + * Play save and reset the merging mechanism for every new + * target node. + */ + if ((target == NULL) || (target->children == NULL)) { + ctxt->lasttext = NULL; + } + + if ((ctxt->style->cdataSection != NULL) && + (ctxt->type == XSLT_OUTPUT_XML) && + (target != NULL) && + (target->type == XML_ELEMENT_NODE) && + (((target->ns == NULL) && + (xmlHashLookup2(ctxt->style->cdataSection, + target->name, NULL) != NULL)) || + ((target->ns != NULL) && + (xmlHashLookup2(ctxt->style->cdataSection, + target->name, target->ns->href) != NULL)))) + { + /* + * Process "cdata-section-elements". + */ + /* + * OPTIMIZE TODO: xsltCopyText() is also used for attribute content. + */ + /* + * TODO: Since this doesn't merge adjacent CDATA-section nodes, + * we'll get: . + * TODO: Reported in #321505. + */ + if ((target->last != NULL) && + (target->last->type == XML_CDATA_SECTION_NODE)) + { + /* + * Append to existing CDATA-section node. + */ + copy = xsltAddTextString(ctxt, target->last, cur->content, + xmlStrlen(cur->content)); + goto exit; + } else { + unsigned int len; + + len = xmlStrlen(cur->content); + copy = xmlNewCDataBlock(ctxt->output, cur->content, len); + if (copy == NULL) + goto exit; + ctxt->lasttext = copy->content; + ctxt->lasttsize = len; + ctxt->lasttuse = len; + } + } else if ((target != NULL) && + (target->last != NULL) && + /* both escaped or both non-escaped text-nodes */ + (((target->last->type == XML_TEXT_NODE) && + (target->last->name == cur->name)) || + /* non-escaped text nodes and CDATA-section nodes */ + (((target->last->type == XML_CDATA_SECTION_NODE) && + (cur->name == xmlStringTextNoenc))))) + { + /* + * we are appending to an existing text node + */ + copy = xsltAddTextString(ctxt, target->last, cur->content, + xmlStrlen(cur->content)); + goto exit; + } else if ((interned) && (target != NULL) && + (target->doc != NULL) && + (target->doc->dict == ctxt->dict)) + { + /* + * TODO: DO we want to use this also for "text" output? + */ + copy = xmlNewTextLen(NULL, 0); + if (copy == NULL) + goto exit; + if (cur->name == xmlStringTextNoenc) + copy->name = xmlStringTextNoenc; + + /* + * Must confirm that content is in dict (bug 302821) + * TODO: This check should be not needed for text coming + * from the stylesheets + */ + if (xmlDictOwns(ctxt->dict, cur->content)) + copy->content = cur->content; + else { + if ((copy->content = xmlStrdup(cur->content)) == NULL) + return NULL; + } + } else { + /* + * normal processing. keep counters to extend the text node + * in xsltAddTextString if needed. + */ + unsigned int len; + + len = xmlStrlen(cur->content); + copy = xmlNewTextLen(cur->content, len); + if (copy == NULL) + goto exit; + if (cur->name == xmlStringTextNoenc) + copy->name = xmlStringTextNoenc; + ctxt->lasttext = copy->content; + ctxt->lasttsize = len; + ctxt->lasttuse = len; + } + if (copy != NULL) { + if (target != NULL) { + copy->doc = target->doc; + /* + * MAYBE TODO: Maybe we should reset the ctxt->lasttext here + * to ensure that the optimized text-merging mechanism + * won't interfere with normal node-merging in any case. + */ + copy = xsltAddChild(target, copy); + } + } else { + xsltTransformError(ctxt, NULL, target, + "xsltCopyText: text copy failed\n"); + } + +exit: + if ((copy == NULL) || (copy->content == NULL)) { + xsltTransformError(ctxt, NULL, target, + "Internal error in xsltCopyText(): " + "Failed to copy the string.\n"); + ctxt->state = XSLT_STATE_STOPPED; + } + return(copy); +} + +/** + * xsltShallowCopyAttr: + * @ctxt: a XSLT process context + * @invocNode: responsible node in the stylesheet; used for error reports + * @target: the element where the attribute will be grafted + * @attr: the attribute to be copied + * + * Do a copy of an attribute. + * Called by: + * - xsltCopyTreeInternal() + * - xsltCopyOf() + * - xsltCopy() + * + * Returns: a new xmlAttrPtr, or NULL in case of error. + */ +static xmlAttrPtr +xsltShallowCopyAttr(xsltTransformContextPtr ctxt, xmlNodePtr invocNode, + xmlNodePtr target, xmlAttrPtr attr) +{ + xmlAttrPtr copy; + xmlChar *value; + + if (attr == NULL) + return(NULL); + + if (target->type != XML_ELEMENT_NODE) { + xsltTransformError(ctxt, NULL, invocNode, + "Cannot add an attribute node to a non-element node.\n"); + return(NULL); + } + + if (target->children != NULL) { + xsltTransformError(ctxt, NULL, invocNode, + "Attribute nodes must be added before " + "any child nodes to an element.\n"); + return(NULL); + } + + value = xmlNodeListGetString(attr->doc, attr->children, 1); + if (attr->ns != NULL) { + xmlNsPtr ns; + + ns = xsltGetSpecialNamespace(ctxt, invocNode, + attr->ns->href, attr->ns->prefix, target); + if (ns == NULL) { + xsltTransformError(ctxt, NULL, invocNode, + "Namespace fixup error: Failed to acquire an in-scope " + "namespace binding of the copied attribute '{%s}%s'.\n", + attr->ns->href, attr->name); + /* + * TODO: Should we just stop here? + */ + } + /* + * Note that xmlSetNsProp() will take care of duplicates + * and assigns the new namespace even to a duplicate. + */ + copy = xmlSetNsProp(target, ns, attr->name, value); + } else { + copy = xmlSetNsProp(target, NULL, attr->name, value); + } + if (value != NULL) + xmlFree(value); + + if (copy == NULL) + return(NULL); + +#if 0 + /* + * NOTE: This was optimized according to bug #342695. + * TODO: Can this further be optimized, if source and target + * share the same dict and attr->children is just 1 text node + * which is in the dict? How probable is such a case? + */ + /* + * TODO: Do we need to create an empty text node if the value + * is the empty string? + */ + value = xmlNodeListGetString(attr->doc, attr->children, 1); + if (value != NULL) { + txtNode = xmlNewDocText(target->doc, NULL); + if (txtNode == NULL) + return(NULL); + if ((target->doc != NULL) && + (target->doc->dict != NULL)) + { + txtNode->content = + (xmlChar *) xmlDictLookup(target->doc->dict, + BAD_CAST value, -1); + xmlFree(value); + } else + txtNode->content = value; + copy->children = txtNode; + } +#endif + + return(copy); +} + +/** + * xsltCopyAttrListNoOverwrite: + * @ctxt: a XSLT process context + * @invocNode: responsible node in the stylesheet; used for error reports + * @target: the element where the new attributes will be grafted + * @attr: the first attribute in the list to be copied + * + * Copies a list of attribute nodes, starting with @attr, over to the + * @target element node. + * + * Called by: + * - xsltCopyTreeInternal() + * + * Returns 0 on success and -1 on errors and internal errors. + */ +static int +xsltCopyAttrListNoOverwrite(xsltTransformContextPtr ctxt, + xmlNodePtr invocNode, + xmlNodePtr target, xmlAttrPtr attr) +{ + xmlAttrPtr copy; + xmlNsPtr origNs = NULL, copyNs = NULL; + xmlChar *value; + + /* + * Don't use xmlCopyProp() here, since it will try to + * reconciliate namespaces. + */ + while (attr != NULL) { + /* + * Find a namespace node in the tree of @target. + * Avoid searching for the same ns. + */ + if (attr->ns != origNs) { + origNs = attr->ns; + if (attr->ns != NULL) { + copyNs = xsltGetSpecialNamespace(ctxt, invocNode, + attr->ns->href, attr->ns->prefix, target); + if (copyNs == NULL) + return(-1); + } else + copyNs = NULL; + } + /* + * If attribute has a value, we need to copy it (watching out + * for possible entities) + */ + if ((attr->children) && (attr->children->type == XML_TEXT_NODE) && + (attr->children->next == NULL)) { + copy = xmlNewNsProp(target, copyNs, attr->name, + attr->children->content); + } else if (attr->children != NULL) { + value = xmlNodeListGetString(attr->doc, attr->children, 1); + copy = xmlNewNsProp(target, copyNs, attr->name, BAD_CAST value); + xmlFree(value); + } else { + copy = xmlNewNsProp(target, copyNs, attr->name, NULL); + } + + if (copy == NULL) + return(-1); + + attr = attr->next; + } + return(0); +} + +/** + * xsltShallowCopyElem: + * @ctxt: the XSLT process context + * @node: the element node in the source tree + * or the Literal Result Element + * @insert: the parent in the result tree + * @isLRE: if @node is a Literal Result Element + * + * Make a copy of the element node @node + * and insert it as last child of @insert. + * + * URGENT TODO: The problem with this one (for the non-refactored code) + * is that it is used for both, Literal Result Elements *and* + * copying input nodes. + * + * BIG NOTE: This is only called for XML_ELEMENT_NODEs. + * + * Called from: + * xsltApplySequenceConstructor() + * (for Literal Result Elements - which is a problem) + * xsltCopy() (for shallow-copying elements via xsl:copy) + * + * Returns a pointer to the new node, or NULL in case of error + */ +static xmlNodePtr +xsltShallowCopyElem(xsltTransformContextPtr ctxt, xmlNodePtr node, + xmlNodePtr insert, int isLRE) +{ + xmlNodePtr copy; + + if ((node->type == XML_DTD_NODE) || (insert == NULL)) + return(NULL); + if ((node->type == XML_TEXT_NODE) || + (node->type == XML_CDATA_SECTION_NODE)) + return(xsltCopyText(ctxt, insert, node, 0)); + + copy = xmlDocCopyNode(node, insert->doc, 0); + if (copy != NULL) { + copy->doc = ctxt->output; + copy = xsltAddChild(insert, copy); + if (copy == NULL) { + xsltTransformError(ctxt, NULL, node, + "xsltShallowCopyElem: copy failed\n"); + return (copy); + } + + if (node->type == XML_ELEMENT_NODE) { + /* + * Add namespaces as they are needed + */ + if (node->nsDef != NULL) { + /* + * TODO: Remove the LRE case in the refactored code + * gets enabled. + */ + if (isLRE) + xsltCopyNamespaceList(ctxt, copy, node->nsDef); + else + xsltCopyNamespaceListInternal(copy, node->nsDef); + } + + /* + * URGENT TODO: The problem with this is that it does not + * copy over all namespace nodes in scope. + * The damn thing about this is, that we would need to + * use the xmlGetNsList(), for every single node; this is + * also done in xsltCopyTreeInternal(), but only for the top node. + */ + if (node->ns != NULL) { + if (isLRE) { + /* + * REVISIT TODO: Since the non-refactored code still does + * ns-aliasing, we need to call xsltGetNamespace() here. + * Remove this when ready. + */ + copy->ns = xsltGetNamespace(ctxt, node, node->ns, copy); + } else { + copy->ns = xsltGetSpecialNamespace(ctxt, + node, node->ns->href, node->ns->prefix, copy); + + } + } else if ((insert->type == XML_ELEMENT_NODE) && + (insert->ns != NULL)) + { + /* + * "Undeclare" the default namespace. + */ + xsltGetSpecialNamespace(ctxt, node, NULL, NULL, copy); + } + } + } else { + xsltTransformError(ctxt, NULL, node, + "xsltShallowCopyElem: copy %s failed\n", node->name); + } + return(copy); +} + +/** + * xsltCopyTreeList: + * @ctxt: a XSLT process context + * @invocNode: responsible node in the stylesheet; used for error reports + * @list: the list of element nodes in the source tree. + * @insert: the parent in the result tree. + * @isLRE: is this a literal result element list + * @topElemVisited: indicates if a top-most element was already processed + * + * Make a copy of the full list of tree @list + * and insert it as last children of @insert + * + * NOTE: Not to be used for Literal Result Elements. + * + * Used by: + * - xsltCopyOf() + * + * Returns a pointer to the new list, or NULL in case of error + */ +static xmlNodePtr +xsltCopyTreeList(xsltTransformContextPtr ctxt, xmlNodePtr invocNode, + xmlNodePtr list, + xmlNodePtr insert, int isLRE, int topElemVisited) +{ + xmlNodePtr copy, ret = NULL; + + while (list != NULL) { + copy = xsltCopyTreeInternal(ctxt, invocNode, + list, insert, isLRE, topElemVisited); + if (copy != NULL) { + if (ret == NULL) { + ret = copy; + } + } + list = list->next; + } + return(ret); +} + +/** + * xsltCopyNamespaceListInternal: + * @node: the target node + * @cur: the first namespace + * + * Do a copy of a namespace list. If @node is non-NULL the + * new namespaces are added automatically. + * Called by: + * xsltCopyTreeInternal() + * + * QUESTION: What is the exact difference between this function + * and xsltCopyNamespaceList() in "namespaces.c"? + * ANSWER: xsltCopyNamespaceList() tries to apply ns-aliases. + * + * Returns: a new xmlNsPtr, or NULL in case of error. + */ +static xmlNsPtr +xsltCopyNamespaceListInternal(xmlNodePtr elem, xmlNsPtr ns) { + xmlNsPtr ret = NULL; + xmlNsPtr p = NULL, q, luNs; + + if (ns == NULL) + return(NULL); + /* + * One can add namespaces only on element nodes + */ + if ((elem != NULL) && (elem->type != XML_ELEMENT_NODE)) + elem = NULL; + + do { + if (ns->type != XML_NAMESPACE_DECL) + break; + /* + * Avoid duplicating namespace declarations on the tree. + */ + if (elem != NULL) { + if ((elem->ns != NULL) && + xmlStrEqual(elem->ns->prefix, ns->prefix) && + xmlStrEqual(elem->ns->href, ns->href)) + { + ns = ns->next; + continue; + } + luNs = xmlSearchNs(elem->doc, elem, ns->prefix); + if ((luNs != NULL) && (xmlStrEqual(luNs->href, ns->href))) + { + ns = ns->next; + continue; + } + } + q = xmlNewNs(elem, ns->href, ns->prefix); + if (p == NULL) { + ret = p = q; + } else if (q != NULL) { + p->next = q; + p = q; + } + ns = ns->next; + } while (ns != NULL); + return(ret); +} + +/** + * xsltShallowCopyNsNode: + * @ctxt: the XSLT transformation context + * @invocNode: responsible node in the stylesheet; used for error reports + * @insert: the target element node in the result tree + * @ns: the namespace node + * + * This is used for copying ns-nodes with xsl:copy-of and xsl:copy. + * + * Returns a new/existing ns-node, or NULL. + */ +static xmlNsPtr +xsltShallowCopyNsNode(xsltTransformContextPtr ctxt, + xmlNodePtr invocNode, + xmlNodePtr insert, + xmlNsPtr ns) +{ + /* + * TODO: Contrary to header comments, this is declared as int. + * be modified to return a node pointer, or NULL if any error + */ + xmlNsPtr tmpns; + + if ((insert == NULL) || (insert->type != XML_ELEMENT_NODE)) + return(NULL); + + if (insert->children != NULL) { + xsltTransformError(ctxt, NULL, invocNode, + "Namespace nodes must be added before " + "any child nodes are added to an element.\n"); + return(NULL); + } + /* + * BIG NOTE: Xalan-J simply overwrites any ns-decls with + * an equal prefix. We definitively won't do that. + * + * MSXML 4.0 and the .NET ignores ns-decls for which an + * equal prefix is already in use. + * + * Saxon raises an error like: + * "net.sf.saxon.xpath.DynamicError: Cannot create two namespace + * nodes with the same name". + * + * NOTE: We'll currently follow MSXML here. + * REVISIT TODO: Check if it's better to follow Saxon here. + */ + if (ns->prefix == NULL) { + /* + * If we are adding ns-nodes to an element using e.g. + * , then we need + * to ensure that we don't incorrectly declare a default + * namespace on an element in no namespace, which otherwise + * would move the element incorrectly into a namespace, if + * the node tree is serialized. + */ + if (insert->ns == NULL) + goto occupied; + } else if ((ns->prefix[0] == 'x') && + xmlStrEqual(ns->prefix, BAD_CAST "xml")) + { + /* + * The XML namespace is built in. + */ + return(NULL); + } + + if (insert->nsDef != NULL) { + tmpns = insert->nsDef; + do { + if ((tmpns->prefix == NULL) == (ns->prefix == NULL)) { + if ((tmpns->prefix == ns->prefix) || + xmlStrEqual(tmpns->prefix, ns->prefix)) + { + /* + * Same prefix. + */ + if (xmlStrEqual(tmpns->href, ns->href)) + return(NULL); + goto occupied; + } + } + tmpns = tmpns->next; + } while (tmpns != NULL); + } + tmpns = xmlSearchNs(insert->doc, insert, ns->prefix); + if ((tmpns != NULL) && xmlStrEqual(tmpns->href, ns->href)) + return(NULL); + /* + * Declare a new namespace. + * TODO: The problem (wrt efficiency) with this xmlNewNs() is + * that it will again search the already declared namespaces + * for a duplicate :-/ + */ + return(xmlNewNs(insert, ns->href, ns->prefix)); + +occupied: + /* + * TODO: We could as well raise an error here (like Saxon does), + * or at least generate a warning. + */ + return(NULL); +} + +/** + * xsltCopyTreeInternal: + * @ctxt: the XSLT transformation context + * @invocNode: responsible node in the stylesheet; used for error reports + * @node: the element node in the source tree + * @insert: the parent in the result tree + * @isLRE: indicates if @node is a Literal Result Element + * @topElemVisited: indicates if a top-most element was already processed + * + * Make a copy of the full tree under the element node @node + * and insert it as last child of @insert + * + * NOTE: Not to be used for Literal Result Elements. + * + * Used by: + * - xsltCopyOf() + * + * Returns a pointer to the new tree, or NULL in case of error + */ +static xmlNodePtr +xsltCopyTreeInternal(xsltTransformContextPtr ctxt, + xmlNodePtr invocNode, + xmlNodePtr node, + xmlNodePtr insert, int isLRE, int topElemVisited) +{ + xmlNodePtr copy; + + if (node == NULL) + return(NULL); + switch (node->type) { + case XML_ELEMENT_NODE: + case XML_ENTITY_REF_NODE: + case XML_ENTITY_NODE: + case XML_PI_NODE: + case XML_COMMENT_NODE: + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: +#ifdef LIBXML_DOCB_ENABLED + case XML_DOCB_DOCUMENT_NODE: +#endif + break; + case XML_TEXT_NODE: { + int noenc = (node->name == xmlStringTextNoenc); + return(xsltCopyTextString(ctxt, insert, node->content, noenc)); + } + case XML_CDATA_SECTION_NODE: + return(xsltCopyTextString(ctxt, insert, node->content, 0)); + case XML_ATTRIBUTE_NODE: + return((xmlNodePtr) + xsltShallowCopyAttr(ctxt, invocNode, insert, (xmlAttrPtr) node)); + case XML_NAMESPACE_DECL: + return((xmlNodePtr) xsltShallowCopyNsNode(ctxt, invocNode, + insert, (xmlNsPtr) node)); + + case XML_DOCUMENT_TYPE_NODE: + case XML_DOCUMENT_FRAG_NODE: + case XML_NOTATION_NODE: + case XML_DTD_NODE: + case XML_ELEMENT_DECL: + case XML_ATTRIBUTE_DECL: + case XML_ENTITY_DECL: + case XML_XINCLUDE_START: + case XML_XINCLUDE_END: + return(NULL); + } + if (XSLT_IS_RES_TREE_FRAG(node)) { + if (node->children != NULL) + copy = xsltCopyTreeList(ctxt, invocNode, + node->children, insert, 0, 0); + else + copy = NULL; + return(copy); + } + copy = xmlDocCopyNode(node, insert->doc, 0); + if (copy != NULL) { + copy->doc = ctxt->output; + copy = xsltAddChild(insert, copy); + if (copy == NULL) { + xsltTransformError(ctxt, NULL, invocNode, + "xsltCopyTreeInternal: Copying of '%s' failed.\n", node->name); + return (copy); + } + /* + * The node may have been coalesced into another text node. + */ + if (insert->last != copy) + return(insert->last); + copy->next = NULL; + + if (node->type == XML_ELEMENT_NODE) { + /* + * Copy in-scope namespace nodes. + * + * REVISIT: Since we try to reuse existing in-scope ns-decls by + * using xmlSearchNsByHref(), this will eventually change + * the prefix of an original ns-binding; thus it might + * break QNames in element/attribute content. + * OPTIMIZE TODO: If we had a xmlNsPtr * on the transformation + * context, plus a ns-lookup function, which writes directly + * to a given list, then we wouldn't need to create/free the + * nsList every time. + */ + if ((topElemVisited == 0) && + (node->parent != NULL) && + (node->parent->type != XML_DOCUMENT_NODE) && + (node->parent->type != XML_HTML_DOCUMENT_NODE)) + { + xmlNsPtr *nsList, *curns, ns; + + /* + * If this is a top-most element in a tree to be + * copied, then we need to ensure that all in-scope + * namespaces are copied over. For nodes deeper in the + * tree, it is sufficient to reconcile only the ns-decls + * (node->nsDef entries). + */ + + nsList = xmlGetNsList(node->doc, node); + if (nsList != NULL) { + curns = nsList; + do { + /* + * Search by prefix first in order to break as less + * QNames in element/attribute content as possible. + */ + ns = xmlSearchNs(insert->doc, insert, + (*curns)->prefix); + + if ((ns == NULL) || + (! xmlStrEqual(ns->href, (*curns)->href))) + { + ns = NULL; + /* + * Search by namespace name. + * REVISIT TODO: Currently disabled. + */ +#if 0 + ns = xmlSearchNsByHref(insert->doc, + insert, (*curns)->href); +#endif + } + if (ns == NULL) { + /* + * Declare a new namespace on the copied element. + */ + ns = xmlNewNs(copy, (*curns)->href, + (*curns)->prefix); + /* TODO: Handle errors */ + } + if (node->ns == *curns) { + /* + * If this was the original's namespace then set + * the generated counterpart on the copy. + */ + copy->ns = ns; + } + curns++; + } while (*curns != NULL); + xmlFree(nsList); + } + } else if (node->nsDef != NULL) { + /* + * Copy over all namespace declaration attributes. + */ + if (node->nsDef != NULL) { + if (isLRE) + xsltCopyNamespaceList(ctxt, copy, node->nsDef); + else + xsltCopyNamespaceListInternal(copy, node->nsDef); + } + } + /* + * Set the namespace. + */ + if (node->ns != NULL) { + if (copy->ns == NULL) { + /* + * This will map copy->ns to one of the newly created + * in-scope ns-decls, OR create a new ns-decl on @copy. + */ + copy->ns = xsltGetSpecialNamespace(ctxt, invocNode, + node->ns->href, node->ns->prefix, copy); + } + } else if ((insert->type == XML_ELEMENT_NODE) && + (insert->ns != NULL)) + { + /* + * "Undeclare" the default namespace on @copy with xmlns="". + */ + xsltGetSpecialNamespace(ctxt, invocNode, NULL, NULL, copy); + } + /* + * Copy attribute nodes. + */ + if (node->properties != NULL) { + xsltCopyAttrListNoOverwrite(ctxt, invocNode, + copy, node->properties); + } + if (topElemVisited == 0) + topElemVisited = 1; + } + /* + * Copy the subtree. + */ + if (node->children != NULL) { + xsltCopyTreeList(ctxt, invocNode, + node->children, copy, isLRE, topElemVisited); + } + } else { + xsltTransformError(ctxt, NULL, invocNode, + "xsltCopyTreeInternal: Copying of '%s' failed.\n", node->name); + } + return(copy); +} + +/** + * xsltCopyTree: + * @ctxt: the XSLT transformation context + * @node: the element node in the source tree + * @insert: the parent in the result tree + * @literal: indicates if @node is a Literal Result Element + * + * Make a copy of the full tree under the element node @node + * and insert it as last child of @insert + * For literal result element, some of the namespaces may not be copied + * over according to section 7.1. + * TODO: Why is this a public function? + * + * Returns a pointer to the new tree, or NULL in case of error + */ +xmlNodePtr +xsltCopyTree(xsltTransformContextPtr ctxt, xmlNodePtr node, + xmlNodePtr insert, int literal) +{ + return(xsltCopyTreeInternal(ctxt, node, node, insert, literal, 0)); + +} + +/************************************************************************ + * * + * Error/fallback processing * + * * + ************************************************************************/ + +/** + * xsltApplyFallbacks: + * @ctxt: a XSLT process context + * @node: the node in the source tree. + * @inst: the node generating the error + * + * Process possible xsl:fallback nodes present under @inst + * + * Returns the number of xsl:fallback element found and processed + */ +static int +xsltApplyFallbacks(xsltTransformContextPtr ctxt, xmlNodePtr node, + xmlNodePtr inst) { + + xmlNodePtr child; + int ret = 0; + + if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || + (inst->children == NULL)) + return(0); + + child = inst->children; + while (child != NULL) { + if ((IS_XSLT_ELEM(child)) && + (xmlStrEqual(child->name, BAD_CAST "fallback"))) { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "applying xsl:fallback\n"); +#endif + ret++; + xsltApplySequenceConstructor(ctxt, node, child->children, + NULL); + } + child = child->next; + } + return(ret); +} + +/************************************************************************ + * * + * Default processing * + * * + ************************************************************************/ + +/** + * xsltDefaultProcessOneNode: + * @ctxt: a XSLT process context + * @node: the node in the source tree. + * @params: extra parameters passed to the template if any + * + * Process the source node with the default built-in template rule: + * + * + * + * + * and + * + * + * + * + * + * Note also that namespace declarations are copied directly: + * + * the built-in template rule is the only template rule that is applied + * for namespace nodes. + */ +static void +xsltDefaultProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node, + xsltStackElemPtr params) { + xmlNodePtr copy; + xmlNodePtr delete = NULL, cur; + int nbchild = 0, oldSize; + int childno = 0, oldPos; + xsltTemplatePtr template; + + CHECK_STOPPED; + /* + * Handling of leaves + */ + switch (node->type) { + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + case XML_ELEMENT_NODE: + break; + case XML_CDATA_SECTION_NODE: +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltDefaultProcessOneNode: copy CDATA %s\n", + node->content)); +#endif + copy = xsltCopyText(ctxt, ctxt->insert, node, 0); + if (copy == NULL) { + xsltTransformError(ctxt, NULL, node, + "xsltDefaultProcessOneNode: cdata copy failed\n"); + } + return; + case XML_TEXT_NODE: +#ifdef WITH_XSLT_DEBUG_PROCESS + if (node->content == NULL) { + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltDefaultProcessOneNode: copy empty text\n")); + return; + } else { + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltDefaultProcessOneNode: copy text %s\n", + node->content)); + } +#endif + copy = xsltCopyText(ctxt, ctxt->insert, node, 0); + if (copy == NULL) { + xsltTransformError(ctxt, NULL, node, + "xsltDefaultProcessOneNode: text copy failed\n"); + } + return; + case XML_ATTRIBUTE_NODE: + cur = node->children; + while ((cur != NULL) && (cur->type != XML_TEXT_NODE)) + cur = cur->next; + if (cur == NULL) { + xsltTransformError(ctxt, NULL, node, + "xsltDefaultProcessOneNode: no text for attribute\n"); + } else { +#ifdef WITH_XSLT_DEBUG_PROCESS + if (cur->content == NULL) { + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltDefaultProcessOneNode: copy empty text\n")); + } else { + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltDefaultProcessOneNode: copy text %s\n", + cur->content)); + } +#endif + copy = xsltCopyText(ctxt, ctxt->insert, cur, 0); + if (copy == NULL) { + xsltTransformError(ctxt, NULL, node, + "xsltDefaultProcessOneNode: text copy failed\n"); + } + } + return; + default: + return; + } + /* + * Handling of Elements: first pass, cleanup and counting + */ + cur = node->children; + while (cur != NULL) { + switch (cur->type) { + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + case XML_ELEMENT_NODE: + case XML_PI_NODE: + case XML_COMMENT_NODE: + nbchild++; + break; + case XML_DTD_NODE: + /* Unlink the DTD, it's still reachable using doc->intSubset */ + if (cur->next != NULL) + cur->next->prev = cur->prev; + if (cur->prev != NULL) + cur->prev->next = cur->next; + break; + default: +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltDefaultProcessOneNode: skipping node type %d\n", + cur->type)); +#endif + delete = cur; + } + cur = cur->next; + if (delete != NULL) { +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltDefaultProcessOneNode: removing ignorable blank node\n")); +#endif + xmlUnlinkNode(delete); + xmlFreeNode(delete); + delete = NULL; + } + } + if (delete != NULL) { +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltDefaultProcessOneNode: removing ignorable blank node\n")); +#endif + xmlUnlinkNode(delete); + xmlFreeNode(delete); + delete = NULL; + } + + /* + * Handling of Elements: second pass, actual processing + */ + oldSize = ctxt->xpathCtxt->contextSize; + oldPos = ctxt->xpathCtxt->proximityPosition; + cur = node->children; + while (cur != NULL) { + childno++; + switch (cur->type) { + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + case XML_ELEMENT_NODE: + ctxt->xpathCtxt->contextSize = nbchild; + ctxt->xpathCtxt->proximityPosition = childno; + xsltProcessOneNode(ctxt, cur, params); + break; + case XML_CDATA_SECTION_NODE: + template = xsltGetTemplate(ctxt, cur, NULL); + if (template) { +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltDefaultProcessOneNode: applying template for CDATA %s\n", + cur->content)); +#endif + /* + * Instantiate the xsl:template. + */ + xsltApplyXSLTTemplate(ctxt, cur, template->content, + template, params); + } else /* if (ctxt->mode == NULL) */ { +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltDefaultProcessOneNode: copy CDATA %s\n", + cur->content)); +#endif + copy = xsltCopyText(ctxt, ctxt->insert, cur, 0); + if (copy == NULL) { + xsltTransformError(ctxt, NULL, cur, + "xsltDefaultProcessOneNode: cdata copy failed\n"); + } + } + break; + case XML_TEXT_NODE: + template = xsltGetTemplate(ctxt, cur, NULL); + if (template) { +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltDefaultProcessOneNode: applying template for text %s\n", + cur->content)); +#endif + ctxt->xpathCtxt->contextSize = nbchild; + ctxt->xpathCtxt->proximityPosition = childno; + /* + * Instantiate the xsl:template. + */ + xsltApplyXSLTTemplate(ctxt, cur, template->content, + template, params); + } else /* if (ctxt->mode == NULL) */ { +#ifdef WITH_XSLT_DEBUG_PROCESS + if (cur->content == NULL) { + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltDefaultProcessOneNode: copy empty text\n")); + } else { + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltDefaultProcessOneNode: copy text %s\n", + cur->content)); + } +#endif + copy = xsltCopyText(ctxt, ctxt->insert, cur, 0); + if (copy == NULL) { + xsltTransformError(ctxt, NULL, cur, + "xsltDefaultProcessOneNode: text copy failed\n"); + } + } + break; + case XML_PI_NODE: + case XML_COMMENT_NODE: + template = xsltGetTemplate(ctxt, cur, NULL); + if (template) { +#ifdef WITH_XSLT_DEBUG_PROCESS + if (cur->type == XML_PI_NODE) { + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltDefaultProcessOneNode: template found for PI %s\n", + cur->name)); + } else if (cur->type == XML_COMMENT_NODE) { + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltDefaultProcessOneNode: template found for comment\n")); + } +#endif + ctxt->xpathCtxt->contextSize = nbchild; + ctxt->xpathCtxt->proximityPosition = childno; + /* + * Instantiate the xsl:template. + */ + xsltApplyXSLTTemplate(ctxt, cur, template->content, + template, params); + } + break; + default: + break; + } + cur = cur->next; + } + ctxt->xpathCtxt->contextSize = oldSize; + ctxt->xpathCtxt->proximityPosition = oldPos; +} + +/** + * xsltProcessOneNode: + * @ctxt: a XSLT process context + * @contextNode: the "current node" in the source tree + * @withParams: extra parameters (e.g. xsl:with-param) passed to the + * template if any + * + * Process the source node. + */ +void +xsltProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, + xsltStackElemPtr withParams) +{ + xsltTemplatePtr templ; + xmlNodePtr oldNode; + + templ = xsltGetTemplate(ctxt, contextNode, NULL); + /* + * If no template is found, apply the default rule. + */ + if (templ == NULL) { +#ifdef WITH_XSLT_DEBUG_PROCESS + if (contextNode->type == XML_DOCUMENT_NODE) { + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltProcessOneNode: no template found for /\n")); + } else if (contextNode->type == XML_CDATA_SECTION_NODE) { + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltProcessOneNode: no template found for CDATA\n")); + } else if (contextNode->type == XML_ATTRIBUTE_NODE) { + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltProcessOneNode: no template found for attribute %s\n", + ((xmlAttrPtr) contextNode)->name)); + } else { + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltProcessOneNode: no template found for %s\n", contextNode->name)); + } +#endif + oldNode = ctxt->node; + ctxt->node = contextNode; + xsltDefaultProcessOneNode(ctxt, contextNode, withParams); + ctxt->node = oldNode; + return; + } + + if (contextNode->type == XML_ATTRIBUTE_NODE) { + xsltTemplatePtr oldCurTempRule = ctxt->currentTemplateRule; + /* + * Set the "current template rule". + */ + ctxt->currentTemplateRule = templ; + +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltProcessOneNode: applying template '%s' for attribute %s\n", + templ->match, contextNode->name)); +#endif + xsltApplyXSLTTemplate(ctxt, contextNode, templ->content, templ, withParams); + + ctxt->currentTemplateRule = oldCurTempRule; + } else { + xsltTemplatePtr oldCurTempRule = ctxt->currentTemplateRule; + /* + * Set the "current template rule". + */ + ctxt->currentTemplateRule = templ; + +#ifdef WITH_XSLT_DEBUG_PROCESS + if (contextNode->type == XML_DOCUMENT_NODE) { + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltProcessOneNode: applying template '%s' for /\n", + templ->match)); + } else { + XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext, + "xsltProcessOneNode: applying template '%s' for %s\n", + templ->match, contextNode->name)); + } +#endif + xsltApplyXSLTTemplate(ctxt, contextNode, templ->content, templ, withParams); + + ctxt->currentTemplateRule = oldCurTempRule; + } +} + +static xmlNodePtr +xsltDebuggerStartSequenceConstructor(xsltTransformContextPtr ctxt, + xmlNodePtr contextNode, + xmlNodePtr list, + xsltTemplatePtr templ, + int *addCallResult) +{ + xmlNodePtr debugedNode = NULL; + + if (ctxt->debugStatus != XSLT_DEBUG_NONE) { + if (templ) { + *addCallResult = xslAddCall(templ, templ->elem); + } else { + *addCallResult = xslAddCall(NULL, list); + } + switch (ctxt->debugStatus) { + case XSLT_DEBUG_RUN_RESTART: + case XSLT_DEBUG_QUIT: + if (*addCallResult) + xslDropCall(); + return(NULL); + } + if (templ) { + xslHandleDebugger(templ->elem, contextNode, templ, ctxt); + debugedNode = templ->elem; + } else if (list) { + xslHandleDebugger(list, contextNode, templ, ctxt); + debugedNode = list; + } else if (ctxt->inst) { + xslHandleDebugger(ctxt->inst, contextNode, templ, ctxt); + debugedNode = ctxt->inst; + } + } + return(debugedNode); +} + +/** + * xsltLocalVariablePush: + * @ctxt: the transformation context + * @variable: variable to be pushed to the variable stack + * @level: new value for variable's level + * + * Places the variable onto the local variable stack + * + * Returns: 0 for success, -1 for any error + * **NOTE:** + * This is an internal routine and should not be called by users! + */ +int +xsltLocalVariablePush(xsltTransformContextPtr ctxt, + xsltStackElemPtr variable, + int level) +{ + if (ctxt->varsMax == 0) { + ctxt->varsMax = 10; + ctxt->varsTab = + (xsltStackElemPtr *) xmlMalloc(ctxt->varsMax * + sizeof(ctxt->varsTab[0])); + if (ctxt->varsTab == NULL) { + xmlGenericError(xmlGenericErrorContext, "malloc failed !\n"); + return (-1); + } + } + if (ctxt->varsNr >= ctxt->varsMax) { + ctxt->varsMax *= 2; + ctxt->varsTab = + (xsltStackElemPtr *) xmlRealloc(ctxt->varsTab, + ctxt->varsMax * + sizeof(ctxt->varsTab[0])); + if (ctxt->varsTab == NULL) { + xmlGenericError(xmlGenericErrorContext, "realloc failed !\n"); + return (-1); + } + } + ctxt->varsTab[ctxt->varsNr++] = variable; + ctxt->vars = variable; + variable->level = level; + return(0); +} + +/** + * xsltReleaseLocalRVTs: + * + * Fragments which are results of extension instructions + * are preserved; all other fragments are freed/cached. + */ +static void +xsltReleaseLocalRVTs(xsltTransformContextPtr ctxt, xmlDocPtr base) +{ + xmlDocPtr cur = ctxt->localRVT, tmp; + + while ((cur != NULL) && (cur != base)) { + if (cur->psvi == (void *) ((long) 1)) { + cur = (xmlDocPtr) cur->next; + } else { + tmp = cur; + cur = (xmlDocPtr) cur->next; + + if (tmp == ctxt->localRVT) + ctxt->localRVT = cur; + + /* + * We need ctxt->localRVTBase for extension instructions + * which return values (like EXSLT's function). + */ + if (tmp == ctxt->localRVTBase) + ctxt->localRVTBase = cur; + + if (tmp->prev) + tmp->prev->next = (xmlNodePtr) cur; + if (cur) + cur->prev = tmp->prev; + xsltReleaseRVT(ctxt, tmp); + } + } +} + +/** + * xsltApplySequenceConstructor: + * @ctxt: a XSLT process context + * @contextNode: the "current node" in the source tree + * @list: the nodes of a sequence constructor; + * (plus leading xsl:param elements) + * @templ: the compiled xsl:template (optional) + * + * Processes a sequence constructor. + * + * NOTE: ctxt->currentTemplateRule was introduced to reflect the + * semantics of "current template rule". I.e. the field ctxt->templ + * is not intended to reflect this, thus always pushed onto the + * template stack. + */ +static void +xsltApplySequenceConstructor(xsltTransformContextPtr ctxt, + xmlNodePtr contextNode, xmlNodePtr list, + xsltTemplatePtr templ) +{ + xmlNodePtr oldInsert, oldInst, oldCurInst, oldContextNode; + xmlNodePtr cur, insert, copy = NULL; + int level = 0, oldVarsNr; + xmlDocPtr oldLocalFragmentTop, oldLocalFragmentBase; + +#ifdef XSLT_REFACTORED + xsltStylePreCompPtr info; +#endif + +#ifdef WITH_DEBUGGER + int addCallResult = 0; + xmlNodePtr debuggedNode = NULL; +#endif + + if (ctxt == NULL) + return; + +#ifdef WITH_DEBUGGER + if (ctxt->debugStatus != XSLT_DEBUG_NONE) { + debuggedNode = + xsltDebuggerStartSequenceConstructor(ctxt, contextNode, + list, templ, &addCallResult); + if (debuggedNode == NULL) + return; + } +#endif + + if (list == NULL) + return; + CHECK_STOPPED; + + oldLocalFragmentTop = ctxt->localRVT; + oldInsert = insert = ctxt->insert; + oldInst = oldCurInst = ctxt->inst; + oldContextNode = ctxt->node; + /* + * Save current number of variables on the stack; new vars are popped when + * exiting. + */ + oldVarsNr = ctxt->varsNr; + /* + * Process the sequence constructor. + */ + cur = list; + while (cur != NULL) { + ctxt->inst = cur; + +#ifdef WITH_DEBUGGER + switch (ctxt->debugStatus) { + case XSLT_DEBUG_RUN_RESTART: + case XSLT_DEBUG_QUIT: + break; + + } +#endif + /* + * Test; we must have a valid insertion point. + */ + if (insert == NULL) { + +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, + "xsltApplySequenceConstructor: insert == NULL !\n")); +#endif + goto error; + } + +#ifdef WITH_DEBUGGER + if ((ctxt->debugStatus != XSLT_DEBUG_NONE) && (debuggedNode != cur)) + xslHandleDebugger(cur, contextNode, templ, ctxt); +#endif + +#ifdef XSLT_REFACTORED + if (cur->type == XML_ELEMENT_NODE) { + info = (xsltStylePreCompPtr) cur->psvi; + /* + * We expect a compiled representation on: + * 1) XSLT instructions of this XSLT version (1.0) + * (with a few exceptions) + * 2) Literal result elements + * 3) Extension instructions + * 4) XSLT instructions of future XSLT versions + * (forwards-compatible mode). + */ + if (info == NULL) { + /* + * Handle the rare cases where we don't expect a compiled + * representation on an XSLT element. + */ + if (IS_XSLT_ELEM_FAST(cur) && IS_XSLT_NAME(cur, "message")) { + xsltMessage(ctxt, contextNode, cur); + goto skip_children; + } + /* + * Something really went wrong: + */ + xsltTransformError(ctxt, NULL, cur, + "Internal error in xsltApplySequenceConstructor(): " + "The element '%s' in the stylesheet has no compiled " + "representation.\n", + cur->name); + goto skip_children; + } + + if (info->type == XSLT_FUNC_LITERAL_RESULT_ELEMENT) { + xsltStyleItemLRElementInfoPtr lrInfo = + (xsltStyleItemLRElementInfoPtr) info; + /* + * Literal result elements + * -------------------------------------------------------- + */ +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt, XSLT_TRACE_APPLY_TEMPLATE, + xsltGenericDebug(xsltGenericDebugContext, + "xsltApplySequenceConstructor: copy literal result " + "element '%s'\n", cur->name)); +#endif + /* + * Copy the raw element-node. + * OLD: if ((copy = xsltShallowCopyElem(ctxt, cur, insert)) + * == NULL) + * goto error; + */ + copy = xmlDocCopyNode(cur, insert->doc, 0); + if (copy == NULL) { + xsltTransformError(ctxt, NULL, cur, + "Internal error in xsltApplySequenceConstructor(): " + "Failed to copy literal result element '%s'.\n", + cur->name); + goto error; + } else { + /* + * Add the element-node to the result tree. + */ + copy->doc = ctxt->output; + copy = xsltAddChild(insert, copy); + /* + * Create effective namespaces declarations. + * OLD: xsltCopyNamespaceList(ctxt, copy, cur->nsDef); + */ + if (lrInfo->effectiveNs != NULL) { + xsltEffectiveNsPtr effNs = lrInfo->effectiveNs; + xmlNsPtr ns, lastns = NULL; + + while (effNs != NULL) { + /* + * Avoid generating redundant namespace + * declarations; thus lookup if there is already + * such a ns-decl in the result. + */ + ns = xmlSearchNs(copy->doc, copy, effNs->prefix); + if ((ns != NULL) && + (xmlStrEqual(ns->href, effNs->nsName))) + { + effNs = effNs->next; + continue; + } + ns = xmlNewNs(copy, effNs->nsName, effNs->prefix); + if (ns == NULL) { + xsltTransformError(ctxt, NULL, cur, + "Internal error in " + "xsltApplySequenceConstructor(): " + "Failed to copy a namespace " + "declaration.\n"); + goto error; + } + + if (lastns == NULL) + copy->nsDef = ns; + else + lastns->next =ns; + lastns = ns; + + effNs = effNs->next; + } + + } + /* + * NOTE that we don't need to apply ns-alising: this was + * already done at compile-time. + */ + if (cur->ns != NULL) { + /* + * If there's no such ns-decl in the result tree, + * then xsltGetSpecialNamespace() will + * create a ns-decl on the copied node. + */ + copy->ns = xsltGetSpecialNamespace(ctxt, cur, + cur->ns->href, cur->ns->prefix, copy); + } else { + /* + * Undeclare the default namespace if needed. + * This can be skipped, if the result element has + * no ns-decls, in which case the result element + * obviously does not declare a default namespace; + * AND there's either no parent, or the parent + * element is in no namespace; this means there's no + * default namespace is scope to care about. + * + * REVISIT: This might result in massive + * generation of ns-decls if nodes in a default + * namespaces are mixed with nodes in no namespace. + * + */ + if (copy->nsDef || + ((insert != NULL) && + (insert->type == XML_ELEMENT_NODE) && + (insert->ns != NULL))) + { + xsltGetSpecialNamespace(ctxt, cur, + NULL, NULL, copy); + } + } + } + /* + * SPEC XSLT 2.0 "Each attribute of the literal result + * element, other than an attribute in the XSLT namespace, + * is processed to produce an attribute for the element in + * the result tree." + * NOTE: See bug #341325. + */ + if (cur->properties != NULL) { + xsltAttrListTemplateProcess(ctxt, copy, cur->properties); + } + } else if (IS_XSLT_ELEM_FAST(cur)) { + /* + * XSLT instructions + * -------------------------------------------------------- + */ + if (info->type == XSLT_FUNC_UNKOWN_FORWARDS_COMPAT) { + /* + * We hit an unknown XSLT element. + * Try to apply one of the fallback cases. + */ + ctxt->insert = insert; + if (!xsltApplyFallbacks(ctxt, contextNode, cur)) { + xsltTransformError(ctxt, NULL, cur, + "The is no fallback behaviour defined for " + "the unknown XSLT element '%s'.\n", + cur->name); + } + ctxt->insert = oldInsert; + } else if (info->func != NULL) { + /* + * Execute the XSLT instruction. + */ + ctxt->insert = insert; + + info->func(ctxt, contextNode, cur, + (xsltElemPreCompPtr) info); + + /* + * Cleanup temporary tree fragments. + */ + if (oldLocalFragmentTop != ctxt->localRVT) + xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop); + + ctxt->insert = oldInsert; + } else if (info->type == XSLT_FUNC_VARIABLE) { + xsltStackElemPtr tmpvar = ctxt->vars; + + xsltParseStylesheetVariable(ctxt, cur); + + if (tmpvar != ctxt->vars) { + /* + * TODO: Using a @tmpvar is an annoying workaround, but + * the current mechanisms do not provide any other way + * of knowing if the var was really pushed onto the + * stack. + */ + ctxt->vars->level = level; + } + } else if (info->type == XSLT_FUNC_MESSAGE) { + /* + * TODO: Won't be hit, since we don't compile xsl:message. + */ + xsltMessage(ctxt, contextNode, cur); + } else { + xsltTransformError(ctxt, NULL, cur, + "Unexpected XSLT element '%s'.\n", cur->name); + } + goto skip_children; + + } else { + xsltTransformFunction func; + /* + * Extension intructions (elements) + * -------------------------------------------------------- + */ + if (cur->psvi == xsltExtMarker) { + /* + * The xsltExtMarker was set during the compilation + * of extension instructions if there was no registered + * handler for this specific extension function at + * compile-time. + * Libxslt will now lookup if a handler is + * registered in the context of this transformation. + */ + func = (xsltTransformFunction) + xsltExtElementLookup(ctxt, cur->name, cur->ns->href); + } else + func = ((xsltElemPreCompPtr) cur->psvi)->func; + + if (func == NULL) { + /* + * No handler available. + * Try to execute fallback behaviour via xsl:fallback. + */ +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt, XSLT_TRACE_APPLY_TEMPLATE, + xsltGenericDebug(xsltGenericDebugContext, + "xsltApplySequenceConstructor: unknown extension %s\n", + cur->name)); +#endif + ctxt->insert = insert; + if (!xsltApplyFallbacks(ctxt, contextNode, cur)) { + xsltTransformError(ctxt, NULL, cur, + "Unknown extension instruction '{%s}%s'.\n", + cur->ns->href, cur->name); + } + ctxt->insert = oldInsert; + } else { + /* + * Execute the handler-callback. + */ +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, + "xsltApplySequenceConstructor: extension construct %s\n", + cur->name)); +#endif + ctxt->insert = insert; + /* + * We need the fragment base for extension instructions + * which return values (like EXSLT's function). + */ + oldLocalFragmentBase = ctxt->localRVTBase; + ctxt->localRVTBase = NULL; + + func(ctxt, contextNode, cur, cur->psvi); + + ctxt->localRVTBase = oldLocalFragmentBase; + /* + * Cleanup temporary tree fragments. + */ + if (oldLocalFragmentTop != ctxt->localRVT) + xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop); + + ctxt->insert = oldInsert; + } + goto skip_children; + } + + } else if (XSLT_IS_TEXT_NODE(cur)) { + /* + * Text + * ------------------------------------------------------------ + */ +#ifdef WITH_XSLT_DEBUG_PROCESS + if (cur->name == xmlStringTextNoenc) { + XSLT_TRACE(ctxt, XSLT_TRACE_APPLY_TEMPLATE, + xsltGenericDebug(xsltGenericDebugContext, + "xsltApplySequenceConstructor: copy unescaped text '%s'\n", + cur->content)); + } else { + XSLT_TRACE(ctxt, XSLT_TRACE_APPLY_TEMPLATE, + xsltGenericDebug(xsltGenericDebugContext, + "xsltApplySequenceConstructor: copy text '%s'\n", + cur->content)); + } +#endif + if (xsltCopyText(ctxt, insert, cur, ctxt->internalized) == NULL) + goto error; + } + +#else /* XSLT_REFACTORED */ + + if (IS_XSLT_ELEM(cur)) { + /* + * This is an XSLT node + */ + xsltStylePreCompPtr info = (xsltStylePreCompPtr) cur->psvi; + + if (info == NULL) { + if (IS_XSLT_NAME(cur, "message")) { + xsltMessage(ctxt, contextNode, cur); + } else { + /* + * That's an error try to apply one of the fallback cases + */ + ctxt->insert = insert; + if (!xsltApplyFallbacks(ctxt, contextNode, cur)) { + xsltGenericError(xsltGenericErrorContext, + "xsltApplySequenceConstructor: %s was not compiled\n", + cur->name); + } + ctxt->insert = oldInsert; + } + goto skip_children; + } + + if (info->func != NULL) { + oldCurInst = ctxt->inst; + ctxt->inst = cur; + ctxt->insert = insert; + oldLocalFragmentBase = ctxt->localRVTBase; + ctxt->localRVTBase = NULL; + + info->func(ctxt, contextNode, cur, (xsltElemPreCompPtr) info); + + ctxt->localRVTBase = oldLocalFragmentBase; + /* + * Cleanup temporary tree fragments. + */ + if (oldLocalFragmentTop != ctxt->localRVT) + xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop); + + ctxt->insert = oldInsert; + ctxt->inst = oldCurInst; + goto skip_children; + } + + if (IS_XSLT_NAME(cur, "variable")) { + xsltStackElemPtr tmpvar = ctxt->vars; + + oldCurInst = ctxt->inst; + ctxt->inst = cur; + + xsltParseStylesheetVariable(ctxt, cur); + + ctxt->inst = oldCurInst; + + if (tmpvar != ctxt->vars) { + /* + * TODO: Using a @tmpvar is an annoying workaround, but + * the current mechanisms do not provide any other way + * of knowing if the var was really pushed onto the + * stack. + */ + ctxt->vars->level = level; + } + } else if (IS_XSLT_NAME(cur, "message")) { + xsltMessage(ctxt, contextNode, cur); + } else { + xsltTransformError(ctxt, NULL, cur, + "Unexpected XSLT element '%s'.\n", cur->name); + } + goto skip_children; + } else if ((cur->type == XML_TEXT_NODE) || + (cur->type == XML_CDATA_SECTION_NODE)) { + + /* + * This text comes from the stylesheet + * For stylesheets, the set of whitespace-preserving + * element names consists of just xsl:text. + */ +#ifdef WITH_XSLT_DEBUG_PROCESS + if (cur->type == XML_CDATA_SECTION_NODE) { + XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, + "xsltApplySequenceConstructor: copy CDATA text %s\n", + cur->content)); + } else if (cur->name == xmlStringTextNoenc) { + XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, + "xsltApplySequenceConstructor: copy unescaped text %s\n", + cur->content)); + } else { + XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, + "xsltApplySequenceConstructor: copy text %s\n", + cur->content)); + } +#endif + if (xsltCopyText(ctxt, insert, cur, ctxt->internalized) == NULL) + goto error; + } else if ((cur->type == XML_ELEMENT_NODE) && + (cur->ns != NULL) && (cur->psvi != NULL)) { + xsltTransformFunction function; + + oldCurInst = ctxt->inst; + ctxt->inst = cur; + /* + * Flagged as an extension element + */ + if (cur->psvi == xsltExtMarker) + function = (xsltTransformFunction) + xsltExtElementLookup(ctxt, cur->name, cur->ns->href); + else + function = ((xsltElemPreCompPtr) cur->psvi)->func; + + if (function == NULL) { + xmlNodePtr child; + int found = 0; + +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, + "xsltApplySequenceConstructor: unknown extension %s\n", + cur->name)); +#endif + /* + * Search if there are fallbacks + */ + child = cur->children; + while (child != NULL) { + if ((IS_XSLT_ELEM(child)) && + (IS_XSLT_NAME(child, "fallback"))) + { + found = 1; + xsltApplySequenceConstructor(ctxt, contextNode, + child->children, NULL); + } + child = child->next; + } + + if (!found) { + xsltTransformError(ctxt, NULL, cur, + "xsltApplySequenceConstructor: failed to find extension %s\n", + cur->name); + } + } else { +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, + "xsltApplySequenceConstructor: extension construct %s\n", + cur->name)); +#endif + + ctxt->insert = insert; + /* + * We need the fragment base for extension instructions + * which return values (like EXSLT's function). + */ + oldLocalFragmentBase = ctxt->localRVTBase; + ctxt->localRVTBase = NULL; + + function(ctxt, contextNode, cur, cur->psvi); + /* + * Cleanup temporary tree fragments. + */ + if (oldLocalFragmentTop != ctxt->localRVT) + xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop); + + ctxt->localRVTBase = oldLocalFragmentBase; + ctxt->insert = oldInsert; + + } + ctxt->inst = oldCurInst; + goto skip_children; + } else if (cur->type == XML_ELEMENT_NODE) { +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, + "xsltApplySequenceConstructor: copy node %s\n", + cur->name)); +#endif + oldCurInst = ctxt->inst; + ctxt->inst = cur; + + if ((copy = xsltShallowCopyElem(ctxt, cur, insert, 1)) == NULL) + goto error; + /* + * Add extra namespaces inherited from the current template + * if we are in the first level children and this is a + * "real" template. + */ + if ((templ != NULL) && (oldInsert == insert) && + (ctxt->templ != NULL) && (ctxt->templ->inheritedNs != NULL)) { + int i; + xmlNsPtr ns, ret; + + for (i = 0; i < ctxt->templ->inheritedNsNr; i++) { + const xmlChar *URI = NULL; + xsltStylesheetPtr style; + ns = ctxt->templ->inheritedNs[i]; + + /* Note that the XSLT namespace was already excluded + * in xsltGetInheritedNsList(). + */ +#if 0 + if (xmlStrEqual(ns->href, XSLT_NAMESPACE)) + continue; +#endif + style = ctxt->style; + while (style != NULL) { + if (style->nsAliases != NULL) + URI = (const xmlChar *) + xmlHashLookup(style->nsAliases, ns->href); + if (URI != NULL) + break; + + style = xsltNextImport(style); + } + if (URI == UNDEFINED_DEFAULT_NS) + continue; + if (URI == NULL) + URI = ns->href; + /* + * TODO: The following will still be buggy for the + * non-refactored code. + */ + ret = xmlSearchNs(copy->doc, copy, ns->prefix); + if ((ret == NULL) || (!xmlStrEqual(ret->href, URI))) + { + xmlNewNs(copy, URI, ns->prefix); + } + } + if (copy->ns != NULL) { + /* + * Fix the node namespace if needed + */ + copy->ns = xsltGetNamespace(ctxt, cur, copy->ns, copy); + } + } + /* + * all the attributes are directly inherited + */ + if (cur->properties != NULL) { + xsltAttrListTemplateProcess(ctxt, copy, cur->properties); + } + ctxt->inst = oldCurInst; + } +#endif /* else of XSLT_REFACTORED */ + + /* + * Descend into content in document order. + */ + if (cur->children != NULL) { + if (cur->children->type != XML_ENTITY_DECL) { + cur = cur->children; + level++; + if (copy != NULL) + insert = copy; + continue; + } + } + +skip_children: + /* + * If xslt:message was just processed, we might have hit a + * terminate='yes'; if so, then break the loop and clean up. + * TODO: Do we need to check this also before trying to descend + * into the content? + */ + if (ctxt->state == XSLT_STATE_STOPPED) + break; + if (cur->next != NULL) { + cur = cur->next; + continue; + } + + do { + cur = cur->parent; + level--; + /* + * Pop variables/params (xsl:variable and xsl:param). + */ + if ((ctxt->varsNr > oldVarsNr) && (ctxt->vars->level > level)) { + xsltLocalVariablePop(ctxt, oldVarsNr, level); + } + + insert = insert->parent; + if (cur == NULL) + break; + if (cur == list->parent) { + cur = NULL; + break; + } + if (cur->next != NULL) { + cur = cur->next; + break; + } + } while (cur != NULL); + } + +error: + /* + * In case of errors: pop remaining variables. + */ + if (ctxt->varsNr > oldVarsNr) + xsltLocalVariablePop(ctxt, oldVarsNr, -1); + + ctxt->node = oldContextNode; + ctxt->inst = oldInst; + ctxt->insert = oldInsert; + +#ifdef WITH_DEBUGGER + if ((ctxt->debugStatus != XSLT_DEBUG_NONE) && (addCallResult)) { + xslDropCall(); + } +#endif +} + +/* +* xsltApplyXSLTTemplate: +* @ctxt: a XSLT transformation context +* @contextNode: the node in the source tree. +* @list: the nodes of a sequence constructor; +* (plus leading xsl:param elements) +* @templ: the compiled xsl:template declaration; +* NULL if a sequence constructor +* @withParams: a set of caller-parameters (xsl:with-param) or NULL +* +* Called by: +* - xsltApplyImports() +* - xsltCallTemplate() +* - xsltDefaultProcessOneNode() +* - xsltProcessOneNode() +*/ +static void +xsltApplyXSLTTemplate(xsltTransformContextPtr ctxt, + xmlNodePtr contextNode, + xmlNodePtr list, + xsltTemplatePtr templ, + xsltStackElemPtr withParams) +{ + int oldVarsBase = 0; + long start = 0; + xmlNodePtr cur; + xsltStackElemPtr tmpParam = NULL; + xmlDocPtr oldUserFragmentTop, oldLocalFragmentTop; + +#ifdef XSLT_REFACTORED + xsltStyleItemParamPtr iparam; +#else + xsltStylePreCompPtr iparam; +#endif + +#ifdef WITH_DEBUGGER + int addCallResult = 0; +#endif + + if (ctxt == NULL) + return; + if (templ == NULL) { + xsltTransformError(ctxt, NULL, list, + "xsltApplyXSLTTemplate: Bad arguments; @templ is mandatory.\n"); + return; + } + +#ifdef WITH_DEBUGGER + if (ctxt->debugStatus != XSLT_DEBUG_NONE) { + if (xsltDebuggerStartSequenceConstructor(ctxt, contextNode, + list, templ, &addCallResult) == NULL) + return; + } +#endif + + if (list == NULL) + return; + CHECK_STOPPED; + + /* + * Check for infinite recursion: stop if the maximum of nested templates + * is excceeded. Adjust xsltMaxDepth if you need more. + */ + if (ctxt->templNr >= ctxt->maxTemplateDepth) + { + xsltTransformError(ctxt, NULL, list, + "xsltApplyXSLTTemplate: A potential infinite template recursion " + "was detected.\n" + "You can adjust xsltMaxDepth (--maxdepth) in order to " + "raise the maximum number of nested template calls and " + "variables/params (currently set to %d).\n", + ctxt->maxTemplateDepth); + xsltDebug(ctxt, contextNode, list, NULL); + return; + } + + if (ctxt->varsNr >= ctxt->maxTemplateVars) + { + xsltTransformError(ctxt, NULL, list, + "xsltApplyXSLTTemplate: A potential infinite template recursion " + "was detected.\n" + "You can adjust maxTemplateVars (--maxvars) in order to " + "raise the maximum number of variables/params (currently set to %d).\n", + ctxt->maxTemplateVars); + xsltDebug(ctxt, contextNode, list, NULL); + return; + } + + oldUserFragmentTop = ctxt->tmpRVT; + ctxt->tmpRVT = NULL; + oldLocalFragmentTop = ctxt->localRVT; + + /* + * Initiate a distinct scope of local params/variables. + */ + oldVarsBase = ctxt->varsBase; + ctxt->varsBase = ctxt->varsNr; + + ctxt->node = contextNode; + if (ctxt->profile) { + templ->nbCalls++; + start = xsltTimestamp(); + profPush(ctxt, 0); + profCallgraphAdd(templ, ctxt->templ); + } + /* + * Push the xsl:template declaration onto the stack. + */ + templPush(ctxt, templ); + +#ifdef WITH_XSLT_DEBUG_PROCESS + if (templ->name != NULL) + XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, + "applying xsl:template '%s'\n", templ->name)); +#endif + /* + * Process xsl:param instructions and skip those elements for + * further processing. + */ + cur = list; + do { + if (cur->type == XML_TEXT_NODE) { + cur = cur->next; + continue; + } + if ((cur->type != XML_ELEMENT_NODE) || + (cur->name[0] != 'p') || + (cur->psvi == NULL) || + (! xmlStrEqual(cur->name, BAD_CAST "param")) || + (! IS_XSLT_ELEM(cur))) + { + break; + } + + list = cur->next; + +#ifdef XSLT_REFACTORED + iparam = (xsltStyleItemParamPtr) cur->psvi; +#else + iparam = (xsltStylePreCompPtr) cur->psvi; +#endif + + /* + * Substitute xsl:param for a given xsl:with-param. + * Since the XPath expression will reference the params/vars + * by index, we need to slot the xsl:with-params in the + * order of encountered xsl:params to keep the sequence of + * params/variables in the stack exactly as it was at + * compile time, + */ + tmpParam = NULL; + if (withParams) { + tmpParam = withParams; + do { + if ((tmpParam->name == (iparam->name)) && + (tmpParam->nameURI == (iparam->ns))) + { + /* + * Push the caller-parameter. + */ + xsltLocalVariablePush(ctxt, tmpParam, -1); + break; + } + tmpParam = tmpParam->next; + } while (tmpParam != NULL); + } + /* + * Push the xsl:param. + */ + if (tmpParam == NULL) { + /* + * Note that we must assume that the added parameter + * has a @depth of 0. + */ + xsltParseStylesheetParam(ctxt, cur); + } + cur = cur->next; + } while (cur != NULL); + /* + * Process the sequence constructor. + */ + xsltApplySequenceConstructor(ctxt, contextNode, list, templ); + + /* + * Remove remaining xsl:param and xsl:with-param items from + * the stack. Don't free xsl:with-param items. + */ + if (ctxt->varsNr > ctxt->varsBase) + xsltTemplateParamsCleanup(ctxt); + ctxt->varsBase = oldVarsBase; + + /* + * Clean up remaining local tree fragments. + * This also frees fragments which are the result of + * extension instructions. Should normally not be hit; but + * just for the case xsltExtensionInstructionResultFinalize() + * was not called by the extension author. + */ + if (oldLocalFragmentTop != ctxt->localRVT) { + xmlDocPtr curdoc = ctxt->localRVT, tmp; + + do { + tmp = curdoc; + curdoc = (xmlDocPtr) curdoc->next; + /* Need to housekeep localRVTBase */ + if (tmp == ctxt->localRVTBase) + ctxt->localRVTBase = curdoc; + if (tmp->prev) + tmp->prev->next = (xmlNodePtr) curdoc; + if (curdoc) + curdoc->prev = tmp->prev; + xsltReleaseRVT(ctxt, tmp); + } while (curdoc != oldLocalFragmentTop); + } + ctxt->localRVT = oldLocalFragmentTop; + + /* + * Release user-created fragments stored in the scope + * of xsl:template. Note that this mechanism is deprecated: + * user code should now use xsltRegisterLocalRVT() instead + * of the obsolete xsltRegisterTmpRVT(). + */ + if (ctxt->tmpRVT) { + xmlDocPtr curdoc = ctxt->tmpRVT, tmp; + + while (curdoc != NULL) { + tmp = curdoc; + curdoc = (xmlDocPtr) curdoc->next; + xsltReleaseRVT(ctxt, tmp); + } + } + ctxt->tmpRVT = oldUserFragmentTop; + + /* + * Pop the xsl:template declaration from the stack. + */ + templPop(ctxt); + if (ctxt->profile) { + long spent, child, total, end; + + end = xsltTimestamp(); + child = profPop(ctxt); + total = end - start; + spent = total - child; + if (spent <= 0) { + /* + * Not possible unless the original calibration failed + * we can try to correct it on the fly. + */ + xsltCalibrateAdjust(spent); + spent = 0; + } + + templ->time += spent; + if (ctxt->profNr > 0) + ctxt->profTab[ctxt->profNr - 1] += total; + } + +#ifdef WITH_DEBUGGER + if ((ctxt->debugStatus != XSLT_DEBUG_NONE) && (addCallResult)) { + xslDropCall(); + } +#endif +} + + +/** + * xsltApplyOneTemplate: + * @ctxt: a XSLT process context + * @contextNode: the node in the source tree. + * @list: the nodes of a sequence constructor + * @templ: not used + * @params: a set of parameters (xsl:param) or NULL + * + * Processes a sequence constructor on the current node in the source tree. + * + * @params are the already computed variable stack items; this function + * pushes them on the variable stack, and pops them before exiting; it's + * left to the caller to free or reuse @params afterwards. The initial + * states of the variable stack will always be restored before this + * function exits. + * NOTE that this does *not* initiate a new distinct variable scope; i.e. + * variables already on the stack are visible to the process. The caller's + * side needs to start a new variable scope if needed (e.g. in exsl:function). + * + * @templ is obsolete and not used anymore (e.g. does not + * provide a @templ); a non-NULL @templ might raise an error in the future. + * + * BIG NOTE: This function is not intended to process the content of an + * xsl:template; it does not expect xsl:param instructions in @list and + * will report errors if found. + * + * Called by: + * - xsltEvalVariable() (variables.c) + * - exsltFuncFunctionFunction() (libexsl/functions.c) + */ +void +xsltApplyOneTemplate(xsltTransformContextPtr ctxt, + xmlNodePtr contextNode, + xmlNodePtr list, + xsltTemplatePtr templ ATTRIBUTE_UNUSED, + xsltStackElemPtr params) +{ + if ((ctxt == NULL) || (list == NULL)) + return; + CHECK_STOPPED; + + if (params) { + /* + * This code should be obsolete - was previously used + * by libexslt/functions.c, but due to bug 381319 the + * logic there was changed. + */ + int oldVarsNr = ctxt->varsNr; + + /* + * Push the given xsl:param(s) onto the variable stack. + */ + while (params != NULL) { + xsltLocalVariablePush(ctxt, params, -1); + params = params->next; + } + xsltApplySequenceConstructor(ctxt, contextNode, list, templ); + /* + * Pop the given xsl:param(s) from the stack but don't free them. + */ + xsltLocalVariablePop(ctxt, oldVarsNr, -2); + } else + xsltApplySequenceConstructor(ctxt, contextNode, list, templ); +} + +/************************************************************************ + * * + * XSLT-1.1 extensions * + * * + ************************************************************************/ + +/** + * xsltDocumentElem: + * @ctxt: an XSLT processing context + * @node: The current node + * @inst: the instruction in the stylesheet + * @castedComp: precomputed information + * + * Process an EXSLT/XSLT-1.1 document element + */ +void +xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node, + xmlNodePtr inst, xsltStylePreCompPtr castedComp) +{ +#ifdef XSLT_REFACTORED + xsltStyleItemDocumentPtr comp = (xsltStyleItemDocumentPtr) castedComp; +#else + xsltStylePreCompPtr comp = castedComp; +#endif + xsltStylesheetPtr style = NULL; + int ret; + xmlChar *filename = NULL, *prop, *elements; + xmlChar *element, *end; + xmlDocPtr res = NULL; + xmlDocPtr oldOutput; + xmlNodePtr oldInsert, root; + const char *oldOutputFile; + xsltOutputType oldType; + xmlChar *URL = NULL; + const xmlChar *method; + const xmlChar *doctypePublic; + const xmlChar *doctypeSystem; + const xmlChar *version; + const xmlChar *encoding; + int redirect_write_append = 0; + + if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || (comp == NULL)) + return; + + if (comp->filename == NULL) { + + if (xmlStrEqual(inst->name, (const xmlChar *) "output")) { + /* + * The element "output" is in the namespace XSLT_SAXON_NAMESPACE + * (http://icl.com/saxon) + * The @file is in no namespace. + */ +#ifdef WITH_XSLT_DEBUG_EXTRA + xsltGenericDebug(xsltGenericDebugContext, + "Found saxon:output extension\n"); +#endif + URL = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) "file", + XSLT_SAXON_NAMESPACE); + + if (URL == NULL) + URL = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) "href", + XSLT_SAXON_NAMESPACE); + } else if (xmlStrEqual(inst->name, (const xmlChar *) "write")) { +#ifdef WITH_XSLT_DEBUG_EXTRA + xsltGenericDebug(xsltGenericDebugContext, + "Found xalan:write extension\n"); +#endif + URL = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) + "select", + XSLT_XALAN_NAMESPACE); + if (URL != NULL) { + xmlXPathCompExprPtr cmp; + xmlChar *val; + + /* + * Trying to handle bug #59212 + * The value of the "select" attribute is an + * XPath expression. + * (see http://xml.apache.org/xalan-j/extensionslib.html#redirect) + */ + cmp = xmlXPathCompile(URL); + val = xsltEvalXPathString(ctxt, cmp); + xmlXPathFreeCompExpr(cmp); + xmlFree(URL); + URL = val; + } + if (URL == NULL) + URL = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) + "file", + XSLT_XALAN_NAMESPACE); + if (URL == NULL) + URL = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) + "href", + XSLT_XALAN_NAMESPACE); + } else if (xmlStrEqual(inst->name, (const xmlChar *) "document")) { + URL = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) "href", + NULL); + } + + } else { + URL = xmlStrdup(comp->filename); + } + + if (URL == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsltDocumentElem: href/URI-Reference not found\n"); + return; + } + + /* + * If the computation failed, it's likely that the URL wasn't escaped + */ + filename = xmlBuildURI(URL, (const xmlChar *) ctxt->outputFile); + if (filename == NULL) { + xmlChar *escURL; + + escURL=xmlURIEscapeStr(URL, BAD_CAST ":/.?,"); + if (escURL != NULL) { + filename = xmlBuildURI(escURL, (const xmlChar *) ctxt->outputFile); + xmlFree(escURL); + } + } + + if (filename == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsltDocumentElem: URL computation failed for %s\n", + URL); + xmlFree(URL); + return; + } + + /* + * Security checking: can we write to this resource + */ + if (ctxt->sec != NULL) { + ret = xsltCheckWrite(ctxt->sec, ctxt, filename); + if (ret == 0) { + xsltTransformError(ctxt, NULL, inst, + "xsltDocumentElem: write rights for %s denied\n", + filename); + xmlFree(URL); + xmlFree(filename); + return; + } + } + + oldOutputFile = ctxt->outputFile; + oldOutput = ctxt->output; + oldInsert = ctxt->insert; + oldType = ctxt->type; + ctxt->outputFile = (const char *) filename; + + style = xsltNewStylesheet(); + if (style == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsltDocumentElem: out of memory\n"); + goto error; + } + + /* + * Version described in 1.1 draft allows full parameterization + * of the output. + */ + prop = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) "version", + NULL); + if (prop != NULL) { + if (style->version != NULL) + xmlFree(style->version); + style->version = prop; + } + prop = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) "encoding", + NULL); + if (prop != NULL) { + if (style->encoding != NULL) + xmlFree(style->encoding); + style->encoding = prop; + } + prop = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) "method", + NULL); + if (prop != NULL) { + const xmlChar *URI; + + if (style->method != NULL) + xmlFree(style->method); + style->method = NULL; + if (style->methodURI != NULL) + xmlFree(style->methodURI); + style->methodURI = NULL; + + URI = xsltGetQNameURI(inst, &prop); + if (prop == NULL) { + if (style != NULL) style->errors++; + } else if (URI == NULL) { + if ((xmlStrEqual(prop, (const xmlChar *) "xml")) || + (xmlStrEqual(prop, (const xmlChar *) "html")) || + (xmlStrEqual(prop, (const xmlChar *) "text"))) { + style->method = prop; + } else { + xsltTransformError(ctxt, NULL, inst, + "invalid value for method: %s\n", prop); + if (style != NULL) style->warnings++; + } + } else { + style->method = prop; + style->methodURI = xmlStrdup(URI); + } + } + prop = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) + "doctype-system", NULL); + if (prop != NULL) { + if (style->doctypeSystem != NULL) + xmlFree(style->doctypeSystem); + style->doctypeSystem = prop; + } + prop = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) + "doctype-public", NULL); + if (prop != NULL) { + if (style->doctypePublic != NULL) + xmlFree(style->doctypePublic); + style->doctypePublic = prop; + } + prop = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) "standalone", + NULL); + if (prop != NULL) { + if (xmlStrEqual(prop, (const xmlChar *) "yes")) { + style->standalone = 1; + } else if (xmlStrEqual(prop, (const xmlChar *) "no")) { + style->standalone = 0; + } else { + xsltTransformError(ctxt, NULL, inst, + "invalid value for standalone: %s\n", + prop); + if (style != NULL) style->warnings++; + } + xmlFree(prop); + } + + prop = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) "indent", + NULL); + if (prop != NULL) { + if (xmlStrEqual(prop, (const xmlChar *) "yes")) { + style->indent = 1; + } else if (xmlStrEqual(prop, (const xmlChar *) "no")) { + style->indent = 0; + } else { + xsltTransformError(ctxt, NULL, inst, + "invalid value for indent: %s\n", prop); + if (style != NULL) style->warnings++; + } + xmlFree(prop); + } + + prop = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) + "omit-xml-declaration", + NULL); + if (prop != NULL) { + if (xmlStrEqual(prop, (const xmlChar *) "yes")) { + style->omitXmlDeclaration = 1; + } else if (xmlStrEqual(prop, (const xmlChar *) "no")) { + style->omitXmlDeclaration = 0; + } else { + xsltTransformError(ctxt, NULL, inst, + "invalid value for omit-xml-declaration: %s\n", + prop); + if (style != NULL) style->warnings++; + } + xmlFree(prop); + } + + elements = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) + "cdata-section-elements", + NULL); + if (elements != NULL) { + if (style->stripSpaces == NULL) + style->stripSpaces = xmlHashCreate(10); + if (style->stripSpaces == NULL) + return; + + element = elements; + while (*element != 0) { + while (IS_BLANK_CH(*element)) + element++; + if (*element == 0) + break; + end = element; + while ((*end != 0) && (!IS_BLANK_CH(*end))) + end++; + element = xmlStrndup(element, end - element); + if (element) { + const xmlChar *URI; + +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "add cdata section output element %s\n", + element); +#endif + URI = xsltGetQNameURI(inst, &element); + + xmlHashAddEntry2(style->stripSpaces, element, URI, + (xmlChar *) "cdata"); + xmlFree(element); + } + element = end; + } + xmlFree(elements); + } + + /* + * Create a new document tree and process the element template + */ + XSLT_GET_IMPORT_PTR(method, style, method) + XSLT_GET_IMPORT_PTR(doctypePublic, style, doctypePublic) + XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem) + XSLT_GET_IMPORT_PTR(version, style, version) + XSLT_GET_IMPORT_PTR(encoding, style, encoding) + + if ((method != NULL) && + (!xmlStrEqual(method, (const xmlChar *) "xml"))) { + if (xmlStrEqual(method, (const xmlChar *) "html")) { + ctxt->type = XSLT_OUTPUT_HTML; + if (((doctypePublic != NULL) || (doctypeSystem != NULL))) + res = htmlNewDoc(doctypeSystem, doctypePublic); + else { + if (version != NULL) { +#ifdef XSLT_GENERATE_HTML_DOCTYPE + xsltGetHTMLIDs(version, &doctypePublic, &doctypeSystem); +#endif + } + res = htmlNewDocNoDtD(doctypeSystem, doctypePublic); + } + if (res == NULL) + goto error; + res->dict = ctxt->dict; + xmlDictReference(res->dict); + } else if (xmlStrEqual(method, (const xmlChar *) "xhtml")) { + xsltTransformError(ctxt, NULL, inst, + "xsltDocumentElem: unsupported method xhtml\n"); + ctxt->type = XSLT_OUTPUT_HTML; + res = htmlNewDocNoDtD(doctypeSystem, doctypePublic); + if (res == NULL) + goto error; + res->dict = ctxt->dict; + xmlDictReference(res->dict); + } else if (xmlStrEqual(method, (const xmlChar *) "text")) { + ctxt->type = XSLT_OUTPUT_TEXT; + res = xmlNewDoc(style->version); + if (res == NULL) + goto error; + res->dict = ctxt->dict; + xmlDictReference(res->dict); +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "reusing transformation dict for output\n"); +#endif + } else { + xsltTransformError(ctxt, NULL, inst, + "xsltDocumentElem: unsupported method (%s)\n", + method); + goto error; + } + } else { + ctxt->type = XSLT_OUTPUT_XML; + res = xmlNewDoc(style->version); + if (res == NULL) + goto error; + res->dict = ctxt->dict; + xmlDictReference(res->dict); +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "reusing transformation dict for output\n"); +#endif + } + res->charset = XML_CHAR_ENCODING_UTF8; + if (encoding != NULL) + res->encoding = xmlStrdup(encoding); + ctxt->output = res; + ctxt->insert = (xmlNodePtr) res; + xsltApplySequenceConstructor(ctxt, node, inst->children, NULL); + + /* + * Do some post processing work depending on the generated output + */ + root = xmlDocGetRootElement(res); + if (root != NULL) { + const xmlChar *doctype = NULL; + + if ((root->ns != NULL) && (root->ns->prefix != NULL)) + doctype = xmlDictQLookup(ctxt->dict, root->ns->prefix, root->name); + if (doctype == NULL) + doctype = root->name; + + /* + * Apply the default selection of the method + */ + if ((method == NULL) && + (root->ns == NULL) && + (!xmlStrcasecmp(root->name, (const xmlChar *) "html"))) { + xmlNodePtr tmp; + + tmp = res->children; + while ((tmp != NULL) && (tmp != root)) { + if (tmp->type == XML_ELEMENT_NODE) + break; + if ((tmp->type == XML_TEXT_NODE) && (!xmlIsBlankNode(tmp))) + break; + tmp = tmp->next; + } + if (tmp == root) { + ctxt->type = XSLT_OUTPUT_HTML; + res->type = XML_HTML_DOCUMENT_NODE; + if (((doctypePublic != NULL) || (doctypeSystem != NULL))) { + res->intSubset = xmlCreateIntSubset(res, doctype, + doctypePublic, + doctypeSystem); +#ifdef XSLT_GENERATE_HTML_DOCTYPE + } else if (version != NULL) { + xsltGetHTMLIDs(version, &doctypePublic, + &doctypeSystem); + if (((doctypePublic != NULL) || (doctypeSystem != NULL))) + res->intSubset = + xmlCreateIntSubset(res, doctype, + doctypePublic, + doctypeSystem); +#endif + } + } + + } + if (ctxt->type == XSLT_OUTPUT_XML) { + XSLT_GET_IMPORT_PTR(doctypePublic, style, doctypePublic) + XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem) + if (((doctypePublic != NULL) || (doctypeSystem != NULL))) + res->intSubset = xmlCreateIntSubset(res, doctype, + doctypePublic, + doctypeSystem); + } + } + + /* + * Calls to redirect:write also take an optional attribute append. + * Attribute append="true|yes" which will attempt to simply append + * to an existing file instead of always opening a new file. The + * default behavior of always overwriting the file still happens + * if we do not specify append. + * Note that append use will forbid use of remote URI target. + */ + prop = xsltEvalAttrValueTemplate(ctxt, inst, (const xmlChar *)"append", + NULL); + if (prop != NULL) { + if (xmlStrEqual(prop, (const xmlChar *) "true") || + xmlStrEqual(prop, (const xmlChar *) "yes")) { + style->omitXmlDeclaration = 1; + redirect_write_append = 1; + } else + style->omitXmlDeclaration = 0; + xmlFree(prop); + } + + if (redirect_write_append) { + FILE *f; + + f = fopen((const char *) filename, "ab"); + if (f == NULL) { + ret = -1; + } else { + ret = xsltSaveResultToFile(f, res, style); + fclose(f); + } + } else { + ret = xsltSaveResultToFilename((const char *) filename, res, style, 0); + } + if (ret < 0) { + xsltTransformError(ctxt, NULL, inst, + "xsltDocumentElem: unable to save to %s\n", + filename); + ctxt->state = XSLT_STATE_ERROR; +#ifdef WITH_XSLT_DEBUG_EXTRA + } else { + xsltGenericDebug(xsltGenericDebugContext, + "Wrote %d bytes to %s\n", ret, filename); +#endif + } + + error: + ctxt->output = oldOutput; + ctxt->insert = oldInsert; + ctxt->type = oldType; + ctxt->outputFile = oldOutputFile; + if (URL != NULL) + xmlFree(URL); + if (filename != NULL) + xmlFree(filename); + if (style != NULL) + xsltFreeStylesheet(style); + if (res != NULL) + xmlFreeDoc(res); +} + +/************************************************************************ + * * + * Most of the XSLT-1.0 transformations * + * * + ************************************************************************/ + +/** + * xsltSort: + * @ctxt: a XSLT process context + * @node: the node in the source tree. + * @inst: the xslt sort node + * @comp: precomputed information + * + * function attached to xsl:sort nodes, but this should not be + * called directly + */ +void +xsltSort(xsltTransformContextPtr ctxt, + xmlNodePtr node ATTRIBUTE_UNUSED, xmlNodePtr inst, + xsltStylePreCompPtr comp) { + if (comp == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsl:sort : compilation failed\n"); + return; + } + xsltTransformError(ctxt, NULL, inst, + "xsl:sort : improper use this should not be reached\n"); +} + +/** + * xsltCopy: + * @ctxt: an XSLT process context + * @node: the node in the source tree + * @inst: the element node of the XSLT-copy instruction + * @castedComp: computed information of the XSLT-copy instruction + * + * Execute the XSLT-copy instruction on the source node. + */ +void +xsltCopy(xsltTransformContextPtr ctxt, xmlNodePtr node, + xmlNodePtr inst, xsltStylePreCompPtr castedComp) +{ +#ifdef XSLT_REFACTORED + xsltStyleItemCopyPtr comp = (xsltStyleItemCopyPtr) castedComp; +#else + xsltStylePreCompPtr comp = castedComp; +#endif + xmlNodePtr copy, oldInsert; + + oldInsert = ctxt->insert; + if (ctxt->insert != NULL) { + switch (node->type) { + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + /* + * This text comes from the stylesheet + * For stylesheets, the set of whitespace-preserving + * element names consists of just xsl:text. + */ +#ifdef WITH_XSLT_DEBUG_PROCESS + if (node->type == XML_CDATA_SECTION_NODE) { + XSLT_TRACE(ctxt,XSLT_TRACE_COPY,xsltGenericDebug(xsltGenericDebugContext, + "xsltCopy: CDATA text %s\n", node->content)); + } else { + XSLT_TRACE(ctxt,XSLT_TRACE_COPY,xsltGenericDebug(xsltGenericDebugContext, + "xsltCopy: text %s\n", node->content)); + } +#endif + xsltCopyText(ctxt, ctxt->insert, node, 0); + break; + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + break; + case XML_ELEMENT_NODE: + /* + * REVISIT NOTE: The "fake" is a doc-node, not an element node. + * REMOVED: + * if (xmlStrEqual(node->name, BAD_CAST " fake node libxslt")) + * return; + */ + +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_COPY,xsltGenericDebug(xsltGenericDebugContext, + "xsltCopy: node %s\n", node->name)); +#endif + copy = xsltShallowCopyElem(ctxt, node, ctxt->insert, 0); + ctxt->insert = copy; + if (comp->use != NULL) { + xsltApplyAttributeSet(ctxt, node, inst, comp->use); + } + break; + case XML_ATTRIBUTE_NODE: { +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_COPY,xsltGenericDebug(xsltGenericDebugContext, + "xsltCopy: attribute %s\n", node->name)); +#endif + /* + * REVISIT: We could also raise an error if the parent is not + * an element node. + * OPTIMIZE TODO: Can we set the value/children of the + * attribute without an intermediate copy of the string value? + */ + xsltShallowCopyAttr(ctxt, inst, ctxt->insert, (xmlAttrPtr) node); + break; + } + case XML_PI_NODE: +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_COPY,xsltGenericDebug(xsltGenericDebugContext, + "xsltCopy: PI %s\n", node->name)); +#endif + copy = xmlNewDocPI(ctxt->insert->doc, node->name, + node->content); + copy = xsltAddChild(ctxt->insert, copy); + break; + case XML_COMMENT_NODE: +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_COPY,xsltGenericDebug(xsltGenericDebugContext, + "xsltCopy: comment\n")); +#endif + copy = xmlNewComment(node->content); + copy = xsltAddChild(ctxt->insert, copy); + break; + case XML_NAMESPACE_DECL: +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_COPY,xsltGenericDebug(xsltGenericDebugContext, + "xsltCopy: namespace declaration\n")); +#endif + xsltShallowCopyNsNode(ctxt, inst, ctxt->insert, (xmlNsPtr)node); + break; + default: + break; + + } + } + + switch (node->type) { + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + case XML_ELEMENT_NODE: + xsltApplySequenceConstructor(ctxt, ctxt->node, inst->children, + NULL); + break; + default: + break; + } + ctxt->insert = oldInsert; +} + +/** + * xsltText: + * @ctxt: a XSLT process context + * @node: the node in the source tree. + * @inst: the xslt text node + * @comp: precomputed information + * + * Process the xslt text node on the source node + */ +void +xsltText(xsltTransformContextPtr ctxt, xmlNodePtr node ATTRIBUTE_UNUSED, + xmlNodePtr inst, xsltStylePreCompPtr comp ATTRIBUTE_UNUSED) { + if ((inst->children != NULL) && (comp != NULL)) { + xmlNodePtr text = inst->children; + xmlNodePtr copy; + + while (text != NULL) { + if ((text->type != XML_TEXT_NODE) && + (text->type != XML_CDATA_SECTION_NODE)) { + xsltTransformError(ctxt, NULL, inst, + "xsl:text content problem\n"); + break; + } + copy = xmlNewDocText(ctxt->output, text->content); + if (text->type != XML_CDATA_SECTION_NODE) { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "Disable escaping: %s\n", text->content); +#endif + copy->name = xmlStringTextNoenc; + } + copy = xsltAddChild(ctxt->insert, copy); + text = text->next; + } + } +} + +/** + * xsltElement: + * @ctxt: a XSLT process context + * @node: the node in the source tree. + * @inst: the xslt element node + * @castedComp: precomputed information + * + * Process the xslt element node on the source node + */ +void +xsltElement(xsltTransformContextPtr ctxt, xmlNodePtr node, + xmlNodePtr inst, xsltStylePreCompPtr castedComp) { +#ifdef XSLT_REFACTORED + xsltStyleItemElementPtr comp = (xsltStyleItemElementPtr) castedComp; +#else + xsltStylePreCompPtr comp = castedComp; +#endif + xmlChar *prop = NULL; + const xmlChar *name, *prefix = NULL, *nsName = NULL; + xmlNodePtr copy; + xmlNodePtr oldInsert; + + if (ctxt->insert == NULL) + return; + + /* + * A comp->has_name == 0 indicates that we need to skip this instruction, + * since it was evaluated to be invalid already during compilation. + */ + if (!comp->has_name) + return; + + /* + * stack and saves + */ + oldInsert = ctxt->insert; + + if (comp->name == NULL) { + /* TODO: fix attr acquisition wrt to the XSLT namespace */ + prop = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) "name", XSLT_NAMESPACE); + if (prop == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsl:element: The attribute 'name' is missing.\n"); + goto error; + } + if (xmlValidateQName(prop, 0)) { + xsltTransformError(ctxt, NULL, inst, + "xsl:element: The effective name '%s' is not a " + "valid QName.\n", prop); + /* we fall through to catch any further errors, if possible */ + } + name = xsltSplitQName(ctxt->dict, prop, &prefix); + xmlFree(prop); + } else { + /* + * The "name" value was static. + */ +#ifdef XSLT_REFACTORED + prefix = comp->nsPrefix; + name = comp->name; +#else + name = xsltSplitQName(ctxt->dict, comp->name, &prefix); +#endif + } + + /* + * Create the new element + */ + if (ctxt->output->dict == ctxt->dict) { + copy = xmlNewDocNodeEatName(ctxt->output, NULL, (xmlChar *)name, NULL); + } else { + copy = xmlNewDocNode(ctxt->output, NULL, (xmlChar *)name, NULL); + } + if (copy == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsl:element : creation of %s failed\n", name); + return; + } + copy = xsltAddChild(ctxt->insert, copy); + if (copy == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsl:element : xsltAddChild failed\n"); + return; + } + + /* + * Namespace + * --------- + */ + if (comp->has_ns) { + if (comp->ns != NULL) { + /* + * No AVT; just plain text for the namespace name. + */ + if (comp->ns[0] != 0) + nsName = comp->ns; + } else { + xmlChar *tmpNsName; + /* + * Eval the AVT. + */ + /* TODO: check attr acquisition wrt to the XSLT namespace */ + tmpNsName = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *) "namespace", XSLT_NAMESPACE); + /* + * SPEC XSLT 1.0: + * "If the string is empty, then the expanded-name of the + * attribute has a null namespace URI." + */ + if ((tmpNsName != NULL) && (tmpNsName[0] != 0)) + nsName = xmlDictLookup(ctxt->dict, BAD_CAST tmpNsName, -1); + xmlFree(tmpNsName); + } + + if (xmlStrEqual(nsName, BAD_CAST "http://www.w3.org/2000/xmlns/")) { + xsltTransformError(ctxt, NULL, inst, + "xsl:attribute: Namespace http://www.w3.org/2000/xmlns/ " + "forbidden.\n"); + goto error; + } + if (xmlStrEqual(nsName, XML_XML_NAMESPACE)) { + prefix = BAD_CAST "xml"; + } else if (xmlStrEqual(prefix, BAD_CAST "xml")) { + prefix = NULL; + } + } else { + xmlNsPtr ns; + /* + * SPEC XSLT 1.0: + * "If the namespace attribute is not present, then the QName is + * expanded into an expanded-name using the namespace declarations + * in effect for the xsl:element element, including any default + * namespace declaration. + */ + ns = xmlSearchNs(inst->doc, inst, prefix); + if (ns == NULL) { + /* + * TODO: Check this in the compilation layer in case it's a + * static value. + */ + if (prefix != NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsl:element: The QName '%s:%s' has no " + "namespace binding in scope in the stylesheet; " + "this is an error, since the namespace was not " + "specified by the instruction itself.\n", prefix, name); + } + } else + nsName = ns->href; + } + /* + * Find/create a matching ns-decl in the result tree. + */ + if (nsName != NULL) { + if (xmlStrEqual(prefix, BAD_CAST "xmlns")) { + /* Don't use a prefix of "xmlns" */ + xmlChar *pref = xmlStrdup(BAD_CAST "ns_1"); + + copy->ns = xsltGetSpecialNamespace(ctxt, inst, nsName, pref, copy); + + xmlFree(pref); + } else { + copy->ns = xsltGetSpecialNamespace(ctxt, inst, nsName, prefix, + copy); + } + } else if ((copy->parent != NULL) && + (copy->parent->type == XML_ELEMENT_NODE) && + (copy->parent->ns != NULL)) + { + /* + * "Undeclare" the default namespace. + */ + xsltGetSpecialNamespace(ctxt, inst, NULL, NULL, copy); + } + + ctxt->insert = copy; + + if (comp->has_use) { + if (comp->use != NULL) { + xsltApplyAttributeSet(ctxt, node, inst, comp->use); + } else { + xmlChar *attrSets = NULL; + /* + * BUG TODO: use-attribute-sets is not a value template. + * use-attribute-sets = qnames + */ + attrSets = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *)"use-attribute-sets", NULL); + if (attrSets != NULL) { + xsltApplyAttributeSet(ctxt, node, inst, attrSets); + xmlFree(attrSets); + } + } + } + /* + * Instantiate the sequence constructor. + */ + if (inst->children != NULL) + xsltApplySequenceConstructor(ctxt, ctxt->node, inst->children, + NULL); + +error: + ctxt->insert = oldInsert; + return; +} + + +/** + * xsltComment: + * @ctxt: a XSLT process context + * @node: the node in the source tree. + * @inst: the xslt comment node + * @comp: precomputed information + * + * Process the xslt comment node on the source node + */ +void +xsltComment(xsltTransformContextPtr ctxt, xmlNodePtr node, + xmlNodePtr inst, xsltStylePreCompPtr comp ATTRIBUTE_UNUSED) { + xmlChar *value = NULL; + xmlNodePtr commentNode; + int len; + + value = xsltEvalTemplateString(ctxt, node, inst); + /* TODO: use or generate the compiled form */ + len = xmlStrlen(value); + if (len > 0) { + if ((value[len-1] == '-') || + (xmlStrstr(value, BAD_CAST "--"))) { + xsltTransformError(ctxt, NULL, inst, + "xsl:comment : '--' or ending '-' not allowed in comment\n"); + /* fall through to try to catch further errors */ + } + } +#ifdef WITH_XSLT_DEBUG_PROCESS + if (value == NULL) { + XSLT_TRACE(ctxt,XSLT_TRACE_COMMENT,xsltGenericDebug(xsltGenericDebugContext, + "xsltComment: empty\n")); + } else { + XSLT_TRACE(ctxt,XSLT_TRACE_COMMENT,xsltGenericDebug(xsltGenericDebugContext, + "xsltComment: content %s\n", value)); + } +#endif + + commentNode = xmlNewComment(value); + commentNode = xsltAddChild(ctxt->insert, commentNode); + + if (value != NULL) + xmlFree(value); +} + +/** + * xsltProcessingInstruction: + * @ctxt: a XSLT process context + * @node: the node in the source tree. + * @inst: the xslt processing-instruction node + * @castedComp: precomputed information + * + * Process the xslt processing-instruction node on the source node + */ +void +xsltProcessingInstruction(xsltTransformContextPtr ctxt, xmlNodePtr node, + xmlNodePtr inst, xsltStylePreCompPtr castedComp) { +#ifdef XSLT_REFACTORED + xsltStyleItemPIPtr comp = (xsltStyleItemPIPtr) castedComp; +#else + xsltStylePreCompPtr comp = castedComp; +#endif + const xmlChar *name; + xmlChar *value = NULL; + xmlNodePtr pi; + + + if (ctxt->insert == NULL) + return; + if (comp->has_name == 0) + return; + if (comp->name == NULL) { + name = xsltEvalAttrValueTemplate(ctxt, inst, + (const xmlChar *)"name", NULL); + if (name == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsl:processing-instruction : name is missing\n"); + goto error; + } + } else { + name = comp->name; + } + /* TODO: check that it's both an an NCName and a PITarget. */ + + + value = xsltEvalTemplateString(ctxt, node, inst); + if (xmlStrstr(value, BAD_CAST "?>") != NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsl:processing-instruction: '?>' not allowed within PI content\n"); + goto error; + } +#ifdef WITH_XSLT_DEBUG_PROCESS + if (value == NULL) { + XSLT_TRACE(ctxt,XSLT_TRACE_PI,xsltGenericDebug(xsltGenericDebugContext, + "xsltProcessingInstruction: %s empty\n", name)); + } else { + XSLT_TRACE(ctxt,XSLT_TRACE_PI,xsltGenericDebug(xsltGenericDebugContext, + "xsltProcessingInstruction: %s content %s\n", name, value)); + } +#endif + + pi = xmlNewDocPI(ctxt->insert->doc, name, value); + pi = xsltAddChild(ctxt->insert, pi); + +error: + if ((name != NULL) && (name != comp->name)) + xmlFree((xmlChar *) name); + if (value != NULL) + xmlFree(value); +} + +/** + * xsltCopyOf: + * @ctxt: an XSLT transformation context + * @node: the current node in the source tree + * @inst: the element node of the XSLT copy-of instruction + * @castedComp: precomputed information of the XSLT copy-of instruction + * + * Process the XSLT copy-of instruction. + */ +void +xsltCopyOf(xsltTransformContextPtr ctxt, xmlNodePtr node, + xmlNodePtr inst, xsltStylePreCompPtr castedComp) { +#ifdef XSLT_REFACTORED + xsltStyleItemCopyOfPtr comp = (xsltStyleItemCopyOfPtr) castedComp; +#else + xsltStylePreCompPtr comp = castedComp; +#endif + xmlXPathObjectPtr res = NULL; + xmlNodeSetPtr list = NULL; + int i; + + if ((ctxt == NULL) || (node == NULL) || (inst == NULL)) + return; + if ((comp == NULL) || (comp->select == NULL) || (comp->comp == NULL)) { + xsltTransformError(ctxt, NULL, inst, + "xsl:copy-of : compilation failed\n"); + return; + } + + /* + * SPEC XSLT 1.0: + * "The xsl:copy-of element can be used to insert a result tree + * fragment into the result tree, without first converting it to + * a string as xsl:value-of does (see [7.6.1 Generating Text with + * xsl:value-of]). The required select attribute contains an + * expression. When the result of evaluating the expression is a + * result tree fragment, the complete fragment is copied into the + * result tree. When the result is a node-set, all the nodes in the + * set are copied in document order into the result tree; copying + * an element node copies the attribute nodes, namespace nodes and + * children of the element node as well as the element node itself; + * a root node is copied by copying its children. When the result + * is neither a node-set nor a result tree fragment, the result is + * converted to a string and then inserted into the result tree, + * as with xsl:value-of. + */ + +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_COPY_OF,xsltGenericDebug(xsltGenericDebugContext, + "xsltCopyOf: select %s\n", comp->select)); +#endif + + /* + * Evaluate the "select" expression. + */ + res = xsltPreCompEval(ctxt, node, comp); + + if (res != NULL) { + if (res->type == XPATH_NODESET) { + /* + * Node-set + * -------- + */ +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_COPY_OF,xsltGenericDebug(xsltGenericDebugContext, + "xsltCopyOf: result is a node set\n")); +#endif + list = res->nodesetval; + if (list != NULL) { + xmlNodePtr cur; + /* + * The list is already sorted in document order by XPath. + * Append everything in this order under ctxt->insert. + */ + for (i = 0;i < list->nodeNr;i++) { + cur = list->nodeTab[i]; + if (cur == NULL) + continue; + if ((cur->type == XML_DOCUMENT_NODE) || + (cur->type == XML_HTML_DOCUMENT_NODE)) + { + xsltCopyTreeList(ctxt, inst, + cur->children, ctxt->insert, 0, 0); + } else if (cur->type == XML_ATTRIBUTE_NODE) { + xsltShallowCopyAttr(ctxt, inst, + ctxt->insert, (xmlAttrPtr) cur); + } else { + xsltCopyTreeInternal(ctxt, inst, + cur, ctxt->insert, 0, 0); + } + } + } + } else if (res->type == XPATH_XSLT_TREE) { + /* + * Result tree fragment + * -------------------- + * E.g. via + * Note that the root node of such trees is an xmlDocPtr in Libxslt. + */ +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_COPY_OF,xsltGenericDebug(xsltGenericDebugContext, + "xsltCopyOf: result is a result tree fragment\n")); +#endif + list = res->nodesetval; + if ((list != NULL) && (list->nodeTab != NULL) && + (list->nodeTab[0] != NULL) && + (IS_XSLT_REAL_NODE(list->nodeTab[0]))) + { + xsltCopyTreeList(ctxt, inst, + list->nodeTab[0]->children, ctxt->insert, 0, 0); + } + } else { + xmlChar *value = NULL; + /* + * Convert to a string. + */ + value = xmlXPathCastToString(res); + if (value == NULL) { + xsltTransformError(ctxt, NULL, inst, + "Internal error in xsltCopyOf(): " + "failed to cast an XPath object to string.\n"); + ctxt->state = XSLT_STATE_STOPPED; + } else { + if (value[0] != 0) { + /* + * Append content as text node. + */ + xsltCopyTextString(ctxt, ctxt->insert, value, 0); + } + xmlFree(value); + +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_COPY_OF,xsltGenericDebug(xsltGenericDebugContext, + "xsltCopyOf: result %s\n", res->stringval)); +#endif + } + } + } else { + ctxt->state = XSLT_STATE_STOPPED; + } + + if (res != NULL) + xmlXPathFreeObject(res); +} + +/** + * xsltValueOf: + * @ctxt: a XSLT process context + * @node: the node in the source tree. + * @inst: the xslt value-of node + * @castedComp: precomputed information + * + * Process the xslt value-of node on the source node + */ +void +xsltValueOf(xsltTransformContextPtr ctxt, xmlNodePtr node, + xmlNodePtr inst, xsltStylePreCompPtr castedComp) +{ +#ifdef XSLT_REFACTORED + xsltStyleItemValueOfPtr comp = (xsltStyleItemValueOfPtr) castedComp; +#else + xsltStylePreCompPtr comp = castedComp; +#endif + xmlXPathObjectPtr res = NULL; + xmlChar *value = NULL; + + if ((ctxt == NULL) || (node == NULL) || (inst == NULL)) + return; + + if ((comp == NULL) || (comp->select == NULL) || (comp->comp == NULL)) { + xsltTransformError(ctxt, NULL, inst, + "Internal error in xsltValueOf(): " + "The XSLT 'value-of' instruction was not compiled.\n"); + return; + } + +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_VALUE_OF,xsltGenericDebug(xsltGenericDebugContext, + "xsltValueOf: select %s\n", comp->select)); +#endif + + res = xsltPreCompEval(ctxt, node, comp); + + /* + * Cast the XPath object to string. + */ + if (res != NULL) { + value = xmlXPathCastToString(res); + if (value == NULL) { + xsltTransformError(ctxt, NULL, inst, + "Internal error in xsltValueOf(): " + "failed to cast an XPath object to string.\n"); + ctxt->state = XSLT_STATE_STOPPED; + goto error; + } + if (value[0] != 0) { + xsltCopyTextString(ctxt, ctxt->insert, value, comp->noescape); + } + } else { + xsltTransformError(ctxt, NULL, inst, + "XPath evaluation returned no result.\n"); + ctxt->state = XSLT_STATE_STOPPED; + goto error; + } + +#ifdef WITH_XSLT_DEBUG_PROCESS + if (value) { + XSLT_TRACE(ctxt,XSLT_TRACE_VALUE_OF,xsltGenericDebug(xsltGenericDebugContext, + "xsltValueOf: result '%s'\n", value)); + } +#endif + +error: + if (value != NULL) + xmlFree(value); + if (res != NULL) + xmlXPathFreeObject(res); +} + +/** + * xsltNumber: + * @ctxt: a XSLT process context + * @node: the node in the source tree. + * @inst: the xslt number node + * @castedComp: precomputed information + * + * Process the xslt number node on the source node + */ +void +xsltNumber(xsltTransformContextPtr ctxt, xmlNodePtr node, + xmlNodePtr inst, xsltStylePreCompPtr castedComp) +{ +#ifdef XSLT_REFACTORED + xsltStyleItemNumberPtr comp = (xsltStyleItemNumberPtr) castedComp; +#else + xsltStylePreCompPtr comp = castedComp; +#endif + xmlXPathContextPtr xpctxt; + xmlNsPtr *oldXPNamespaces; + int oldXPNsNr; + + if (comp == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsl:number : compilation failed\n"); + return; + } + + if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || (comp == NULL)) + return; + + comp->numdata.doc = inst->doc; + comp->numdata.node = inst; + + xpctxt = ctxt->xpathCtxt; + oldXPNsNr = xpctxt->nsNr; + oldXPNamespaces = xpctxt->namespaces; + +#ifdef XSLT_REFACTORED + if (comp->inScopeNs != NULL) { + xpctxt->namespaces = comp->inScopeNs->list; + xpctxt->nsNr = comp->inScopeNs->xpathNumber; + } else { + xpctxt->namespaces = NULL; + xpctxt->nsNr = 0; + } +#else + xpctxt->namespaces = comp->nsList; + xpctxt->nsNr = comp->nsNr; +#endif + + xsltNumberFormat(ctxt, &comp->numdata, node); + + xpctxt->nsNr = oldXPNsNr; + xpctxt->namespaces = oldXPNamespaces; +} + +/** + * xsltApplyImports: + * @ctxt: an XSLT transformation context + * @contextNode: the current node in the source tree. + * @inst: the element node of the XSLT 'apply-imports' instruction + * @comp: the compiled instruction + * + * Process the XSLT apply-imports element. + */ +void +xsltApplyImports(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, + xmlNodePtr inst, + xsltStylePreCompPtr comp ATTRIBUTE_UNUSED) +{ + xsltTemplatePtr templ; + + if ((ctxt == NULL) || (inst == NULL)) + return; + + if (comp == NULL) { + xsltTransformError(ctxt, NULL, inst, + "Internal error in xsltApplyImports(): " + "The XSLT 'apply-imports' instruction was not compiled.\n"); + return; + } + /* + * NOTE that ctxt->currentTemplateRule and ctxt->templ is not the + * same; the former is the "Current Template Rule" as defined by the + * XSLT spec, the latter is simply the template struct being + * currently processed. + */ + if (ctxt->currentTemplateRule == NULL) { + /* + * SPEC XSLT 2.0: + * "[ERR XTDE0560] It is a non-recoverable dynamic error if + * xsl:apply-imports or xsl:next-match is evaluated when the + * current template rule is null." + */ + xsltTransformError(ctxt, NULL, inst, + "It is an error to call 'apply-imports' " + "when there's no current template rule.\n"); + return; + } + /* + * TODO: Check if this is correct. + */ + templ = xsltGetTemplate(ctxt, contextNode, + ctxt->currentTemplateRule->style); + + if (templ != NULL) { + xsltTemplatePtr oldCurTemplRule = ctxt->currentTemplateRule; + /* + * Set the current template rule. + */ + ctxt->currentTemplateRule = templ; + /* + * URGENT TODO: Need xsl:with-param be handled somehow here? + */ + xsltApplyXSLTTemplate(ctxt, contextNode, templ->content, + templ, NULL); + + ctxt->currentTemplateRule = oldCurTemplRule; + } +} + +/** + * xsltCallTemplate: + * @ctxt: a XSLT transformation context + * @node: the "current node" in the source tree + * @inst: the XSLT 'call-template' instruction + * @castedComp: the compiled information of the instruction + * + * Processes the XSLT call-template instruction on the source node. + */ +void +xsltCallTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node, + xmlNodePtr inst, xsltStylePreCompPtr castedComp) +{ +#ifdef XSLT_REFACTORED + xsltStyleItemCallTemplatePtr comp = + (xsltStyleItemCallTemplatePtr) castedComp; +#else + xsltStylePreCompPtr comp = castedComp; +#endif + xsltStackElemPtr withParams = NULL; + + if (ctxt->insert == NULL) + return; + if (comp == NULL) { + xsltTransformError(ctxt, NULL, inst, + "The XSLT 'call-template' instruction was not compiled.\n"); + return; + } + + /* + * The template must have been precomputed + */ + if (comp->templ == NULL) { + comp->templ = xsltFindTemplate(ctxt, comp->name, comp->ns); + if (comp->templ == NULL) { + if (comp->ns != NULL) { + xsltTransformError(ctxt, NULL, inst, + "The called template '{%s}%s' was not found.\n", + comp->ns, comp->name); + } else { + xsltTransformError(ctxt, NULL, inst, + "The called template '%s' was not found.\n", + comp->name); + } + return; + } + } + +#ifdef WITH_XSLT_DEBUG_PROCESS + if ((comp != NULL) && (comp->name != NULL)) + XSLT_TRACE(ctxt,XSLT_TRACE_CALL_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, + "call-template: name %s\n", comp->name)); +#endif + + if (inst->children) { + xmlNodePtr cur; + xsltStackElemPtr param; + + cur = inst->children; + while (cur != NULL) { +#ifdef WITH_DEBUGGER + if (ctxt->debugStatus != XSLT_DEBUG_NONE) + xslHandleDebugger(cur, node, comp->templ, ctxt); +#endif + if (ctxt->state == XSLT_STATE_STOPPED) break; + /* + * TODO: The "with-param"s could be part of the "call-template" + * structure. Avoid to "search" for params dynamically + * in the XML tree every time. + */ + if (IS_XSLT_ELEM(cur)) { + if (IS_XSLT_NAME(cur, "with-param")) { + param = xsltParseStylesheetCallerParam(ctxt, cur); + if (param != NULL) { + param->next = withParams; + withParams = param; + } + } else { + xsltGenericError(xsltGenericErrorContext, + "xsl:call-template: misplaced xsl:%s\n", cur->name); + } + } else { + xsltGenericError(xsltGenericErrorContext, + "xsl:call-template: misplaced %s element\n", cur->name); + } + cur = cur->next; + } + } + /* + * Create a new frame using the params first + */ + xsltApplyXSLTTemplate(ctxt, node, comp->templ->content, comp->templ, + withParams); + if (withParams != NULL) + xsltFreeStackElemList(withParams); + +#ifdef WITH_XSLT_DEBUG_PROCESS + if ((comp != NULL) && (comp->name != NULL)) + XSLT_TRACE(ctxt,XSLT_TRACE_CALL_TEMPLATE,xsltGenericDebug(xsltGenericDebugContext, + "call-template returned: name %s\n", comp->name)); +#endif +} + +/** + * xsltApplyTemplates: + * @ctxt: a XSLT transformation context + * @node: the 'current node' in the source tree + * @inst: the element node of an XSLT 'apply-templates' instruction + * @castedComp: the compiled instruction + * + * Processes the XSLT 'apply-templates' instruction on the current node. + */ +void +xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node, + xmlNodePtr inst, xsltStylePreCompPtr castedComp) +{ +#ifdef XSLT_REFACTORED + xsltStyleItemApplyTemplatesPtr comp = + (xsltStyleItemApplyTemplatesPtr) castedComp; +#else + xsltStylePreCompPtr comp = castedComp; +#endif + int i; + xmlNodePtr cur, delNode = NULL, oldContextNode; + xmlNodeSetPtr list = NULL, oldList; + xsltStackElemPtr withParams = NULL; + int oldXPProximityPosition, oldXPContextSize; + const xmlChar *oldMode, *oldModeURI; + xmlDocPtr oldXPDoc; + xsltDocumentPtr oldDocInfo; + xmlXPathContextPtr xpctxt; + + if (comp == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsl:apply-templates : compilation failed\n"); + return; + } + if ((ctxt == NULL) || (node == NULL) || (inst == NULL) || (comp == NULL)) + return; + +#ifdef WITH_XSLT_DEBUG_PROCESS + if ((node != NULL) && (node->name != NULL)) + XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext, + "xsltApplyTemplates: node: '%s'\n", node->name)); +#endif + + xpctxt = ctxt->xpathCtxt; + /* + * Save context states. + */ + oldContextNode = ctxt->node; + oldMode = ctxt->mode; + oldModeURI = ctxt->modeURI; + oldDocInfo = ctxt->document; + oldList = ctxt->nodeList; + + /* + * The xpath context size and proximity position, as + * well as the xpath and context documents, may be changed + * so we save their initial state and will restore on exit + */ + oldXPContextSize = xpctxt->contextSize; + oldXPProximityPosition = xpctxt->proximityPosition; + oldXPDoc = xpctxt->doc; + + /* + * Set up contexts. + */ + ctxt->mode = comp->mode; + ctxt->modeURI = comp->modeURI; + + if (comp->select != NULL) { + xmlXPathObjectPtr res = NULL; + + if (comp->comp == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsl:apply-templates : compilation failed\n"); + goto error; + } +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext, + "xsltApplyTemplates: select %s\n", comp->select)); +#endif + + res = xsltPreCompEval(ctxt, node, comp); + + if (res != NULL) { + if (res->type == XPATH_NODESET) { + list = res->nodesetval; /* consume the node set */ + res->nodesetval = NULL; + } else { + xsltTransformError(ctxt, NULL, inst, + "The 'select' expression did not evaluate to a " + "node set.\n"); + ctxt->state = XSLT_STATE_STOPPED; + xmlXPathFreeObject(res); + goto error; + } + xmlXPathFreeObject(res); + /* + * Note: An xsl:apply-templates with a 'select' attribute, + * can change the current source doc. + */ + } else { + xsltTransformError(ctxt, NULL, inst, + "Failed to evaluate the 'select' expression.\n"); + ctxt->state = XSLT_STATE_STOPPED; + goto error; + } + if (list == NULL) { +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext, + "xsltApplyTemplates: select didn't evaluate to a node list\n")); +#endif + goto exit; + } + /* + * + * NOTE: Previously a document info (xsltDocument) was + * created and attached to the Result Tree Fragment. + * But such a document info is created on demand in + * xsltKeyFunction() (functions.c), so we need to create + * it here beforehand. + * In order to take care of potential keys we need to + * do some extra work for the case when a Result Tree Fragment + * is converted into a nodeset (e.g. exslt:node-set()) : + * We attach a "pseudo-doc" (xsltDocument) to _private. + * This xsltDocument, together with the keyset, will be freed + * when the Result Tree Fragment is freed. + * + */ +#if 0 + if ((ctxt->nbKeys > 0) && + (list->nodeNr != 0) && + (list->nodeTab[0]->doc != NULL) && + XSLT_IS_RES_TREE_FRAG(list->nodeTab[0]->doc)) + { + /* + * NOTE that it's also OK if @effectiveDocInfo will be + * set to NULL. + */ + isRTF = 1; + effectiveDocInfo = list->nodeTab[0]->doc->_private; + } +#endif + } else { + /* + * Build an XPath node set with the children + */ + list = xmlXPathNodeSetCreate(NULL); + if (list == NULL) + goto error; + if (node->type != XML_NAMESPACE_DECL) + cur = node->children; + else + cur = NULL; + while (cur != NULL) { + switch (cur->type) { + case XML_TEXT_NODE: + if ((IS_BLANK_NODE(cur)) && + (cur->parent != NULL) && + (cur->parent->type == XML_ELEMENT_NODE) && + (ctxt->style->stripSpaces != NULL)) { + const xmlChar *val; + + if (cur->parent->ns != NULL) { + val = (const xmlChar *) + xmlHashLookup2(ctxt->style->stripSpaces, + cur->parent->name, + cur->parent->ns->href); + if (val == NULL) { + val = (const xmlChar *) + xmlHashLookup2(ctxt->style->stripSpaces, + BAD_CAST "*", + cur->parent->ns->href); + } + } else { + val = (const xmlChar *) + xmlHashLookup2(ctxt->style->stripSpaces, + cur->parent->name, NULL); + } + if ((val != NULL) && + (xmlStrEqual(val, (xmlChar *) "strip"))) { + delNode = cur; + break; + } + } + /* no break on purpose */ + case XML_ELEMENT_NODE: + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_PI_NODE: + case XML_COMMENT_NODE: + xmlXPathNodeSetAddUnique(list, cur); + break; + case XML_DTD_NODE: + /* Unlink the DTD, it's still reachable + * using doc->intSubset */ + if (cur->next != NULL) + cur->next->prev = cur->prev; + if (cur->prev != NULL) + cur->prev->next = cur->next; + break; + case XML_NAMESPACE_DECL: + break; + default: +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext, + "xsltApplyTemplates: skipping cur type %d\n", + cur->type)); +#endif + delNode = cur; + } + cur = cur->next; + if (delNode != NULL) { +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext, + "xsltApplyTemplates: removing ignorable blank cur\n")); +#endif + xmlUnlinkNode(delNode); + xmlFreeNode(delNode); + delNode = NULL; + } + } + } + +#ifdef WITH_XSLT_DEBUG_PROCESS + if (list != NULL) + XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext, + "xsltApplyTemplates: list of %d nodes\n", list->nodeNr)); +#endif + + if ((list == NULL) || (list->nodeNr == 0)) + goto exit; + + /* + * Set the context's node set and size; this is also needed for + * for xsltDoSortFunction(). + */ + ctxt->nodeList = list; + /* + * Process xsl:with-param and xsl:sort instructions. + * (The code became so verbose just to avoid the + * xmlNodePtr sorts[XSLT_MAX_SORT] if there's no xsl:sort) + * BUG TODO: We are not using namespaced potentially defined on the + * xsl:sort or xsl:with-param elements; XPath expression might fail. + */ + if (inst->children) { + xsltStackElemPtr param; + + cur = inst->children; + while (cur) { + +#ifdef WITH_DEBUGGER + if (ctxt->debugStatus != XSLT_DEBUG_NONE) + xslHandleDebugger(cur, node, NULL, ctxt); +#endif + if (ctxt->state == XSLT_STATE_STOPPED) + break; + if (cur->type == XML_TEXT_NODE) { + cur = cur->next; + continue; + } + if (! IS_XSLT_ELEM(cur)) + break; + if (IS_XSLT_NAME(cur, "with-param")) { + param = xsltParseStylesheetCallerParam(ctxt, cur); + if (param != NULL) { + param->next = withParams; + withParams = param; + } + } + if (IS_XSLT_NAME(cur, "sort")) { + xsltTemplatePtr oldCurTempRule = + ctxt->currentTemplateRule; + int nbsorts = 0; + xmlNodePtr sorts[XSLT_MAX_SORT]; + + sorts[nbsorts++] = cur; + + while (cur) { + +#ifdef WITH_DEBUGGER + if (ctxt->debugStatus != XSLT_DEBUG_NONE) + xslHandleDebugger(cur, node, NULL, ctxt); +#endif + if (ctxt->state == XSLT_STATE_STOPPED) + break; + + if (cur->type == XML_TEXT_NODE) { + cur = cur->next; + continue; + } + + if (! IS_XSLT_ELEM(cur)) + break; + if (IS_XSLT_NAME(cur, "with-param")) { + param = xsltParseStylesheetCallerParam(ctxt, cur); + if (param != NULL) { + param->next = withParams; + withParams = param; + } + } + if (IS_XSLT_NAME(cur, "sort")) { + if (nbsorts >= XSLT_MAX_SORT) { + xsltTransformError(ctxt, NULL, cur, + "The number (%d) of xsl:sort instructions exceeds the " + "maximum allowed by this processor's settings.\n", + nbsorts); + ctxt->state = XSLT_STATE_STOPPED; + break; + } else { + sorts[nbsorts++] = cur; + } + } + cur = cur->next; + } + /* + * The "current template rule" is cleared for xsl:sort. + */ + ctxt->currentTemplateRule = NULL; + /* + * Sort. + */ + xsltDoSortFunction(ctxt, sorts, nbsorts); + ctxt->currentTemplateRule = oldCurTempRule; + break; + } + cur = cur->next; + } + } + xpctxt->contextSize = list->nodeNr; + /* + * Apply templates for all selected source nodes. + */ + for (i = 0; i < list->nodeNr; i++) { + cur = list->nodeTab[i]; + /* + * The node becomes the "current node". + */ + ctxt->node = cur; + /* + * An xsl:apply-templates can change the current context doc. + * OPTIMIZE TODO: Get rid of the need to set the context doc. + */ + if ((cur->type != XML_NAMESPACE_DECL) && (cur->doc != NULL)) + xpctxt->doc = cur->doc; + + xpctxt->proximityPosition = i + 1; + /* + * Find and apply a template for this node. + */ + xsltProcessOneNode(ctxt, cur, withParams); + } + +exit: +error: + /* + * Free the parameter list. + */ + if (withParams != NULL) + xsltFreeStackElemList(withParams); + if (list != NULL) + xmlXPathFreeNodeSet(list); + /* + * Restore context states. + */ + xpctxt->doc = oldXPDoc; + xpctxt->contextSize = oldXPContextSize; + xpctxt->proximityPosition = oldXPProximityPosition; + + ctxt->document = oldDocInfo; + ctxt->nodeList = oldList; + ctxt->node = oldContextNode; + ctxt->mode = oldMode; + ctxt->modeURI = oldModeURI; +} + + +/** + * xsltChoose: + * @ctxt: a XSLT process context + * @contextNode: the current node in the source tree + * @inst: the xsl:choose instruction + * @comp: compiled information of the instruction + * + * Processes the xsl:choose instruction on the source node. + */ +void +xsltChoose(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, + xmlNodePtr inst, xsltStylePreCompPtr comp ATTRIBUTE_UNUSED) +{ + xmlNodePtr cur; + + if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL)) + return; + + /* + * TODO: Content model checks should be done only at compilation + * time. + */ + cur = inst->children; + if (cur == NULL) { + xsltTransformError(ctxt, NULL, inst, + "xsl:choose: The instruction has no content.\n"); + return; + } + +#ifdef XSLT_REFACTORED + /* + * We don't check the content model during transformation. + */ +#else + if ((! IS_XSLT_ELEM(cur)) || (! IS_XSLT_NAME(cur, "when"))) { + xsltTransformError(ctxt, NULL, inst, + "xsl:choose: xsl:when expected first\n"); + return; + } +#endif + + { + int testRes = 0, res = 0; + +#ifdef XSLT_REFACTORED + xsltStyleItemWhenPtr wcomp = NULL; +#else + xsltStylePreCompPtr wcomp = NULL; +#endif + + /* + * Process xsl:when --------------------------------------------------- + */ + while (IS_XSLT_ELEM(cur) && IS_XSLT_NAME(cur, "when")) { + wcomp = cur->psvi; + + if ((wcomp == NULL) || (wcomp->test == NULL) || + (wcomp->comp == NULL)) + { + xsltTransformError(ctxt, NULL, cur, + "Internal error in xsltChoose(): " + "The XSLT 'when' instruction was not compiled.\n"); + goto error; + } + + +#ifdef WITH_DEBUGGER + if (xslDebugStatus != XSLT_DEBUG_NONE) { + /* + * TODO: Isn't comp->templ always NULL for xsl:choose? + */ + xslHandleDebugger(cur, contextNode, NULL, ctxt); + } +#endif +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_CHOOSE,xsltGenericDebug(xsltGenericDebugContext, + "xsltChoose: test %s\n", wcomp->test)); +#endif + +#ifdef XSLT_FAST_IF + res = xsltPreCompEvalToBoolean(ctxt, contextNode, wcomp); + + if (res == -1) { + ctxt->state = XSLT_STATE_STOPPED; + goto error; + } + testRes = (res == 1) ? 1 : 0; + +#else /* XSLT_FAST_IF */ + + res = xsltPreCompEval(ctxt, cotextNode, wcomp); + + if (res != NULL) { + if (res->type != XPATH_BOOLEAN) + res = xmlXPathConvertBoolean(res); + if (res->type == XPATH_BOOLEAN) + testRes = res->boolval; + else { +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_CHOOSE,xsltGenericDebug(xsltGenericDebugContext, + "xsltChoose: test didn't evaluate to a boolean\n")); +#endif + goto error; + } + xmlXPathFreeObject(res); + res = NULL; + } else { + ctxt->state = XSLT_STATE_STOPPED; + goto error; + } + +#endif /* else of XSLT_FAST_IF */ + +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_CHOOSE,xsltGenericDebug(xsltGenericDebugContext, + "xsltChoose: test evaluate to %d\n", testRes)); +#endif + if (testRes) + goto test_is_true; + + cur = cur->next; + } + + /* + * Process xsl:otherwise ---------------------------------------------- + */ + if (IS_XSLT_ELEM(cur) && IS_XSLT_NAME(cur, "otherwise")) { + +#ifdef WITH_DEBUGGER + if (xslDebugStatus != XSLT_DEBUG_NONE) + xslHandleDebugger(cur, contextNode, NULL, ctxt); +#endif + +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_CHOOSE,xsltGenericDebug(xsltGenericDebugContext, + "evaluating xsl:otherwise\n")); +#endif + goto test_is_true; + } + goto exit; + +test_is_true: + + goto process_sequence; + } + +process_sequence: + + /* + * Instantiate the sequence constructor. + */ + xsltApplySequenceConstructor(ctxt, ctxt->node, cur->children, + NULL); + +exit: +error: + return; +} + +/** + * xsltIf: + * @ctxt: a XSLT process context + * @contextNode: the current node in the source tree + * @inst: the xsl:if instruction + * @castedComp: compiled information of the instruction + * + * Processes the xsl:if instruction on the source node. + */ +void +xsltIf(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, + xmlNodePtr inst, xsltStylePreCompPtr castedComp) +{ + int res = 0; + +#ifdef XSLT_REFACTORED + xsltStyleItemIfPtr comp = (xsltStyleItemIfPtr) castedComp; +#else + xsltStylePreCompPtr comp = castedComp; +#endif + + if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL)) + return; + if ((comp == NULL) || (comp->test == NULL) || (comp->comp == NULL)) { + xsltTransformError(ctxt, NULL, inst, + "Internal error in xsltIf(): " + "The XSLT 'if' instruction was not compiled.\n"); + return; + } + +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_IF,xsltGenericDebug(xsltGenericDebugContext, + "xsltIf: test %s\n", comp->test)); +#endif + +#ifdef XSLT_FAST_IF + { + xmlDocPtr oldLocalFragmentTop = ctxt->localRVT; + + res = xsltPreCompEvalToBoolean(ctxt, contextNode, comp); + + /* + * Cleanup fragments created during evaluation of the + * "select" expression. + */ + if (oldLocalFragmentTop != ctxt->localRVT) + xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop); + } + +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_IF,xsltGenericDebug(xsltGenericDebugContext, + "xsltIf: test evaluate to %d\n", res)); +#endif + + if (res == -1) { + ctxt->state = XSLT_STATE_STOPPED; + goto error; + } + if (res == 1) { + /* + * Instantiate the sequence constructor of xsl:if. + */ + xsltApplySequenceConstructor(ctxt, + contextNode, inst->children, NULL); + } + +#else /* XSLT_FAST_IF */ + { + /* + * OLD CODE: + */ + xmlXPathObjectPtr xpobj = xsltPreCompEval(ctxt, contextNode, comp); + if (xpobj != NULL) { + if (xpobj->type != XPATH_BOOLEAN) + xpobj = xmlXPathConvertBoolean(xpobj); + if (xpobj->type == XPATH_BOOLEAN) { + res = xpobj->boolval; + +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_IF,xsltGenericDebug(xsltGenericDebugContext, + "xsltIf: test evaluate to %d\n", res)); +#endif + if (res) { + xsltApplySequenceConstructor(ctxt, + contextNode, inst->children, NULL); + } + } else { + +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt, XSLT_TRACE_IF, + xsltGenericDebug(xsltGenericDebugContext, + "xsltIf: test didn't evaluate to a boolean\n")); +#endif + ctxt->state = XSLT_STATE_STOPPED; + } + xmlXPathFreeObject(xpobj); + } else { + ctxt->state = XSLT_STATE_STOPPED; + } + } +#endif /* else of XSLT_FAST_IF */ + +error: + return; +} + +/** + * xsltForEach: + * @ctxt: an XSLT transformation context + * @contextNode: the "current node" in the source tree + * @inst: the element node of the xsl:for-each instruction + * @castedComp: the compiled information of the instruction + * + * Process the xslt for-each node on the source node + */ +void +xsltForEach(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, + xmlNodePtr inst, xsltStylePreCompPtr castedComp) +{ +#ifdef XSLT_REFACTORED + xsltStyleItemForEachPtr comp = (xsltStyleItemForEachPtr) castedComp; +#else + xsltStylePreCompPtr comp = castedComp; +#endif + int i; + xmlXPathObjectPtr res = NULL; + xmlNodePtr cur, curInst; + xmlNodeSetPtr list = NULL; + xmlNodeSetPtr oldList; + int oldXPProximityPosition, oldXPContextSize; + xmlNodePtr oldContextNode; + xsltTemplatePtr oldCurTemplRule; + xmlDocPtr oldXPDoc; + xsltDocumentPtr oldDocInfo; + xmlXPathContextPtr xpctxt; + + if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL)) { + xsltGenericError(xsltGenericErrorContext, + "xsltForEach(): Bad arguments.\n"); + return; + } + + if (comp == NULL) { + xsltTransformError(ctxt, NULL, inst, + "Internal error in xsltForEach(): " + "The XSLT 'for-each' instruction was not compiled.\n"); + return; + } + if ((comp->select == NULL) || (comp->comp == NULL)) { + xsltTransformError(ctxt, NULL, inst, + "Internal error in xsltForEach(): " + "The selecting expression of the XSLT 'for-each' " + "instruction was not compiled correctly.\n"); + return; + } + xpctxt = ctxt->xpathCtxt; + +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_FOR_EACH,xsltGenericDebug(xsltGenericDebugContext, + "xsltForEach: select %s\n", comp->select)); +#endif + + /* + * Save context states. + */ + oldDocInfo = ctxt->document; + oldList = ctxt->nodeList; + oldContextNode = ctxt->node; + /* + * The "current template rule" is cleared for the instantiation of + * xsl:for-each. + */ + oldCurTemplRule = ctxt->currentTemplateRule; + ctxt->currentTemplateRule = NULL; + + oldXPDoc = xpctxt->doc; + oldXPProximityPosition = xpctxt->proximityPosition; + oldXPContextSize = xpctxt->contextSize; + + /* + * Evaluate the 'select' expression. + */ + res = xsltPreCompEval(ctxt, contextNode, comp); + + if (res != NULL) { + if (res->type == XPATH_NODESET) + list = res->nodesetval; + else { + xsltTransformError(ctxt, NULL, inst, + "The 'select' expression does not evaluate to a node set.\n"); + +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_FOR_EACH,xsltGenericDebug(xsltGenericDebugContext, + "xsltForEach: select didn't evaluate to a node list\n")); +#endif + goto error; + } + } else { + xsltTransformError(ctxt, NULL, inst, + "Failed to evaluate the 'select' expression.\n"); + ctxt->state = XSLT_STATE_STOPPED; + goto error; + } + + if ((list == NULL) || (list->nodeNr <= 0)) + goto exit; + +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_FOR_EACH,xsltGenericDebug(xsltGenericDebugContext, + "xsltForEach: select evaluates to %d nodes\n", list->nodeNr)); +#endif + + /* + * Set the list; this has to be done already here for xsltDoSortFunction(). + */ + ctxt->nodeList = list; + /* + * Handle xsl:sort instructions and skip them for further processing. + * BUG TODO: We are not using namespaced potentially defined on the + * xsl:sort element; XPath expression might fail. + */ + curInst = inst->children; + if (IS_XSLT_ELEM(curInst) && IS_XSLT_NAME(curInst, "sort")) { + int nbsorts = 0; + xmlNodePtr sorts[XSLT_MAX_SORT]; + + sorts[nbsorts++] = curInst; + +#ifdef WITH_DEBUGGER + if (xslDebugStatus != XSLT_DEBUG_NONE) + xslHandleDebugger(curInst, contextNode, NULL, ctxt); +#endif + + curInst = curInst->next; + while (IS_XSLT_ELEM(curInst) && IS_XSLT_NAME(curInst, "sort")) { + if (nbsorts >= XSLT_MAX_SORT) { + xsltTransformError(ctxt, NULL, curInst, + "The number of xsl:sort instructions exceeds the " + "maximum (%d) allowed by this processor.\n", + XSLT_MAX_SORT); + goto error; + } else { + sorts[nbsorts++] = curInst; + } + +#ifdef WITH_DEBUGGER + if (xslDebugStatus != XSLT_DEBUG_NONE) + xslHandleDebugger(curInst, contextNode, NULL, ctxt); +#endif + curInst = curInst->next; + } + xsltDoSortFunction(ctxt, sorts, nbsorts); + } + xpctxt->contextSize = list->nodeNr; + /* + * Instantiate the sequence constructor for each selected node. + */ + for (i = 0; i < list->nodeNr; i++) { + cur = list->nodeTab[i]; + /* + * The selected node becomes the "current node". + */ + ctxt->node = cur; + /* + * An xsl:for-each can change the current context doc. + * OPTIMIZE TODO: Get rid of the need to set the context doc. + */ + if ((cur->type != XML_NAMESPACE_DECL) && (cur->doc != NULL)) + xpctxt->doc = cur->doc; + + xpctxt->proximityPosition = i + 1; + + xsltApplySequenceConstructor(ctxt, cur, curInst, NULL); + } + +exit: +error: + if (res != NULL) + xmlXPathFreeObject(res); + /* + * Restore old states. + */ + ctxt->document = oldDocInfo; + ctxt->nodeList = oldList; + ctxt->node = oldContextNode; + ctxt->currentTemplateRule = oldCurTemplRule; + + xpctxt->doc = oldXPDoc; + xpctxt->contextSize = oldXPContextSize; + xpctxt->proximityPosition = oldXPProximityPosition; +} + +/************************************************************************ + * * + * Generic interface * + * * + ************************************************************************/ + +#ifdef XSLT_GENERATE_HTML_DOCTYPE +typedef struct xsltHTMLVersion { + const char *version; + const char *public; + const char *system; +} xsltHTMLVersion; + +static xsltHTMLVersion xsltHTMLVersions[] = { + { "4.01frame", "-//W3C//DTD HTML 4.01 Frameset//EN", + "http://www.w3.org/TR/1999/REC-html401-19991224/frameset.dtd"}, + { "4.01strict", "-//W3C//DTD HTML 4.01//EN", + "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd"}, + { "4.01trans", "-//W3C//DTD HTML 4.01 Transitional//EN", + "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"}, + { "4.01", "-//W3C//DTD HTML 4.01 Transitional//EN", + "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"}, + { "4.0strict", "-//W3C//DTD HTML 4.01//EN", + "http://www.w3.org/TR/html4/strict.dtd"}, + { "4.0trans", "-//W3C//DTD HTML 4.01 Transitional//EN", + "http://www.w3.org/TR/html4/loose.dtd"}, + { "4.0frame", "-//W3C//DTD HTML 4.01 Frameset//EN", + "http://www.w3.org/TR/html4/frameset.dtd"}, + { "4.0", "-//W3C//DTD HTML 4.01 Transitional//EN", + "http://www.w3.org/TR/html4/loose.dtd"}, + { "3.2", "-//W3C//DTD HTML 3.2//EN", NULL } +}; + +/** + * xsltGetHTMLIDs: + * @version: the version string + * @publicID: used to return the public ID + * @systemID: used to return the system ID + * + * Returns -1 if not found, 0 otherwise and the system and public + * Identifier for this given verion of HTML + */ +static int +xsltGetHTMLIDs(const xmlChar *version, const xmlChar **publicID, + const xmlChar **systemID) { + unsigned int i; + if (version == NULL) + return(-1); + for (i = 0;i < (sizeof(xsltHTMLVersions)/sizeof(xsltHTMLVersions[1])); + i++) { + if (!xmlStrcasecmp(version, + (const xmlChar *) xsltHTMLVersions[i].version)) { + if (publicID != NULL) + *publicID = (const xmlChar *) xsltHTMLVersions[i].public; + if (systemID != NULL) + *systemID = (const xmlChar *) xsltHTMLVersions[i].system; + return(0); + } + } + return(-1); +} +#endif + +/** + * xsltApplyStripSpaces: + * @ctxt: a XSLT process context + * @node: the root of the XML tree + * + * Strip the unwanted ignorable spaces from the input tree + */ +void +xsltApplyStripSpaces(xsltTransformContextPtr ctxt, xmlNodePtr node) { + xmlNodePtr current; +#ifdef WITH_XSLT_DEBUG_PROCESS + int nb = 0; +#endif + + + current = node; + while (current != NULL) { + /* + * Cleanup children empty nodes if asked for + */ + if ((IS_XSLT_REAL_NODE(current)) && + (current->children != NULL) && + (xsltFindElemSpaceHandling(ctxt, current))) { + xmlNodePtr delete = NULL, cur = current->children; + + while (cur != NULL) { + if (IS_BLANK_NODE(cur)) + delete = cur; + + cur = cur->next; + if (delete != NULL) { + xmlUnlinkNode(delete); + xmlFreeNode(delete); + delete = NULL; +#ifdef WITH_XSLT_DEBUG_PROCESS + nb++; +#endif + } + } + } + + /* + * Skip to next node in document order. + */ + if (node->type == XML_ENTITY_REF_NODE) { + /* process deep in entities */ + xsltApplyStripSpaces(ctxt, node->children); + } + if ((current->children != NULL) && + (current->type != XML_ENTITY_REF_NODE)) { + current = current->children; + } else if (current->next != NULL) { + current = current->next; + } else { + do { + current = current->parent; + if (current == NULL) + break; + if (current == node) + goto done; + if (current->next != NULL) { + current = current->next; + break; + } + } while (current != NULL); + } + } + +done: +#ifdef WITH_XSLT_DEBUG_PROCESS + XSLT_TRACE(ctxt,XSLT_TRACE_STRIP_SPACES,xsltGenericDebug(xsltGenericDebugContext, + "xsltApplyStripSpaces: removed %d ignorable blank node\n", nb)); +#endif + return; +} + +static int +xsltCountKeys(xsltTransformContextPtr ctxt) +{ + xsltStylesheetPtr style; + xsltKeyDefPtr keyd; + + if (ctxt == NULL) + return(-1); + + /* + * Do we have those nastly templates with a key() in the match pattern? + */ + ctxt->hasTemplKeyPatterns = 0; + style = ctxt->style; + while (style != NULL) { + if (style->keyMatch != NULL) { + ctxt->hasTemplKeyPatterns = 1; + break; + } + style = xsltNextImport(style); + } + /* + * Count number of key declarations. + */ + ctxt->nbKeys = 0; + style = ctxt->style; + while (style != NULL) { + keyd = style->keys; + while (keyd) { + ctxt->nbKeys++; + keyd = keyd->next; + } + style = xsltNextImport(style); + } + return(ctxt->nbKeys); +} + +/** + * xsltApplyStylesheetInternal: + * @style: a parsed XSLT stylesheet + * @doc: a parsed XML document + * @params: a NULL terminated array of parameters names/values tuples + * @output: the targetted output + * @profile: profile FILE * output or NULL + * @user: user provided parameter + * + * Apply the stylesheet to the document + * NOTE: This may lead to a non-wellformed output XML wise ! + * + * Returns the result document or NULL in case of error + */ +static xmlDocPtr +xsltApplyStylesheetInternal(xsltStylesheetPtr style, xmlDocPtr doc, + const char **params, const char *output, + FILE * profile, xsltTransformContextPtr userCtxt) +{ + xmlDocPtr res = NULL; + xsltTransformContextPtr ctxt = NULL; + xmlNodePtr root, node; + const xmlChar *method; + const xmlChar *doctypePublic; + const xmlChar *doctypeSystem; + const xmlChar *version; + const xmlChar *encoding; + xsltStackElemPtr variables; + xsltStackElemPtr vptr; + + xsltInitGlobals(); + + if ((style == NULL) || (doc == NULL)) + return (NULL); + + if (style->internalized == 0) { +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "Stylesheet was not fully internalized !\n"); +#endif + } + if (doc->intSubset != NULL) { + /* + * Avoid hitting the DTD when scanning nodes + * but keep it linked as doc->intSubset + */ + xmlNodePtr cur = (xmlNodePtr) doc->intSubset; + if (cur->next != NULL) + cur->next->prev = cur->prev; + if (cur->prev != NULL) + cur->prev->next = cur->next; + if (doc->children == cur) + doc->children = cur->next; + if (doc->last == cur) + doc->last = cur->prev; + cur->prev = cur->next = NULL; + } + + /* + * Check for XPath document order availability + */ + root = xmlDocGetRootElement(doc); + if (root != NULL) { + if (((long) root->content) >= 0 && (xslDebugStatus == XSLT_DEBUG_NONE)) + xmlXPathOrderDocElems(doc); + } + + if (userCtxt != NULL) + ctxt = userCtxt; + else + ctxt = xsltNewTransformContext(style, doc); + + if (ctxt == NULL) + return (NULL); + + ctxt->initialContextDoc = doc; + ctxt->initialContextNode = (xmlNodePtr) doc; + + if (profile != NULL) + ctxt->profile = 1; + + if (output != NULL) + ctxt->outputFile = output; + else + ctxt->outputFile = NULL; + + /* + * internalize the modes if needed + */ + if (ctxt->dict != NULL) { + if (ctxt->mode != NULL) + ctxt->mode = xmlDictLookup(ctxt->dict, ctxt->mode, -1); + if (ctxt->modeURI != NULL) + ctxt->modeURI = xmlDictLookup(ctxt->dict, ctxt->modeURI, -1); + } + + XSLT_GET_IMPORT_PTR(method, style, method) + XSLT_GET_IMPORT_PTR(doctypePublic, style, doctypePublic) + XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem) + XSLT_GET_IMPORT_PTR(version, style, version) + XSLT_GET_IMPORT_PTR(encoding, style, encoding) + + if ((method != NULL) && + (!xmlStrEqual(method, (const xmlChar *) "xml"))) + { + if (xmlStrEqual(method, (const xmlChar *) "html")) { + ctxt->type = XSLT_OUTPUT_HTML; + if (((doctypePublic != NULL) || (doctypeSystem != NULL))) { + res = htmlNewDoc(doctypeSystem, doctypePublic); + } else { + if (version == NULL) { + xmlDtdPtr dtd; + + res = htmlNewDoc(NULL, NULL); + /* + * Make sure no DTD node is generated in this case + */ + if (res != NULL) { + dtd = xmlGetIntSubset(res); + if (dtd != NULL) { + xmlUnlinkNode((xmlNodePtr) dtd); + xmlFreeDtd(dtd); + } + res->intSubset = NULL; + res->extSubset = NULL; + } + } else { + +#ifdef XSLT_GENERATE_HTML_DOCTYPE + xsltGetHTMLIDs(version, &doctypePublic, &doctypeSystem); +#endif + res = htmlNewDoc(doctypeSystem, doctypePublic); + } + } + if (res == NULL) + goto error; + res->dict = ctxt->dict; + xmlDictReference(res->dict); + +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "reusing transformation dict for output\n"); +#endif + } else if (xmlStrEqual(method, (const xmlChar *) "xhtml")) { + xsltTransformError(ctxt, NULL, (xmlNodePtr) doc, + "xsltApplyStylesheetInternal: unsupported method xhtml, using html\n"); + ctxt->type = XSLT_OUTPUT_HTML; + res = htmlNewDoc(doctypeSystem, doctypePublic); + if (res == NULL) + goto error; + res->dict = ctxt->dict; + xmlDictReference(res->dict); + +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "reusing transformation dict for output\n"); +#endif + } else if (xmlStrEqual(method, (const xmlChar *) "text")) { + ctxt->type = XSLT_OUTPUT_TEXT; + res = xmlNewDoc(style->version); + if (res == NULL) + goto error; + res->dict = ctxt->dict; + xmlDictReference(res->dict); + +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "reusing transformation dict for output\n"); +#endif + } else { + xsltTransformError(ctxt, NULL, (xmlNodePtr) doc, + "xsltApplyStylesheetInternal: unsupported method (%s)\n", + method); + goto error; + } + } else { + ctxt->type = XSLT_OUTPUT_XML; + res = xmlNewDoc(style->version); + if (res == NULL) + goto error; + res->dict = ctxt->dict; + xmlDictReference(ctxt->dict); +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "reusing transformation dict for output\n"); +#endif + } + res->charset = XML_CHAR_ENCODING_UTF8; + if (encoding != NULL) + res->encoding = xmlStrdup(encoding); + variables = style->variables; + + /* + * Start the evaluation, evaluate the params, the stylesheets globals + * and start by processing the top node. + */ + if (xsltNeedElemSpaceHandling(ctxt)) + xsltApplyStripSpaces(ctxt, xmlDocGetRootElement(doc)); + /* + * Evaluate global params and user-provided params. + */ + ctxt->node = (xmlNodePtr) doc; + if (ctxt->globalVars == NULL) + ctxt->globalVars = xmlHashCreate(20); + if (params != NULL) { + xsltEvalUserParams(ctxt, params); + } + + /* need to be called before evaluating global variables */ + xsltCountKeys(ctxt); + + xsltEvalGlobalVariables(ctxt); + + ctxt->node = (xmlNodePtr) doc; + ctxt->output = res; + ctxt->insert = (xmlNodePtr) res; + ctxt->varsBase = ctxt->varsNr - 1; + + ctxt->xpathCtxt->contextSize = 1; + ctxt->xpathCtxt->proximityPosition = 1; + ctxt->xpathCtxt->node = NULL; /* TODO: Set the context node here? */ + /* + * Start processing the source tree ----------------------------------- + */ + xsltProcessOneNode(ctxt, ctxt->node, NULL); + /* + * Remove all remaining vars from the stack. + */ + xsltLocalVariablePop(ctxt, 0, -2); + xsltShutdownCtxtExts(ctxt); + + xsltCleanupTemplates(style); /* TODO: <- style should be read only */ + + /* + * Now cleanup our variables so stylesheet can be re-used + * + * TODO: this is not needed anymore global variables are copied + * and not evaluated directly anymore, keep this as a check + */ + if (style->variables != variables) { + vptr = style->variables; + while (vptr->next != variables) + vptr = vptr->next; + vptr->next = NULL; + xsltFreeStackElemList(style->variables); + style->variables = variables; + } + vptr = style->variables; + while (vptr != NULL) { + if (vptr->computed) { + if (vptr->value != NULL) { + xmlXPathFreeObject(vptr->value); + vptr->value = NULL; + vptr->computed = 0; + } + } + vptr = vptr->next; + } +#if 0 + /* + * code disabled by wmb; awaiting kb's review + * problem is that global variable(s) may contain xpath objects + * from doc associated with RVT, so can't be freed at this point. + * xsltFreeTransformContext includes a call to xsltFreeRVTs, so + * I assume this shouldn't be required at this point. + */ + /* + * Free all remaining tree fragments. + */ + xsltFreeRVTs(ctxt); +#endif + /* + * Do some post processing work depending on the generated output + */ + root = xmlDocGetRootElement(res); + if (root != NULL) { + const xmlChar *doctype = NULL; + + if ((root->ns != NULL) && (root->ns->prefix != NULL)) + doctype = xmlDictQLookup(ctxt->dict, root->ns->prefix, root->name); + if (doctype == NULL) + doctype = root->name; + + /* + * Apply the default selection of the method + */ + if ((method == NULL) && + (root->ns == NULL) && + (!xmlStrcasecmp(root->name, (const xmlChar *) "html"))) { + xmlNodePtr tmp; + + tmp = res->children; + while ((tmp != NULL) && (tmp != root)) { + if (tmp->type == XML_ELEMENT_NODE) + break; + if ((tmp->type == XML_TEXT_NODE) && (!xmlIsBlankNode(tmp))) + break; + tmp = tmp->next; + } + if (tmp == root) { + ctxt->type = XSLT_OUTPUT_HTML; + /* + * REVISIT TODO: XML_HTML_DOCUMENT_NODE is set after the + * transformation on the doc, but functions like + */ + res->type = XML_HTML_DOCUMENT_NODE; + if (((doctypePublic != NULL) || (doctypeSystem != NULL))) { + res->intSubset = xmlCreateIntSubset(res, doctype, + doctypePublic, + doctypeSystem); +#ifdef XSLT_GENERATE_HTML_DOCTYPE + } else if (version != NULL) { + xsltGetHTMLIDs(version, &doctypePublic, + &doctypeSystem); + if (((doctypePublic != NULL) || (doctypeSystem != NULL))) + res->intSubset = + xmlCreateIntSubset(res, doctype, + doctypePublic, + doctypeSystem); +#endif + } + } + + } + if (ctxt->type == XSLT_OUTPUT_XML) { + XSLT_GET_IMPORT_PTR(doctypePublic, style, doctypePublic) + XSLT_GET_IMPORT_PTR(doctypeSystem, style, doctypeSystem) + if (((doctypePublic != NULL) || (doctypeSystem != NULL))) { + xmlNodePtr last; + /* Need a small "hack" here to assure DTD comes before + possible comment nodes */ + node = res->children; + last = res->last; + res->children = NULL; + res->last = NULL; + res->intSubset = xmlCreateIntSubset(res, doctype, + doctypePublic, + doctypeSystem); + if (res->children != NULL) { + res->children->next = node; + node->prev = res->children; + res->last = last; + } else { + res->children = node; + res->last = last; + } + } + } + } + xmlXPathFreeNodeSet(ctxt->nodeList); + if (profile != NULL) { + xsltSaveProfiling(ctxt, profile); + } + + /* + * Be pedantic. + */ + if ((ctxt != NULL) && (ctxt->state == XSLT_STATE_ERROR)) { + xmlFreeDoc(res); + res = NULL; + } + if ((res != NULL) && (ctxt != NULL) && (output != NULL)) { + int ret; + + ret = xsltCheckWrite(ctxt->sec, ctxt, (const xmlChar *) output); + if (ret == 0) { + xsltTransformError(ctxt, NULL, NULL, + "xsltApplyStylesheet: forbidden to save to %s\n", + output); + } else if (ret < 0) { + xsltTransformError(ctxt, NULL, NULL, + "xsltApplyStylesheet: saving to %s may not be possible\n", + output); + } + } + +#ifdef XSLT_DEBUG_PROFILE_CACHE + printf("# Cache:\n"); + printf("# Reused tree fragments: %d\n", ctxt->cache->dbgReusedRVTs); + printf("# Reused variables : %d\n", ctxt->cache->dbgReusedVars); +#endif + + if ((ctxt != NULL) && (userCtxt == NULL)) + xsltFreeTransformContext(ctxt); + + return (res); + +error: + if (res != NULL) + xmlFreeDoc(res); + +#ifdef XSLT_DEBUG_PROFILE_CACHE + printf("# Cache:\n"); + printf("# Reused tree fragments: %d\n", ctxt->cache->dbgReusedRVTs); + printf("# Reused variables : %d\n", ctxt->cache->dbgReusedVars); +#endif + + if ((ctxt != NULL) && (userCtxt == NULL)) + xsltFreeTransformContext(ctxt); + return (NULL); +} + +/** + * xsltApplyStylesheet: + * @style: a parsed XSLT stylesheet + * @doc: a parsed XML document + * @params: a NULL terminated arry of parameters names/values tuples + * + * Apply the stylesheet to the document + * NOTE: This may lead to a non-wellformed output XML wise ! + * + * Returns the result document or NULL in case of error + */ +xmlDocPtr +xsltApplyStylesheet(xsltStylesheetPtr style, xmlDocPtr doc, + const char **params) +{ + return (xsltApplyStylesheetInternal(style, doc, params, NULL, NULL, NULL)); +} + +/** + * xsltProfileStylesheet: + * @style: a parsed XSLT stylesheet + * @doc: a parsed XML document + * @params: a NULL terminated arry of parameters names/values tuples + * @output: a FILE * for the profiling output + * + * Apply the stylesheet to the document and dump the profiling to + * the given output. + * + * Returns the result document or NULL in case of error + */ +xmlDocPtr +xsltProfileStylesheet(xsltStylesheetPtr style, xmlDocPtr doc, + const char **params, FILE * output) +{ + xmlDocPtr res; + + res = xsltApplyStylesheetInternal(style, doc, params, NULL, output, NULL); + return (res); +} + +/** + * xsltApplyStylesheetUser: + * @style: a parsed XSLT stylesheet + * @doc: a parsed XML document + * @params: a NULL terminated array of parameters names/values tuples + * @output: the targetted output + * @profile: profile FILE * output or NULL + * @userCtxt: user provided transform context + * + * Apply the stylesheet to the document and allow the user to provide + * its own transformation context. + * + * Returns the result document or NULL in case of error + */ +xmlDocPtr +xsltApplyStylesheetUser(xsltStylesheetPtr style, xmlDocPtr doc, + const char **params, const char *output, + FILE * profile, xsltTransformContextPtr userCtxt) +{ + xmlDocPtr res; + + res = xsltApplyStylesheetInternal(style, doc, params, output, + profile, userCtxt); + return (res); +} + +/** + * xsltRunStylesheetUser: + * @style: a parsed XSLT stylesheet + * @doc: a parsed XML document + * @params: a NULL terminated array of parameters names/values tuples + * @output: the URL/filename ot the generated resource if available + * @SAX: a SAX handler for progressive callback output (not implemented yet) + * @IObuf: an output buffer for progressive output (not implemented yet) + * @profile: profile FILE * output or NULL + * @userCtxt: user provided transform context + * + * Apply the stylesheet to the document and generate the output according + * to @output @SAX and @IObuf. It's an error to specify both @SAX and @IObuf. + * + * NOTE: This may lead to a non-wellformed output XML wise ! + * NOTE: This may also result in multiple files being generated + * NOTE: using IObuf, the result encoding used will be the one used for + * creating the output buffer, use the following macro to read it + * from the stylesheet + * XSLT_GET_IMPORT_PTR(encoding, style, encoding) + * NOTE: using SAX, any encoding specified in the stylesheet will be lost + * since the interface uses only UTF8 + * + * Returns the number of by written to the main resource or -1 in case of + * error. + */ +int +xsltRunStylesheetUser(xsltStylesheetPtr style, xmlDocPtr doc, + const char **params, const char *output, + xmlSAXHandlerPtr SAX, xmlOutputBufferPtr IObuf, + FILE * profile, xsltTransformContextPtr userCtxt) +{ + xmlDocPtr tmp; + int ret; + + if ((output == NULL) && (SAX == NULL) && (IObuf == NULL)) + return (-1); + if ((SAX != NULL) && (IObuf != NULL)) + return (-1); + + /* unsupported yet */ + if (SAX != NULL) { + XSLT_TODO /* xsltRunStylesheet xmlSAXHandlerPtr SAX */ + return (-1); + } + + tmp = xsltApplyStylesheetInternal(style, doc, params, output, profile, + userCtxt); + if (tmp == NULL) { + xsltTransformError(NULL, NULL, (xmlNodePtr) doc, + "xsltRunStylesheet : run failed\n"); + return (-1); + } + if (IObuf != NULL) { + /* TODO: incomplete, IObuf output not progressive */ + ret = xsltSaveResultTo(IObuf, tmp, style); + } else { + ret = xsltSaveResultToFilename(output, tmp, style, 0); + } + xmlFreeDoc(tmp); + return (ret); +} + +/** + * xsltRunStylesheet: + * @style: a parsed XSLT stylesheet + * @doc: a parsed XML document + * @params: a NULL terminated array of parameters names/values tuples + * @output: the URL/filename ot the generated resource if available + * @SAX: a SAX handler for progressive callback output (not implemented yet) + * @IObuf: an output buffer for progressive output (not implemented yet) + * + * Apply the stylesheet to the document and generate the output according + * to @output @SAX and @IObuf. It's an error to specify both @SAX and @IObuf. + * + * NOTE: This may lead to a non-wellformed output XML wise ! + * NOTE: This may also result in multiple files being generated + * NOTE: using IObuf, the result encoding used will be the one used for + * creating the output buffer, use the following macro to read it + * from the stylesheet + * XSLT_GET_IMPORT_PTR(encoding, style, encoding) + * NOTE: using SAX, any encoding specified in the stylesheet will be lost + * since the interface uses only UTF8 + * + * Returns the number of bytes written to the main resource or -1 in case of + * error. + */ +int +xsltRunStylesheet(xsltStylesheetPtr style, xmlDocPtr doc, + const char **params, const char *output, + xmlSAXHandlerPtr SAX, xmlOutputBufferPtr IObuf) +{ + return(xsltRunStylesheetUser(style, doc, params, output, SAX, IObuf, + NULL, NULL)); +} + +/** + * xsltRegisterAllElement: + * @ctxt: the XPath context + * + * Registers all default XSLT elements in this context + */ +void +xsltRegisterAllElement(xsltTransformContextPtr ctxt) +{ + xsltRegisterExtElement(ctxt, (const xmlChar *) "apply-templates", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltApplyTemplates); + xsltRegisterExtElement(ctxt, (const xmlChar *) "apply-imports", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltApplyImports); + xsltRegisterExtElement(ctxt, (const xmlChar *) "call-template", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltCallTemplate); + xsltRegisterExtElement(ctxt, (const xmlChar *) "element", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltElement); + xsltRegisterExtElement(ctxt, (const xmlChar *) "attribute", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltAttribute); + xsltRegisterExtElement(ctxt, (const xmlChar *) "text", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltText); + xsltRegisterExtElement(ctxt, (const xmlChar *) "processing-instruction", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltProcessingInstruction); + xsltRegisterExtElement(ctxt, (const xmlChar *) "comment", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltComment); + xsltRegisterExtElement(ctxt, (const xmlChar *) "copy", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltCopy); + xsltRegisterExtElement(ctxt, (const xmlChar *) "value-of", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltValueOf); + xsltRegisterExtElement(ctxt, (const xmlChar *) "number", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltNumber); + xsltRegisterExtElement(ctxt, (const xmlChar *) "for-each", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltForEach); + xsltRegisterExtElement(ctxt, (const xmlChar *) "if", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltIf); + xsltRegisterExtElement(ctxt, (const xmlChar *) "choose", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltChoose); + xsltRegisterExtElement(ctxt, (const xmlChar *) "sort", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltSort); + xsltRegisterExtElement(ctxt, (const xmlChar *) "copy-of", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltCopyOf); + xsltRegisterExtElement(ctxt, (const xmlChar *) "message", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltMessage); + + /* + * Those don't have callable entry points but are registered anyway + */ + xsltRegisterExtElement(ctxt, (const xmlChar *) "variable", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltDebug); + xsltRegisterExtElement(ctxt, (const xmlChar *) "param", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltDebug); + xsltRegisterExtElement(ctxt, (const xmlChar *) "with-param", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltDebug); + xsltRegisterExtElement(ctxt, (const xmlChar *) "decimal-format", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltDebug); + xsltRegisterExtElement(ctxt, (const xmlChar *) "when", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltDebug); + xsltRegisterExtElement(ctxt, (const xmlChar *) "otherwise", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltDebug); + xsltRegisterExtElement(ctxt, (const xmlChar *) "fallback", + XSLT_NAMESPACE, + (xsltTransformFunction) xsltDebug); + +} diff --git a/libxslt/transform.h b/libxslt/transform.h new file mode 100644 index 0000000..2cfbec2 --- /dev/null +++ b/libxslt/transform.h @@ -0,0 +1,207 @@ +/* + * Summary: the XSLT engine transformation part. + * Description: This module implements the bulk of the actual + * transformation processing. Most of the xsl: element + * constructs are implemented in this module. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XSLT_TRANSFORM_H__ +#define __XML_XSLT_TRANSFORM_H__ + +#include +#include +#include "xsltexports.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * XInclude default processing. + */ +XSLTPUBFUN void XSLTCALL + xsltSetXIncludeDefault (int xinclude); +XSLTPUBFUN int XSLTCALL + xsltGetXIncludeDefault (void); + +/** + * Export context to users. + */ +XSLTPUBFUN xsltTransformContextPtr XSLTCALL + xsltNewTransformContext (xsltStylesheetPtr style, + xmlDocPtr doc); + +XSLTPUBFUN void XSLTCALL + xsltFreeTransformContext(xsltTransformContextPtr ctxt); + +XSLTPUBFUN xmlDocPtr XSLTCALL + xsltApplyStylesheetUser (xsltStylesheetPtr style, + xmlDocPtr doc, + const char **params, + const char *output, + FILE * profile, + xsltTransformContextPtr userCtxt); +XSLTPUBFUN void XSLTCALL + xsltProcessOneNode (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xsltStackElemPtr params); +/** + * Private Interfaces. + */ +XSLTPUBFUN void XSLTCALL + xsltApplyStripSpaces (xsltTransformContextPtr ctxt, + xmlNodePtr node); +XSLTPUBFUN xmlDocPtr XSLTCALL + xsltApplyStylesheet (xsltStylesheetPtr style, + xmlDocPtr doc, + const char **params); +XSLTPUBFUN xmlDocPtr XSLTCALL + xsltProfileStylesheet (xsltStylesheetPtr style, + xmlDocPtr doc, + const char **params, + FILE * output); +XSLTPUBFUN int XSLTCALL + xsltRunStylesheet (xsltStylesheetPtr style, + xmlDocPtr doc, + const char **params, + const char *output, + xmlSAXHandlerPtr SAX, + xmlOutputBufferPtr IObuf); +XSLTPUBFUN int XSLTCALL + xsltRunStylesheetUser (xsltStylesheetPtr style, + xmlDocPtr doc, + const char **params, + const char *output, + xmlSAXHandlerPtr SAX, + xmlOutputBufferPtr IObuf, + FILE * profile, + xsltTransformContextPtr userCtxt); +XSLTPUBFUN void XSLTCALL + xsltApplyOneTemplate (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr list, + xsltTemplatePtr templ, + xsltStackElemPtr params); +XSLTPUBFUN void XSLTCALL + xsltDocumentElem (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); +XSLTPUBFUN void XSLTCALL + xsltSort (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); +XSLTPUBFUN void XSLTCALL + xsltCopy (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); +XSLTPUBFUN void XSLTCALL + xsltText (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); +XSLTPUBFUN void XSLTCALL + xsltElement (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); +XSLTPUBFUN void XSLTCALL + xsltComment (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); +XSLTPUBFUN void XSLTCALL + xsltAttribute (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); +XSLTPUBFUN void XSLTCALL + xsltProcessingInstruction(xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); +XSLTPUBFUN void XSLTCALL + xsltCopyOf (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); +XSLTPUBFUN void XSLTCALL + xsltValueOf (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); +XSLTPUBFUN void XSLTCALL + xsltNumber (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); +XSLTPUBFUN void XSLTCALL + xsltApplyImports (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); +XSLTPUBFUN void XSLTCALL + xsltCallTemplate (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); +XSLTPUBFUN void XSLTCALL + xsltApplyTemplates (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); +XSLTPUBFUN void XSLTCALL + xsltChoose (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); +XSLTPUBFUN void XSLTCALL + xsltIf (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); +XSLTPUBFUN void XSLTCALL + xsltForEach (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltStylePreCompPtr comp); +XSLTPUBFUN void XSLTCALL + xsltRegisterAllElement (xsltTransformContextPtr ctxt); + +XSLTPUBFUN xmlNodePtr XSLTCALL + xsltCopyTextString (xsltTransformContextPtr ctxt, + xmlNodePtr target, + const xmlChar *string, + int noescape); + +/* Following 2 functions needed for libexslt/functions.c */ +XSLTPUBFUN void XSLTCALL + xsltLocalVariablePop (xsltTransformContextPtr ctxt, + int limitNr, + int level); +XSLTPUBFUN int XSLTCALL + xsltLocalVariablePush (xsltTransformContextPtr ctxt, + xsltStackElemPtr variable, + int level); +/* + * Hook for the debugger if activated. + */ +XSLTPUBFUN void XSLTCALL + xslHandleDebugger (xmlNodePtr cur, + xmlNodePtr node, + xsltTemplatePtr templ, + xsltTransformContextPtr ctxt); + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XSLT_TRANSFORM_H__ */ + diff --git a/libxslt/trio.h b/libxslt/trio.h new file mode 100644 index 0000000..941bdd0 --- /dev/null +++ b/libxslt/trio.h @@ -0,0 +1,216 @@ +/************************************************************************* + * + * $Id$ + * + * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND + * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. + * + ************************************************************************* + * + * http://ctrio.sourceforge.net/ + * + ************************************************************************/ + +#ifndef TRIO_TRIO_H +#define TRIO_TRIO_H + +#if !defined(WITHOUT_TRIO) + +/* + * Use autoconf defines if present. Packages using trio must define + * HAVE_CONFIG_H as a compiler option themselves. + */ +#if defined(HAVE_CONFIG_H) +# include +#endif + +#include "triodef.h" + +#include +#include +#if defined(TRIO_COMPILER_ANCIENT) +# include +#else +# include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Error codes. + * + * Remember to add a textual description to trio_strerror. + */ +enum { + TRIO_EOF = 1, + TRIO_EINVAL = 2, + TRIO_ETOOMANY = 3, + TRIO_EDBLREF = 4, + TRIO_EGAP = 5, + TRIO_ENOMEM = 6, + TRIO_ERANGE = 7, + TRIO_ERRNO = 8, + TRIO_ECUSTOM = 9 +}; + +/* Error macros */ +#define TRIO_ERROR_CODE(x) ((-(x)) & 0x00FF) +#define TRIO_ERROR_POSITION(x) ((-(x)) >> 8) +#define TRIO_ERROR_NAME(x) trio_strerror(x) + +typedef int (*trio_outstream_t) TRIO_PROTO((trio_pointer_t, int)); +typedef int (*trio_instream_t) TRIO_PROTO((trio_pointer_t)); + +TRIO_CONST char *trio_strerror TRIO_PROTO((int)); + +/************************************************************************* + * Print Functions + */ + +int trio_printf TRIO_PROTO((TRIO_CONST char *format, ...)); +int trio_vprintf TRIO_PROTO((TRIO_CONST char *format, va_list args)); +int trio_printfv TRIO_PROTO((TRIO_CONST char *format, void **args)); + +int trio_fprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...)); +int trio_vfprintf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args)); +int trio_fprintfv TRIO_PROTO((FILE *file, TRIO_CONST char *format, void **args)); + +int trio_dprintf TRIO_PROTO((int fd, TRIO_CONST char *format, ...)); +int trio_vdprintf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args)); +int trio_dprintfv TRIO_PROTO((int fd, TRIO_CONST char *format, void **args)); + +int trio_cprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure, + TRIO_CONST char *format, ...)); +int trio_vcprintf TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure, + TRIO_CONST char *format, va_list args)); +int trio_cprintfv TRIO_PROTO((trio_outstream_t stream, trio_pointer_t closure, + TRIO_CONST char *format, void **args)); + +int trio_sprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, ...)); +int trio_vsprintf TRIO_PROTO((char *buffer, TRIO_CONST char *format, va_list args)); +int trio_sprintfv TRIO_PROTO((char *buffer, TRIO_CONST char *format, void **args)); + +int trio_snprintf TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...)); +int trio_vsnprintf TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format, + va_list args)); +int trio_snprintfv TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format, + void **args)); + +int trio_snprintfcat TRIO_PROTO((char *buffer, size_t max, TRIO_CONST char *format, ...)); +int trio_vsnprintfcat TRIO_PROTO((char *buffer, size_t bufferSize, TRIO_CONST char *format, + va_list args)); + +char *trio_aprintf TRIO_PROTO((TRIO_CONST char *format, ...)); +char *trio_vaprintf TRIO_PROTO((TRIO_CONST char *format, va_list args)); + +int trio_asprintf TRIO_PROTO((char **ret, TRIO_CONST char *format, ...)); +int trio_vasprintf TRIO_PROTO((char **ret, TRIO_CONST char *format, va_list args)); + +/************************************************************************* + * Scan Functions + */ +int trio_scanf TRIO_PROTO((TRIO_CONST char *format, ...)); +int trio_vscanf TRIO_PROTO((TRIO_CONST char *format, va_list args)); +int trio_scanfv TRIO_PROTO((TRIO_CONST char *format, void **args)); + +int trio_fscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, ...)); +int trio_vfscanf TRIO_PROTO((FILE *file, TRIO_CONST char *format, va_list args)); +int trio_fscanfv TRIO_PROTO((FILE *file, TRIO_CONST char *format, void **args)); + +int trio_dscanf TRIO_PROTO((int fd, TRIO_CONST char *format, ...)); +int trio_vdscanf TRIO_PROTO((int fd, TRIO_CONST char *format, va_list args)); +int trio_dscanfv TRIO_PROTO((int fd, TRIO_CONST char *format, void **args)); + +int trio_cscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure, + TRIO_CONST char *format, ...)); +int trio_vcscanf TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure, + TRIO_CONST char *format, va_list args)); +int trio_cscanfv TRIO_PROTO((trio_instream_t stream, trio_pointer_t closure, + TRIO_CONST char *format, void **args)); + +int trio_sscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, ...)); +int trio_vsscanf TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, va_list args)); +int trio_sscanfv TRIO_PROTO((TRIO_CONST char *buffer, TRIO_CONST char *format, void **args)); + +/************************************************************************* + * Locale Functions + */ +void trio_locale_set_decimal_point TRIO_PROTO((char *decimalPoint)); +void trio_locale_set_thousand_separator TRIO_PROTO((char *thousandSeparator)); +void trio_locale_set_grouping TRIO_PROTO((char *grouping)); + +/************************************************************************* + * Renaming + */ +#ifdef TRIO_REPLACE_STDIO +/* Replace the functions */ +#ifndef HAVE_PRINTF +# define printf trio_printf +#endif +#ifndef HAVE_VPRINTF +# define vprintf trio_vprintf +#endif +#ifndef HAVE_FPRINTF +# define fprintf trio_fprintf +#endif +#ifndef HAVE_VFPRINTF +# define vfprintf trio_vfprintf +#endif +#ifndef HAVE_SPRINTF +# define sprintf trio_sprintf +#endif +#ifndef HAVE_VSPRINTF +# define vsprintf trio_vsprintf +#endif +#ifndef HAVE_SNPRINTF +# define snprintf trio_snprintf +#endif +#ifndef HAVE_VSNPRINTF +# define vsnprintf trio_vsnprintf +#endif +#ifndef HAVE_SCANF +# define scanf trio_scanf +#endif +#ifndef HAVE_VSCANF +# define vscanf trio_vscanf +#endif +#ifndef HAVE_FSCANF +# define fscanf trio_fscanf +#endif +#ifndef HAVE_VFSCANF +# define vfscanf trio_vfscanf +#endif +#ifndef HAVE_SSCANF +# define sscanf trio_sscanf +#endif +#ifndef HAVE_VSSCANF +# define vsscanf trio_vsscanf +#endif +/* These aren't stdio functions, but we make them look similar */ +#define dprintf trio_dprintf +#define vdprintf trio_vdprintf +#define aprintf trio_aprintf +#define vaprintf trio_vaprintf +#define asprintf trio_asprintf +#define vasprintf trio_vasprintf +#define dscanf trio_dscanf +#define vdscanf trio_vdscanf +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* WITHOUT_TRIO */ + +#endif /* TRIO_TRIO_H */ diff --git a/libxslt/triodef.h b/libxslt/triodef.h new file mode 100644 index 0000000..0fd32fb --- /dev/null +++ b/libxslt/triodef.h @@ -0,0 +1,220 @@ +/************************************************************************* + * + * $Id$ + * + * Copyright (C) 2001 Bjorn Reese + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND + * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. + * + ************************************************************************/ + +#ifndef TRIO_TRIODEF_H +#define TRIO_TRIODEF_H + +/************************************************************************* + * Platform and compiler support detection + */ +#if defined(__GNUC__) +# define TRIO_COMPILER_GCC +#elif defined(__SUNPRO_C) +# define TRIO_COMPILER_SUNPRO +#elif defined(__SUNPRO_CC) +# define TRIO_COMPILER_SUNPRO +# define __SUNPRO_C __SUNPRO_CC +#elif defined(__xlC__) || defined(__IBMC__) || defined(__IBMCPP__) +# define TRIO_COMPILER_XLC +#elif defined(_AIX) && !defined(__GNUC__) +# define TRIO_COMPILER_XLC /* Workaround for old xlc */ +#elif defined(__DECC) || defined(__DECCXX) +# define TRIO_COMPILER_DECC +#elif defined(__osf__) && defined(__LANGUAGE_C__) +# define TRIO_COMPILER_DECC /* Workaround for old DEC C compilers */ +#elif defined(_MSC_VER) +# define TRIO_COMPILER_MSVC +#elif defined(__BORLANDC__) +# define TRIO_COMPILER_BCB +#endif + +#if defined(VMS) || defined(__VMS) +/* + * VMS is placed first to avoid identifying the platform as Unix + * based on the DECC compiler later on. + */ +# define TRIO_PLATFORM_VMS +#elif defined(unix) || defined(__unix) || defined(__unix__) +# define TRIO_PLATFORM_UNIX +#elif defined(TRIO_COMPILER_XLC) || defined(_AIX) +# define TRIO_PLATFORM_UNIX +#elif defined(TRIO_COMPILER_DECC) || defined(__osf___) +# define TRIO_PLATFORM_UNIX +#elif defined(__NetBSD__) +# define TRIO_PLATFORM_UNIX +#elif defined(__QNX__) +# define TRIO_PLATFORM_UNIX +# define TRIO_PLATFORM_QNX +#elif defined(__CYGWIN__) +# define TRIO_PLATFORM_UNIX +#elif defined(AMIGA) && defined(TRIO_COMPILER_GCC) +# define TRIO_PLATFORM_UNIX +#elif defined(TRIO_COMPILER_MSVC) || defined(WIN32) || defined(_WIN32) +# define TRIO_PLATFORM_WIN32 +#elif defined(mpeix) || defined(__mpexl) +# define TRIO_PLATFORM_MPEIX +#endif + +#if defined(_AIX) +# define TRIO_PLATFORM_AIX +#elif defined(__hpux) +# define TRIO_PLATFORM_HPUX +#elif defined(sun) || defined(__sun__) +# if defined(__SVR4) || defined(__svr4__) +# define TRIO_PLATFORM_SOLARIS +# else +# define TRIO_PLATFORM_SUNOS +# endif +#endif + +#if defined(__STDC__) || defined(TRIO_COMPILER_MSVC) || defined(TRIO_COMPILER_BCB) +# define TRIO_COMPILER_SUPPORTS_C89 +# if defined(__STDC_VERSION__) +# define TRIO_COMPILER_SUPPORTS_C90 +# if (__STDC_VERSION__ >= 199409L) +# define TRIO_COMPILER_SUPPORTS_C94 +# endif +# if (__STDC_VERSION__ >= 199901L) +# define TRIO_COMPILER_SUPPORTS_C99 +# endif +# elif defined(TRIO_COMPILER_SUNPRO) +# if (__SUNPRO_C >= 0x420) +# define TRIO_COMPILER_SUPPORTS_C94 +# endif +# endif +#endif + +#if defined(_XOPEN_SOURCE) +# if defined(_XOPEN_SOURCE_EXTENDED) +# define TRIO_COMPILER_SUPPORTS_UNIX95 +# endif +# if (_XOPEN_VERSION >= 500) +# define TRIO_COMPILER_SUPPORTS_UNIX98 +# endif +# if (_XOPEN_VERSION >= 600) +# define TRIO_COMPILER_SUPPORTS_UNIX01 +# endif +#endif + +/************************************************************************* + * Generic defines + */ + +#if !defined(TRIO_PUBLIC) +# define TRIO_PUBLIC +#endif +#if !defined(TRIO_PRIVATE) +# define TRIO_PRIVATE static +#endif + +#if !(defined(TRIO_COMPILER_SUPPORTS_C89) || defined(__cplusplus)) +# define TRIO_COMPILER_ANCIENT +#endif + +#if defined(TRIO_COMPILER_ANCIENT) +# define TRIO_CONST +# define TRIO_VOLATILE +# define TRIO_SIGNED +typedef double trio_long_double_t; +typedef char * trio_pointer_t; +# define TRIO_SUFFIX_LONG(x) x +# define TRIO_PROTO(x) () +# define TRIO_NOARGS +# define TRIO_ARGS1(list,a1) list a1; +# define TRIO_ARGS2(list,a1,a2) list a1; a2; +# define TRIO_ARGS3(list,a1,a2,a3) list a1; a2; a3; +# define TRIO_ARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4; +# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5; +# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) list a1; a2; a3; a4; a5; a6; +# define TRIO_VARGS2(list,a1,a2) list a1; a2 +# define TRIO_VARGS3(list,a1,a2,a3) list a1; a2; a3 +# define TRIO_VARGS4(list,a1,a2,a3,a4) list a1; a2; a3; a4 +# define TRIO_VARGS5(list,a1,a2,a3,a4,a5) list a1; a2; a3; a4; a5 +# define TRIO_VA_DECL va_dcl +# define TRIO_VA_START(x,y) va_start(x) +# define TRIO_VA_END(x) va_end(x) +#else /* ANSI C */ +# define TRIO_CONST const +# define TRIO_VOLATILE volatile +# define TRIO_SIGNED signed +typedef long double trio_long_double_t; +typedef void * trio_pointer_t; +# define TRIO_SUFFIX_LONG(x) x ## L +# define TRIO_PROTO(x) x +# define TRIO_NOARGS void +# define TRIO_ARGS1(list,a1) (a1) +# define TRIO_ARGS2(list,a1,a2) (a1,a2) +# define TRIO_ARGS3(list,a1,a2,a3) (a1,a2,a3) +# define TRIO_ARGS4(list,a1,a2,a3,a4) (a1,a2,a3,a4) +# define TRIO_ARGS5(list,a1,a2,a3,a4,a5) (a1,a2,a3,a4,a5) +# define TRIO_ARGS6(list,a1,a2,a3,a4,a5,a6) (a1,a2,a3,a4,a5,a6) +# define TRIO_VARGS2 TRIO_ARGS2 +# define TRIO_VARGS3 TRIO_ARGS3 +# define TRIO_VARGS4 TRIO_ARGS4 +# define TRIO_VARGS5 TRIO_ARGS5 +# define TRIO_VA_DECL ... +# define TRIO_VA_START(x,y) va_start(x,y) +# define TRIO_VA_END(x) va_end(x) +#endif + +#if defined(TRIO_COMPILER_SUPPORTS_C99) || defined(__cplusplus) +# define TRIO_INLINE inline +#elif defined(TRIO_COMPILER_GCC) +# define TRIO_INLINE __inline__ +#elif defined(TRIO_COMPILER_MSVC) +# define TRIO_INLINE _inline +#elif defined(TRIO_COMPILER_BCB) +# define TRIO_INLINE __inline +#else +# define TRIO_INLINE +#endif + +/************************************************************************* + * Workarounds + */ + +#if defined(TRIO_PLATFORM_VMS) +/* + * Computations done with constants at compile time can trigger these + * even when compiling with IEEE enabled. + */ +# pragma message disable (UNDERFLOW, FLOATOVERFL) + +# if (__CRTL_VER < 80000000) +/* + * Although the compiler supports C99 language constructs, the C + * run-time library does not contain all C99 functions. + * + * This was the case for 70300022. Update the 80000000 value when + * it has been accurately determined what version of the library + * supports C99. + */ +# if defined(TRIO_COMPILER_SUPPORTS_C99) +# undef TRIO_COMPILER_SUPPORTS_C99 +# endif +# endif +#endif + +/* + * Not all preprocessors supports the LL token. + */ +#if defined(TRIO_COMPILER_BCB) +#else +# define TRIO_COMPILER_SUPPORTS_LL +#endif + +#endif /* TRIO_TRIODEF_H */ diff --git a/libxslt/variables.c b/libxslt/variables.c new file mode 100644 index 0000000..345123d --- /dev/null +++ b/libxslt/variables.c @@ -0,0 +1,2335 @@ +/* + * variables.c: Implementation of the variable storage and lookup + * + * Reference: + * http://www.w3.org/TR/1999/REC-xslt-19991116 + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "xsltutils.h" +#include "variables.h" +#include "transform.h" +#include "imports.h" +#include "preproc.h" +#include "keys.h" + +#ifdef WITH_XSLT_DEBUG + #define WITH_XSLT_DEBUG_VARIABLE +#endif + +#ifdef XSLT_REFACTORED +const xmlChar *xsltDocFragFake = (const xmlChar *) " fake node libxslt"; +#endif + +const xmlChar *xsltComputingGlobalVarMarker = + (const xmlChar *) " var/param being computed"; + +#define XSLT_VAR_GLOBAL 1<<0 +#define XSLT_VAR_IN_SELECT 1<<1 +#define XSLT_TCTXT_VARIABLE(c) ((xsltStackElemPtr) (c)->contextVariable) + +/************************************************************************ + * * + * Result Value Tree (Result Tree Fragment) interfaces * + * * + ************************************************************************/ +/** + * xsltCreateRVT: + * @ctxt: an XSLT transformation context + * + * Creates a Result Value Tree + * (the XSLT 1.0 term for this is "Result Tree Fragment") + * + * Returns the result value tree or NULL in case of API or internal errors. + */ +xmlDocPtr +xsltCreateRVT(xsltTransformContextPtr ctxt) +{ + xmlDocPtr container; + + /* + * Question: Why is this function public? + * Answer: It is called by the EXSLT module. + */ + if (ctxt == NULL) + return(NULL); + + /* + * Reuse a RTF from the cache if available. + */ + if (ctxt->cache->RVT) { + container = ctxt->cache->RVT; + ctxt->cache->RVT = (xmlDocPtr) container->next; + /* clear the internal pointers */ + container->next = NULL; + container->prev = NULL; + if (ctxt->cache->nbRVT > 0) + ctxt->cache->nbRVT--; +#ifdef XSLT_DEBUG_PROFILE_CACHE + ctxt->cache->dbgReusedRVTs++; +#endif + return(container); + } + + container = xmlNewDoc(NULL); + if (container == NULL) + return(NULL); + container->dict = ctxt->dict; + xmlDictReference(container->dict); + XSLT_MARK_RES_TREE_FRAG(container); + container->doc = container; + container->parent = NULL; + return(container); +} + +/** + * xsltRegisterTmpRVT: + * @ctxt: an XSLT transformation context + * @RVT: a result value tree (Result Tree Fragment) + * + * Registers the result value tree (XSLT 1.0 term: Result Tree Fragment) + * in the garbage collector. + * The fragment will be freed at the exit of the currently + * instantiated xsl:template. + * Obsolete; this function might produce massive memory overhead, + * since the fragment is only freed when the current xsl:template + * exits. Use xsltRegisterLocalRVT() instead. + * + * Returns 0 in case of success and -1 in case of API or internal errors. + */ +int +xsltRegisterTmpRVT(xsltTransformContextPtr ctxt, xmlDocPtr RVT) +{ + if ((ctxt == NULL) || (RVT == NULL)) + return(-1); + + /* + * We'll restrict the lifetime of user-created fragments + * insinde an xsl:variable and xsl:param to the lifetime of the + * var/param itself. + */ + if (ctxt->contextVariable != NULL) { + RVT->next = (xmlNodePtr) XSLT_TCTXT_VARIABLE(ctxt)->fragment; + XSLT_TCTXT_VARIABLE(ctxt)->fragment = RVT; + return(0); + } + + RVT->next = (xmlNodePtr) ctxt->tmpRVT; + if (ctxt->tmpRVT != NULL) + ctxt->tmpRVT->prev = (xmlNodePtr) RVT; + ctxt->tmpRVT = RVT; + return(0); +} + +/** + * xsltRegisterLocalRVT: + * @ctxt: an XSLT transformation context + * @RVT: a result value tree (Result Tree Fragment; xmlDocPtr) + * + * Registers a result value tree (XSLT 1.0 term: Result Tree Fragment) + * in the RVT garbage collector. + * The fragment will be freed when the instruction which created the + * fragment exits. + * + * Returns 0 in case of success and -1 in case of API or internal errors. + */ +int +xsltRegisterLocalRVT(xsltTransformContextPtr ctxt, + xmlDocPtr RVT) +{ + if ((ctxt == NULL) || (RVT == NULL)) + return(-1); + + /* + * When evaluating "select" expressions of xsl:variable + * and xsl:param, we need to bind newly created tree fragments + * to the variable itself; otherwise the tragment will be + * freed before we leave the scope of a var. + */ + if ((ctxt->contextVariable != NULL) && + (XSLT_TCTXT_VARIABLE(ctxt)->flags & XSLT_VAR_IN_SELECT)) + { + RVT->next = (xmlNodePtr) XSLT_TCTXT_VARIABLE(ctxt)->fragment; + XSLT_TCTXT_VARIABLE(ctxt)->fragment = RVT; + return(0); + } + /* + * Store the fragment in the scope of the current instruction. + * If not reference by a returning instruction (like EXSLT's function), + * then this fragment will be freed, when the instruction exits. + */ + RVT->next = (xmlNodePtr) ctxt->localRVT; + if (ctxt->localRVT != NULL) + ctxt->localRVT->prev = (xmlNodePtr) RVT; + ctxt->localRVT = RVT; + /* + * We need to keep track of the first registered fragment + * for extension instructions which return fragments + * (e.g. EXSLT'S function), in order to let + * xsltExtensionInstructionResultFinalize() clear the + * preserving flag on the fragments. + */ + if (ctxt->localRVTBase == NULL) + ctxt->localRVTBase = RVT; + return(0); +} + +/** + * xsltExtensionInstructionResultFinalize: + * @ctxt: an XSLT transformation context + * + * Finalizes the data (e.g. result tree fragments) created + * within a value-returning process (e.g. EXSLT's function). + * Tree fragments marked as being returned by a function are + * set to normal state, which means that the fragment garbage + * collector will free them after the function-calling process exits. + * + * Returns 0 in case of success and -1 in case of API or internal errors. + */ +int +xsltExtensionInstructionResultFinalize(xsltTransformContextPtr ctxt) +{ + xmlDocPtr cur; + + if (ctxt == NULL) + return(-1); + if (ctxt->localRVTBase == NULL) + return(0); + /* + * Enable remaining local tree fragments to be freed + * by the fragment garbage collector. + */ + cur = ctxt->localRVTBase; + do { + cur->psvi = NULL; + cur = (xmlDocPtr) cur->next; + } while (cur != NULL); + return(0); +} + +/** + * xsltExtensionInstructionResultRegister: + * @ctxt: an XSLT transformation context + * @obj: an XPath object to be inspected for result tree fragments + * + * Marks the result of a value-returning extension instruction + * in order to avoid it being garbage collected before the + * extension instruction exits. + * Note that one still has to additionally register any newly created + * tree fragments (via xsltCreateRVT()) with xsltRegisterLocalRVT(). + * + * Returns 0 in case of success and -1 in case of error. + */ +int +xsltExtensionInstructionResultRegister(xsltTransformContextPtr ctxt, + xmlXPathObjectPtr obj) +{ + int i; + xmlNodePtr cur; + xmlDocPtr doc; + + if ((ctxt == NULL) || (obj == NULL)) + return(-1); + + /* + * OPTIMIZE TODO: If no local variables/params and no local tree + * fragments were created, then we don't need to analyse the XPath + * objects for tree fragments. + */ + + if ((obj->type != XPATH_NODESET) && (obj->type != XPATH_XSLT_TREE)) + return(0); + if ((obj->nodesetval == NULL) || (obj->nodesetval->nodeNr == 0)) + return(0); + + for (i = 0; i < obj->nodesetval->nodeNr; i++) { + cur = obj->nodesetval->nodeTab[i]; + if (cur->type == XML_NAMESPACE_DECL) { + /* + * The XPath module sets the owner element of a ns-node on + * the ns->next field. + */ + if ((((xmlNsPtr) cur)->next != NULL) && + (((xmlNsPtr) cur)->next->type == XML_ELEMENT_NODE)) + { + cur = (xmlNodePtr) ((xmlNsPtr) cur)->next; + doc = cur->doc; + } else { + xsltTransformError(ctxt, NULL, ctxt->inst, + "Internal error in " + "xsltExtensionInstructionResultRegister(): " + "Cannot retrieve the doc of a namespace node.\n"); + goto error; + } + } else { + doc = cur->doc; + } + if (doc == NULL) { + xsltTransformError(ctxt, NULL, ctxt->inst, + "Internal error in " + "xsltExtensionInstructionResultRegister(): " + "Cannot retrieve the doc of a node.\n"); + goto error; + } + if (doc->name && (doc->name[0] == ' ')) { + /* + * This is a result tree fragment. + * We'll use the @psvi field for reference counting. + * TODO: How do we know if this is a value of a + * global variable or a doc acquired via the + * document() function? + */ + doc->psvi = (void *) ((long) 1); + } + } + + return(0); +error: + return(-1); +} + +/** + * xsltReleaseRVT: + * @ctxt: an XSLT transformation context + * @RVT: a result value tree (Result Tree Fragment) + * + * Either frees the RVT (which is an xmlDoc) or stores + * it in the context's cache for later reuse. + */ +void +xsltReleaseRVT(xsltTransformContextPtr ctxt, xmlDocPtr RVT) +{ + if (RVT == NULL) + return; + + if (ctxt && (ctxt->cache->nbRVT < 40)) { + /* + * Store the Result Tree Fragment. + * Free the document info. + */ + if (RVT->_private != NULL) { + xsltFreeDocumentKeys((xsltDocumentPtr) RVT->_private); + xmlFree(RVT->_private); + RVT->_private = NULL; + } + /* + * Clear the document tree. + * REVISIT TODO: Do we expect ID/IDREF tables to be existent? + */ + if (RVT->children != NULL) { + xmlFreeNodeList(RVT->children); + RVT->children = NULL; + RVT->last = NULL; + } + if (RVT->ids != NULL) { + xmlFreeIDTable((xmlIDTablePtr) RVT->ids); + RVT->ids = NULL; + } + if (RVT->refs != NULL) { + xmlFreeRefTable((xmlRefTablePtr) RVT->refs); + RVT->refs = NULL; + } + + /* + * Reset the reference counter. + */ + RVT->psvi = 0; + + RVT->next = (xmlNodePtr) ctxt->cache->RVT; + ctxt->cache->RVT = RVT; + + ctxt->cache->nbRVT++; + +#ifdef XSLT_DEBUG_PROFILE_CACHE + ctxt->cache->dbgCachedRVTs++; +#endif + return; + } + /* + * Free it. + */ + if (RVT->_private != NULL) { + xsltFreeDocumentKeys((xsltDocumentPtr) RVT->_private); + xmlFree(RVT->_private); + } + xmlFreeDoc(RVT); +} + +/** + * xsltRegisterPersistRVT: + * @ctxt: an XSLT transformation context + * @RVT: a result value tree (Result Tree Fragment) + * + * Register the result value tree (XSLT 1.0 term: Result Tree Fragment) + * in the fragment garbage collector. + * The fragment will be freed when the transformation context is + * freed. + * + * Returns 0 in case of success and -1 in case of error. + */ +int +xsltRegisterPersistRVT(xsltTransformContextPtr ctxt, xmlDocPtr RVT) +{ + if ((ctxt == NULL) || (RVT == NULL)) return(-1); + + RVT->next = (xmlNodePtr) ctxt->persistRVT; + if (ctxt->persistRVT != NULL) + ctxt->persistRVT->prev = (xmlNodePtr) RVT; + ctxt->persistRVT = RVT; + return(0); +} + +/** + * xsltFreeRVTs: + * @ctxt: an XSLT transformation context + * + * Frees all registered result value trees (Result Tree Fragments) + * of the transformation. Internal function; should not be called + * by user-code. + */ +void +xsltFreeRVTs(xsltTransformContextPtr ctxt) +{ + xmlDocPtr cur, next; + + if (ctxt == NULL) + return; + /* + * Local fragments. + */ + cur = ctxt->localRVT; + while (cur != NULL) { + next = (xmlDocPtr) cur->next; + if (cur->_private != NULL) { + xsltFreeDocumentKeys(cur->_private); + xmlFree(cur->_private); + } + xmlFreeDoc(cur); + cur = next; + } + ctxt->localRVT = NULL; + /* + * User-created per-template fragments. + */ + cur = ctxt->tmpRVT; + while (cur != NULL) { + next = (xmlDocPtr) cur->next; + if (cur->_private != NULL) { + xsltFreeDocumentKeys(cur->_private); + xmlFree(cur->_private); + } + xmlFreeDoc(cur); + cur = next; + } + ctxt->tmpRVT = NULL; + /* + * Global fragments. + */ + cur = ctxt->persistRVT; + while (cur != NULL) { + next = (xmlDocPtr) cur->next; + if (cur->_private != NULL) { + xsltFreeDocumentKeys(cur->_private); + xmlFree(cur->_private); + } + xmlFreeDoc(cur); + cur = next; + } + ctxt->persistRVT = NULL; +} + +/************************************************************************ + * * + * Module interfaces * + * * + ************************************************************************/ + +/** + * xsltNewStackElem: + * + * Create a new XSLT ParserContext + * + * Returns the newly allocated xsltParserStackElem or NULL in case of error + */ +static xsltStackElemPtr +xsltNewStackElem(xsltTransformContextPtr ctxt) +{ + xsltStackElemPtr ret; + /* + * Reuse a stack item from the cache if available. + */ + if (ctxt && ctxt->cache->stackItems) { + ret = ctxt->cache->stackItems; + ctxt->cache->stackItems = ret->next; + ret->next = NULL; + ctxt->cache->nbStackItems--; +#ifdef XSLT_DEBUG_PROFILE_CACHE + ctxt->cache->dbgReusedVars++; +#endif + return(ret); + } + ret = (xsltStackElemPtr) xmlMalloc(sizeof(xsltStackElem)); + if (ret == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltNewStackElem : malloc failed\n"); + return(NULL); + } + memset(ret, 0, sizeof(xsltStackElem)); + ret->context = ctxt; + return(ret); +} + +/** + * xsltCopyStackElem: + * @elem: an XSLT stack element + * + * Makes a copy of the stack element + * + * Returns the copy of NULL + */ +static xsltStackElemPtr +xsltCopyStackElem(xsltStackElemPtr elem) { + xsltStackElemPtr cur; + + cur = (xsltStackElemPtr) xmlMalloc(sizeof(xsltStackElem)); + if (cur == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltCopyStackElem : malloc failed\n"); + return(NULL); + } + memset(cur, 0, sizeof(xsltStackElem)); + cur->context = elem->context; + cur->name = elem->name; + cur->nameURI = elem->nameURI; + cur->select = elem->select; + cur->tree = elem->tree; + cur->comp = elem->comp; + return(cur); +} + +/** + * xsltFreeStackElem: + * @elem: an XSLT stack element + * + * Free up the memory allocated by @elem + */ +static void +xsltFreeStackElem(xsltStackElemPtr elem) { + if (elem == NULL) + return; + if (elem->value != NULL) + xmlXPathFreeObject(elem->value); + /* + * Release the list of temporary Result Tree Fragments. + */ + if (elem->fragment) { + xmlDocPtr cur; + + while (elem->fragment != NULL) { + cur = elem->fragment; + elem->fragment = (xmlDocPtr) cur->next; + + if (elem->context && + (cur->psvi == (void *) ((long) 1))) + { + /* + * This fragment is a result of an extension instruction + * (e.g. XSLT's function) and needs to be preserved until + * the instruction exits. + * Example: The fragment of the variable must not be freed + * since it is returned by the EXSLT function: + * + * + * + * + * + * + * + */ + xsltRegisterLocalRVT(elem->context, cur); + } else { + xsltReleaseRVT((xsltTransformContextPtr) elem->context, + cur); + } + } + } + /* + * Cache or free the variable structure. + */ + if (elem->context && (elem->context->cache->nbStackItems < 50)) { + /* + * Store the item in the cache. + */ + xsltTransformContextPtr ctxt = elem->context; + memset(elem, 0, sizeof(xsltStackElem)); + elem->context = ctxt; + elem->next = ctxt->cache->stackItems; + ctxt->cache->stackItems = elem; + ctxt->cache->nbStackItems++; +#ifdef XSLT_DEBUG_PROFILE_CACHE + ctxt->cache->dbgCachedVars++; +#endif + return; + } + xmlFree(elem); +} + +/** + * xsltFreeStackElemList: + * @elem: an XSLT stack element + * + * Free up the memory allocated by @elem + */ +void +xsltFreeStackElemList(xsltStackElemPtr elem) { + xsltStackElemPtr next; + + while (elem != NULL) { + next = elem->next; + xsltFreeStackElem(elem); + elem = next; + } +} + +/** + * xsltStackLookup: + * @ctxt: an XSLT transformation context + * @name: the local part of the name + * @nameURI: the URI part of the name + * + * Locate an element in the stack based on its name. + */ +#if 0 /* TODO: Those seem to have been used for debugging. */ +static int stack_addr = 0; +static int stack_cmp = 0; +#endif + +static xsltStackElemPtr +xsltStackLookup(xsltTransformContextPtr ctxt, const xmlChar *name, + const xmlChar *nameURI) { + int i; + xsltStackElemPtr cur; + + if ((ctxt == NULL) || (name == NULL) || (ctxt->varsNr == 0)) + return(NULL); + + /* + * Do the lookup from the top of the stack, but + * don't use params being computed in a call-param + * First lookup expects the variable name and URI to + * come from the disctionnary and hence pointer comparison. + */ + for (i = ctxt->varsNr; i > ctxt->varsBase; i--) { + cur = ctxt->varsTab[i-1]; + while (cur != NULL) { + if ((cur->name == name) && (cur->nameURI == nameURI)) { +#if 0 + stack_addr++; +#endif + return(cur); + } + cur = cur->next; + } + } + + /* + * Redo the lookup with interned string compares + * to avoid string compares. + */ + name = xmlDictLookup(ctxt->dict, name, -1); + if (nameURI != NULL) + nameURI = xmlDictLookup(ctxt->dict, nameURI, -1); + + for (i = ctxt->varsNr; i > ctxt->varsBase; i--) { + cur = ctxt->varsTab[i-1]; + while (cur != NULL) { + if ((cur->name == name) && (cur->nameURI == nameURI)) { +#if 0 + stack_cmp++; +#endif + return(cur); + } + cur = cur->next; + } + } + + return(NULL); +} + +#ifdef XSLT_REFACTORED +#else + +/** + * xsltCheckStackElem: + * @ctxt: xn XSLT transformation context + * @name: the variable name + * @nameURI: the variable namespace URI + * + * Checks whether a variable or param is already defined. + * + * URGENT TODO: Checks for redefinition of vars/params should be + * done only at compilation time. + * + * Returns 1 if variable is present, 2 if param is present, 3 if this + * is an inherited param, 0 if not found, -1 in case of failure. + */ +static int +xsltCheckStackElem(xsltTransformContextPtr ctxt, const xmlChar *name, + const xmlChar *nameURI) { + xsltStackElemPtr cur; + + if ((ctxt == NULL) || (name == NULL)) + return(-1); + + cur = xsltStackLookup(ctxt, name, nameURI); + if (cur == NULL) + return(0); + if (cur->comp != NULL) { + if (cur->comp->type == XSLT_FUNC_WITHPARAM) + return(3); + else if (cur->comp->type == XSLT_FUNC_PARAM) + return(2); + } + + return(1); +} + +#endif /* XSLT_REFACTORED */ + +/** + * xsltAddStackElem: + * @ctxt: xn XSLT transformation context + * @elem: a stack element + * + * Push an element (or list) onto the stack. + * In case of a list, each member will be pushed into + * a seperate slot; i.e. there's always 1 stack entry for + * 1 stack element. + * + * Returns 0 in case of success, -1 in case of failure. + */ +static int +xsltAddStackElem(xsltTransformContextPtr ctxt, xsltStackElemPtr elem) +{ + if ((ctxt == NULL) || (elem == NULL)) + return(-1); + + do { + if (ctxt->varsMax == 0) { + ctxt->varsMax = 10; + ctxt->varsTab = + (xsltStackElemPtr *) xmlMalloc(ctxt->varsMax * + sizeof(ctxt->varsTab[0])); + if (ctxt->varsTab == NULL) { + xmlGenericError(xmlGenericErrorContext, "malloc failed !\n"); + return (-1); + } + } + if (ctxt->varsNr >= ctxt->varsMax) { + ctxt->varsMax *= 2; + ctxt->varsTab = + (xsltStackElemPtr *) xmlRealloc(ctxt->varsTab, + ctxt->varsMax * + sizeof(ctxt->varsTab[0])); + if (ctxt->varsTab == NULL) { + xmlGenericError(xmlGenericErrorContext, "realloc failed !\n"); + return (-1); + } + } + ctxt->varsTab[ctxt->varsNr++] = elem; + ctxt->vars = elem; + + elem = elem->next; + } while (elem != NULL); + + return(0); +} + +/** + * xsltAddStackElemList: + * @ctxt: xn XSLT transformation context + * @elems: a stack element list + * + * Push an element list onto the stack. + * + * Returns 0 in case of success, -1 in case of failure. + */ +int +xsltAddStackElemList(xsltTransformContextPtr ctxt, xsltStackElemPtr elems) +{ + return(xsltAddStackElem(ctxt, elems)); +} + +/************************************************************************ + * * + * Module interfaces * + * * + ************************************************************************/ + +/** + * xsltEvalVariable: + * @ctxt: the XSLT transformation context + * @variable: the variable or parameter item + * @comp: the compiled XSLT instruction + * + * Evaluate a variable value. + * + * Returns the XPath Object value or NULL in case of error + */ +static xmlXPathObjectPtr +xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable, + xsltStylePreCompPtr castedComp) +{ +#ifdef XSLT_REFACTORED + xsltStyleItemVariablePtr comp = + (xsltStyleItemVariablePtr) castedComp; +#else + xsltStylePreCompPtr comp = castedComp; +#endif + xmlXPathObjectPtr result = NULL; + xmlNodePtr oldInst; + + if ((ctxt == NULL) || (variable == NULL)) + return(NULL); + + /* + * A variable or parameter are evaluated on demand; thus the + * context (of XSLT and XPath) need to be temporarily adjusted and + * restored on exit. + */ + oldInst = ctxt->inst; + +#ifdef WITH_XSLT_DEBUG_VARIABLE + XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + "Evaluating variable '%s'\n", variable->name)); +#endif + if (variable->select != NULL) { + xmlXPathCompExprPtr xpExpr = NULL; + xmlDocPtr oldXPDoc; + xmlNodePtr oldXPContextNode; + int oldXPProximityPosition, oldXPContextSize, oldXPNsNr; + xmlNsPtr *oldXPNamespaces; + xmlXPathContextPtr xpctxt = ctxt->xpathCtxt; + xsltStackElemPtr oldVar = ctxt->contextVariable; + + if ((comp != NULL) && (comp->comp != NULL)) { + xpExpr = comp->comp; + } else { + xpExpr = xmlXPathCompile(variable->select); + } + if (xpExpr == NULL) + return(NULL); + /* + * Save context states. + */ + oldXPDoc = xpctxt->doc; + oldXPContextNode = xpctxt->node; + oldXPProximityPosition = xpctxt->proximityPosition; + oldXPContextSize = xpctxt->contextSize; + oldXPNamespaces = xpctxt->namespaces; + oldXPNsNr = xpctxt->nsNr; + + xpctxt->node = ctxt->node; + /* + * OPTIMIZE TODO: Lame try to set the context doc. + * Get rid of this somehow in xpath.c. + */ + if ((ctxt->node->type != XML_NAMESPACE_DECL) && + ctxt->node->doc) + xpctxt->doc = ctxt->node->doc; + /* + * BUG TODO: The proximity position and the context size will + * potentially be wrong. + * Example: + * + * + * + * + * + * + * Here the proximity position and context size are changed + * to the context of , but + * the variable needs to be evaluated in the context of + * . + */ + if (comp != NULL) { + +#ifdef XSLT_REFACTORED + if (comp->inScopeNs != NULL) { + xpctxt->namespaces = comp->inScopeNs->list; + xpctxt->nsNr = comp->inScopeNs->xpathNumber; + } else { + xpctxt->namespaces = NULL; + xpctxt->nsNr = 0; + } +#else + xpctxt->namespaces = comp->nsList; + xpctxt->nsNr = comp->nsNr; +#endif + } else { + xpctxt->namespaces = NULL; + xpctxt->nsNr = 0; + } + + /* + * We need to mark that we are "selecting" a var's value; + * if any tree fragments are created inside the expression, + * then those need to be stored inside the variable; otherwise + * we'll eventually free still referenced fragments, before + * we leave the scope of the variable. + */ + ctxt->contextVariable = variable; + variable->flags |= XSLT_VAR_IN_SELECT; + + result = xmlXPathCompiledEval(xpExpr, xpctxt); + + variable->flags ^= XSLT_VAR_IN_SELECT; + /* + * Restore Context states. + */ + ctxt->contextVariable = oldVar; + + xpctxt->doc = oldXPDoc; + xpctxt->node = oldXPContextNode; + xpctxt->contextSize = oldXPContextSize; + xpctxt->proximityPosition = oldXPProximityPosition; + xpctxt->namespaces = oldXPNamespaces; + xpctxt->nsNr = oldXPNsNr; + + if ((comp == NULL) || (comp->comp == NULL)) + xmlXPathFreeCompExpr(xpExpr); + if (result == NULL) { + xsltTransformError(ctxt, NULL, + (comp != NULL) ? comp->inst : NULL, + "Failed to evaluate the expression of variable '%s'.\n", + variable->name); + ctxt->state = XSLT_STATE_STOPPED; + +#ifdef WITH_XSLT_DEBUG_VARIABLE +#ifdef LIBXML_DEBUG_ENABLED + } else { + if ((xsltGenericDebugContext == stdout) || + (xsltGenericDebugContext == stderr)) + xmlXPathDebugDumpObject((FILE *)xsltGenericDebugContext, + result, 0); +#endif +#endif + } + } else { + if (variable->tree == NULL) { + result = xmlXPathNewCString(""); + } else { + if (variable->tree) { + xmlDocPtr container; + xmlNodePtr oldInsert; + xmlDocPtr oldOutput; + xsltStackElemPtr oldVar = ctxt->contextVariable; + + /* + * Generate a result tree fragment. + */ + container = xsltCreateRVT(ctxt); + if (container == NULL) + goto error; + /* + * NOTE: Local Result Tree Fragments of params/variables + * are not registered globally anymore; the life-time + * is not directly dependant of the param/variable itself. + * + * OLD: xsltRegisterTmpRVT(ctxt, container); + */ + /* + * Attach the Result Tree Fragment to the variable; + * when the variable is freed, it will also free + * the Result Tree Fragment. + */ + variable->fragment = container; + + oldOutput = ctxt->output; + oldInsert = ctxt->insert; + + ctxt->output = container; + ctxt->insert = (xmlNodePtr) container; + ctxt->contextVariable = variable; + /* + * Process the sequence constructor (variable->tree). + * The resulting tree will be held by @container. + */ + xsltApplyOneTemplate(ctxt, ctxt->node, variable->tree, + NULL, NULL); + + ctxt->contextVariable = oldVar; + ctxt->insert = oldInsert; + ctxt->output = oldOutput; + + result = xmlXPathNewValueTree((xmlNodePtr) container); + } + if (result == NULL) { + result = xmlXPathNewCString(""); + } else { + /* + * Freeing is not handled there anymore. + * QUESTION TODO: What does the above comment mean? + */ + result->boolval = 0; + } +#ifdef WITH_XSLT_DEBUG_VARIABLE +#ifdef LIBXML_DEBUG_ENABLED + + if ((xsltGenericDebugContext == stdout) || + (xsltGenericDebugContext == stderr)) + xmlXPathDebugDumpObject((FILE *)xsltGenericDebugContext, + result, 0); +#endif +#endif + } + } + +error: + ctxt->inst = oldInst; + return(result); +} + +/** + * xsltEvalGlobalVariable: + * @elem: the variable or parameter + * @ctxt: the XSLT transformation context + * + * Evaluates a the value of a global xsl:variable or + * xsl:param declaration. + * + * Returns the XPath Object value or NULL in case of error + */ +static xmlXPathObjectPtr +xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt) +{ + xmlXPathObjectPtr result = NULL; + xmlNodePtr oldInst; + const xmlChar* oldVarName; + +#ifdef XSLT_REFACTORED + xsltStyleBasicItemVariablePtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((ctxt == NULL) || (elem == NULL)) + return(NULL); + if (elem->computed) + return(elem->value); + + +#ifdef WITH_XSLT_DEBUG_VARIABLE + XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + "Evaluating global variable %s\n", elem->name)); +#endif + +#ifdef WITH_DEBUGGER + if ((ctxt->debugStatus != XSLT_DEBUG_NONE) && + elem->comp && elem->comp->inst) + xslHandleDebugger(elem->comp->inst, NULL, NULL, ctxt); +#endif + + oldInst = ctxt->inst; +#ifdef XSLT_REFACTORED + comp = (xsltStyleBasicItemVariablePtr) elem->comp; +#else + comp = elem->comp; +#endif + oldVarName = elem->name; + elem->name = xsltComputingGlobalVarMarker; + /* + * OPTIMIZE TODO: We should consider instantiating global vars/params + * on-demand. The vars/params don't need to be evaluated if never + * called; and in the case of global params, if values for such params + * are provided by the user. + */ + if (elem->select != NULL) { + xmlXPathCompExprPtr xpExpr = NULL; + xmlDocPtr oldXPDoc; + xmlNodePtr oldXPContextNode; + int oldXPProximityPosition, oldXPContextSize, oldXPNsNr; + xmlNsPtr *oldXPNamespaces; + xmlXPathContextPtr xpctxt = ctxt->xpathCtxt; + + if ((comp != NULL) && (comp->comp != NULL)) { + xpExpr = comp->comp; + } else { + xpExpr = xmlXPathCompile(elem->select); + } + if (xpExpr == NULL) + goto error; + + + if (comp != NULL) + ctxt->inst = comp->inst; + else + ctxt->inst = NULL; + /* + * SPEC XSLT 1.0: + * "At top-level, the expression or template specifying the + * variable value is evaluated with the same context as that used + * to process the root node of the source document: the current + * node is the root node of the source document and the current + * node list is a list containing just the root node of the source + * document." + */ + /* + * Save context states. + */ + oldXPDoc = xpctxt->doc; + oldXPContextNode = xpctxt->node; + oldXPProximityPosition = xpctxt->proximityPosition; + oldXPContextSize = xpctxt->contextSize; + oldXPNamespaces = xpctxt->namespaces; + oldXPNsNr = xpctxt->nsNr; + + xpctxt->node = ctxt->initialContextNode; + xpctxt->doc = ctxt->initialContextDoc; + xpctxt->contextSize = 1; + xpctxt->proximityPosition = 1; + + if (comp != NULL) { + +#ifdef XSLT_REFACTORED + if (comp->inScopeNs != NULL) { + xpctxt->namespaces = comp->inScopeNs->list; + xpctxt->nsNr = comp->inScopeNs->xpathNumber; + } else { + xpctxt->namespaces = NULL; + xpctxt->nsNr = 0; + } +#else + xpctxt->namespaces = comp->nsList; + xpctxt->nsNr = comp->nsNr; +#endif + } else { + xpctxt->namespaces = NULL; + xpctxt->nsNr = 0; + } + + result = xmlXPathCompiledEval(xpExpr, xpctxt); + + /* + * Restore Context states. + */ + xpctxt->doc = oldXPDoc; + xpctxt->node = oldXPContextNode; + xpctxt->contextSize = oldXPContextSize; + xpctxt->proximityPosition = oldXPProximityPosition; + xpctxt->namespaces = oldXPNamespaces; + xpctxt->nsNr = oldXPNsNr; + + if ((comp == NULL) || (comp->comp == NULL)) + xmlXPathFreeCompExpr(xpExpr); + if (result == NULL) { + if (comp == NULL) + xsltTransformError(ctxt, NULL, NULL, + "Evaluating global variable %s failed\n", elem->name); + else + xsltTransformError(ctxt, NULL, comp->inst, + "Evaluating global variable %s failed\n", elem->name); + ctxt->state = XSLT_STATE_STOPPED; +#ifdef WITH_XSLT_DEBUG_VARIABLE +#ifdef LIBXML_DEBUG_ENABLED + } else { + if ((xsltGenericDebugContext == stdout) || + (xsltGenericDebugContext == stderr)) + xmlXPathDebugDumpObject((FILE *)xsltGenericDebugContext, + result, 0); +#endif +#endif + } + } else { + if (elem->tree == NULL) { + result = xmlXPathNewCString(""); + } else { + xmlDocPtr container; + xmlNodePtr oldInsert; + xmlDocPtr oldOutput, oldXPDoc; + /* + * Generate a result tree fragment. + */ + container = xsltCreateRVT(ctxt); + if (container == NULL) + goto error; + /* + * Let the lifetime of the tree fragment be handled by + * the Libxslt's garbage collector. + */ + xsltRegisterPersistRVT(ctxt, container); + + oldOutput = ctxt->output; + oldInsert = ctxt->insert; + + oldXPDoc = ctxt->xpathCtxt->doc; + + ctxt->output = container; + ctxt->insert = (xmlNodePtr) container; + + ctxt->xpathCtxt->doc = ctxt->initialContextDoc; + /* + * Process the sequence constructor. + */ + xsltApplyOneTemplate(ctxt, ctxt->node, elem->tree, NULL, NULL); + + ctxt->xpathCtxt->doc = oldXPDoc; + + ctxt->insert = oldInsert; + ctxt->output = oldOutput; + + result = xmlXPathNewValueTree((xmlNodePtr) container); + if (result == NULL) { + result = xmlXPathNewCString(""); + } else { + result->boolval = 0; /* Freeing is not handled there anymore */ + } +#ifdef WITH_XSLT_DEBUG_VARIABLE +#ifdef LIBXML_DEBUG_ENABLED + if ((xsltGenericDebugContext == stdout) || + (xsltGenericDebugContext == stderr)) + xmlXPathDebugDumpObject((FILE *)xsltGenericDebugContext, + result, 0); +#endif +#endif + } + } + +error: + elem->name = oldVarName; + ctxt->inst = oldInst; + if (result != NULL) { + elem->value = result; + elem->computed = 1; + } + return(result); +} + +/** + * xsltEvalGlobalVariables: + * @ctxt: the XSLT transformation context + * + * Evaluates all global variables and parameters of a stylesheet. + * For internal use only. This is called at start of a transformation. + * + * Returns 0 in case of success, -1 in case of error + */ +int +xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) { + xsltStackElemPtr elem; + xsltStylesheetPtr style; + + if ((ctxt == NULL) || (ctxt->document == NULL)) + return(-1); + +#ifdef WITH_XSLT_DEBUG_VARIABLE + XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + "Registering global variables\n")); +#endif + /* + * Walk the list from the stylesheets and populate the hash table + */ + style = ctxt->style; + while (style != NULL) { + elem = style->variables; + +#ifdef WITH_XSLT_DEBUG_VARIABLE + if ((style->doc != NULL) && (style->doc->URL != NULL)) { + XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + "Registering global variables from %s\n", + style->doc->URL)); + } +#endif + + while (elem != NULL) { + xsltStackElemPtr def; + + /* + * Global variables are stored in the variables pool. + */ + def = (xsltStackElemPtr) + xmlHashLookup2(ctxt->globalVars, + elem->name, elem->nameURI); + if (def == NULL) { + + def = xsltCopyStackElem(elem); + xmlHashAddEntry2(ctxt->globalVars, + elem->name, elem->nameURI, def); + } else if ((elem->comp != NULL) && + (elem->comp->type == XSLT_FUNC_VARIABLE)) { + /* + * Redefinition of variables from a different stylesheet + * should not generate a message. + */ + if ((elem->comp->inst != NULL) && + (def->comp != NULL) && (def->comp->inst != NULL) && + (elem->comp->inst->doc == def->comp->inst->doc)) + { + xsltTransformError(ctxt, style, elem->comp->inst, + "Global variable %s already defined\n", elem->name); + if (style != NULL) style->errors++; + } + } + elem = elem->next; + } + + style = xsltNextImport(style); + } + + /* + * This part does the actual evaluation + */ + xmlHashScan(ctxt->globalVars, + (xmlHashScanner) xsltEvalGlobalVariable, ctxt); + + return(0); +} + +/** + * xsltRegisterGlobalVariable: + * @style: the XSLT transformation context + * @name: the variable name + * @ns_uri: the variable namespace URI + * @sel: the expression which need to be evaluated to generate a value + * @tree: the subtree if sel is NULL + * @comp: the precompiled value + * @value: the string value if available + * + * Register a new variable value. If @value is NULL it unregisters + * the variable + * + * Returns 0 in case of success, -1 in case of error + */ +static int +xsltRegisterGlobalVariable(xsltStylesheetPtr style, const xmlChar *name, + const xmlChar *ns_uri, const xmlChar *sel, + xmlNodePtr tree, xsltStylePreCompPtr comp, + const xmlChar *value) { + xsltStackElemPtr elem, tmp; + if (style == NULL) + return(-1); + if (name == NULL) + return(-1); + if (comp == NULL) + return(-1); + +#ifdef WITH_XSLT_DEBUG_VARIABLE + if (comp->type == XSLT_FUNC_PARAM) + xsltGenericDebug(xsltGenericDebugContext, + "Defining global param %s\n", name); + else + xsltGenericDebug(xsltGenericDebugContext, + "Defining global variable %s\n", name); +#endif + + elem = xsltNewStackElem(NULL); + if (elem == NULL) + return(-1); + elem->comp = comp; + elem->name = xmlDictLookup(style->dict, name, -1); + elem->select = xmlDictLookup(style->dict, sel, -1); + if (ns_uri) + elem->nameURI = xmlDictLookup(style->dict, ns_uri, -1); + elem->tree = tree; + tmp = style->variables; + if (tmp == NULL) { + elem->next = NULL; + style->variables = elem; + } else { + while (tmp != NULL) { + if ((elem->comp->type == XSLT_FUNC_VARIABLE) && + (tmp->comp->type == XSLT_FUNC_VARIABLE) && + (xmlStrEqual(elem->name, tmp->name)) && + ((elem->nameURI == tmp->nameURI) || + (xmlStrEqual(elem->nameURI, tmp->nameURI)))) + { + xsltTransformError(NULL, style, comp->inst, + "redefinition of global variable %s\n", elem->name); + style->errors++; + } + if (tmp->next == NULL) + break; + tmp = tmp->next; + } + elem->next = NULL; + tmp->next = elem; + } + if (value != NULL) { + elem->computed = 1; + elem->value = xmlXPathNewString(value); + } + return(0); +} + +/** + * xsltProcessUserParamInternal + * + * @ctxt: the XSLT transformation context + * @name: a null terminated parameter name + * @value: a null terminated value (may be an XPath expression) + * @eval: 0 to treat the value literally, else evaluate as XPath expression + * + * If @eval is 0 then @value is treated literally and is stored in the global + * parameter/variable table without any change. + * + * Uf @eval is 1 then @value is treated as an XPath expression and is + * evaluated. In this case, if you want to pass a string which will be + * interpreted literally then it must be enclosed in single or double quotes. + * If the string contains single quotes (double quotes) then it cannot be + * enclosed single quotes (double quotes). If the string which you want to + * be treated literally contains both single and double quotes (e.g. Meet + * at Joe's for "Twelfth Night" at 7 o'clock) then there is no suitable + * quoting character. You cannot use ' or " inside the string + * because the replacement of character entities with their equivalents is + * done at a different stage of processing. The solution is to call + * xsltQuoteUserParams or xsltQuoteOneUserParam. + * + * This needs to be done on parsed stylesheets before starting to apply + * transformations. Normally this will be called (directly or indirectly) + * only from xsltEvalUserParams, xsltEvalOneUserParam, xsltQuoteUserParams, + * or xsltQuoteOneUserParam. + * + * Returns 0 in case of success, -1 in case of error + */ + +static +int +xsltProcessUserParamInternal(xsltTransformContextPtr ctxt, + const xmlChar * name, + const xmlChar * value, + int eval) { + + xsltStylesheetPtr style; + const xmlChar *prefix; + const xmlChar *href; + xmlXPathCompExprPtr xpExpr; + xmlXPathObjectPtr result; + + xsltStackElemPtr elem; + int res; + void *res_ptr; + + if (ctxt == NULL) + return(-1); + if (name == NULL) + return(0); + if (value == NULL) + return(0); + + style = ctxt->style; + +#ifdef WITH_XSLT_DEBUG_VARIABLE + XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + "Evaluating user parameter %s=%s\n", name, value)); +#endif + + /* + * Name lookup + */ + href = NULL; + + if (name[0] == '{') { + int len = 0; + + while ((name[len] != 0) && (name[len] != '}')) len++; + if (name[len] == 0) { + xsltTransformError(ctxt, style, NULL, + "user param : malformed parameter name : %s\n", name); + } else { + href = xmlDictLookup(ctxt->dict, &name[1], len-1); + name = xmlDictLookup(ctxt->dict, &name[len + 1], -1); + } + } + else { + name = xsltSplitQName(ctxt->dict, name, &prefix); + if (prefix != NULL) { + xmlNsPtr ns; + + ns = xmlSearchNs(style->doc, xmlDocGetRootElement(style->doc), + prefix); + if (ns == NULL) { + xsltTransformError(ctxt, style, NULL, + "user param : no namespace bound to prefix %s\n", prefix); + href = NULL; + } else { + href = ns->href; + } + } + } + + if (name == NULL) + return (-1); + + res_ptr = xmlHashLookup2(ctxt->globalVars, name, href); + if (res_ptr != 0) { + xsltTransformError(ctxt, style, NULL, + "Global parameter %s already defined\n", name); + } + if (ctxt->globalVars == NULL) + ctxt->globalVars = xmlHashCreate(20); + + /* + * do not overwrite variables with parameters from the command line + */ + while (style != NULL) { + elem = ctxt->style->variables; + while (elem != NULL) { + if ((elem->comp != NULL) && + (elem->comp->type == XSLT_FUNC_VARIABLE) && + (xmlStrEqual(elem->name, name)) && + (xmlStrEqual(elem->nameURI, href))) { + return(0); + } + elem = elem->next; + } + style = xsltNextImport(style); + } + style = ctxt->style; + elem = NULL; + + /* + * Do the evaluation if @eval is non-zero. + */ + + result = NULL; + if (eval != 0) { + xpExpr = xmlXPathCompile(value); + if (xpExpr != NULL) { + xmlDocPtr oldXPDoc; + xmlNodePtr oldXPContextNode; + int oldXPProximityPosition, oldXPContextSize, oldXPNsNr; + xmlNsPtr *oldXPNamespaces; + xmlXPathContextPtr xpctxt = ctxt->xpathCtxt; + + /* + * Save context states. + */ + oldXPDoc = xpctxt->doc; + oldXPContextNode = xpctxt->node; + oldXPProximityPosition = xpctxt->proximityPosition; + oldXPContextSize = xpctxt->contextSize; + oldXPNamespaces = xpctxt->namespaces; + oldXPNsNr = xpctxt->nsNr; + + /* + * SPEC XSLT 1.0: + * "At top-level, the expression or template specifying the + * variable value is evaluated with the same context as that used + * to process the root node of the source document: the current + * node is the root node of the source document and the current + * node list is a list containing just the root node of the source + * document." + */ + xpctxt->doc = ctxt->initialContextDoc; + xpctxt->node = ctxt->initialContextNode; + xpctxt->contextSize = 1; + xpctxt->proximityPosition = 1; + /* + * There is really no in scope namespace for parameters on the + * command line. + */ + xpctxt->namespaces = NULL; + xpctxt->nsNr = 0; + + result = xmlXPathCompiledEval(xpExpr, xpctxt); + + /* + * Restore Context states. + */ + xpctxt->doc = oldXPDoc; + xpctxt->node = oldXPContextNode; + xpctxt->contextSize = oldXPContextSize; + xpctxt->proximityPosition = oldXPProximityPosition; + xpctxt->namespaces = oldXPNamespaces; + xpctxt->nsNr = oldXPNsNr; + + xmlXPathFreeCompExpr(xpExpr); + } + if (result == NULL) { + xsltTransformError(ctxt, style, NULL, + "Evaluating user parameter %s failed\n", name); + ctxt->state = XSLT_STATE_STOPPED; + return(-1); + } + } + + /* + * If @eval is 0 then @value is to be taken literally and result is NULL + * + * If @eval is not 0, then @value is an XPath expression and has been + * successfully evaluated and result contains the resulting value and + * is not NULL. + * + * Now create an xsltStackElemPtr for insertion into the context's + * global variable/parameter hash table. + */ + +#ifdef WITH_XSLT_DEBUG_VARIABLE +#ifdef LIBXML_DEBUG_ENABLED + if ((xsltGenericDebugContext == stdout) || + (xsltGenericDebugContext == stderr)) + xmlXPathDebugDumpObject((FILE *)xsltGenericDebugContext, + result, 0); +#endif +#endif + + elem = xsltNewStackElem(NULL); + if (elem != NULL) { + elem->name = name; + elem->select = xmlDictLookup(ctxt->dict, value, -1); + if (href != NULL) + elem->nameURI = xmlDictLookup(ctxt->dict, href, -1); + elem->tree = NULL; + elem->computed = 1; + if (eval == 0) { + elem->value = xmlXPathNewString(value); + } + else { + elem->value = result; + } + } + + /* + * Global parameters are stored in the XPath context variables pool. + */ + + res = xmlHashAddEntry2(ctxt->globalVars, name, href, elem); + if (res != 0) { + xsltFreeStackElem(elem); + xsltTransformError(ctxt, style, NULL, + "Global parameter %s already defined\n", name); + } + return(0); +} + +/** + * xsltEvalUserParams: + * + * @ctxt: the XSLT transformation context + * @params: a NULL terminated array of parameters name/value tuples + * + * Evaluate the global variables of a stylesheet. This needs to be + * done on parsed stylesheets before starting to apply transformations. + * Each of the parameters is evaluated as an XPath expression and stored + * in the global variables/parameter hash table. If you want your + * parameter used literally, use xsltQuoteUserParams. + * + * Returns 0 in case of success, -1 in case of error + */ + +int +xsltEvalUserParams(xsltTransformContextPtr ctxt, const char **params) { + int indx = 0; + const xmlChar *name; + const xmlChar *value; + + if (params == NULL) + return(0); + while (params[indx] != NULL) { + name = (const xmlChar *) params[indx++]; + value = (const xmlChar *) params[indx++]; + if (xsltEvalOneUserParam(ctxt, name, value) != 0) + return(-1); + } + return 0; +} + +/** + * xsltQuoteUserParams: + * + * @ctxt: the XSLT transformation context + * @params: a NULL terminated arry of parameters names/values tuples + * + * Similar to xsltEvalUserParams, but the values are treated literally and + * are * *not* evaluated as XPath expressions. This should be done on parsed + * stylesheets before starting to apply transformations. + * + * Returns 0 in case of success, -1 in case of error. + */ + +int +xsltQuoteUserParams(xsltTransformContextPtr ctxt, const char **params) { + int indx = 0; + const xmlChar *name; + const xmlChar *value; + + if (params == NULL) + return(0); + while (params[indx] != NULL) { + name = (const xmlChar *) params[indx++]; + value = (const xmlChar *) params[indx++]; + if (xsltQuoteOneUserParam(ctxt, name, value) != 0) + return(-1); + } + return 0; +} + +/** + * xsltEvalOneUserParam: + * @ctxt: the XSLT transformation context + * @name: a null terminated string giving the name of the parameter + * @value: a null terminated string giving the XPath expression to be evaluated + * + * This is normally called from xsltEvalUserParams to process a single + * parameter from a list of parameters. The @value is evaluated as an + * XPath expression and the result is stored in the context's global + * variable/parameter hash table. + * + * To have a parameter treated literally (not as an XPath expression) + * use xsltQuoteUserParams (or xsltQuoteOneUserParam). For more + * details see description of xsltProcessOneUserParamInternal. + * + * Returns 0 in case of success, -1 in case of error. + */ + +int +xsltEvalOneUserParam(xsltTransformContextPtr ctxt, + const xmlChar * name, + const xmlChar * value) { + return xsltProcessUserParamInternal(ctxt, name, value, + 1 /* xpath eval ? */); +} + +/** + * xsltQuoteOneUserParam: + * @ctxt: the XSLT transformation context + * @name: a null terminated string giving the name of the parameter + * @value: a null terminated string giving the parameter value + * + * This is normally called from xsltQuoteUserParams to process a single + * parameter from a list of parameters. The @value is stored in the + * context's global variable/parameter hash table. + * + * Returns 0 in case of success, -1 in case of error. + */ + +int +xsltQuoteOneUserParam(xsltTransformContextPtr ctxt, + const xmlChar * name, + const xmlChar * value) { + return xsltProcessUserParamInternal(ctxt, name, value, + 0 /* xpath eval ? */); +} + +/** + * xsltBuildVariable: + * @ctxt: the XSLT transformation context + * @comp: the precompiled form + * @tree: the tree if select is NULL + * + * Computes a new variable value. + * + * Returns the xsltStackElemPtr or NULL in case of error + */ +static xsltStackElemPtr +xsltBuildVariable(xsltTransformContextPtr ctxt, + xsltStylePreCompPtr castedComp, + xmlNodePtr tree) +{ +#ifdef XSLT_REFACTORED + xsltStyleBasicItemVariablePtr comp = + (xsltStyleBasicItemVariablePtr) castedComp; +#else + xsltStylePreCompPtr comp = castedComp; +#endif + xsltStackElemPtr elem; + +#ifdef WITH_XSLT_DEBUG_VARIABLE + XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + "Building variable %s", comp->name)); + if (comp->select != NULL) + XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + " select %s", comp->select)); + XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, "\n")); +#endif + + elem = xsltNewStackElem(ctxt); + if (elem == NULL) + return(NULL); + elem->comp = (xsltStylePreCompPtr) comp; + elem->name = comp->name; + elem->select = comp->select; + elem->nameURI = comp->ns; + elem->tree = tree; + elem->value = xsltEvalVariable(ctxt, elem, + (xsltStylePreCompPtr) comp); + if (elem->value != NULL) + elem->computed = 1; + return(elem); +} + +/** + * xsltRegisterVariable: + * @ctxt: the XSLT transformation context + * @comp: the compiled XSLT-variable (or param) instruction + * @tree: the tree if select is NULL + * @isParam: indicates if this is a parameter + * + * Computes and registers a new variable. + * + * Returns 0 in case of success, -1 in case of error + */ +static int +xsltRegisterVariable(xsltTransformContextPtr ctxt, + xsltStylePreCompPtr castedComp, + xmlNodePtr tree, int isParam) +{ +#ifdef XSLT_REFACTORED + xsltStyleBasicItemVariablePtr comp = + (xsltStyleBasicItemVariablePtr) castedComp; +#else + xsltStylePreCompPtr comp = castedComp; + int present; +#endif + xsltStackElemPtr variable; + +#ifdef XSLT_REFACTORED + /* + * REFACTORED NOTE: Redefinitions of vars/params are checked + * at compilation time in the refactored code. + * xsl:with-param parameters are checked in xsltApplyXSLTTemplate(). + */ +#else + present = xsltCheckStackElem(ctxt, comp->name, comp->ns); + if (isParam == 0) { + if ((present != 0) && (present != 3)) { + /* TODO: report QName. */ + xsltTransformError(ctxt, NULL, comp->inst, + "XSLT-variable: Redefinition of variable '%s'.\n", comp->name); + return(0); + } + } else if (present != 0) { + if ((present == 1) || (present == 2)) { + /* TODO: report QName. */ + xsltTransformError(ctxt, NULL, comp->inst, + "XSLT-param: Redefinition of parameter '%s'.\n", comp->name); + return(0); + } +#ifdef WITH_XSLT_DEBUG_VARIABLE + XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + "param %s defined by caller\n", comp->name)); +#endif + return(0); + } +#endif /* else of XSLT_REFACTORED */ + + variable = xsltBuildVariable(ctxt, (xsltStylePreCompPtr) comp, tree); + xsltAddStackElem(ctxt, variable); + return(0); +} + +/** + * xsltGlobalVariableLookup: + * @ctxt: the XSLT transformation context + * @name: the variable name + * @ns_uri: the variable namespace URI + * + * Search in the Variable array of the context for the given + * variable value. + * + * Returns the value or NULL if not found + */ +static xmlXPathObjectPtr +xsltGlobalVariableLookup(xsltTransformContextPtr ctxt, const xmlChar *name, + const xmlChar *ns_uri) { + xsltStackElemPtr elem; + xmlXPathObjectPtr ret = NULL; + + /* + * Lookup the global variables in XPath global variable hash table + */ + if ((ctxt->xpathCtxt == NULL) || (ctxt->globalVars == NULL)) + return(NULL); + elem = (xsltStackElemPtr) + xmlHashLookup2(ctxt->globalVars, name, ns_uri); + if (elem == NULL) { +#ifdef WITH_XSLT_DEBUG_VARIABLE + XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + "global variable not found %s\n", name)); +#endif + return(NULL); + } + /* + * URGENT TODO: Move the detection of recursive definitions + * to compile-time. + */ + if (elem->computed == 0) { + if (elem->name == xsltComputingGlobalVarMarker) { + xsltTransformError(ctxt, NULL, elem->comp->inst, + "Recursive definition of %s\n", name); + return(NULL); + } + ret = xsltEvalGlobalVariable(elem, ctxt); + } else + ret = elem->value; + return(xmlXPathObjectCopy(ret)); +} + +/** + * xsltVariableLookup: + * @ctxt: the XSLT transformation context + * @name: the variable name + * @ns_uri: the variable namespace URI + * + * Search in the Variable array of the context for the given + * variable value. + * + * Returns the value or NULL if not found + */ +xmlXPathObjectPtr +xsltVariableLookup(xsltTransformContextPtr ctxt, const xmlChar *name, + const xmlChar *ns_uri) { + xsltStackElemPtr elem; + + if (ctxt == NULL) + return(NULL); + + elem = xsltStackLookup(ctxt, name, ns_uri); + if (elem == NULL) { + return(xsltGlobalVariableLookup(ctxt, name, ns_uri)); + } + if (elem->computed == 0) { +#ifdef WITH_XSLT_DEBUG_VARIABLE + XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + "uncomputed variable %s\n", name)); +#endif + elem->value = xsltEvalVariable(ctxt, elem, NULL); + elem->computed = 1; + } + if (elem->value != NULL) + return(xmlXPathObjectCopy(elem->value)); +#ifdef WITH_XSLT_DEBUG_VARIABLE + XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + "variable not found %s\n", name)); +#endif + return(NULL); +} + +/** + * xsltParseStylesheetCallerParam: + * @ctxt: the XSLT transformation context + * @inst: the xsl:with-param instruction element + * + * Processes an xsl:with-param instruction at transformation time. + * The value is compute, but not recorded. + * NOTE that this is also called with an *xsl:param* element + * from exsltFuncFunctionFunction(). + * + * Returns the new xsltStackElemPtr or NULL + */ + +xsltStackElemPtr +xsltParseStylesheetCallerParam(xsltTransformContextPtr ctxt, xmlNodePtr inst) +{ +#ifdef XSLT_REFACTORED + xsltStyleBasicItemVariablePtr comp; +#else + xsltStylePreCompPtr comp; +#endif + xmlNodePtr tree = NULL; /* The first child node of the instruction or + the instruction itself. */ + xsltStackElemPtr param = NULL; + + if ((ctxt == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) + return(NULL); + +#ifdef XSLT_REFACTORED + comp = (xsltStyleBasicItemVariablePtr) inst->psvi; +#else + comp = (xsltStylePreCompPtr) inst->psvi; +#endif + + if (comp == NULL) { + xsltTransformError(ctxt, NULL, inst, + "Internal error in xsltParseStylesheetCallerParam(): " + "The XSLT 'with-param' instruction was not compiled.\n"); + return(NULL); + } + if (comp->name == NULL) { + xsltTransformError(ctxt, NULL, inst, + "Internal error in xsltParseStylesheetCallerParam(): " + "XSLT 'with-param': The attribute 'name' was not compiled.\n"); + return(NULL); + } + +#ifdef WITH_XSLT_DEBUG_VARIABLE + XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + "Handling xsl:with-param %s\n", comp->name)); +#endif + + if (comp->select == NULL) { + tree = inst->children; + } else { +#ifdef WITH_XSLT_DEBUG_VARIABLE + XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + " select %s\n", comp->select)); +#endif + tree = inst; + } + + param = xsltBuildVariable(ctxt, (xsltStylePreCompPtr) comp, tree); + + return(param); +} + +/** + * xsltParseGlobalVariable: + * @style: the XSLT stylesheet + * @cur: the "variable" element + * + * Parses a global XSLT 'variable' declaration at compilation time + * and registers it + */ +void +xsltParseGlobalVariable(xsltStylesheetPtr style, xmlNodePtr cur) +{ +#ifdef XSLT_REFACTORED + xsltStyleItemVariablePtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + /* + * Note that xsltStylePreCompute() will be called from + * xslt.c only. + */ + comp = (xsltStyleItemVariablePtr) cur->psvi; +#else + xsltStylePreCompute(style, cur); + comp = (xsltStylePreCompPtr) cur->psvi; +#endif + if (comp == NULL) { + xsltTransformError(NULL, style, cur, + "xsl:variable : compilation failed\n"); + return; + } + + if (comp->name == NULL) { + xsltTransformError(NULL, style, cur, + "xsl:variable : missing name attribute\n"); + return; + } + + /* + * Parse the content (a sequence constructor) of xsl:variable. + */ + if (cur->children != NULL) { +#ifdef XSLT_REFACTORED + xsltParseSequenceConstructor(XSLT_CCTXT(style), cur->children); +#else + xsltParseTemplateContent(style, cur); +#endif + } +#ifdef WITH_XSLT_DEBUG_VARIABLE + xsltGenericDebug(xsltGenericDebugContext, + "Registering global variable %s\n", comp->name); +#endif + + xsltRegisterGlobalVariable(style, comp->name, comp->ns, + comp->select, cur->children, (xsltStylePreCompPtr) comp, + NULL); +} + +/** + * xsltParseGlobalParam: + * @style: the XSLT stylesheet + * @cur: the "param" element + * + * parse an XSLT transformation param declaration and record + * its value. + */ + +void +xsltParseGlobalParam(xsltStylesheetPtr style, xmlNodePtr cur) { +#ifdef XSLT_REFACTORED + xsltStyleItemParamPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) + return; + +#ifdef XSLT_REFACTORED + /* + * Note that xsltStylePreCompute() will be called from + * xslt.c only. + */ + comp = (xsltStyleItemParamPtr) cur->psvi; +#else + xsltStylePreCompute(style, cur); + comp = (xsltStylePreCompPtr) cur->psvi; +#endif + if (comp == NULL) { + xsltTransformError(NULL, style, cur, + "xsl:param : compilation failed\n"); + return; + } + + if (comp->name == NULL) { + xsltTransformError(NULL, style, cur, + "xsl:param : missing name attribute\n"); + return; + } + + /* + * Parse the content (a sequence constructor) of xsl:param. + */ + if (cur->children != NULL) { +#ifdef XSLT_REFACTORED + xsltParseSequenceConstructor(XSLT_CCTXT(style), cur->children); +#else + xsltParseTemplateContent(style, cur); +#endif + } + +#ifdef WITH_XSLT_DEBUG_VARIABLE + xsltGenericDebug(xsltGenericDebugContext, + "Registering global param %s\n", comp->name); +#endif + + xsltRegisterGlobalVariable(style, comp->name, comp->ns, + comp->select, cur->children, (xsltStylePreCompPtr) comp, + NULL); +} + +/** + * xsltParseStylesheetVariable: + * @ctxt: the XSLT transformation context + * @inst: the xsl:variable instruction element + * + * Registers a local XSLT 'variable' instruction at transformation time + * and evaluates its value. + */ +void +xsltParseStylesheetVariable(xsltTransformContextPtr ctxt, xmlNodePtr inst) +{ +#ifdef XSLT_REFACTORED + xsltStyleItemVariablePtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((inst == NULL) || (ctxt == NULL) || (inst->type != XML_ELEMENT_NODE)) + return; + + comp = inst->psvi; + if (comp == NULL) { + xsltTransformError(ctxt, NULL, inst, + "Internal error in xsltParseStylesheetVariable(): " + "The XSLT 'variable' instruction was not compiled.\n"); + return; + } + if (comp->name == NULL) { + xsltTransformError(ctxt, NULL, inst, + "Internal error in xsltParseStylesheetVariable(): " + "The attribute 'name' was not compiled.\n"); + return; + } + +#ifdef WITH_XSLT_DEBUG_VARIABLE + XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + "Registering variable '%s'\n", comp->name)); +#endif + + xsltRegisterVariable(ctxt, (xsltStylePreCompPtr) comp, inst->children, 0); +} + +/** + * xsltParseStylesheetParam: + * @ctxt: the XSLT transformation context + * @cur: the XSLT 'param' element + * + * Registers a local XSLT 'param' declaration at transformation time and + * evaluates its value. + */ +void +xsltParseStylesheetParam(xsltTransformContextPtr ctxt, xmlNodePtr cur) +{ +#ifdef XSLT_REFACTORED + xsltStyleItemParamPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + + if ((cur == NULL) || (ctxt == NULL) || (cur->type != XML_ELEMENT_NODE)) + return; + + comp = cur->psvi; + if ((comp == NULL) || (comp->name == NULL)) { + xsltTransformError(ctxt, NULL, cur, + "Internal error in xsltParseStylesheetParam(): " + "The XSLT 'param' declaration was not compiled correctly.\n"); + return; + } + +#ifdef WITH_XSLT_DEBUG_VARIABLE + XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + "Registering param %s\n", comp->name)); +#endif + + xsltRegisterVariable(ctxt, (xsltStylePreCompPtr) comp, cur->children, 1); +} + +/** + * xsltFreeGlobalVariables: + * @ctxt: the XSLT transformation context + * + * Free up the data associated to the global variables + * its value. + */ + +void +xsltFreeGlobalVariables(xsltTransformContextPtr ctxt) { + xmlHashFree(ctxt->globalVars, (xmlHashDeallocator) xsltFreeStackElem); +} + +/** + * xsltXPathVariableLookup: + * @ctxt: a void * but the the XSLT transformation context actually + * @name: the variable name + * @ns_uri: the variable namespace URI + * + * This is the entry point when a varibale is needed by the XPath + * interpretor. + * + * Returns the value or NULL if not found + */ +xmlXPathObjectPtr +xsltXPathVariableLookup(void *ctxt, const xmlChar *name, + const xmlChar *ns_uri) { + xsltTransformContextPtr tctxt; + xmlXPathObjectPtr valueObj = NULL; + + if ((ctxt == NULL) || (name == NULL)) + return(NULL); + +#ifdef WITH_XSLT_DEBUG_VARIABLE + XSLT_TRACE(((xsltTransformContextPtr)ctxt),XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + "Lookup variable '%s'\n", name)); +#endif + + tctxt = (xsltTransformContextPtr) ctxt; + /* + * Local variables/params --------------------------------------------- + * + * Do the lookup from the top of the stack, but + * don't use params being computed in a call-param + * First lookup expects the variable name and URI to + * come from the disctionnary and hence pointer comparison. + */ + if (tctxt->varsNr != 0) { + int i; + xsltStackElemPtr variable = NULL, cur; + + for (i = tctxt->varsNr; i > tctxt->varsBase; i--) { + cur = tctxt->varsTab[i-1]; + if ((cur->name == name) && (cur->nameURI == ns_uri)) { +#if 0 + stack_addr++; +#endif + variable = cur; + goto local_variable_found; + } + cur = cur->next; + } + /* + * Redo the lookup with interned strings to avoid string comparison. + * + * OPTIMIZE TODO: The problem here is, that if we request a + * global variable, then this will be also executed. + */ + { + const xmlChar *tmpName = name, *tmpNsName = ns_uri; + + name = xmlDictLookup(tctxt->dict, name, -1); + if (ns_uri) + ns_uri = xmlDictLookup(tctxt->dict, ns_uri, -1); + if ((tmpName != name) || (tmpNsName != ns_uri)) { + for (i = tctxt->varsNr; i > tctxt->varsBase; i--) { + cur = tctxt->varsTab[i-1]; + if ((cur->name == name) && (cur->nameURI == ns_uri)) { +#if 0 + stack_cmp++; +#endif + variable = cur; + goto local_variable_found; + } + } + } + } + +local_variable_found: + + if (variable) { + if (variable->computed == 0) { + +#ifdef WITH_XSLT_DEBUG_VARIABLE + XSLT_TRACE(tctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + "uncomputed variable '%s'\n", name)); +#endif + variable->value = xsltEvalVariable(tctxt, variable, NULL); + variable->computed = 1; + } + if (variable->value != NULL) { + valueObj = xmlXPathObjectCopy(variable->value); + } + return(valueObj); + } + } + /* + * Global variables/params -------------------------------------------- + */ + if (tctxt->globalVars) { + valueObj = xsltGlobalVariableLookup(tctxt, name, ns_uri); + } + + if (valueObj == NULL) { + +#ifdef WITH_XSLT_DEBUG_VARIABLE + XSLT_TRACE(tctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + "variable not found '%s'\n", name)); +#endif + + if (ns_uri) { + xsltTransformError(tctxt, NULL, tctxt->inst, + "Variable '{%s}%s' has not been declared.\n", ns_uri, name); + } else { + xsltTransformError(tctxt, NULL, tctxt->inst, + "Variable '%s' has not been declared.\n", name); + } + } else { + +#ifdef WITH_XSLT_DEBUG_VARIABLE + XSLT_TRACE(tctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext, + "found variable '%s'\n", name)); +#endif + } + + return(valueObj); +} + + diff --git a/libxslt/variables.h b/libxslt/variables.h new file mode 100644 index 0000000..17b4c6f --- /dev/null +++ b/libxslt/variables.h @@ -0,0 +1,91 @@ +/* + * Summary: interface for the variable matching and lookup. + * Description: interface for the variable matching and lookup. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XSLT_VARIABLES_H__ +#define __XML_XSLT_VARIABLES_H__ + +#include +#include +#include "xsltexports.h" +#include "xsltInternals.h" +#include "functions.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * XSLT_REGISTER_VARIABLE_LOOKUP: + * + * Registering macro, not general purpose at all but used in different modules. + */ + +#define XSLT_REGISTER_VARIABLE_LOOKUP(ctxt) \ + xmlXPathRegisterVariableLookup((ctxt)->xpathCtxt, \ + xsltXPathVariableLookup, (void *)(ctxt)); \ + xsltRegisterAllFunctions((ctxt)->xpathCtxt); \ + xsltRegisterAllElement(ctxt); \ + (ctxt)->xpathCtxt->extra = ctxt + +/* + * Interfaces for the variable module. + */ + +XSLTPUBFUN int XSLTCALL + xsltEvalGlobalVariables (xsltTransformContextPtr ctxt); +XSLTPUBFUN int XSLTCALL + xsltEvalUserParams (xsltTransformContextPtr ctxt, + const char **params); +XSLTPUBFUN int XSLTCALL + xsltQuoteUserParams (xsltTransformContextPtr ctxt, + const char **params); +XSLTPUBFUN int XSLTCALL + xsltEvalOneUserParam (xsltTransformContextPtr ctxt, + const xmlChar * name, + const xmlChar * value); +XSLTPUBFUN int XSLTCALL + xsltQuoteOneUserParam (xsltTransformContextPtr ctxt, + const xmlChar * name, + const xmlChar * value); + +XSLTPUBFUN void XSLTCALL + xsltParseGlobalVariable (xsltStylesheetPtr style, + xmlNodePtr cur); +XSLTPUBFUN void XSLTCALL + xsltParseGlobalParam (xsltStylesheetPtr style, + xmlNodePtr cur); +XSLTPUBFUN void XSLTCALL + xsltParseStylesheetVariable (xsltTransformContextPtr ctxt, + xmlNodePtr cur); +XSLTPUBFUN void XSLTCALL + xsltParseStylesheetParam (xsltTransformContextPtr ctxt, + xmlNodePtr cur); +XSLTPUBFUN xsltStackElemPtr XSLTCALL + xsltParseStylesheetCallerParam (xsltTransformContextPtr ctxt, + xmlNodePtr cur); +XSLTPUBFUN int XSLTCALL + xsltAddStackElemList (xsltTransformContextPtr ctxt, + xsltStackElemPtr elems); +XSLTPUBFUN void XSLTCALL + xsltFreeGlobalVariables (xsltTransformContextPtr ctxt); +XSLTPUBFUN xmlXPathObjectPtr XSLTCALL + xsltVariableLookup (xsltTransformContextPtr ctxt, + const xmlChar *name, + const xmlChar *ns_uri); +XSLTPUBFUN xmlXPathObjectPtr XSLTCALL + xsltXPathVariableLookup (void *ctxt, + const xmlChar *name, + const xmlChar *ns_uri); +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XSLT_VARIABLES_H__ */ + diff --git a/libxslt/win32config.h b/libxslt/win32config.h new file mode 100644 index 0000000..8fe7042 --- /dev/null +++ b/libxslt/win32config.h @@ -0,0 +1,129 @@ +/* + * Summary: Windows configuration header + * Description: Windows configuration header + * + * Copy: See Copyright for the status of this software. + * + * Author: Igor Zlatkovic + */ +#ifndef __LIBXSLT_WIN32_CONFIG__ +#define __LIBXSLT_WIN32_CONFIG__ + +#define HAVE_CTYPE_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_TIME_H 1 +#define HAVE_LOCALTIME 1 +#define HAVE_GMTIME 1 +#define HAVE_TIME 1 +#define HAVE_MATH_H 1 +#define HAVE_FCNTL_H 1 + +#include + +#define HAVE_ISINF +#define HAVE_ISNAN + +#include +#if defined _MSC_VER || defined __MINGW32__ +/* MS C-runtime has functions which can be used in order to determine if + a given floating-point variable contains NaN, (+-)INF. These are + preferred, because floating-point technology is considered propriatary + by MS and we can assume that their functions know more about their + oddities than we do. */ +#include +/* Bjorn Reese figured a quite nice construct for isinf() using the + _fpclass() function. */ +#ifndef isinf +#define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \ + : ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0)) +#endif +/* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */ +#ifndef isnan +#define isnan(d) (_isnan(d)) +#endif +#else /* _MSC_VER */ +static int isinf (double d) { + int expon = 0; + double val = frexp (d, &expon); + if (expon == 1025) { + if (val == 0.5) { + return 1; + } else if (val == -0.5) { + return -1; + } else { + return 0; + } + } else { + return 0; + } +} +static int isnan (double d) { + int expon = 0; + double val = frexp (d, &expon); + if (expon == 1025) { + if (val == 0.5) { + return 0; + } else if (val == -0.5) { + return 0; + } else { + return 1; + } + } else { + return 0; + } +} +#endif /* _MSC_VER */ + +#include + +/* snprintf emulation taken from http://stackoverflow.com/a/8712996/1956010 */ +#if defined(_MSC_VER) && _MSC_VER < 1900 + +#include +#include + +#define snprintf c99_snprintf +#define vsnprintf c99_vsnprintf + +__inline int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap) +{ + int count = -1; + + if (size != 0) + count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap); + if (count == -1) + count = _vscprintf(format, ap); + + return count; +} + +__inline int c99_snprintf(char *outBuf, size_t size, const char *format, ...) +{ + int count; + va_list ap; + + va_start(ap, format); + count = c99_vsnprintf(outBuf, size, format, ap); + va_end(ap); + + return count; +} + +#endif /* defined(_MSC_VER) && _MSC_VER < 1900 */ + +#define HAVE_SYS_STAT_H +#define HAVE__STAT +#define HAVE_STRING_H + +#include + +#ifndef ATTRIBUTE_UNUSED +#define ATTRIBUTE_UNUSED +#endif + +#define _WINSOCKAPI_ + +#endif /* __LIBXSLT_WIN32_CONFIG__ */ + diff --git a/libxslt/xslt.c b/libxslt/xslt.c new file mode 100644 index 0000000..bca91ee --- /dev/null +++ b/libxslt/xslt.c @@ -0,0 +1,6997 @@ +/* + * xslt.c: Implemetation of an XSL Transformation 1.0 engine + * + * Reference: + * XSLT specification + * http://www.w3.org/TR/1999/REC-xslt-19991116 + * + * Associating Style Sheets with XML documents + * http://www.w3.org/1999/06/REC-xml-stylesheet-19990629 + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "xslt.h" +#include "xsltInternals.h" +#include "pattern.h" +#include "variables.h" +#include "namespaces.h" +#include "attributes.h" +#include "xsltutils.h" +#include "imports.h" +#include "keys.h" +#include "documents.h" +#include "extensions.h" +#include "preproc.h" +#include "extra.h" +#include "security.h" + +#ifdef WITH_XSLT_DEBUG +#define WITH_XSLT_DEBUG_PARSING +/* #define WITH_XSLT_DEBUG_BLANKS */ +#endif + +const char *xsltEngineVersion = LIBXSLT_VERSION_STRING LIBXSLT_VERSION_EXTRA; +const int xsltLibxsltVersion = LIBXSLT_VERSION; +const int xsltLibxmlVersion = LIBXML_VERSION; + +#ifdef XSLT_REFACTORED + +const xmlChar *xsltConstNamespaceNameXSLT = (const xmlChar *) XSLT_NAMESPACE; + +#define XSLT_ELEMENT_CATEGORY_XSLT 0 +#define XSLT_ELEMENT_CATEGORY_EXTENSION 1 +#define XSLT_ELEMENT_CATEGORY_LRE 2 + +/* +* xsltLiteralResultMarker: +* Marker for Literal result elements, in order to avoid multiple attempts +* to recognize such elements in the stylesheet's tree. +* This marker is set on node->psvi during the initial traversal +* of a stylesheet's node tree. +* +const xmlChar *xsltLiteralResultMarker = + (const xmlChar *) "Literal Result Element"; +*/ + +/* +* xsltXSLTTextMarker: +* Marker for xsl:text elements. Used to recognize xsl:text elements +* for post-processing of the stylesheet's tree, where those +* elements are removed from the tree. +*/ +const xmlChar *xsltXSLTTextMarker = (const xmlChar *) "XSLT Text Element"; + +/* +* xsltXSLTAttrMarker: +* Marker for XSLT attribute on Literal Result Elements. +*/ +const xmlChar *xsltXSLTAttrMarker = (const xmlChar *) "LRE XSLT Attr"; + +#endif + +#ifdef XSLT_LOCALE_WINAPI +extern xmlRMutexPtr xsltLocaleMutex; +#endif +/* + * Harmless but avoiding a problem when compiling against a + * libxml <= 2.3.11 without LIBXML_DEBUG_ENABLED + */ +#ifndef LIBXML_DEBUG_ENABLED +double xmlXPathStringEvalNumber(const xmlChar *str); +#endif +/* + * Useful macros + */ + +#ifdef IS_BLANK +#undef IS_BLANK +#endif +#define IS_BLANK(c) (((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) || \ + ((c) == 0x0D)) + +#ifdef IS_BLANK_NODE +#undef IS_BLANK_NODE +#endif +#define IS_BLANK_NODE(n) \ + (((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content))) + +/** + * xsltParseContentError: + * + * @style: the stylesheet + * @node: the node where the error occured + * + * Compile-time error function. + */ +static void +xsltParseContentError(xsltStylesheetPtr style, + xmlNodePtr node) +{ + if ((style == NULL) || (node == NULL)) + return; + + if (IS_XSLT_ELEM(node)) + xsltTransformError(NULL, style, node, + "The XSLT-element '%s' is not allowed at this position.\n", + node->name); + else + xsltTransformError(NULL, style, node, + "The element '%s' is not allowed at this position.\n", + node->name); + style->errors++; +} + +#ifdef XSLT_REFACTORED +#else +/** + * exclPrefixPush: + * @style: the transformation stylesheet + * @value: the excluded namespace name to push on the stack + * + * Push an excluded namespace name on the stack + * + * Returns the new index in the stack or -1 if already present or + * in case of error + */ +static int +exclPrefixPush(xsltStylesheetPtr style, xmlChar * value) +{ + int i; + + if (style->exclPrefixMax == 0) { + style->exclPrefixMax = 4; + style->exclPrefixTab = + (xmlChar * *)xmlMalloc(style->exclPrefixMax * + sizeof(style->exclPrefixTab[0])); + if (style->exclPrefixTab == NULL) { + xmlGenericError(xmlGenericErrorContext, "malloc failed !\n"); + return (-1); + } + } + /* do not push duplicates */ + for (i = 0;i < style->exclPrefixNr;i++) { + if (xmlStrEqual(style->exclPrefixTab[i], value)) + return(-1); + } + if (style->exclPrefixNr >= style->exclPrefixMax) { + style->exclPrefixMax *= 2; + style->exclPrefixTab = + (xmlChar * *)xmlRealloc(style->exclPrefixTab, + style->exclPrefixMax * + sizeof(style->exclPrefixTab[0])); + if (style->exclPrefixTab == NULL) { + xmlGenericError(xmlGenericErrorContext, "realloc failed !\n"); + return (-1); + } + } + style->exclPrefixTab[style->exclPrefixNr] = value; + style->exclPrefix = value; + return (style->exclPrefixNr++); +} +/** + * exclPrefixPop: + * @style: the transformation stylesheet + * + * Pop an excluded prefix value from the stack + * + * Returns the stored excluded prefix value + */ +static xmlChar * +exclPrefixPop(xsltStylesheetPtr style) +{ + xmlChar *ret; + + if (style->exclPrefixNr <= 0) + return (0); + style->exclPrefixNr--; + if (style->exclPrefixNr > 0) + style->exclPrefix = style->exclPrefixTab[style->exclPrefixNr - 1]; + else + style->exclPrefix = NULL; + ret = style->exclPrefixTab[style->exclPrefixNr]; + style->exclPrefixTab[style->exclPrefixNr] = 0; + return (ret); +} +#endif + +/************************************************************************ + * * + * Helper functions * + * * + ************************************************************************/ + +static int initialized = 0; +/** + * xsltInit: + * + * Initializes the processor (e.g. registers built-in extensions, + * etc.) + */ +void +xsltInit (void) { + if (initialized == 0) { + initialized = 1; +#ifdef XSLT_LOCALE_WINAPI + xsltLocaleMutex = xmlNewRMutex(); +#endif + xsltRegisterAllExtras(); + } +} + +/** + * xsltUninit: + * + * Uninitializes the processor. + */ +void +xsltUninit (void) { +#ifdef XSLT_LOCALE_WINAPI + xmlFreeRMutex(xsltLocaleMutex); + xsltLocaleMutex = NULL; +#endif + initialized = 0; +} + +/** + * xsltIsBlank: + * @str: a string + * + * Check if a string is ignorable + * + * Returns 1 if the string is NULL or made of blanks chars, 0 otherwise + */ +int +xsltIsBlank(xmlChar *str) { + if (str == NULL) + return(1); + while (*str != 0) { + if (!(IS_BLANK(*str))) return(0); + str++; + } + return(1); +} + +/************************************************************************ + * * + * Routines to handle XSLT data structures * + * * + ************************************************************************/ +static xsltDecimalFormatPtr +xsltNewDecimalFormat(xmlChar *name) +{ + xsltDecimalFormatPtr self; + /* UTF-8 for 0x2030 */ + static const xmlChar permille[4] = {0xe2, 0x80, 0xb0, 0}; + + self = xmlMalloc(sizeof(xsltDecimalFormat)); + if (self != NULL) { + self->next = NULL; + self->name = name; + + /* Default values */ + self->digit = xmlStrdup(BAD_CAST("#")); + self->patternSeparator = xmlStrdup(BAD_CAST(";")); + self->decimalPoint = xmlStrdup(BAD_CAST(".")); + self->grouping = xmlStrdup(BAD_CAST(",")); + self->percent = xmlStrdup(BAD_CAST("%")); + self->permille = xmlStrdup(BAD_CAST(permille)); + self->zeroDigit = xmlStrdup(BAD_CAST("0")); + self->minusSign = xmlStrdup(BAD_CAST("-")); + self->infinity = xmlStrdup(BAD_CAST("Infinity")); + self->noNumber = xmlStrdup(BAD_CAST("NaN")); + } + return self; +} + +static void +xsltFreeDecimalFormat(xsltDecimalFormatPtr self) +{ + if (self != NULL) { + if (self->digit) + xmlFree(self->digit); + if (self->patternSeparator) + xmlFree(self->patternSeparator); + if (self->decimalPoint) + xmlFree(self->decimalPoint); + if (self->grouping) + xmlFree(self->grouping); + if (self->percent) + xmlFree(self->percent); + if (self->permille) + xmlFree(self->permille); + if (self->zeroDigit) + xmlFree(self->zeroDigit); + if (self->minusSign) + xmlFree(self->minusSign); + if (self->infinity) + xmlFree(self->infinity); + if (self->noNumber) + xmlFree(self->noNumber); + if (self->name) + xmlFree(self->name); + xmlFree(self); + } +} + +static void +xsltFreeDecimalFormatList(xsltStylesheetPtr self) +{ + xsltDecimalFormatPtr iter; + xsltDecimalFormatPtr tmp; + + if (self == NULL) + return; + + iter = self->decimalFormat; + while (iter != NULL) { + tmp = iter->next; + xsltFreeDecimalFormat(iter); + iter = tmp; + } +} + +/** + * xsltDecimalFormatGetByName: + * @style: the XSLT stylesheet + * @name: the decimal-format name to find + * + * Find decimal-format by name + * + * Returns the xsltDecimalFormatPtr + */ +xsltDecimalFormatPtr +xsltDecimalFormatGetByName(xsltStylesheetPtr style, xmlChar *name) +{ + xsltDecimalFormatPtr result = NULL; + + if (name == NULL) + return style->decimalFormat; + + while (style != NULL) { + for (result = style->decimalFormat->next; + result != NULL; + result = result->next) { + if (xmlStrEqual(name, result->name)) + return result; + } + style = xsltNextImport(style); + } + return result; +} + + +/** + * xsltNewTemplate: + * + * Create a new XSLT Template + * + * Returns the newly allocated xsltTemplatePtr or NULL in case of error + */ +static xsltTemplatePtr +xsltNewTemplate(void) { + xsltTemplatePtr cur; + + cur = (xsltTemplatePtr) xmlMalloc(sizeof(xsltTemplate)); + if (cur == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltNewTemplate : malloc failed\n"); + return(NULL); + } + memset(cur, 0, sizeof(xsltTemplate)); + cur->priority = XSLT_PAT_NO_PRIORITY; + return(cur); +} + +/** + * xsltFreeTemplate: + * @template: an XSLT template + * + * Free up the memory allocated by @template + */ +static void +xsltFreeTemplate(xsltTemplatePtr template) { + if (template == NULL) + return; + if (template->match) xmlFree(template->match); +/* +* NOTE: @name and @nameURI are put into the string dict now. +* if (template->name) xmlFree(template->name); +* if (template->nameURI) xmlFree(template->nameURI); +*/ +/* + if (template->mode) xmlFree(template->mode); + if (template->modeURI) xmlFree(template->modeURI); + */ + if (template->inheritedNs) xmlFree(template->inheritedNs); + + /* free profiling data */ + if (template->templCalledTab) xmlFree(template->templCalledTab); + if (template->templCountTab) xmlFree(template->templCountTab); + + memset(template, -1, sizeof(xsltTemplate)); + xmlFree(template); +} + +/** + * xsltFreeTemplateList: + * @template: an XSLT template list + * + * Free up the memory allocated by all the elements of @template + */ +static void +xsltFreeTemplateList(xsltTemplatePtr template) { + xsltTemplatePtr cur; + + while (template != NULL) { + cur = template; + template = template->next; + xsltFreeTemplate(cur); + } +} + +#ifdef XSLT_REFACTORED + +static void +xsltFreeNsAliasList(xsltNsAliasPtr item) +{ + xsltNsAliasPtr tmp; + + while (item) { + tmp = item; + item = item->next; + xmlFree(tmp); + } + return; +} + +#ifdef XSLT_REFACTORED_XSLT_NSCOMP +static void +xsltFreeNamespaceMap(xsltNsMapPtr item) +{ + xsltNsMapPtr tmp; + + while (item) { + tmp = item; + item = item->next; + xmlFree(tmp); + } + return; +} + +static xsltNsMapPtr +xsltNewNamespaceMapItem(xsltCompilerCtxtPtr cctxt, + xmlDocPtr doc, + xmlNsPtr ns, + xmlNodePtr elem) +{ + xsltNsMapPtr ret; + + if ((cctxt == NULL) || (doc == NULL) || (ns == NULL)) + return(NULL); + + ret = (xsltNsMapPtr) xmlMalloc(sizeof(xsltNsMap)); + if (ret == NULL) { + xsltTransformError(NULL, cctxt->style, elem, + "Internal error: (xsltNewNamespaceMapItem) " + "memory allocation failed.\n"); + return(NULL); + } + memset(ret, 0, sizeof(xsltNsMap)); + ret->doc = doc; + ret->ns = ns; + ret->origNsName = ns->href; + /* + * Store the item at current stylesheet-level. + */ + if (cctxt->psData->nsMap != NULL) + ret->next = cctxt->psData->nsMap; + cctxt->psData->nsMap = ret; + + return(ret); +} +#endif /* XSLT_REFACTORED_XSLT_NSCOMP */ + +/** + * xsltCompilerVarInfoFree: + * @cctxt: the compilation context + * + * Frees the list of information for vars/params. + */ +static void +xsltCompilerVarInfoFree(xsltCompilerCtxtPtr cctxt) +{ + xsltVarInfoPtr ivar = cctxt->ivars, ivartmp; + + while (ivar) { + ivartmp = ivar; + ivar = ivar->next; + xmlFree(ivartmp); + } +} + +/** + * xsltCompilerCtxtFree: + * + * Free an XSLT compiler context. + */ +static void +xsltCompilationCtxtFree(xsltCompilerCtxtPtr cctxt) +{ + if (cctxt == NULL) + return; +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "Freeing compilation context\n"); + xsltGenericDebug(xsltGenericDebugContext, + "### Max inodes: %d\n", cctxt->maxNodeInfos); + xsltGenericDebug(xsltGenericDebugContext, + "### Max LREs : %d\n", cctxt->maxLREs); +#endif + /* + * Free node-infos. + */ + if (cctxt->inodeList != NULL) { + xsltCompilerNodeInfoPtr tmp, cur = cctxt->inodeList; + while (cur != NULL) { + tmp = cur; + cur = cur->next; + xmlFree(tmp); + } + } + if (cctxt->tmpList != NULL) + xsltPointerListFree(cctxt->tmpList); +#ifdef XSLT_REFACTORED_XPATHCOMP + if (cctxt->xpathCtxt != NULL) + xmlXPathFreeContext(cctxt->xpathCtxt); +#endif + if (cctxt->nsAliases != NULL) + xsltFreeNsAliasList(cctxt->nsAliases); + + if (cctxt->ivars) + xsltCompilerVarInfoFree(cctxt); + + xmlFree(cctxt); +} + +/** + * xsltCompilerCreate: + * + * Creates an XSLT compiler context. + * + * Returns the pointer to the created xsltCompilerCtxt or + * NULL in case of an internal error. + */ +static xsltCompilerCtxtPtr +xsltCompilationCtxtCreate(xsltStylesheetPtr style) { + xsltCompilerCtxtPtr ret; + + ret = (xsltCompilerCtxtPtr) xmlMalloc(sizeof(xsltCompilerCtxt)); + if (ret == NULL) { + xsltTransformError(NULL, style, NULL, + "xsltCompilerCreate: allocation of compiler " + "context failed.\n"); + return(NULL); + } + memset(ret, 0, sizeof(xsltCompilerCtxt)); + + ret->errSeverity = XSLT_ERROR_SEVERITY_ERROR; + ret->tmpList = xsltPointerListCreate(20); + if (ret->tmpList == NULL) { + goto internal_err; + } +#ifdef XSLT_REFACTORED_XPATHCOMP + /* + * Create the XPath compilation context in order + * to speed up precompilation of XPath expressions. + */ + ret->xpathCtxt = xmlXPathNewContext(NULL); + if (ret->xpathCtxt == NULL) + goto internal_err; +#endif + + return(ret); + +internal_err: + xsltCompilationCtxtFree(ret); + return(NULL); +} + +static void +xsltLREEffectiveNsNodesFree(xsltEffectiveNsPtr first) +{ + xsltEffectiveNsPtr tmp; + + while (first != NULL) { + tmp = first; + first = first->nextInStore; + xmlFree(tmp); + } +} + +static void +xsltFreePrincipalStylesheetData(xsltPrincipalStylesheetDataPtr data) +{ + if (data == NULL) + return; + + if (data->inScopeNamespaces != NULL) { + int i; + xsltNsListContainerPtr nsi; + xsltPointerListPtr list = + (xsltPointerListPtr) data->inScopeNamespaces; + + for (i = 0; i < list->number; i++) { + /* + * REVISIT TODO: Free info of in-scope namespaces. + */ + nsi = (xsltNsListContainerPtr) list->items[i]; + if (nsi->list != NULL) + xmlFree(nsi->list); + xmlFree(nsi); + } + xsltPointerListFree(list); + data->inScopeNamespaces = NULL; + } + + if (data->exclResultNamespaces != NULL) { + int i; + xsltPointerListPtr list = (xsltPointerListPtr) + data->exclResultNamespaces; + + for (i = 0; i < list->number; i++) + xsltPointerListFree((xsltPointerListPtr) list->items[i]); + + xsltPointerListFree(list); + data->exclResultNamespaces = NULL; + } + + if (data->extElemNamespaces != NULL) { + xsltPointerListPtr list = (xsltPointerListPtr) + data->extElemNamespaces; + int i; + + for (i = 0; i < list->number; i++) + xsltPointerListFree((xsltPointerListPtr) list->items[i]); + + xsltPointerListFree(list); + data->extElemNamespaces = NULL; + } + if (data->effectiveNs) { + xsltLREEffectiveNsNodesFree(data->effectiveNs); + data->effectiveNs = NULL; + } +#ifdef XSLT_REFACTORED_XSLT_NSCOMP + xsltFreeNamespaceMap(data->nsMap); +#endif + xmlFree(data); +} + +static xsltPrincipalStylesheetDataPtr +xsltNewPrincipalStylesheetData(void) +{ + xsltPrincipalStylesheetDataPtr ret; + + ret = (xsltPrincipalStylesheetDataPtr) + xmlMalloc(sizeof(xsltPrincipalStylesheetData)); + if (ret == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltNewPrincipalStylesheetData: memory allocation failed.\n"); + return(NULL); + } + memset(ret, 0, sizeof(xsltPrincipalStylesheetData)); + + /* + * Global list of in-scope namespaces. + */ + ret->inScopeNamespaces = xsltPointerListCreate(-1); + if (ret->inScopeNamespaces == NULL) + goto internal_err; + /* + * Global list of excluded result ns-decls. + */ + ret->exclResultNamespaces = xsltPointerListCreate(-1); + if (ret->exclResultNamespaces == NULL) + goto internal_err; + /* + * Global list of extension instruction namespace names. + */ + ret->extElemNamespaces = xsltPointerListCreate(-1); + if (ret->extElemNamespaces == NULL) + goto internal_err; + + return(ret); + +internal_err: + + return(NULL); +} + +#endif + +/** + * xsltNewStylesheet: + * + * Create a new XSLT Stylesheet + * + * Returns the newly allocated xsltStylesheetPtr or NULL in case of error + */ +xsltStylesheetPtr +xsltNewStylesheet(void) { + xsltStylesheetPtr ret = NULL; + + ret = (xsltStylesheetPtr) xmlMalloc(sizeof(xsltStylesheet)); + if (ret == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltNewStylesheet : malloc failed\n"); + goto internal_err; + } + memset(ret, 0, sizeof(xsltStylesheet)); + + ret->omitXmlDeclaration = -1; + ret->standalone = -1; + ret->decimalFormat = xsltNewDecimalFormat(NULL); + ret->indent = -1; + ret->errors = 0; + ret->warnings = 0; + ret->exclPrefixNr = 0; + ret->exclPrefixMax = 0; + ret->exclPrefixTab = NULL; + ret->extInfos = NULL; + ret->extrasNr = 0; + ret->internalized = 1; + ret->literal_result = 0; + ret->forwards_compatible = 0; + ret->dict = xmlDictCreate(); +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "creating dictionary for stylesheet\n"); +#endif + + xsltInit(); + + return(ret); + +internal_err: + if (ret != NULL) + xsltFreeStylesheet(ret); + return(NULL); +} + +/** + * xsltAllocateExtra: + * @style: an XSLT stylesheet + * + * Allocate an extra runtime information slot statically while compiling + * the stylesheet and return its number + * + * Returns the number of the slot + */ +int +xsltAllocateExtra(xsltStylesheetPtr style) +{ + return(style->extrasNr++); +} + +/** + * xsltAllocateExtraCtxt: + * @ctxt: an XSLT transformation context + * + * Allocate an extra runtime information slot at run-time + * and return its number + * This make sure there is a slot ready in the transformation context + * + * Returns the number of the slot + */ +int +xsltAllocateExtraCtxt(xsltTransformContextPtr ctxt) +{ + if (ctxt->extrasNr >= ctxt->extrasMax) { + int i; + if (ctxt->extrasNr == 0) { + ctxt->extrasMax = 20; + ctxt->extras = (xsltRuntimeExtraPtr) + xmlMalloc(ctxt->extrasMax * sizeof(xsltRuntimeExtra)); + if (ctxt->extras == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xsltAllocateExtraCtxt: out of memory\n"); + ctxt->state = XSLT_STATE_ERROR; + return(0); + } + for (i = 0;i < ctxt->extrasMax;i++) { + ctxt->extras[i].info = NULL; + ctxt->extras[i].deallocate = NULL; + ctxt->extras[i].val.ptr = NULL; + } + + } else { + xsltRuntimeExtraPtr tmp; + + ctxt->extrasMax += 100; + tmp = (xsltRuntimeExtraPtr) xmlRealloc(ctxt->extras, + ctxt->extrasMax * sizeof(xsltRuntimeExtra)); + if (tmp == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xsltAllocateExtraCtxt: out of memory\n"); + ctxt->state = XSLT_STATE_ERROR; + return(0); + } + ctxt->extras = tmp; + for (i = ctxt->extrasNr;i < ctxt->extrasMax;i++) { + ctxt->extras[i].info = NULL; + ctxt->extras[i].deallocate = NULL; + ctxt->extras[i].val.ptr = NULL; + } + } + } + return(ctxt->extrasNr++); +} + +/** + * xsltFreeStylesheetList: + * @style: an XSLT stylesheet list + * + * Free up the memory allocated by the list @style + */ +static void +xsltFreeStylesheetList(xsltStylesheetPtr style) { + xsltStylesheetPtr next; + + while (style != NULL) { + next = style->next; + xsltFreeStylesheet(style); + style = next; + } +} + +/** + * xsltCleanupStylesheetTree: + * + * @doc: the document-node + * @node: the element where the stylesheet is rooted at + * + * Actually @node need not be the document-element, but + * currently Libxslt does not support embedded stylesheets. + * + * Returns 0 if OK, -1 on API or internal errors. + */ +static int +xsltCleanupStylesheetTree(xmlDocPtr doc ATTRIBUTE_UNUSED, + xmlNodePtr rootElem ATTRIBUTE_UNUSED) +{ +#if 0 /* TODO: Currently disabled, since probably not needed. */ + xmlNodePtr cur; + + if ((doc == NULL) || (rootElem == NULL) || + (rootElem->type != XML_ELEMENT_NODE) || + (doc != rootElem->doc)) + return(-1); + + /* + * Cleanup was suggested by Aleksey Sanin: + * Clear the PSVI field to avoid problems if the + * node-tree of the stylesheet is intended to be used for + * further processing by the user (e.g. for compiling it + * once again - although not recommended). + */ + + cur = rootElem; + while (cur != NULL) { + if (cur->type == XML_ELEMENT_NODE) { + /* + * Clear the PSVI field. + */ + cur->psvi = NULL; + if (cur->children) { + cur = cur->children; + continue; + } + } + +leave_node: + if (cur == rootElem) + break; + if (cur->next != NULL) + cur = cur->next; + else { + cur = cur->parent; + if (cur == NULL) + break; + goto leave_node; + } + } +#endif /* #if 0 */ + return(0); +} + +/** + * xsltFreeStylesheet: + * @style: an XSLT stylesheet + * + * Free up the memory allocated by @style + */ +void +xsltFreeStylesheet(xsltStylesheetPtr style) +{ + if (style == NULL) + return; + +#ifdef XSLT_REFACTORED + /* + * Start with a cleanup of the main stylesheet's doc. + */ + if ((style->principal == style) && (style->doc)) + xsltCleanupStylesheetTree(style->doc, + xmlDocGetRootElement(style->doc)); +#ifdef XSLT_REFACTORED_XSLT_NSCOMP + /* + * Restore changed ns-decls before freeing the document. + */ + if ((style->doc != NULL) && + XSLT_HAS_INTERNAL_NSMAP(style)) + { + xsltRestoreDocumentNamespaces(XSLT_GET_INTERNAL_NSMAP(style), + style->doc); + } +#endif /* XSLT_REFACTORED_XSLT_NSCOMP */ +#else + /* + * Start with a cleanup of the main stylesheet's doc. + */ + if ((style->parent == NULL) && (style->doc)) + xsltCleanupStylesheetTree(style->doc, + xmlDocGetRootElement(style->doc)); +#endif /* XSLT_REFACTORED */ + + xsltFreeKeys(style); + xsltFreeExts(style); + xsltFreeTemplateHashes(style); + xsltFreeDecimalFormatList(style); + xsltFreeTemplateList(style->templates); + xsltFreeAttributeSetsHashes(style); + xsltFreeNamespaceAliasHashes(style); + xsltFreeStylePreComps(style); + /* + * Free documents of all included stylsheet modules of this + * stylesheet level. + */ + xsltFreeStyleDocuments(style); + /* + * TODO: Best time to shutdown extension stuff? + */ + xsltShutdownExts(style); + + if (style->variables != NULL) + xsltFreeStackElemList(style->variables); + if (style->cdataSection != NULL) + xmlHashFree(style->cdataSection, NULL); + if (style->stripSpaces != NULL) + xmlHashFree(style->stripSpaces, NULL); + if (style->nsHash != NULL) + xmlHashFree(style->nsHash, NULL); + if (style->exclPrefixTab != NULL) + xmlFree(style->exclPrefixTab); + if (style->method != NULL) + xmlFree(style->method); + if (style->methodURI != NULL) + xmlFree(style->methodURI); + if (style->version != NULL) + xmlFree(style->version); + if (style->encoding != NULL) + xmlFree(style->encoding); + if (style->doctypePublic != NULL) + xmlFree(style->doctypePublic); + if (style->doctypeSystem != NULL) + xmlFree(style->doctypeSystem); + if (style->mediaType != NULL) + xmlFree(style->mediaType); + if (style->attVTs) + xsltFreeAVTList(style->attVTs); + if (style->imports != NULL) + xsltFreeStylesheetList(style->imports); + +#ifdef XSLT_REFACTORED + /* + * If this is the principal stylesheet, then + * free its internal data. + */ + if (style->principal == style) { + if (style->principalData) { + xsltFreePrincipalStylesheetData(style->principalData); + style->principalData = NULL; + } + } +#endif + /* + * Better to free the main document of this stylesheet level + * at the end - so here. + */ + if (style->doc != NULL) { + xmlFreeDoc(style->doc); + } + +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "freeing dictionary from stylesheet\n"); +#endif + xmlDictFree(style->dict); + + memset(style, -1, sizeof(xsltStylesheet)); + xmlFree(style); +} + +/************************************************************************ + * * + * Parsing of an XSLT Stylesheet * + * * + ************************************************************************/ + +#ifdef XSLT_REFACTORED + /* + * This is now performed in an optimized way in xsltParseXSLTTemplate. + */ +#else +/** + * xsltGetInheritedNsList: + * @style: the stylesheet + * @template: the template + * @node: the current node + * + * Search all the namespace applying to a given element except the ones + * from excluded output prefixes currently in scope. Initialize the + * template inheritedNs list with it. + * + * Returns the number of entries found + */ +static int +xsltGetInheritedNsList(xsltStylesheetPtr style, + xsltTemplatePtr template, + xmlNodePtr node) +{ + xmlNsPtr cur; + xmlNsPtr *ret = NULL; + int nbns = 0; + int maxns = 10; + int i; + + if ((style == NULL) || (template == NULL) || (node == NULL) || + (template->inheritedNsNr != 0) || (template->inheritedNs != NULL)) + return(0); + while (node != NULL) { + if (node->type == XML_ELEMENT_NODE) { + cur = node->nsDef; + while (cur != NULL) { + if (xmlStrEqual(cur->href, XSLT_NAMESPACE)) + goto skip_ns; + + if ((cur->prefix != NULL) && + (xsltCheckExtPrefix(style, cur->prefix))) + goto skip_ns; + /* + * Check if this namespace was excluded. + * Note that at this point only the exclusions defined + * on the topmost stylesheet element are in the exclusion-list. + */ + for (i = 0;i < style->exclPrefixNr;i++) { + if (xmlStrEqual(cur->href, style->exclPrefixTab[i])) + goto skip_ns; + } + if (ret == NULL) { + ret = + (xmlNsPtr *) xmlMalloc((maxns + 1) * + sizeof(xmlNsPtr)); + if (ret == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xsltGetInheritedNsList : out of memory!\n"); + return(0); + } + ret[nbns] = NULL; + } + /* + * Skip shadowed namespace bindings. + */ + for (i = 0; i < nbns; i++) { + if ((cur->prefix == ret[i]->prefix) || + (xmlStrEqual(cur->prefix, ret[i]->prefix))) + break; + } + if (i >= nbns) { + if (nbns >= maxns) { + maxns *= 2; + ret = (xmlNsPtr *) xmlRealloc(ret, + (maxns + + 1) * + sizeof(xmlNsPtr)); + if (ret == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xsltGetInheritedNsList : realloc failed!\n"); + return(0); + } + } + ret[nbns++] = cur; + ret[nbns] = NULL; + } +skip_ns: + cur = cur->next; + } + } + node = node->parent; + } + if (nbns != 0) { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "template has %d inherited namespaces\n", nbns); +#endif + template->inheritedNsNr = nbns; + template->inheritedNs = ret; + } + return (nbns); +} +#endif /* else of XSLT_REFACTORED */ + +/** + * xsltParseStylesheetOutput: + * @style: the XSLT stylesheet + * @cur: the "output" element + * + * parse an XSLT stylesheet output element and record + * information related to the stylesheet output + */ + +void +xsltParseStylesheetOutput(xsltStylesheetPtr style, xmlNodePtr cur) +{ + xmlChar *elements, + *prop; + xmlChar *element, + *end; + + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) + return; + + prop = xmlGetNsProp(cur, (const xmlChar *) "version", NULL); + if (prop != NULL) { + if (style->version != NULL) + xmlFree(style->version); + style->version = prop; + } + + prop = xmlGetNsProp(cur, (const xmlChar *) "encoding", NULL); + if (prop != NULL) { + if (style->encoding != NULL) + xmlFree(style->encoding); + style->encoding = prop; + } + + /* relaxed to support xt:document + * TODO KB: What does "relaxed to support xt:document" mean? + */ + prop = xmlGetNsProp(cur, (const xmlChar *) "method", NULL); + if (prop != NULL) { + const xmlChar *URI; + + if (style->method != NULL) + xmlFree(style->method); + style->method = NULL; + if (style->methodURI != NULL) + xmlFree(style->methodURI); + style->methodURI = NULL; + + /* + * TODO: Don't use xsltGetQNameURI(). + */ + URI = xsltGetQNameURI(cur, &prop); + if (prop == NULL) { + if (style != NULL) style->errors++; + } else if (URI == NULL) { + if ((xmlStrEqual(prop, (const xmlChar *) "xml")) || + (xmlStrEqual(prop, (const xmlChar *) "html")) || + (xmlStrEqual(prop, (const xmlChar *) "text"))) { + style->method = prop; + } else { + xsltTransformError(NULL, style, cur, + "invalid value for method: %s\n", prop); + if (style != NULL) style->warnings++; + } + } else { + style->method = prop; + style->methodURI = xmlStrdup(URI); + } + } + + prop = xmlGetNsProp(cur, (const xmlChar *) "doctype-system", NULL); + if (prop != NULL) { + if (style->doctypeSystem != NULL) + xmlFree(style->doctypeSystem); + style->doctypeSystem = prop; + } + + prop = xmlGetNsProp(cur, (const xmlChar *) "doctype-public", NULL); + if (prop != NULL) { + if (style->doctypePublic != NULL) + xmlFree(style->doctypePublic); + style->doctypePublic = prop; + } + + prop = xmlGetNsProp(cur, (const xmlChar *) "standalone", NULL); + if (prop != NULL) { + if (xmlStrEqual(prop, (const xmlChar *) "yes")) { + style->standalone = 1; + } else if (xmlStrEqual(prop, (const xmlChar *) "no")) { + style->standalone = 0; + } else { + xsltTransformError(NULL, style, cur, + "invalid value for standalone: %s\n", prop); + style->errors++; + } + xmlFree(prop); + } + + prop = xmlGetNsProp(cur, (const xmlChar *) "indent", NULL); + if (prop != NULL) { + if (xmlStrEqual(prop, (const xmlChar *) "yes")) { + style->indent = 1; + } else if (xmlStrEqual(prop, (const xmlChar *) "no")) { + style->indent = 0; + } else { + xsltTransformError(NULL, style, cur, + "invalid value for indent: %s\n", prop); + style->errors++; + } + xmlFree(prop); + } + + prop = xmlGetNsProp(cur, (const xmlChar *) "omit-xml-declaration", NULL); + if (prop != NULL) { + if (xmlStrEqual(prop, (const xmlChar *) "yes")) { + style->omitXmlDeclaration = 1; + } else if (xmlStrEqual(prop, (const xmlChar *) "no")) { + style->omitXmlDeclaration = 0; + } else { + xsltTransformError(NULL, style, cur, + "invalid value for omit-xml-declaration: %s\n", + prop); + style->errors++; + } + xmlFree(prop); + } + + elements = xmlGetNsProp(cur, (const xmlChar *) "cdata-section-elements", + NULL); + if (elements != NULL) { + if (style->cdataSection == NULL) + style->cdataSection = xmlHashCreate(10); + if (style->cdataSection == NULL) + return; + + element = elements; + while (*element != 0) { + while (IS_BLANK(*element)) + element++; + if (*element == 0) + break; + end = element; + while ((*end != 0) && (!IS_BLANK(*end))) + end++; + element = xmlStrndup(element, end - element); + if (element) { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "add cdata section output element %s\n", + element); +#endif + if (xmlValidateQName(BAD_CAST element, 0) != 0) { + xsltTransformError(NULL, style, cur, + "Attribute 'cdata-section-elements': The value " + "'%s' is not a valid QName.\n", element); + xmlFree(element); + style->errors++; + } else { + const xmlChar *URI; + + /* + * TODO: Don't use xsltGetQNameURI(). + */ + URI = xsltGetQNameURI(cur, &element); + if (element == NULL) { + /* + * TODO: We'll report additionally an error + * via the stylesheet's error handling. + */ + xsltTransformError(NULL, style, cur, + "Attribute 'cdata-section-elements': The value " + "'%s' is not a valid QName.\n", element); + style->errors++; + } else { + xmlNsPtr ns; + + /* + * XSLT-1.0 "Each QName is expanded into an + * expanded-name using the namespace declarations in + * effect on the xsl:output element in which the QName + * occurs; if there is a default namespace, it is used + * for QNames that do not have a prefix" + * NOTE: Fix of bug #339570. + */ + if (URI == NULL) { + ns = xmlSearchNs(style->doc, cur, NULL); + if (ns != NULL) + URI = ns->href; + } + xmlHashAddEntry2(style->cdataSection, element, URI, + (void *) "cdata"); + xmlFree(element); + } + } + } + element = end; + } + xmlFree(elements); + } + + prop = xmlGetNsProp(cur, (const xmlChar *) "media-type", NULL); + if (prop != NULL) { + if (style->mediaType) + xmlFree(style->mediaType); + style->mediaType = prop; + } + if (cur->children != NULL) { + xsltParseContentError(style, cur->children); + } +} + +/** + * xsltParseStylesheetDecimalFormat: + * @style: the XSLT stylesheet + * @cur: the "decimal-format" element + * + * + * + * + * parse an XSLT stylesheet decimal-format element and + * and record the formatting characteristics + */ +static void +xsltParseStylesheetDecimalFormat(xsltStylesheetPtr style, xmlNodePtr cur) +{ + xmlChar *prop; + xsltDecimalFormatPtr format; + xsltDecimalFormatPtr iter; + + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) + return; + + format = style->decimalFormat; + + prop = xmlGetNsProp(cur, BAD_CAST("name"), NULL); + if (prop != NULL) { + format = xsltDecimalFormatGetByName(style, prop); + if (format != NULL) { + xsltTransformError(NULL, style, cur, + "xsltParseStylestyleDecimalFormat: %s already exists\n", prop); + if (style != NULL) style->warnings++; + return; + } + format = xsltNewDecimalFormat(prop); + if (format == NULL) { + xsltTransformError(NULL, style, cur, + "xsltParseStylestyleDecimalFormat: failed creating new decimal-format\n"); + if (style != NULL) style->errors++; + return; + } + /* Append new decimal-format structure */ + for (iter = style->decimalFormat; iter->next; iter = iter->next) + ; + if (iter) + iter->next = format; + } + + prop = xmlGetNsProp(cur, (const xmlChar *)"decimal-separator", NULL); + if (prop != NULL) { + if (format->decimalPoint != NULL) xmlFree(format->decimalPoint); + format->decimalPoint = prop; + } + + prop = xmlGetNsProp(cur, (const xmlChar *)"grouping-separator", NULL); + if (prop != NULL) { + if (format->grouping != NULL) xmlFree(format->grouping); + format->grouping = prop; + } + + prop = xmlGetNsProp(cur, (const xmlChar *)"infinity", NULL); + if (prop != NULL) { + if (format->infinity != NULL) xmlFree(format->infinity); + format->infinity = prop; + } + + prop = xmlGetNsProp(cur, (const xmlChar *)"minus-sign", NULL); + if (prop != NULL) { + if (format->minusSign != NULL) xmlFree(format->minusSign); + format->minusSign = prop; + } + + prop = xmlGetNsProp(cur, (const xmlChar *)"NaN", NULL); + if (prop != NULL) { + if (format->noNumber != NULL) xmlFree(format->noNumber); + format->noNumber = prop; + } + + prop = xmlGetNsProp(cur, (const xmlChar *)"percent", NULL); + if (prop != NULL) { + if (format->percent != NULL) xmlFree(format->percent); + format->percent = prop; + } + + prop = xmlGetNsProp(cur, (const xmlChar *)"per-mille", NULL); + if (prop != NULL) { + if (format->permille != NULL) xmlFree(format->permille); + format->permille = prop; + } + + prop = xmlGetNsProp(cur, (const xmlChar *)"zero-digit", NULL); + if (prop != NULL) { + if (format->zeroDigit != NULL) xmlFree(format->zeroDigit); + format->zeroDigit = prop; + } + + prop = xmlGetNsProp(cur, (const xmlChar *)"digit", NULL); + if (prop != NULL) { + if (format->digit != NULL) xmlFree(format->digit); + format->digit = prop; + } + + prop = xmlGetNsProp(cur, (const xmlChar *)"pattern-separator", NULL); + if (prop != NULL) { + if (format->patternSeparator != NULL) xmlFree(format->patternSeparator); + format->patternSeparator = prop; + } + if (cur->children != NULL) { + xsltParseContentError(style, cur->children); + } +} + +/** + * xsltParseStylesheetPreserveSpace: + * @style: the XSLT stylesheet + * @cur: the "preserve-space" element + * + * parse an XSLT stylesheet preserve-space element and record + * elements needing preserving + */ + +static void +xsltParseStylesheetPreserveSpace(xsltStylesheetPtr style, xmlNodePtr cur) { + xmlChar *elements; + xmlChar *element, *end; + + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) + return; + + elements = xmlGetNsProp(cur, (const xmlChar *)"elements", NULL); + if (elements == NULL) { + xsltTransformError(NULL, style, cur, + "xsltParseStylesheetPreserveSpace: missing elements attribute\n"); + if (style != NULL) style->warnings++; + return; + } + + if (style->stripSpaces == NULL) + style->stripSpaces = xmlHashCreate(10); + if (style->stripSpaces == NULL) + return; + + element = elements; + while (*element != 0) { + while (IS_BLANK(*element)) element++; + if (*element == 0) + break; + end = element; + while ((*end != 0) && (!IS_BLANK(*end))) end++; + element = xmlStrndup(element, end - element); + if (element) { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "add preserved space element %s\n", element); +#endif + if (xmlStrEqual(element, (const xmlChar *)"*")) { + style->stripAll = -1; + } else { + const xmlChar *URI; + + /* + * TODO: Don't use xsltGetQNameURI(). + */ + URI = xsltGetQNameURI(cur, &element); + + xmlHashAddEntry2(style->stripSpaces, element, URI, + (xmlChar *) "preserve"); + } + xmlFree(element); + } + element = end; + } + xmlFree(elements); + if (cur->children != NULL) { + xsltParseContentError(style, cur->children); + } +} + +#ifdef XSLT_REFACTORED +#else +/** + * xsltParseStylesheetExtPrefix: + * @style: the XSLT stylesheet + * @template: the "extension-element-prefixes" prefix + * + * parse an XSLT stylesheet's "extension-element-prefix" attribute value + * and register the namespaces of extension instruction. + * SPEC "A namespace is designated as an extension namespace by using + * an extension-element-prefixes attribute on: + * 1) an xsl:stylesheet element + * 2) an xsl:extension-element-prefixes attribute on a + * literal result element + * 3) an extension instruction." + */ +static void +xsltParseStylesheetExtPrefix(xsltStylesheetPtr style, xmlNodePtr cur, + int isXsltElem) { + xmlChar *prefixes; + xmlChar *prefix, *end; + + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) + return; + + if (isXsltElem) { + /* For xsl:stylesheet/xsl:transform. */ + prefixes = xmlGetNsProp(cur, + (const xmlChar *)"extension-element-prefixes", NULL); + } else { + /* For literal result elements and extension instructions. */ + prefixes = xmlGetNsProp(cur, + (const xmlChar *)"extension-element-prefixes", XSLT_NAMESPACE); + } + if (prefixes == NULL) { + return; + } + + prefix = prefixes; + while (*prefix != 0) { + while (IS_BLANK(*prefix)) prefix++; + if (*prefix == 0) + break; + end = prefix; + while ((*end != 0) && (!IS_BLANK(*end))) end++; + prefix = xmlStrndup(prefix, end - prefix); + if (prefix) { + xmlNsPtr ns; + + if (xmlStrEqual(prefix, (const xmlChar *)"#default")) + ns = xmlSearchNs(style->doc, cur, NULL); + else + ns = xmlSearchNs(style->doc, cur, prefix); + if (ns == NULL) { + xsltTransformError(NULL, style, cur, + "xsl:extension-element-prefix : undefined namespace %s\n", + prefix); + if (style != NULL) style->warnings++; + } else { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "add extension prefix %s\n", prefix); +#endif + xsltRegisterExtPrefix(style, prefix, ns->href); + } + xmlFree(prefix); + } + prefix = end; + } + xmlFree(prefixes); +} +#endif /* else of XSLT_REFACTORED */ + +/** + * xsltParseStylesheetStripSpace: + * @style: the XSLT stylesheet + * @cur: the "strip-space" element + * + * parse an XSLT stylesheet's strip-space element and record + * the elements needing stripping + */ + +static void +xsltParseStylesheetStripSpace(xsltStylesheetPtr style, xmlNodePtr cur) { + xmlChar *elements; + xmlChar *element, *end; + + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) + return; + + elements = xmlGetNsProp(cur, (const xmlChar *)"elements", NULL); + if (elements == NULL) { + xsltTransformError(NULL, style, cur, + "xsltParseStylesheetStripSpace: missing elements attribute\n"); + if (style != NULL) style->warnings++; + return; + } + + if (style->stripSpaces == NULL) + style->stripSpaces = xmlHashCreate(10); + if (style->stripSpaces == NULL) + return; + + element = elements; + while (*element != 0) { + while (IS_BLANK(*element)) element++; + if (*element == 0) + break; + end = element; + while ((*end != 0) && (!IS_BLANK(*end))) end++; + element = xmlStrndup(element, end - element); + if (element) { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "add stripped space element %s\n", element); +#endif + if (xmlStrEqual(element, (const xmlChar *)"*")) { + style->stripAll = 1; + } else { + const xmlChar *URI; + + /* + * TODO: Don't use xsltGetQNameURI(). + */ + URI = xsltGetQNameURI(cur, &element); + + xmlHashAddEntry2(style->stripSpaces, element, URI, + (xmlChar *) "strip"); + } + xmlFree(element); + } + element = end; + } + xmlFree(elements); + if (cur->children != NULL) { + xsltParseContentError(style, cur->children); + } +} + +#ifdef XSLT_REFACTORED +#else +/** + * xsltParseStylesheetExcludePrefix: + * @style: the XSLT stylesheet + * @cur: the current point in the stylesheet + * + * parse an XSLT stylesheet exclude prefix and record + * namespaces needing stripping + * + * Returns the number of Excluded prefixes added at that level + */ + +static int +xsltParseStylesheetExcludePrefix(xsltStylesheetPtr style, xmlNodePtr cur, + int isXsltElem) +{ + int nb = 0; + xmlChar *prefixes; + xmlChar *prefix, *end; + + if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) + return(0); + + if (isXsltElem) + prefixes = xmlGetNsProp(cur, + (const xmlChar *)"exclude-result-prefixes", NULL); + else + prefixes = xmlGetNsProp(cur, + (const xmlChar *)"exclude-result-prefixes", XSLT_NAMESPACE); + + if (prefixes == NULL) { + return(0); + } + + prefix = prefixes; + while (*prefix != 0) { + while (IS_BLANK(*prefix)) prefix++; + if (*prefix == 0) + break; + end = prefix; + while ((*end != 0) && (!IS_BLANK(*end))) end++; + prefix = xmlStrndup(prefix, end - prefix); + if (prefix) { + xmlNsPtr ns; + + if (xmlStrEqual(prefix, (const xmlChar *)"#default")) + ns = xmlSearchNs(style->doc, cur, NULL); + else + ns = xmlSearchNs(style->doc, cur, prefix); + if (ns == NULL) { + xsltTransformError(NULL, style, cur, + "xsl:exclude-result-prefixes : undefined namespace %s\n", + prefix); + if (style != NULL) style->warnings++; + } else { + if (exclPrefixPush(style, (xmlChar *) ns->href) >= 0) { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "exclude result prefix %s\n", prefix); +#endif + nb++; + } + } + xmlFree(prefix); + } + prefix = end; + } + xmlFree(prefixes); + return(nb); +} +#endif /* else of XSLT_REFACTORED */ + +#ifdef XSLT_REFACTORED + +/* +* xsltTreeEnsureXMLDecl: +* @doc: the doc +* +* BIG NOTE: +* This was copy&pasted from Libxml2's xmlTreeEnsureXMLDecl() in "tree.c". +* Ensures that there is an XML namespace declaration on the doc. +* +* Returns the XML ns-struct or NULL on API and internal errors. +*/ +static xmlNsPtr +xsltTreeEnsureXMLDecl(xmlDocPtr doc) +{ + if (doc == NULL) + return (NULL); + if (doc->oldNs != NULL) + return (doc->oldNs); + { + xmlNsPtr ns; + ns = (xmlNsPtr) xmlMalloc(sizeof(xmlNs)); + if (ns == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xsltTreeEnsureXMLDecl: Failed to allocate " + "the XML namespace.\n"); + return (NULL); + } + memset(ns, 0, sizeof(xmlNs)); + ns->type = XML_LOCAL_NAMESPACE; + /* + * URGENT TODO: revisit this. + */ +#ifdef LIBXML_NAMESPACE_DICT + if (doc->dict) + ns->href = xmlDictLookup(doc->dict, XML_XML_NAMESPACE, -1); + else + ns->href = xmlStrdup(XML_XML_NAMESPACE); +#else + ns->href = xmlStrdup(XML_XML_NAMESPACE); +#endif + ns->prefix = xmlStrdup((const xmlChar *)"xml"); + doc->oldNs = ns; + return (ns); + } +} + +/* +* xsltTreeAcquireStoredNs: +* @doc: the doc +* @nsName: the namespace name +* @prefix: the prefix +* +* BIG NOTE: +* This was copy&pasted from Libxml2's xmlDOMWrapStoreNs() in "tree.c". +* Creates or reuses an xmlNs struct on doc->oldNs with +* the given prefix and namespace name. +* +* Returns the aquired ns struct or NULL in case of an API +* or internal error. +*/ +static xmlNsPtr +xsltTreeAcquireStoredNs(xmlDocPtr doc, + const xmlChar *nsName, + const xmlChar *prefix) +{ + xmlNsPtr ns; + + if (doc == NULL) + return (NULL); + if (doc->oldNs != NULL) + ns = doc->oldNs; + else + ns = xsltTreeEnsureXMLDecl(doc); + if (ns == NULL) + return (NULL); + if (ns->next != NULL) { + /* Reuse. */ + ns = ns->next; + while (ns != NULL) { + if ((ns->prefix == NULL) != (prefix == NULL)) { + /* NOP */ + } else if (prefix == NULL) { + if (xmlStrEqual(ns->href, nsName)) + return (ns); + } else { + if ((ns->prefix[0] == prefix[0]) && + xmlStrEqual(ns->prefix, prefix) && + xmlStrEqual(ns->href, nsName)) + return (ns); + + } + if (ns->next == NULL) + break; + ns = ns->next; + } + } + /* Create. */ + ns->next = xmlNewNs(NULL, nsName, prefix); + return (ns->next); +} + +/** + * xsltLREBuildEffectiveNs: + * + * Apply ns-aliasing on the namespace of the given @elem and + * its attributes. + */ +static int +xsltLREBuildEffectiveNs(xsltCompilerCtxtPtr cctxt, + xmlNodePtr elem) +{ + xmlNsPtr ns; + xsltNsAliasPtr alias; + + if ((cctxt == NULL) || (elem == NULL)) + return(-1); + if ((cctxt->nsAliases == NULL) || (! cctxt->hasNsAliases)) + return(0); + + alias = cctxt->nsAliases; + while (alias != NULL) { + if ( /* If both namespaces are NULL... */ + ( (elem->ns == NULL) && + ((alias->literalNs == NULL) || + (alias->literalNs->href == NULL)) ) || + /* ... or both namespace are equal */ + ( (elem->ns != NULL) && + (alias->literalNs != NULL) && + xmlStrEqual(elem->ns->href, alias->literalNs->href) ) ) + { + if ((alias->targetNs != NULL) && + (alias->targetNs->href != NULL)) + { + /* + * Convert namespace. + */ + if (elem->doc == alias->docOfTargetNs) { + /* + * This is the nice case: same docs. + * This will eventually assign a ns-decl which + * is shadowed, but this has no negative effect on + * the generation of the result tree. + */ + elem->ns = alias->targetNs; + } else { + /* + * This target xmlNs originates from a different + * stylesheet tree. Try to locate it in the + * in-scope namespaces. + * OPTIMIZE TODO: Use the compiler-node-info inScopeNs. + */ + ns = xmlSearchNs(elem->doc, elem, + alias->targetNs->prefix); + /* + * If no matching ns-decl found, then assign a + * ns-decl stored in xmlDoc. + */ + if ((ns == NULL) || + (! xmlStrEqual(ns->href, alias->targetNs->href))) + { + /* + * BIG NOTE: The use of xsltTreeAcquireStoredNs() + * is not very efficient, but currently I don't + * see an other way of *safely* changing a node's + * namespace, since the xmlNs struct in + * alias->targetNs might come from an other + * stylesheet tree. So we need to anchor it in the + * current document, without adding it to the tree, + * which would otherwise change the in-scope-ns + * semantic of the tree. + */ + ns = xsltTreeAcquireStoredNs(elem->doc, + alias->targetNs->href, + alias->targetNs->prefix); + + if (ns == NULL) { + xsltTransformError(NULL, cctxt->style, elem, + "Internal error in " + "xsltLREBuildEffectiveNs(): " + "failed to acquire a stored " + "ns-declaration.\n"); + cctxt->style->errors++; + return(-1); + + } + } + elem->ns = ns; + } + } else { + /* + * Move into or leave in the NULL namespace. + */ + elem->ns = NULL; + } + break; + } + alias = alias->next; + } + /* + * Same with attributes of literal result elements. + */ + if (elem->properties != NULL) { + xmlAttrPtr attr = elem->properties; + + while (attr != NULL) { + if (attr->ns == NULL) { + attr = attr->next; + continue; + } + alias = cctxt->nsAliases; + while (alias != NULL) { + if ( /* If both namespaces are NULL... */ + ( (elem->ns == NULL) && + ((alias->literalNs == NULL) || + (alias->literalNs->href == NULL)) ) || + /* ... or both namespace are equal */ + ( (elem->ns != NULL) && + (alias->literalNs != NULL) && + xmlStrEqual(elem->ns->href, alias->literalNs->href) ) ) + { + if ((alias->targetNs != NULL) && + (alias->targetNs->href != NULL)) + { + if (elem->doc == alias->docOfTargetNs) { + elem->ns = alias->targetNs; + } else { + ns = xmlSearchNs(elem->doc, elem, + alias->targetNs->prefix); + if ((ns == NULL) || + (! xmlStrEqual(ns->href, alias->targetNs->href))) + { + ns = xsltTreeAcquireStoredNs(elem->doc, + alias->targetNs->href, + alias->targetNs->prefix); + + if (ns == NULL) { + xsltTransformError(NULL, cctxt->style, elem, + "Internal error in " + "xsltLREBuildEffectiveNs(): " + "failed to acquire a stored " + "ns-declaration.\n"); + cctxt->style->errors++; + return(-1); + + } + } + elem->ns = ns; + } + } else { + /* + * Move into or leave in the NULL namespace. + */ + elem->ns = NULL; + } + break; + } + alias = alias->next; + } + + attr = attr->next; + } + } + return(0); +} + +/** + * xsltLREBuildEffectiveNsNodes: + * + * Computes the effective namespaces nodes for a literal result + * element. + * @effectiveNs is the set of effective ns-nodes + * on the literal result element, which will be added to the result + * element if not already existing in the result tree. + * This means that excluded namespaces (via exclude-result-prefixes, + * extension-element-prefixes and the XSLT namespace) not added + * to the set. + * Namespace-aliasing was applied on the @effectiveNs. + */ +static int +xsltLREBuildEffectiveNsNodes(xsltCompilerCtxtPtr cctxt, + xsltStyleItemLRElementInfoPtr item, + xmlNodePtr elem, + int isLRE) +{ + xmlNsPtr ns, tmpns; + xsltEffectiveNsPtr effNs, lastEffNs = NULL; + int i, j, holdByElem; + xsltPointerListPtr extElemNs = cctxt->inode->extElemNs; + xsltPointerListPtr exclResultNs = cctxt->inode->exclResultNs; + + if ((cctxt == NULL) || (cctxt->inode == NULL) || (elem == NULL) || + (item == NULL) || (item->effectiveNs != NULL)) + return(-1); + + if (item->inScopeNs == NULL) + return(0); + + extElemNs = cctxt->inode->extElemNs; + exclResultNs = cctxt->inode->exclResultNs; + + for (i = 0; i < item->inScopeNs->totalNumber; i++) { + ns = item->inScopeNs->list[i]; + /* + * Skip namespaces designated as excluded namespaces + * ------------------------------------------------- + * + * XSLT-20 TODO: In XSLT 2.0 we need to keep namespaces + * which are target namespaces of namespace-aliases + * regardless if designated as excluded. + * + * Exclude the XSLT namespace. + */ + if (xmlStrEqual(ns->href, XSLT_NAMESPACE)) + goto skip_ns; + + /* + * Apply namespace aliasing + * ------------------------ + * + * SPEC XSLT 2.0 + * "- A namespace node whose string value is a literal namespace + * URI is not copied to the result tree. + * - A namespace node whose string value is a target namespace URI + * is copied to the result tree, whether or not the URI + * identifies an excluded namespace." + * + * NOTE: The ns-aliasing machanism is non-cascading. + * (checked with Saxon, Xalan and MSXML .NET). + * URGENT TODO: is style->nsAliases the effective list of + * ns-aliases, or do we need to lookup the whole + * import-tree? + * TODO: Get rid of import-tree lookup. + */ + if (cctxt->hasNsAliases) { + xsltNsAliasPtr alias; + /* + * First check for being a target namespace. + */ + alias = cctxt->nsAliases; + do { + /* + * TODO: Is xmlns="" handled already? + */ + if ((alias->targetNs != NULL) && + (xmlStrEqual(alias->targetNs->href, ns->href))) + { + /* + * Recognized as a target namespace; use it regardless + * if excluded otherwise. + */ + goto add_effective_ns; + } + alias = alias->next; + } while (alias != NULL); + + alias = cctxt->nsAliases; + do { + /* + * TODO: Is xmlns="" handled already? + */ + if ((alias->literalNs != NULL) && + (xmlStrEqual(alias->literalNs->href, ns->href))) + { + /* + * Recognized as an namespace alias; do not use it. + */ + goto skip_ns; + } + alias = alias->next; + } while (alias != NULL); + } + + /* + * Exclude excluded result namespaces. + */ + if (exclResultNs) { + for (j = 0; j < exclResultNs->number; j++) + if (xmlStrEqual(ns->href, BAD_CAST exclResultNs->items[j])) + goto skip_ns; + } + /* + * Exclude extension-element namespaces. + */ + if (extElemNs) { + for (j = 0; j < extElemNs->number; j++) + if (xmlStrEqual(ns->href, BAD_CAST extElemNs->items[j])) + goto skip_ns; + } + +add_effective_ns: + /* + * OPTIMIZE TODO: This information may not be needed. + */ + if (isLRE && (elem->nsDef != NULL)) { + holdByElem = 0; + tmpns = elem->nsDef; + do { + if (tmpns == ns) { + holdByElem = 1; + break; + } + tmpns = tmpns->next; + } while (tmpns != NULL); + } else + holdByElem = 0; + + + /* + * Add the effective namespace declaration. + */ + effNs = (xsltEffectiveNsPtr) xmlMalloc(sizeof(xsltEffectiveNs)); + if (effNs == NULL) { + xsltTransformError(NULL, cctxt->style, elem, + "Internal error in xsltLREBuildEffectiveNs(): " + "failed to allocate memory.\n"); + cctxt->style->errors++; + return(-1); + } + if (cctxt->psData->effectiveNs == NULL) { + cctxt->psData->effectiveNs = effNs; + effNs->nextInStore = NULL; + } else { + effNs->nextInStore = cctxt->psData->effectiveNs; + cctxt->psData->effectiveNs = effNs; + } + + effNs->next = NULL; + effNs->prefix = ns->prefix; + effNs->nsName = ns->href; + effNs->holdByElem = holdByElem; + + if (lastEffNs == NULL) + item->effectiveNs = effNs; + else + lastEffNs->next = effNs; + lastEffNs = effNs; + +skip_ns: + {} + } + return(0); +} + + +/** + * xsltLREInfoCreate: + * + * @isLRE: indicates if the given @elem is a literal result element + * + * Creates a new info for a literal result element. + */ +static int +xsltLREInfoCreate(xsltCompilerCtxtPtr cctxt, + xmlNodePtr elem, + int isLRE) +{ + xsltStyleItemLRElementInfoPtr item; + + if ((cctxt == NULL) || (cctxt->inode == NULL)) + return(-1); + + item = (xsltStyleItemLRElementInfoPtr) + xmlMalloc(sizeof(xsltStyleItemLRElementInfo)); + if (item == NULL) { + xsltTransformError(NULL, cctxt->style, NULL, + "Internal error in xsltLREInfoCreate(): " + "memory allocation failed.\n"); + cctxt->style->errors++; + return(-1); + } + memset(item, 0, sizeof(xsltStyleItemLRElementInfo)); + item->type = XSLT_FUNC_LITERAL_RESULT_ELEMENT; + /* + * Store it in the stylesheet. + */ + item->next = cctxt->style->preComps; + cctxt->style->preComps = (xsltElemPreCompPtr) item; + /* + * @inScopeNs are used for execution of XPath expressions + * in AVTs. + */ + item->inScopeNs = cctxt->inode->inScopeNs; + + if (elem) + xsltLREBuildEffectiveNsNodes(cctxt, item, elem, isLRE); + + cctxt->inode->litResElemInfo = item; + cctxt->inode->nsChanged = 0; + cctxt->maxLREs++; + return(0); +} + +/** + * xsltCompilerVarInfoPush: + * @cctxt: the compilation context + * + * Pushes a new var/param info onto the stack. + * + * Returns the acquired variable info. + */ +static xsltVarInfoPtr +xsltCompilerVarInfoPush(xsltCompilerCtxtPtr cctxt, + xmlNodePtr inst, + const xmlChar *name, + const xmlChar *nsName) +{ + xsltVarInfoPtr ivar; + + if ((cctxt->ivar != NULL) && (cctxt->ivar->next != NULL)) { + ivar = cctxt->ivar->next; + } else if ((cctxt->ivar == NULL) && (cctxt->ivars != NULL)) { + ivar = cctxt->ivars; + } else { + ivar = (xsltVarInfoPtr) xmlMalloc(sizeof(xsltVarInfo)); + if (ivar == NULL) { + xsltTransformError(NULL, cctxt->style, inst, + "xsltParseInScopeVarPush: xmlMalloc() failed!\n"); + cctxt->style->errors++; + return(NULL); + } + /* memset(retVar, 0, sizeof(xsltInScopeVar)); */ + if (cctxt->ivars == NULL) { + cctxt->ivars = ivar; + ivar->prev = NULL; + } else { + cctxt->ivar->next = ivar; + ivar->prev = cctxt->ivar; + } + cctxt->ivar = ivar; + ivar->next = NULL; + } + ivar->depth = cctxt->depth; + ivar->name = name; + ivar->nsName = nsName; + return(ivar); +} + +/** + * xsltCompilerVarInfoPop: + * @cctxt: the compilation context + * + * Pops all var/param infos from the stack, which + * have the current depth. + */ +static void +xsltCompilerVarInfoPop(xsltCompilerCtxtPtr cctxt) +{ + + while ((cctxt->ivar != NULL) && + (cctxt->ivar->depth > cctxt->depth)) + { + cctxt->ivar = cctxt->ivar->prev; + } +} + +/* +* xsltCompilerNodePush: +* +* @cctxt: the compilation context +* @node: the node to be pushed (this can also be the doc-node) +* +* +* +* Returns the current node info structure or +* NULL in case of an internal error. +*/ +static xsltCompilerNodeInfoPtr +xsltCompilerNodePush(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) +{ + xsltCompilerNodeInfoPtr inode, iprev; + + if ((cctxt->inode != NULL) && (cctxt->inode->next != NULL)) { + inode = cctxt->inode->next; + } else if ((cctxt->inode == NULL) && (cctxt->inodeList != NULL)) { + inode = cctxt->inodeList; + } else { + /* + * Create a new node-info. + */ + inode = (xsltCompilerNodeInfoPtr) + xmlMalloc(sizeof(xsltCompilerNodeInfo)); + if (inode == NULL) { + xsltTransformError(NULL, cctxt->style, NULL, + "xsltCompilerNodePush: malloc failed.\n"); + return(NULL); + } + memset(inode, 0, sizeof(xsltCompilerNodeInfo)); + if (cctxt->inodeList == NULL) + cctxt->inodeList = inode; + else { + cctxt->inodeLast->next = inode; + inode->prev = cctxt->inodeLast; + } + cctxt->inodeLast = inode; + cctxt->maxNodeInfos++; + if (cctxt->inode == NULL) { + cctxt->inode = inode; + /* + * Create an initial literal result element info for + * the root of the stylesheet. + */ + xsltLREInfoCreate(cctxt, NULL, 0); + } + } + cctxt->depth++; + cctxt->inode = inode; + /* + * REVISIT TODO: Keep the reset always complete. + * NOTE: Be carefull with the @node, since it might be + * a doc-node. + */ + inode->node = node; + inode->depth = cctxt->depth; + inode->templ = NULL; + inode->category = XSLT_ELEMENT_CATEGORY_XSLT; + inode->type = 0; + inode->item = NULL; + inode->curChildType = 0; + inode->extContentHandled = 0; + inode->isRoot = 0; + + if (inode->prev != NULL) { + iprev = inode->prev; + /* + * Inherit the following information: + * --------------------------------- + * + * In-scope namespaces + */ + inode->inScopeNs = iprev->inScopeNs; + /* + * Info for literal result elements + */ + inode->litResElemInfo = iprev->litResElemInfo; + inode->nsChanged = iprev->nsChanged; + /* + * Excluded result namespaces + */ + inode->exclResultNs = iprev->exclResultNs; + /* + * Extension instruction namespaces + */ + inode->extElemNs = iprev->extElemNs; + /* + * Whitespace preservation + */ + inode->preserveWhitespace = iprev->preserveWhitespace; + /* + * Forwards-compatible mode + */ + inode->forwardsCompat = iprev->forwardsCompat; + } else { + inode->inScopeNs = NULL; + inode->exclResultNs = NULL; + inode->extElemNs = NULL; + inode->preserveWhitespace = 0; + inode->forwardsCompat = 0; + } + + return(inode); +} + +/* +* xsltCompilerNodePop: +* +* @cctxt: the compilation context +* @node: the node to be pushed (this can also be the doc-node) +* +* Pops the current node info. +*/ +static void +xsltCompilerNodePop(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) +{ + if (cctxt->inode == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xsltCompilerNodePop: Top-node mismatch.\n"); + return; + } + /* + * NOTE: Be carefull with the @node, since it might be + * a doc-node. + */ + if (cctxt->inode->node != node) { + xmlGenericError(xmlGenericErrorContext, + "xsltCompilerNodePop: Node mismatch.\n"); + goto mismatch; + } + if (cctxt->inode->depth != cctxt->depth) { + xmlGenericError(xmlGenericErrorContext, + "xsltCompilerNodePop: Depth mismatch.\n"); + goto mismatch; + } + cctxt->depth--; + /* + * Pop information of variables. + */ + if ((cctxt->ivar) && (cctxt->ivar->depth > cctxt->depth)) + xsltCompilerVarInfoPop(cctxt); + + cctxt->inode = cctxt->inode->prev; + if (cctxt->inode != NULL) + cctxt->inode->curChildType = 0; + return; + +mismatch: + { + const xmlChar *nsName = NULL, *name = NULL; + const xmlChar *infnsName = NULL, *infname = NULL; + + if (node) { + if (node->type == XML_ELEMENT_NODE) { + name = node->name; + if (node->ns != NULL) + nsName = node->ns->href; + else + nsName = BAD_CAST ""; + } else { + name = BAD_CAST "#document"; + nsName = BAD_CAST ""; + } + } else + name = BAD_CAST "Not given"; + + if (cctxt->inode->node) { + if (node->type == XML_ELEMENT_NODE) { + infname = cctxt->inode->node->name; + if (cctxt->inode->node->ns != NULL) + infnsName = cctxt->inode->node->ns->href; + else + infnsName = BAD_CAST ""; + } else { + infname = BAD_CAST "#document"; + infnsName = BAD_CAST ""; + } + } else + infname = BAD_CAST "Not given"; + + + xmlGenericError(xmlGenericErrorContext, + "xsltCompilerNodePop: Given : '%s' URI '%s'\n", + name, nsName); + xmlGenericError(xmlGenericErrorContext, + "xsltCompilerNodePop: Expected: '%s' URI '%s'\n", + infname, infnsName); + } +} + +/* +* xsltCompilerBuildInScopeNsList: +* +* Create and store the list of in-scope namespaces for the given +* node in the stylesheet. If there are no changes in the in-scope +* namespaces then the last ns-info of the ancestor axis will be returned. +* Compilation-time only. +* +* Returns the ns-info or NULL if there are no namespaces in scope. +*/ +static xsltNsListContainerPtr +xsltCompilerBuildInScopeNsList(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) +{ + xsltNsListContainerPtr nsi = NULL; + xmlNsPtr *list = NULL, ns; + int i, maxns = 5; + /* + * Create a new ns-list for this position in the node-tree. + * xmlGetNsList() will return NULL, if there are no ns-decls in the + * tree. Note that the ns-decl for the XML namespace is not added + * to the resulting list; the XPath module handles the XML namespace + * internally. + */ + while (node != NULL) { + if (node->type == XML_ELEMENT_NODE) { + ns = node->nsDef; + while (ns != NULL) { + if (nsi == NULL) { + nsi = (xsltNsListContainerPtr) + xmlMalloc(sizeof(xsltNsListContainer)); + if (nsi == NULL) { + xsltTransformError(NULL, cctxt->style, NULL, + "xsltCompilerBuildInScopeNsList: " + "malloc failed!\n"); + goto internal_err; + } + memset(nsi, 0, sizeof(xsltNsListContainer)); + nsi->list = + (xmlNsPtr *) xmlMalloc(maxns * sizeof(xmlNsPtr)); + if (nsi->list == NULL) { + xsltTransformError(NULL, cctxt->style, NULL, + "xsltCompilerBuildInScopeNsList: " + "malloc failed!\n"); + goto internal_err; + } + nsi->list[0] = NULL; + } + /* + * Skip shadowed namespace bindings. + */ + for (i = 0; i < nsi->totalNumber; i++) { + if ((ns->prefix == nsi->list[i]->prefix) || + (xmlStrEqual(ns->prefix, nsi->list[i]->prefix))) + break; + } + if (i >= nsi->totalNumber) { + if (nsi->totalNumber +1 >= maxns) { + maxns *= 2; + nsi->list = + (xmlNsPtr *) xmlRealloc(nsi->list, + maxns * sizeof(xmlNsPtr)); + if (nsi->list == NULL) { + xsltTransformError(NULL, cctxt->style, NULL, + "xsltCompilerBuildInScopeNsList: " + "realloc failed!\n"); + goto internal_err; + } + } + nsi->list[nsi->totalNumber++] = ns; + nsi->list[nsi->totalNumber] = NULL; + } + + ns = ns->next; + } + } + node = node->parent; + } + if (nsi == NULL) + return(NULL); + /* + * Move the default namespace to last position. + */ + nsi->xpathNumber = nsi->totalNumber; + for (i = 0; i < nsi->totalNumber; i++) { + if (nsi->list[i]->prefix == NULL) { + ns = nsi->list[i]; + nsi->list[i] = nsi->list[nsi->totalNumber-1]; + nsi->list[nsi->totalNumber-1] = ns; + nsi->xpathNumber--; + break; + } + } + /* + * Store the ns-list in the stylesheet. + */ + if (xsltPointerListAddSize( + (xsltPointerListPtr)cctxt->psData->inScopeNamespaces, + (void *) nsi, 5) == -1) + { + xmlFree(nsi); + nsi = NULL; + xsltTransformError(NULL, cctxt->style, NULL, + "xsltCompilerBuildInScopeNsList: failed to add ns-info.\n"); + goto internal_err; + } + /* + * Notify of change in status wrt namespaces. + */ + if (cctxt->inode != NULL) + cctxt->inode->nsChanged = 1; + + return(nsi); + +internal_err: + if (list != NULL) + xmlFree(list); + cctxt->style->errors++; + return(NULL); +} + +static int +xsltParseNsPrefixList(xsltCompilerCtxtPtr cctxt, + xsltPointerListPtr list, + xmlNodePtr node, + const xmlChar *value) +{ + xmlChar *cur, *end; + xmlNsPtr ns; + + if ((cctxt == NULL) || (value == NULL) || (list == NULL)) + return(-1); + + list->number = 0; + + cur = (xmlChar *) value; + while (*cur != 0) { + while (IS_BLANK(*cur)) cur++; + if (*cur == 0) + break; + end = cur; + while ((*end != 0) && (!IS_BLANK(*end))) end++; + cur = xmlStrndup(cur, end - cur); + if (cur == NULL) { + cur = end; + continue; + } + /* + * TODO: Export and use xmlSearchNsByPrefixStrict() + * in Libxml2, tree.c, since xmlSearchNs() is in most + * cases not efficient and in some cases not correct. + * + * XSLT-2 TODO: XSLT 2.0 allows an additional "#all" value. + */ + if ((cur[0] == '#') && + xmlStrEqual(cur, (const xmlChar *)"#default")) + ns = xmlSearchNs(cctxt->style->doc, node, NULL); + else + ns = xmlSearchNs(cctxt->style->doc, node, cur); + + if (ns == NULL) { + /* + * TODO: Better to report the attr-node, otherwise + * the user won't know which attribute was invalid. + */ + xsltTransformError(NULL, cctxt->style, node, + "No namespace binding in scope for prefix '%s'.\n", cur); + /* + * XSLT-1.0: "It is an error if there is no namespace + * bound to the prefix on the element bearing the + * exclude-result-prefixes or xsl:exclude-result-prefixes + * attribute." + */ + cctxt->style->errors++; + } else { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "resolved prefix '%s'\n", cur); +#endif + /* + * Note that we put the namespace name into the dict. + */ + if (xsltPointerListAddSize(list, + (void *) xmlDictLookup(cctxt->style->dict, + ns->href, -1), 5) == -1) + { + xmlFree(cur); + goto internal_err; + } + } + xmlFree(cur); + + cur = end; + } + return(0); + +internal_err: + cctxt->style->errors++; + return(-1); +} + +/** + * xsltCompilerUtilsCreateMergedList: + * @dest: the destination list (optional) + * @first: the first list + * @second: the second list (optional) + * + * Appends the content of @second to @first into @destination. + * If @destination is NULL a new list will be created. + * + * Returns the merged list of items or NULL if there's nothing to merge. + */ +static xsltPointerListPtr +xsltCompilerUtilsCreateMergedList(xsltPointerListPtr first, + xsltPointerListPtr second) +{ + xsltPointerListPtr ret; + size_t num; + + if (first) + num = first->number; + else + num = 0; + if (second) + num += second->number; + if (num == 0) + return(NULL); + ret = xsltPointerListCreate(num); + if (ret == NULL) + return(NULL); + /* + * Copy contents. + */ + if ((first != NULL) && (first->number != 0)) { + memcpy(ret->items, first->items, + first->number * sizeof(void *)); + if ((second != NULL) && (second->number != 0)) + memcpy(ret->items + first->number, second->items, + second->number * sizeof(void *)); + } else if ((second != NULL) && (second->number != 0)) + memcpy(ret->items, (void *) second->items, + second->number * sizeof(void *)); + ret->number = num; + return(ret); +} + +/* +* xsltParseExclResultPrefixes: +* +* Create and store the list of in-scope namespaces for the given +* node in the stylesheet. If there are no changes in the in-scope +* namespaces then the last ns-info of the ancestor axis will be returned. +* Compilation-time only. +* +* Returns the ns-info or NULL if there are no namespaces in scope. +*/ +static xsltPointerListPtr +xsltParseExclResultPrefixes(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, + xsltPointerListPtr def, + int instrCategory) +{ + xsltPointerListPtr list = NULL; + xmlChar *value; + xmlAttrPtr attr; + + if ((cctxt == NULL) || (node == NULL)) + return(NULL); + + if (instrCategory == XSLT_ELEMENT_CATEGORY_XSLT) + attr = xmlHasNsProp(node, BAD_CAST "exclude-result-prefixes", NULL); + else + attr = xmlHasNsProp(node, BAD_CAST "exclude-result-prefixes", + XSLT_NAMESPACE); + if (attr == NULL) + return(def); + + if (attr && (instrCategory == XSLT_ELEMENT_CATEGORY_LRE)) { + /* + * Mark the XSLT attr. + */ + attr->psvi = (void *) xsltXSLTAttrMarker; + } + + if ((attr->children != NULL) && + (attr->children->content != NULL)) + value = attr->children->content; + else { + xsltTransformError(NULL, cctxt->style, node, + "Attribute 'exclude-result-prefixes': Invalid value.\n"); + cctxt->style->errors++; + return(def); + } + + if (xsltParseNsPrefixList(cctxt, cctxt->tmpList, node, + BAD_CAST value) != 0) + goto exit; + if (cctxt->tmpList->number == 0) + goto exit; + /* + * Merge the list with the inherited list. + */ + list = xsltCompilerUtilsCreateMergedList(def, cctxt->tmpList); + if (list == NULL) + goto exit; + /* + * Store the list in the stylesheet/compiler context. + */ + if (xsltPointerListAddSize( + cctxt->psData->exclResultNamespaces, list, 5) == -1) + { + xsltPointerListFree(list); + list = NULL; + goto exit; + } + /* + * Notify of change in status wrt namespaces. + */ + if (cctxt->inode != NULL) + cctxt->inode->nsChanged = 1; + +exit: + if (list != NULL) + return(list); + else + return(def); +} + +/* +* xsltParseExtElemPrefixes: +* +* Create and store the list of in-scope namespaces for the given +* node in the stylesheet. If there are no changes in the in-scope +* namespaces then the last ns-info of the ancestor axis will be returned. +* Compilation-time only. +* +* Returns the ns-info or NULL if there are no namespaces in scope. +*/ +static xsltPointerListPtr +xsltParseExtElemPrefixes(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, + xsltPointerListPtr def, + int instrCategory) +{ + xsltPointerListPtr list = NULL; + xmlAttrPtr attr; + xmlChar *value; + int i; + + if ((cctxt == NULL) || (node == NULL)) + return(NULL); + + if (instrCategory == XSLT_ELEMENT_CATEGORY_XSLT) + attr = xmlHasNsProp(node, BAD_CAST "extension-element-prefixes", NULL); + else + attr = xmlHasNsProp(node, BAD_CAST "extension-element-prefixes", + XSLT_NAMESPACE); + if (attr == NULL) + return(def); + + if (attr && (instrCategory == XSLT_ELEMENT_CATEGORY_LRE)) { + /* + * Mark the XSLT attr. + */ + attr->psvi = (void *) xsltXSLTAttrMarker; + } + + if ((attr->children != NULL) && + (attr->children->content != NULL)) + value = attr->children->content; + else { + xsltTransformError(NULL, cctxt->style, node, + "Attribute 'extension-element-prefixes': Invalid value.\n"); + cctxt->style->errors++; + return(def); + } + + + if (xsltParseNsPrefixList(cctxt, cctxt->tmpList, node, + BAD_CAST value) != 0) + goto exit; + + if (cctxt->tmpList->number == 0) + goto exit; + /* + * REVISIT: Register the extension namespaces. + */ + for (i = 0; i < cctxt->tmpList->number; i++) + xsltRegisterExtPrefix(cctxt->style, NULL, + BAD_CAST cctxt->tmpList->items[i]); + /* + * Merge the list with the inherited list. + */ + list = xsltCompilerUtilsCreateMergedList(def, cctxt->tmpList); + if (list == NULL) + goto exit; + /* + * Store the list in the stylesheet. + */ + if (xsltPointerListAddSize( + cctxt->psData->extElemNamespaces, list, 5) == -1) + { + xsltPointerListFree(list); + list = NULL; + goto exit; + } + /* + * Notify of change in status wrt namespaces. + */ + if (cctxt->inode != NULL) + cctxt->inode->nsChanged = 1; + +exit: + if (list != NULL) + return(list); + else + return(def); +} + +/* +* xsltParseAttrXSLTVersion: +* +* @cctxt: the compilation context +* @node: the element-node +* @isXsltElem: whether this is an XSLT element +* +* Parses the attribute xsl:version. +* +* Returns 1 if there was such an attribute, 0 if not and +* -1 if an internal or API error occured. +*/ +static int +xsltParseAttrXSLTVersion(xsltCompilerCtxtPtr cctxt, xmlNodePtr node, + int instrCategory) +{ + xmlChar *value; + xmlAttrPtr attr; + + if ((cctxt == NULL) || (node == NULL)) + return(-1); + + if (instrCategory == XSLT_ELEMENT_CATEGORY_XSLT) + attr = xmlHasNsProp(node, BAD_CAST "version", NULL); + else + attr = xmlHasNsProp(node, BAD_CAST "version", XSLT_NAMESPACE); + + if (attr == NULL) + return(0); + + attr->psvi = (void *) xsltXSLTAttrMarker; + + if ((attr->children != NULL) && + (attr->children->content != NULL)) + value = attr->children->content; + else { + xsltTransformError(NULL, cctxt->style, node, + "Attribute 'version': Invalid value.\n"); + cctxt->style->errors++; + return(1); + } + + if (! xmlStrEqual(value, (const xmlChar *)"1.0")) { + cctxt->inode->forwardsCompat = 1; + /* + * TODO: To what extent do we support the + * forwards-compatible mode? + */ + /* + * Report this only once per compilation episode. + */ + if (! cctxt->hasForwardsCompat) { + cctxt->hasForwardsCompat = 1; + cctxt->errSeverity = XSLT_ERROR_SEVERITY_WARNING; + xsltTransformError(NULL, cctxt->style, node, + "Warning: the attribute xsl:version specifies a value " + "different from '1.0'. Switching to forwards-compatible " + "mode. Only features of XSLT 1.0 are supported by this " + "processor.\n"); + cctxt->style->warnings++; + cctxt->errSeverity = XSLT_ERROR_SEVERITY_ERROR; + } + } else { + cctxt->inode->forwardsCompat = 0; + } + + if (attr && (instrCategory == XSLT_ELEMENT_CATEGORY_LRE)) { + /* + * Set a marker on XSLT attributes. + */ + attr->psvi = (void *) xsltXSLTAttrMarker; + } + return(1); +} + +static int +xsltParsePreprocessStylesheetTree(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) +{ + xmlNodePtr deleteNode, cur, txt, textNode = NULL; + xmlDocPtr doc; + xsltStylesheetPtr style; + int internalize = 0, findSpaceAttr; + int xsltStylesheetElemDepth; + xmlAttrPtr attr; + xmlChar *value; + const xmlChar *name, *nsNameXSLT = NULL; + int strictWhitespace, inXSLText = 0; +#ifdef XSLT_REFACTORED_XSLT_NSCOMP + xsltNsMapPtr nsMapItem; +#endif + + if ((cctxt == NULL) || (cctxt->style == NULL) || + (node == NULL) || (node->type != XML_ELEMENT_NODE)) + return(-1); + + doc = node->doc; + if (doc == NULL) + goto internal_err; + + style = cctxt->style; + if ((style->dict != NULL) && (doc->dict == style->dict)) + internalize = 1; + else + style->internalized = 0; + + /* + * Init value of xml:space. Since this might be an embedded + * stylesheet, this is needed to be performed on the element + * where the stylesheet is rooted at, taking xml:space of + * ancestors into account. + */ + if (! cctxt->simplified) + xsltStylesheetElemDepth = cctxt->depth +1; + else + xsltStylesheetElemDepth = 0; + + if (xmlNodeGetSpacePreserve(node) != 1) + cctxt->inode->preserveWhitespace = 0; + else + cctxt->inode->preserveWhitespace = 1; + + /* + * Eval if we should keep the old incorrect behaviour. + */ + strictWhitespace = (cctxt->strict != 0) ? 1 : 0; + + nsNameXSLT = xsltConstNamespaceNameXSLT; + + deleteNode = NULL; + cur = node; + while (cur != NULL) { + if (deleteNode != NULL) { + +#ifdef WITH_XSLT_DEBUG_BLANKS + xsltGenericDebug(xsltGenericDebugContext, + "xsltParsePreprocessStylesheetTree: removing node\n"); +#endif + xmlUnlinkNode(deleteNode); + xmlFreeNode(deleteNode); + deleteNode = NULL; + } + if (cur->type == XML_ELEMENT_NODE) { + + /* + * Clear the PSVI field. + */ + cur->psvi = NULL; + + xsltCompilerNodePush(cctxt, cur); + + inXSLText = 0; + textNode = NULL; + findSpaceAttr = 1; + cctxt->inode->stripWhitespace = 0; + /* + * TODO: I'd love to use a string pointer comparison here :-/ + */ + if (IS_XSLT_ELEM(cur)) { +#ifdef XSLT_REFACTORED_XSLT_NSCOMP + if (cur->ns->href != nsNameXSLT) { + nsMapItem = xsltNewNamespaceMapItem(cctxt, + doc, cur->ns, cur); + if (nsMapItem == NULL) + goto internal_err; + cur->ns->href = nsNameXSLT; + } +#endif + + if (cur->name == NULL) + goto process_attributes; + /* + * Mark the XSLT element for later recognition. + * TODO: Using the marker is still too dangerous, since if + * the parsing mechanism leaves out an XSLT element, then + * this might hit the transformation-mechanism, which + * will break if it doesn't expect such a marker. + */ + /* cur->psvi = (void *) xsltXSLTElemMarker; */ + + /* + * XSLT 2.0: "Any whitespace text node whose parent is + * one of the following elements is removed from the " + * tree, regardless of any xml:space attributes:..." + * xsl:apply-imports, + * xsl:apply-templates, + * xsl:attribute-set, + * xsl:call-template, + * xsl:choose, + * xsl:stylesheet, xsl:transform. + * XSLT 2.0: xsl:analyze-string, + * xsl:character-map, + * xsl:next-match + * + * TODO: I'd love to use a string pointer comparison here :-/ + */ + name = cur->name; + switch (*name) { + case 't': + if ((name[0] == 't') && (name[1] == 'e') && + (name[2] == 'x') && (name[3] == 't') && + (name[4] == 0)) + { + /* + * Process the xsl:text element. + * ---------------------------- + * Mark it for later recognition. + */ + cur->psvi = (void *) xsltXSLTTextMarker; + /* + * For stylesheets, the set of + * whitespace-preserving element names + * consists of just xsl:text. + */ + findSpaceAttr = 0; + cctxt->inode->preserveWhitespace = 1; + inXSLText = 1; + } + break; + case 'c': + if (xmlStrEqual(name, BAD_CAST "choose") || + xmlStrEqual(name, BAD_CAST "call-template")) + cctxt->inode->stripWhitespace = 1; + break; + case 'a': + if (xmlStrEqual(name, BAD_CAST "apply-templates") || + xmlStrEqual(name, BAD_CAST "apply-imports") || + xmlStrEqual(name, BAD_CAST "attribute-set")) + + cctxt->inode->stripWhitespace = 1; + break; + default: + if (xsltStylesheetElemDepth == cctxt->depth) { + /* + * This is a xsl:stylesheet/xsl:transform. + */ + cctxt->inode->stripWhitespace = 1; + break; + } + + if ((cur->prev != NULL) && + (cur->prev->type == XML_TEXT_NODE)) + { + /* + * XSLT 2.0 : "Any whitespace text node whose + * following-sibling node is an xsl:param or + * xsl:sort element is removed from the tree, + * regardless of any xml:space attributes." + */ + if (((*name == 'p') || (*name == 's')) && + (xmlStrEqual(name, BAD_CAST "param") || + xmlStrEqual(name, BAD_CAST "sort"))) + { + do { + if (IS_BLANK_NODE(cur->prev)) { + txt = cur->prev; + xmlUnlinkNode(txt); + xmlFreeNode(txt); + } else { + /* + * This will result in a content + * error, when hitting the parsing + * functions. + */ + break; + } + } while (cur->prev); + } + } + break; + } + } + +process_attributes: + /* + * Process attributes. + * ------------------ + */ + if (cur->properties != NULL) { + if (cur->children == NULL) + findSpaceAttr = 0; + attr = cur->properties; + do { +#ifdef XSLT_REFACTORED_XSLT_NSCOMP + if ((attr->ns) && (attr->ns->href != nsNameXSLT) && + xmlStrEqual(attr->ns->href, nsNameXSLT)) + { + nsMapItem = xsltNewNamespaceMapItem(cctxt, + doc, attr->ns, cur); + if (nsMapItem == NULL) + goto internal_err; + attr->ns->href = nsNameXSLT; + } +#endif + if (internalize) { + /* + * Internalize the attribute's value; the goal is to + * speed up operations and minimize used space by + * compiled stylesheets. + */ + txt = attr->children; + /* + * NOTE that this assumes only one + * text-node in the attribute's content. + */ + if ((txt != NULL) && (txt->content != NULL) && + (!xmlDictOwns(style->dict, txt->content))) + { + value = (xmlChar *) xmlDictLookup(style->dict, + txt->content, -1); + xmlNodeSetContent(txt, NULL); + txt->content = value; + } + } + /* + * Process xml:space attributes. + * ---------------------------- + */ + if ((findSpaceAttr != 0) && + (attr->ns != NULL) && + (attr->name != NULL) && + (attr->name[0] == 's') && + (attr->ns->prefix != NULL) && + (attr->ns->prefix[0] == 'x') && + (attr->ns->prefix[1] == 'm') && + (attr->ns->prefix[2] == 'l') && + (attr->ns->prefix[3] == 0)) + { + value = xmlGetNsProp(cur, BAD_CAST "space", + XML_XML_NAMESPACE); + if (value != NULL) { + if (xmlStrEqual(value, BAD_CAST "preserve")) { + cctxt->inode->preserveWhitespace = 1; + } else if (xmlStrEqual(value, BAD_CAST "default")) { + cctxt->inode->preserveWhitespace = 0; + } else { + /* Invalid value for xml:space. */ + xsltTransformError(NULL, style, cur, + "Attribute xml:space: Invalid value.\n"); + cctxt->style->warnings++; + } + findSpaceAttr = 0; + xmlFree(value); + } + + } + attr = attr->next; + } while (attr != NULL); + } + /* + * We'll descend into the children of element nodes only. + */ + if (cur->children != NULL) { + cur = cur->children; + continue; + } + } else if ((cur->type == XML_TEXT_NODE) || + (cur->type == XML_CDATA_SECTION_NODE)) + { + /* + * Merge adjacent text/CDATA-section-nodes + * --------------------------------------- + * In order to avoid breaking of existing stylesheets, + * if the old behaviour is wanted (strictWhitespace == 0), + * then we *won't* merge adjacent text-nodes + * (except in xsl:text); this will ensure that whitespace-only + * text nodes are (incorrectly) not stripped in some cases. + * + * Example: : zoo + * Corrent (strict) result: zoo + * Incorrect (old) result : zoo + * + * NOTE that we *will* merge adjacent text-nodes if + * they are in xsl:text. + * Example, the following: + * zoo + * will result in both cases in: + * zoo + */ + cur->type = XML_TEXT_NODE; + if ((strictWhitespace != 0) || (inXSLText != 0)) { + /* + * New behaviour; merge nodes. + */ + if (textNode == NULL) + textNode = cur; + else { + if (cur->content != NULL) + xmlNodeAddContent(textNode, cur->content); + deleteNode = cur; + } + if ((cur->next == NULL) || + (cur->next->type == XML_ELEMENT_NODE)) + goto end_of_text; + else + goto next_sibling; + } else { + /* + * Old behaviour. + */ + if (textNode == NULL) + textNode = cur; + goto end_of_text; + } + } else if ((cur->type == XML_COMMENT_NODE) || + (cur->type == XML_PI_NODE)) + { + /* + * Remove processing instructions and comments. + */ + deleteNode = cur; + if ((cur->next == NULL) || + (cur->next->type == XML_ELEMENT_NODE)) + goto end_of_text; + else + goto next_sibling; + } else { + textNode = NULL; + /* + * Invalid node-type for this data-model. + */ + xsltTransformError(NULL, style, cur, + "Invalid type of node for the XSLT data model.\n"); + cctxt->style->errors++; + goto next_sibling; + } + +end_of_text: + if (textNode) { + value = textNode->content; + /* + * At this point all adjacent text/CDATA-section nodes + * have been merged. + * + * Strip whitespace-only text-nodes. + * (cctxt->inode->stripWhitespace) + */ + if ((value == NULL) || (*value == 0) || + (((cctxt->inode->stripWhitespace) || + (! cctxt->inode->preserveWhitespace)) && + IS_BLANK(*value) && + xsltIsBlank(value))) + { + if (textNode != cur) { + xmlUnlinkNode(textNode); + xmlFreeNode(textNode); + } else + deleteNode = textNode; + textNode = NULL; + goto next_sibling; + } + /* + * Convert CDATA-section nodes to text-nodes. + * TODO: Can this produce problems? + */ + if (textNode->type != XML_TEXT_NODE) { + textNode->type = XML_TEXT_NODE; + textNode->name = xmlStringText; + } + if (internalize && + (textNode->content != NULL) && + (!xmlDictOwns(style->dict, textNode->content))) + { + /* + * Internalize the string. + */ + value = (xmlChar *) xmlDictLookup(style->dict, + textNode->content, -1); + xmlNodeSetContent(textNode, NULL); + textNode->content = value; + } + textNode = NULL; + /* + * Note that "disable-output-escaping" of the xsl:text + * element will be applied at a later level, when + * XSLT elements are processed. + */ + } + +next_sibling: + if (cur->type == XML_ELEMENT_NODE) { + xsltCompilerNodePop(cctxt, cur); + } + if (cur == node) + break; + if (cur->next != NULL) { + cur = cur->next; + } else { + cur = cur->parent; + inXSLText = 0; + goto next_sibling; + }; + } + if (deleteNode != NULL) { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltParsePreprocessStylesheetTree: removing node\n"); +#endif + xmlUnlinkNode(deleteNode); + xmlFreeNode(deleteNode); + } + return(0); + +internal_err: + return(-1); +} + +#endif /* XSLT_REFACTORED */ + +#ifdef XSLT_REFACTORED +#else +static void +xsltPrecomputeStylesheet(xsltStylesheetPtr style, xmlNodePtr cur) +{ + xmlNodePtr deleteNode, styleelem; + int internalize = 0; + + if ((style == NULL) || (cur == NULL)) + return; + + if ((cur->doc != NULL) && (style->dict != NULL) && + (cur->doc->dict == style->dict)) + internalize = 1; + else + style->internalized = 0; + + if ((cur != NULL) && (IS_XSLT_ELEM(cur)) && + (IS_XSLT_NAME(cur, "stylesheet"))) { + styleelem = cur; + } else { + styleelem = NULL; + } + + /* + * This content comes from the stylesheet + * For stylesheets, the set of whitespace-preserving + * element names consists of just xsl:text. + */ + deleteNode = NULL; + while (cur != NULL) { + if (deleteNode != NULL) { +#ifdef WITH_XSLT_DEBUG_BLANKS + xsltGenericDebug(xsltGenericDebugContext, + "xsltPrecomputeStylesheet: removing ignorable blank node\n"); +#endif + xmlUnlinkNode(deleteNode); + xmlFreeNode(deleteNode); + deleteNode = NULL; + } + if (cur->type == XML_ELEMENT_NODE) { + int exclPrefixes; + /* + * Internalize attributes values. + */ + if ((internalize) && (cur->properties != NULL)) { + xmlAttrPtr attr = cur->properties; + xmlNodePtr txt; + + while (attr != NULL) { + txt = attr->children; + if ((txt != NULL) && (txt->type == XML_TEXT_NODE) && + (txt->content != NULL) && + (!xmlDictOwns(style->dict, txt->content))) + { + xmlChar *tmp; + + /* + * internalize the text string, goal is to speed + * up operations and minimize used space by compiled + * stylesheets. + */ + tmp = (xmlChar *) xmlDictLookup(style->dict, + txt->content, -1); + if (tmp != txt->content) { + xmlNodeSetContent(txt, NULL); + txt->content = tmp; + } + } + attr = attr->next; + } + } + if (IS_XSLT_ELEM(cur)) { + exclPrefixes = 0; + xsltStylePreCompute(style, cur); + if (IS_XSLT_NAME(cur, "text")) { + for (;exclPrefixes > 0;exclPrefixes--) + exclPrefixPop(style); + goto skip_children; + } + } else { + exclPrefixes = xsltParseStylesheetExcludePrefix(style, cur, 0); + } + + if ((cur->nsDef != NULL) && (style->exclPrefixNr > 0)) { + xmlNsPtr ns = cur->nsDef, prev = NULL, next; + xmlNodePtr root = NULL; + int i, moved; + + root = xmlDocGetRootElement(cur->doc); + if ((root != NULL) && (root != cur)) { + while (ns != NULL) { + moved = 0; + next = ns->next; + for (i = 0;i < style->exclPrefixNr;i++) { + if ((ns->prefix != NULL) && + (xmlStrEqual(ns->href, + style->exclPrefixTab[i]))) { + /* + * Move the namespace definition on the root + * element to avoid duplicating it without + * loosing it. + */ + if (prev == NULL) { + cur->nsDef = ns->next; + } else { + prev->next = ns->next; + } + ns->next = root->nsDef; + root->nsDef = ns; + moved = 1; + break; + } + } + if (moved == 0) + prev = ns; + ns = next; + } + } + } + /* + * If we have prefixes locally, recurse and pop them up when + * going back + */ + if (exclPrefixes > 0) { + xsltPrecomputeStylesheet(style, cur->children); + for (;exclPrefixes > 0;exclPrefixes--) + exclPrefixPop(style); + goto skip_children; + } + } else if (cur->type == XML_TEXT_NODE) { + if (IS_BLANK_NODE(cur)) { + if (xmlNodeGetSpacePreserve(cur->parent) != 1) { + deleteNode = cur; + } + } else if ((cur->content != NULL) && (internalize) && + (!xmlDictOwns(style->dict, cur->content))) { + xmlChar *tmp; + + /* + * internalize the text string, goal is to speed + * up operations and minimize used space by compiled + * stylesheets. + */ + tmp = (xmlChar *) xmlDictLookup(style->dict, cur->content, -1); + xmlNodeSetContent(cur, NULL); + cur->content = tmp; + } + } else if ((cur->type != XML_ELEMENT_NODE) && + (cur->type != XML_CDATA_SECTION_NODE)) { + deleteNode = cur; + goto skip_children; + } + + /* + * Skip to next node. In case of a namespaced element children of + * the stylesheet and not in the XSLT namespace and not an extension + * element, ignore its content. + */ + if ((cur->type == XML_ELEMENT_NODE) && (cur->ns != NULL) && + (styleelem != NULL) && (cur->parent == styleelem) && + (!xmlStrEqual(cur->ns->href, XSLT_NAMESPACE)) && + (!xsltCheckExtURI(style, cur->ns->href))) { + goto skip_children; + } else if (cur->children != NULL) { + if ((cur->children->type != XML_ENTITY_DECL) && + (cur->children->type != XML_ENTITY_REF_NODE) && + (cur->children->type != XML_ENTITY_NODE)) { + cur = cur->children; + continue; + } + } + +skip_children: + if (cur->next != NULL) { + cur = cur->next; + continue; + } + do { + + cur = cur->parent; + if (cur == NULL) + break; + if (cur == (xmlNodePtr) style->doc) { + cur = NULL; + break; + } + if (cur->next != NULL) { + cur = cur->next; + break; + } + } while (cur != NULL); + } + if (deleteNode != NULL) { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltPrecomputeStylesheet: removing ignorable blank node\n"); +#endif + xmlUnlinkNode(deleteNode); + xmlFreeNode(deleteNode); + } +} +#endif /* end of else XSLT_REFACTORED */ + +/** + * xsltGatherNamespaces: + * @style: the XSLT stylesheet + * + * Browse the stylesheet and build the namspace hash table which + * will be used for XPath interpretation. If needed do a bit of normalization + */ + +static void +xsltGatherNamespaces(xsltStylesheetPtr style) { + xmlNodePtr cur; + const xmlChar *URI; + + if (style == NULL) + return; + /* + * TODO: basically if the stylesheet uses the same prefix for different + * patterns, well they may be in problem, hopefully they will get + * a warning first. + */ + /* + * TODO: Eliminate the use of the hash for XPath expressions. + * An expression should be evaluated in the context of the in-scope + * namespaces; eliminate the restriction of an XML document to contain + * no duplicate prefixes for different namespace names. + * + */ + cur = xmlDocGetRootElement(style->doc); + while (cur != NULL) { + if (cur->type == XML_ELEMENT_NODE) { + xmlNsPtr ns = cur->nsDef; + while (ns != NULL) { + if (ns->prefix != NULL) { + if (style->nsHash == NULL) { + style->nsHash = xmlHashCreate(10); + if (style->nsHash == NULL) { + xsltTransformError(NULL, style, cur, + "xsltGatherNamespaces: failed to create hash table\n"); + style->errors++; + return; + } + } + URI = xmlHashLookup(style->nsHash, ns->prefix); + if ((URI != NULL) && (!xmlStrEqual(URI, ns->href))) { + xsltTransformError(NULL, style, cur, + "Namespaces prefix %s used for multiple namespaces\n",ns->prefix); + style->warnings++; + } else if (URI == NULL) { + xmlHashUpdateEntry(style->nsHash, ns->prefix, + (void *) ns->href, (xmlHashDeallocator)xmlFree); + +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "Added namespace: %s mapped to %s\n", ns->prefix, ns->href); +#endif + } + } + ns = ns->next; + } + } + + /* + * Skip to next node + */ + if (cur->children != NULL) { + if (cur->children->type != XML_ENTITY_DECL) { + cur = cur->children; + continue; + } + } + if (cur->next != NULL) { + cur = cur->next; + continue; + } + + do { + cur = cur->parent; + if (cur == NULL) + break; + if (cur == (xmlNodePtr) style->doc) { + cur = NULL; + break; + } + if (cur->next != NULL) { + cur = cur->next; + break; + } + } while (cur != NULL); + } +} + +#ifdef XSLT_REFACTORED + +static xsltStyleType +xsltGetXSLTElementTypeByNode(xsltCompilerCtxtPtr cctxt, + xmlNodePtr node) +{ + if ((node == NULL) || (node->type != XML_ELEMENT_NODE) || + (node->name == NULL)) + return(0); + + if (node->name[0] == 'a') { + if (IS_XSLT_NAME(node, "apply-templates")) + return(XSLT_FUNC_APPLYTEMPLATES); + else if (IS_XSLT_NAME(node, "attribute")) + return(XSLT_FUNC_ATTRIBUTE); + else if (IS_XSLT_NAME(node, "apply-imports")) + return(XSLT_FUNC_APPLYIMPORTS); + else if (IS_XSLT_NAME(node, "attribute-set")) + return(0); + + } else if (node->name[0] == 'c') { + if (IS_XSLT_NAME(node, "choose")) + return(XSLT_FUNC_CHOOSE); + else if (IS_XSLT_NAME(node, "copy")) + return(XSLT_FUNC_COPY); + else if (IS_XSLT_NAME(node, "copy-of")) + return(XSLT_FUNC_COPYOF); + else if (IS_XSLT_NAME(node, "call-template")) + return(XSLT_FUNC_CALLTEMPLATE); + else if (IS_XSLT_NAME(node, "comment")) + return(XSLT_FUNC_COMMENT); + + } else if (node->name[0] == 'd') { + if (IS_XSLT_NAME(node, "document")) + return(XSLT_FUNC_DOCUMENT); + else if (IS_XSLT_NAME(node, "decimal-format")) + return(0); + + } else if (node->name[0] == 'e') { + if (IS_XSLT_NAME(node, "element")) + return(XSLT_FUNC_ELEMENT); + + } else if (node->name[0] == 'f') { + if (IS_XSLT_NAME(node, "for-each")) + return(XSLT_FUNC_FOREACH); + else if (IS_XSLT_NAME(node, "fallback")) + return(XSLT_FUNC_FALLBACK); + + } else if (*(node->name) == 'i') { + if (IS_XSLT_NAME(node, "if")) + return(XSLT_FUNC_IF); + else if (IS_XSLT_NAME(node, "include")) + return(0); + else if (IS_XSLT_NAME(node, "import")) + return(0); + + } else if (*(node->name) == 'k') { + if (IS_XSLT_NAME(node, "key")) + return(0); + + } else if (*(node->name) == 'm') { + if (IS_XSLT_NAME(node, "message")) + return(XSLT_FUNC_MESSAGE); + + } else if (*(node->name) == 'n') { + if (IS_XSLT_NAME(node, "number")) + return(XSLT_FUNC_NUMBER); + else if (IS_XSLT_NAME(node, "namespace-alias")) + return(0); + + } else if (*(node->name) == 'o') { + if (IS_XSLT_NAME(node, "otherwise")) + return(XSLT_FUNC_OTHERWISE); + else if (IS_XSLT_NAME(node, "output")) + return(0); + + } else if (*(node->name) == 'p') { + if (IS_XSLT_NAME(node, "param")) + return(XSLT_FUNC_PARAM); + else if (IS_XSLT_NAME(node, "processing-instruction")) + return(XSLT_FUNC_PI); + else if (IS_XSLT_NAME(node, "preserve-space")) + return(0); + + } else if (*(node->name) == 's') { + if (IS_XSLT_NAME(node, "sort")) + return(XSLT_FUNC_SORT); + else if (IS_XSLT_NAME(node, "strip-space")) + return(0); + else if (IS_XSLT_NAME(node, "stylesheet")) + return(0); + + } else if (node->name[0] == 't') { + if (IS_XSLT_NAME(node, "text")) + return(XSLT_FUNC_TEXT); + else if (IS_XSLT_NAME(node, "template")) + return(0); + else if (IS_XSLT_NAME(node, "transform")) + return(0); + + } else if (*(node->name) == 'v') { + if (IS_XSLT_NAME(node, "value-of")) + return(XSLT_FUNC_VALUEOF); + else if (IS_XSLT_NAME(node, "variable")) + return(XSLT_FUNC_VARIABLE); + + } else if (*(node->name) == 'w') { + if (IS_XSLT_NAME(node, "when")) + return(XSLT_FUNC_WHEN); + if (IS_XSLT_NAME(node, "with-param")) + return(XSLT_FUNC_WITHPARAM); + } + return(0); +} + +/** + * xsltParseAnyXSLTElem: + * + * @cctxt: the compilation context + * @elem: the element node of the XSLT instruction + * + * Parses, validates the content models and compiles XSLT instructions. + * + * Returns 0 if everything's fine; + * -1 on API or internal errors. + */ +int +xsltParseAnyXSLTElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr elem) +{ + if ((cctxt == NULL) || (elem == NULL) || + (elem->type != XML_ELEMENT_NODE)) + return(-1); + + elem->psvi = NULL; + + if (! (IS_XSLT_ELEM_FAST(elem))) + return(-1); + /* + * Detection of handled content of extension instructions. + */ + if (cctxt->inode->category == XSLT_ELEMENT_CATEGORY_EXTENSION) { + cctxt->inode->extContentHandled = 1; + } + + xsltCompilerNodePush(cctxt, elem); + /* + * URGENT TODO: Find a way to speed up this annoying redundant + * textual node-name and namespace comparison. + */ + if (cctxt->inode->prev->curChildType != 0) + cctxt->inode->type = cctxt->inode->prev->curChildType; + else + cctxt->inode->type = xsltGetXSLTElementTypeByNode(cctxt, elem); + /* + * Update the in-scope namespaces if needed. + */ + if (elem->nsDef != NULL) + cctxt->inode->inScopeNs = + xsltCompilerBuildInScopeNsList(cctxt, elem); + /* + * xsltStylePreCompute(): + * This will compile the information found on the current + * element's attributes. NOTE that this won't process the + * children of the instruction. + */ + xsltStylePreCompute(cctxt->style, elem); + /* + * TODO: How to react on errors in xsltStylePreCompute() ? + */ + + /* + * Validate the content model of the XSLT-element. + */ + switch (cctxt->inode->type) { + case XSLT_FUNC_APPLYIMPORTS: + /* EMPTY */ + goto empty_content; + case XSLT_FUNC_APPLYTEMPLATES: + /* */ + goto apply_templates; + case XSLT_FUNC_ATTRIBUTE: + /* */ + goto sequence_constructor; + case XSLT_FUNC_CALLTEMPLATE: + /* */ + goto call_template; + case XSLT_FUNC_CHOOSE: + /* */ + goto choose; + case XSLT_FUNC_COMMENT: + /* */ + goto sequence_constructor; + case XSLT_FUNC_COPY: + /* */ + goto sequence_constructor; + case XSLT_FUNC_COPYOF: + /* EMPTY */ + goto empty_content; + case XSLT_FUNC_DOCUMENT: /* Extra one */ + /* ?? template ?? */ + goto sequence_constructor; + case XSLT_FUNC_ELEMENT: + /* */ + goto sequence_constructor; + case XSLT_FUNC_FALLBACK: + /* */ + goto sequence_constructor; + case XSLT_FUNC_FOREACH: + /* */ + goto for_each; + case XSLT_FUNC_IF: + /* */ + goto sequence_constructor; + case XSLT_FUNC_OTHERWISE: + /* */ + goto sequence_constructor; + case XSLT_FUNC_MESSAGE: + /* */ + goto sequence_constructor; + case XSLT_FUNC_NUMBER: + /* EMPTY */ + goto empty_content; + case XSLT_FUNC_PARAM: + /* + * Check for redefinition. + */ + if ((elem->psvi != NULL) && (cctxt->ivar != NULL)) { + xsltVarInfoPtr ivar = cctxt->ivar; + + do { + if ((ivar->name == + ((xsltStyleItemParamPtr) elem->psvi)->name) && + (ivar->nsName == + ((xsltStyleItemParamPtr) elem->psvi)->ns)) + { + elem->psvi = NULL; + xsltTransformError(NULL, cctxt->style, elem, + "Redefinition of variable or parameter '%s'.\n", + ivar->name); + cctxt->style->errors++; + goto error; + } + ivar = ivar->prev; + } while (ivar != NULL); + } + /* */ + goto sequence_constructor; + case XSLT_FUNC_PI: + /* */ + goto sequence_constructor; + case XSLT_FUNC_SORT: + /* EMPTY */ + goto empty_content; + case XSLT_FUNC_TEXT: + /* */ + goto text; + case XSLT_FUNC_VALUEOF: + /* EMPTY */ + goto empty_content; + case XSLT_FUNC_VARIABLE: + /* + * Check for redefinition. + */ + if ((elem->psvi != NULL) && (cctxt->ivar != NULL)) { + xsltVarInfoPtr ivar = cctxt->ivar; + + do { + if ((ivar->name == + ((xsltStyleItemVariablePtr) elem->psvi)->name) && + (ivar->nsName == + ((xsltStyleItemVariablePtr) elem->psvi)->ns)) + { + elem->psvi = NULL; + xsltTransformError(NULL, cctxt->style, elem, + "Redefinition of variable or parameter '%s'.\n", + ivar->name); + cctxt->style->errors++; + goto error; + } + ivar = ivar->prev; + } while (ivar != NULL); + } + /* */ + goto sequence_constructor; + case XSLT_FUNC_WHEN: + /* */ + goto sequence_constructor; + case XSLT_FUNC_WITHPARAM: + /* */ + goto sequence_constructor; + default: +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltParseXSLTNode: Unhandled XSLT element '%s'.\n", + elem->name); +#endif + xsltTransformError(NULL, cctxt->style, elem, + "xsltParseXSLTNode: Internal error; " + "unhandled XSLT element '%s'.\n", elem->name); + cctxt->style->errors++; + goto internal_err; + } + +apply_templates: + /* */ + if (elem->children != NULL) { + xmlNodePtr child = elem->children; + do { + if (child->type == XML_ELEMENT_NODE) { + if (IS_XSLT_ELEM_FAST(child)) { + if (xmlStrEqual(child->name, BAD_CAST "with-param")) { + cctxt->inode->curChildType = XSLT_FUNC_WITHPARAM; + xsltParseAnyXSLTElem(cctxt, child); + } else if (xmlStrEqual(child->name, BAD_CAST "sort")) { + cctxt->inode->curChildType = XSLT_FUNC_SORT; + xsltParseAnyXSLTElem(cctxt, child); + } else + xsltParseContentError(cctxt->style, child); + } else + xsltParseContentError(cctxt->style, child); + } + child = child->next; + } while (child != NULL); + } + goto exit; + +call_template: + /* */ + if (elem->children != NULL) { + xmlNodePtr child = elem->children; + do { + if (child->type == XML_ELEMENT_NODE) { + if (IS_XSLT_ELEM_FAST(child)) { + xsltStyleType type; + + type = xsltGetXSLTElementTypeByNode(cctxt, child); + if (type == XSLT_FUNC_WITHPARAM) { + cctxt->inode->curChildType = XSLT_FUNC_WITHPARAM; + xsltParseAnyXSLTElem(cctxt, child); + } else { + xsltParseContentError(cctxt->style, child); + } + } else + xsltParseContentError(cctxt->style, child); + } + child = child->next; + } while (child != NULL); + } + goto exit; + +text: + if (elem->children != NULL) { + xmlNodePtr child = elem->children; + do { + if ((child->type != XML_TEXT_NODE) && + (child->type != XML_CDATA_SECTION_NODE)) + { + xsltTransformError(NULL, cctxt->style, elem, + "The XSLT 'text' element must have only character " + "data as content.\n"); + } + child = child->next; + } while (child != NULL); + } + goto exit; + +empty_content: + if (elem->children != NULL) { + xmlNodePtr child = elem->children; + /* + * Relaxed behaviour: we will allow whitespace-only text-nodes. + */ + do { + if (((child->type != XML_TEXT_NODE) && + (child->type != XML_CDATA_SECTION_NODE)) || + (! IS_BLANK_NODE(child))) + { + xsltTransformError(NULL, cctxt->style, elem, + "This XSLT element must have no content.\n"); + cctxt->style->errors++; + break; + } + child = child->next; + } while (child != NULL); + } + goto exit; + +choose: + /* */ + /* + * TODO: text-nodes in between are *not* allowed in XSLT 1.0. + * The old behaviour did not check this. + * NOTE: In XSLT 2.0 they are stripped beforehand + * if whitespace-only (regardless of xml:space). + */ + if (elem->children != NULL) { + xmlNodePtr child = elem->children; + int nbWhen = 0, nbOtherwise = 0, err = 0; + do { + if (child->type == XML_ELEMENT_NODE) { + if (IS_XSLT_ELEM_FAST(child)) { + xsltStyleType type; + + type = xsltGetXSLTElementTypeByNode(cctxt, child); + if (type == XSLT_FUNC_WHEN) { + nbWhen++; + if (nbOtherwise) { + xsltParseContentError(cctxt->style, child); + err = 1; + break; + } + cctxt->inode->curChildType = XSLT_FUNC_WHEN; + xsltParseAnyXSLTElem(cctxt, child); + } else if (type == XSLT_FUNC_OTHERWISE) { + if (! nbWhen) { + xsltParseContentError(cctxt->style, child); + err = 1; + break; + } + if (nbOtherwise) { + xsltTransformError(NULL, cctxt->style, elem, + "The XSLT 'choose' element must not contain " + "more than one XSLT 'otherwise' element.\n"); + cctxt->style->errors++; + err = 1; + break; + } + nbOtherwise++; + cctxt->inode->curChildType = XSLT_FUNC_OTHERWISE; + xsltParseAnyXSLTElem(cctxt, child); + } else + xsltParseContentError(cctxt->style, child); + } else + xsltParseContentError(cctxt->style, child); + } + /* + else + xsltParseContentError(cctxt, child); + */ + child = child->next; + } while (child != NULL); + if ((! err) && (! nbWhen)) { + xsltTransformError(NULL, cctxt->style, elem, + "The XSLT element 'choose' must contain at least one " + "XSLT element 'when'.\n"); + cctxt->style->errors++; + } + } + goto exit; + +for_each: + /* */ + /* + * NOTE: Text-nodes before xsl:sort are *not* allowed in XSLT 1.0. + * The old behaviour did not allow this, but it catched this + * only at transformation-time. + * In XSLT 2.0 they are stripped beforehand if whitespace-only + * (regardless of xml:space). + */ + if (elem->children != NULL) { + xmlNodePtr child = elem->children; + /* + * Parse xsl:sort first. + */ + do { + if ((child->type == XML_ELEMENT_NODE) && + IS_XSLT_ELEM_FAST(child)) + { + if (xsltGetXSLTElementTypeByNode(cctxt, child) == + XSLT_FUNC_SORT) + { + cctxt->inode->curChildType = XSLT_FUNC_SORT; + xsltParseAnyXSLTElem(cctxt, child); + } else + break; + } else + break; + child = child->next; + } while (child != NULL); + /* + * Parse the sequece constructor. + */ + if (child != NULL) + xsltParseSequenceConstructor(cctxt, child); + } + goto exit; + +sequence_constructor: + /* + * Parse the sequence constructor. + */ + if (elem->children != NULL) + xsltParseSequenceConstructor(cctxt, elem->children); + + /* + * Register information for vars/params. Only needed if there + * are any following siblings. + */ + if ((elem->next != NULL) && + ((cctxt->inode->type == XSLT_FUNC_VARIABLE) || + (cctxt->inode->type == XSLT_FUNC_PARAM))) + { + if ((elem->psvi != NULL) && + (((xsltStyleBasicItemVariablePtr) elem->psvi)->name)) + { + xsltCompilerVarInfoPush(cctxt, elem, + ((xsltStyleBasicItemVariablePtr) elem->psvi)->name, + ((xsltStyleBasicItemVariablePtr) elem->psvi)->ns); + } + } + +error: +exit: + xsltCompilerNodePop(cctxt, elem); + return(0); + +internal_err: + xsltCompilerNodePop(cctxt, elem); + return(-1); +} + +/** + * xsltForwardsCompatUnkownItemCreate: + * + * @cctxt: the compilation context + * + * Creates a compiled representation of the unknown + * XSLT instruction. + * + * Returns the compiled representation. + */ +static xsltStyleItemUknownPtr +xsltForwardsCompatUnkownItemCreate(xsltCompilerCtxtPtr cctxt) +{ + xsltStyleItemUknownPtr item; + + item = (xsltStyleItemUknownPtr) xmlMalloc(sizeof(xsltStyleItemUknown)); + if (item == NULL) { + xsltTransformError(NULL, cctxt->style, NULL, + "Internal error in xsltForwardsCompatUnkownItemCreate(): " + "Failed to allocate memory.\n"); + cctxt->style->errors++; + return(NULL); + } + memset(item, 0, sizeof(xsltStyleItemUknown)); + item->type = XSLT_FUNC_UNKOWN_FORWARDS_COMPAT; + /* + * Store it in the stylesheet. + */ + item->next = cctxt->style->preComps; + cctxt->style->preComps = (xsltElemPreCompPtr) item; + return(item); +} + +/** + * xsltParseUnknownXSLTElem: + * + * @cctxt: the compilation context + * @node: the element of the unknown XSLT instruction + * + * Parses an unknown XSLT element. + * If forwards compatible mode is enabled this will allow + * such an unknown XSLT and; otherwise it is rejected. + * + * Returns 1 in the unknown XSLT instruction is rejected, + * 0 if everything's fine and + * -1 on API or internal errors. + */ +static int +xsltParseUnknownXSLTElem(xsltCompilerCtxtPtr cctxt, + xmlNodePtr node) +{ + if ((cctxt == NULL) || (node == NULL) || (node->type != XML_ELEMENT_NODE)) + return(-1); + + /* + * Detection of handled content of extension instructions. + */ + if (cctxt->inode->category == XSLT_ELEMENT_CATEGORY_EXTENSION) { + cctxt->inode->extContentHandled = 1; + } + if (cctxt->inode->forwardsCompat == 0) { + /* + * We are not in forwards-compatible mode, so raise an error. + */ + xsltTransformError(NULL, cctxt->style, node, + "Unknown XSLT element '%s'.\n", node->name); + cctxt->style->errors++; + return(1); + } + /* + * Forwards-compatible mode. + * ------------------------ + * + * Parse/compile xsl:fallback elements. + * + * QUESTION: Do we have to raise an error if there's no xsl:fallback? + * ANSWER: No, since in the stylesheet the fallback behaviour might + * also be provided by using the XSLT function "element-available". + */ + if (cctxt->unknownItem == NULL) { + /* + * Create a singleton for all unknown XSLT instructions. + */ + cctxt->unknownItem = xsltForwardsCompatUnkownItemCreate(cctxt); + if (cctxt->unknownItem == NULL) { + node->psvi = NULL; + return(-1); + } + } + node->psvi = cctxt->unknownItem; + if (node->children == NULL) + return(0); + else { + xmlNodePtr child = node->children; + + xsltCompilerNodePush(cctxt, node); + /* + * Update the in-scope namespaces if needed. + */ + if (node->nsDef != NULL) + cctxt->inode->inScopeNs = + xsltCompilerBuildInScopeNsList(cctxt, node); + /* + * Parse all xsl:fallback children. + */ + do { + if ((child->type == XML_ELEMENT_NODE) && + IS_XSLT_ELEM_FAST(child) && + IS_XSLT_NAME(child, "fallback")) + { + cctxt->inode->curChildType = XSLT_FUNC_FALLBACK; + xsltParseAnyXSLTElem(cctxt, child); + } + child = child->next; + } while (child != NULL); + + xsltCompilerNodePop(cctxt, node); + } + return(0); +} + +/** + * xsltParseSequenceConstructor: + * + * @cctxt: the compilation context + * @cur: the start-node of the content to be parsed + * + * Parses a "template" content (or "sequence constructor" in XSLT 2.0 terms). + * This will additionally remove xsl:text elements from the tree. + */ +void +xsltParseSequenceConstructor(xsltCompilerCtxtPtr cctxt, xmlNodePtr cur) +{ + xsltStyleType type; + xmlNodePtr deleteNode = NULL; + + if (cctxt == NULL) { + xmlGenericError(xmlGenericErrorContext, + "xsltParseSequenceConstructor: Bad arguments\n"); + cctxt->style->errors++; + return; + } + /* + * Detection of handled content of extension instructions. + */ + if (cctxt->inode->category == XSLT_ELEMENT_CATEGORY_EXTENSION) { + cctxt->inode->extContentHandled = 1; + } + if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL)) + return; + /* + * This is the content reffered to as a "template". + * E.g. an xsl:element has such content model: + * + * + * + * NOTE that in XSLT-2 the term "template" was abandoned due to + * confusion with xsl:template and the term "sequence constructor" + * was introduced instead. + * + * The following XSLT-instructions are allowed to appear: + * xsl:apply-templates, xsl:call-template, xsl:apply-imports, + * xsl:for-each, xsl:value-of, xsl:copy-of, xsl:number, + * xsl:choose, xsl:if, xsl:text, xsl:copy, xsl:variable, + * xsl:message, xsl:fallback, + * xsl:processing-instruction, xsl:comment, xsl:element + * xsl:attribute. + * Additional allowed content: + * 1) extension instructions + * 2) literal result elements + * 3) PCDATA + * + * NOTE that this content model does *not* allow xsl:param. + */ + while (cur != NULL) { + if (deleteNode != NULL) { +#ifdef WITH_XSLT_DEBUG_BLANKS + xsltGenericDebug(xsltGenericDebugContext, + "xsltParseSequenceConstructor: removing xsl:text element\n"); +#endif + xmlUnlinkNode(deleteNode); + xmlFreeNode(deleteNode); + deleteNode = NULL; + } + if (cur->type == XML_ELEMENT_NODE) { + + if (cur->psvi == xsltXSLTTextMarker) { + /* + * xsl:text elements + * -------------------------------------------------------- + */ + xmlNodePtr tmp; + + cur->psvi = NULL; + /* + * Mark the xsl:text element for later deletion. + */ + deleteNode = cur; + /* + * Validate content. + */ + tmp = cur->children; + if (tmp) { + /* + * We don't expect more than one text-node in the + * content, since we already merged adjacent + * text/CDATA-nodes and eliminated PI/comment-nodes. + */ + if ((tmp->type == XML_TEXT_NODE) || + (tmp->next == NULL)) + { + /* + * Leave the contained text-node in the tree. + */ + xmlUnlinkNode(tmp); + xmlAddPrevSibling(cur, tmp); + } else { + tmp = NULL; + xsltTransformError(NULL, cctxt->style, cur, + "Element 'xsl:text': Invalid type " + "of node found in content.\n"); + cctxt->style->errors++; + } + } + if (cur->properties) { + xmlAttrPtr attr; + /* + * TODO: We need to report errors for + * invalid attrs. + */ + attr = cur->properties; + do { + if ((attr->ns == NULL) && + (attr->name != NULL) && + (attr->name[0] == 'd') && + xmlStrEqual(attr->name, + BAD_CAST "disable-output-escaping")) + { + /* + * Attr "disable-output-escaping". + * XSLT-2: This attribute is deprecated. + */ + if ((attr->children != NULL) && + xmlStrEqual(attr->children->content, + BAD_CAST "yes")) + { + /* + * Disable output escaping for this + * text node. + */ + if (tmp) + tmp->name = xmlStringTextNoenc; + } else if ((attr->children == NULL) || + (attr->children->content == NULL) || + (!xmlStrEqual(attr->children->content, + BAD_CAST "no"))) + { + xsltTransformError(NULL, cctxt->style, + cur, + "Attribute 'disable-output-escaping': " + "Invalid value. Expected is " + "'yes' or 'no'.\n"); + cctxt->style->errors++; + } + break; + } + attr = attr->next; + } while (attr != NULL); + } + } else if (IS_XSLT_ELEM_FAST(cur)) { + /* + * TODO: Using the XSLT-marker is still not stable yet. + */ + /* if (cur->psvi == xsltXSLTElemMarker) { */ + /* + * XSLT instructions + * -------------------------------------------------------- + */ + cur->psvi = NULL; + type = xsltGetXSLTElementTypeByNode(cctxt, cur); + switch (type) { + case XSLT_FUNC_APPLYIMPORTS: + case XSLT_FUNC_APPLYTEMPLATES: + case XSLT_FUNC_ATTRIBUTE: + case XSLT_FUNC_CALLTEMPLATE: + case XSLT_FUNC_CHOOSE: + case XSLT_FUNC_COMMENT: + case XSLT_FUNC_COPY: + case XSLT_FUNC_COPYOF: + case XSLT_FUNC_DOCUMENT: /* Extra one */ + case XSLT_FUNC_ELEMENT: + case XSLT_FUNC_FALLBACK: + case XSLT_FUNC_FOREACH: + case XSLT_FUNC_IF: + case XSLT_FUNC_MESSAGE: + case XSLT_FUNC_NUMBER: + case XSLT_FUNC_PI: + case XSLT_FUNC_TEXT: + case XSLT_FUNC_VALUEOF: + case XSLT_FUNC_VARIABLE: + /* + * Parse the XSLT element. + */ + cctxt->inode->curChildType = type; + xsltParseAnyXSLTElem(cctxt, cur); + break; + default: + xsltParseUnknownXSLTElem(cctxt, cur); + cur = cur->next; + continue; + } + } else { + /* + * Non-XSLT elements + * ----------------- + */ + xsltCompilerNodePush(cctxt, cur); + /* + * Update the in-scope namespaces if needed. + */ + if (cur->nsDef != NULL) + cctxt->inode->inScopeNs = + xsltCompilerBuildInScopeNsList(cctxt, cur); + /* + * The current element is either a literal result element + * or an extension instruction. + * + * Process attr "xsl:extension-element-prefixes". + * FUTURE TODO: IIRC in XSLT 2.0 this attribute must be + * processed by the implementor of the extension function; + * i.e., it won't be handled by the XSLT processor. + */ + /* SPEC 1.0: + * "exclude-result-prefixes" is only allowed on literal + * result elements and "xsl:exclude-result-prefixes" + * on xsl:stylesheet/xsl:transform. + * SPEC 2.0: + * "There are a number of standard attributes + * that may appear on any XSLT element: specifically + * version, exclude-result-prefixes, + * extension-element-prefixes, xpath-default-namespace, + * default-collation, and use-when." + * + * SPEC 2.0: + * For literal result elements: + * "xsl:version, xsl:exclude-result-prefixes, + * xsl:extension-element-prefixes, + * xsl:xpath-default-namespace, + * xsl:default-collation, or xsl:use-when." + */ + if (cur->properties) + cctxt->inode->extElemNs = + xsltParseExtElemPrefixes(cctxt, + cur, cctxt->inode->extElemNs, + XSLT_ELEMENT_CATEGORY_LRE); + /* + * Eval if we have an extension instruction here. + */ + if ((cur->ns != NULL) && + (cctxt->inode->extElemNs != NULL) && + (xsltCheckExtPrefix(cctxt->style, cur->ns->href) == 1)) + { + /* + * Extension instructions + * ---------------------------------------------------- + * Mark the node information. + */ + cctxt->inode->category = XSLT_ELEMENT_CATEGORY_EXTENSION; + cctxt->inode->extContentHandled = 0; + if (cur->psvi != NULL) { + cur->psvi = NULL; + /* + * TODO: Temporary sanity check. + */ + xsltTransformError(NULL, cctxt->style, cur, + "Internal error in xsltParseSequenceConstructor(): " + "Occupied PSVI field.\n"); + cctxt->style->errors++; + cur = cur->next; + continue; + } + cur->psvi = (void *) + xsltPreComputeExtModuleElement(cctxt->style, cur); + + if (cur->psvi == NULL) { + /* + * OLD COMMENT: "Unknown element, maybe registered + * at the context level. Mark it for later + * recognition." + * QUESTION: What does the xsltExtMarker mean? + * ANSWER: It is used in + * xsltApplySequenceConstructor() at + * transformation-time to look out for extension + * registered in the transformation context. + */ + cur->psvi = (void *) xsltExtMarker; + } + /* + * BIG NOTE: Now the ugly part. In previous versions + * of Libxslt (until 1.1.16), all the content of an + * extension instruction was processed and compiled without + * the need of the extension-author to explicitely call + * such a processing;.We now need to mimic this old + * behaviour in order to avoid breaking old code + * on the extension-author's side. + * The mechanism: + * 1) If the author does *not* set the + * compile-time-flag @extContentHandled, then we'll + * parse the content assuming that it's a "template" + * (or "sequence constructor in XSLT 2.0 terms). + * NOTE: If the extension is registered at + * transformation-time only, then there's no way of + * knowing that content shall be valid, and we'll + * process the content the same way. + * 2) If the author *does* set the flag, then we'll assume + * that the author has handled the parsing him/herself + * (e.g. called xsltParseSequenceConstructor(), etc. + * explicitely in his/her code). + */ + if ((cur->children != NULL) && + (cctxt->inode->extContentHandled == 0)) + { + /* + * Default parsing of the content using the + * sequence-constructor model. + */ + xsltParseSequenceConstructor(cctxt, cur->children); + } + } else { + /* + * Literal result element + * ---------------------------------------------------- + * Allowed XSLT attributes: + * xsl:extension-element-prefixes CDATA #IMPLIED + * xsl:exclude-result-prefixes CDATA #IMPLIED + * TODO: xsl:use-attribute-sets %qnames; #IMPLIED + * xsl:version NMTOKEN #IMPLIED + */ + cur->psvi = NULL; + cctxt->inode->category = XSLT_ELEMENT_CATEGORY_LRE; + if (cur->properties != NULL) { + xmlAttrPtr attr = cur->properties; + /* + * Attribute "xsl:exclude-result-prefixes". + */ + cctxt->inode->exclResultNs = + xsltParseExclResultPrefixes(cctxt, cur, + cctxt->inode->exclResultNs, + XSLT_ELEMENT_CATEGORY_LRE); + /* + * Attribute "xsl:version". + */ + xsltParseAttrXSLTVersion(cctxt, cur, + XSLT_ELEMENT_CATEGORY_LRE); + /* + * Report invalid XSLT attributes. + * For XSLT 1.0 only xsl:use-attribute-sets is allowed + * next to xsl:version, xsl:exclude-result-prefixes and + * xsl:extension-element-prefixes. + * + * Mark all XSLT attributes, in order to skip such + * attributes when instantiating the LRE. + */ + do { + if ((attr->psvi != xsltXSLTAttrMarker) && + IS_XSLT_ATTR_FAST(attr)) + { + if (! xmlStrEqual(attr->name, + BAD_CAST "use-attribute-sets")) + { + xsltTransformError(NULL, cctxt->style, + cur, + "Unknown XSLT attribute '%s'.\n", + attr->name); + cctxt->style->errors++; + } else { + /* + * XSLT attr marker. + */ + attr->psvi = (void *) xsltXSLTAttrMarker; + } + } + attr = attr->next; + } while (attr != NULL); + } + /* + * Create/reuse info for the literal result element. + */ + if (cctxt->inode->nsChanged) + xsltLREInfoCreate(cctxt, cur, 1); + cur->psvi = cctxt->inode->litResElemInfo; + /* + * Apply ns-aliasing on the element and on its attributes. + */ + if (cctxt->hasNsAliases) + xsltLREBuildEffectiveNs(cctxt, cur); + /* + * Compile attribute value templates (AVT). + */ + if (cur->properties) { + xmlAttrPtr attr = cur->properties; + + while (attr != NULL) { + xsltCompileAttr(cctxt->style, attr); + attr = attr->next; + } + } + /* + * Parse the content, which is defined to be a "template" + * (or "sequence constructor" in XSLT 2.0 terms). + */ + if (cur->children != NULL) { + xsltParseSequenceConstructor(cctxt, cur->children); + } + } + /* + * Leave the non-XSLT element. + */ + xsltCompilerNodePop(cctxt, cur); + } + } + cur = cur->next; + } + if (deleteNode != NULL) { +#ifdef WITH_XSLT_DEBUG_BLANKS + xsltGenericDebug(xsltGenericDebugContext, + "xsltParseSequenceConstructor: removing xsl:text element\n"); +#endif + xmlUnlinkNode(deleteNode); + xmlFreeNode(deleteNode); + deleteNode = NULL; + } +} + +/** + * xsltParseTemplateContent: + * @style: the XSLT stylesheet + * @templ: the node containing the content to be parsed + * + * Parses and compiles the content-model of an xsl:template element. + * Note that this is *not* the "template" content model (or "sequence + * constructor" in XSLT 2.0); it it allows addional xsl:param + * elements as immediate children of @templ. + * + * Called by: + * exsltFuncFunctionComp() (EXSLT, functions.c) + * So this is intended to be called from extension functions. + */ +void +xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) { + if ((style == NULL) || (templ == NULL) || + (templ->type == XML_NAMESPACE_DECL)) + return; + + /* + * Detection of handled content of extension instructions. + */ + if (XSLT_CCTXT(style)->inode->category == XSLT_ELEMENT_CATEGORY_EXTENSION) { + XSLT_CCTXT(style)->inode->extContentHandled = 1; + } + + if (templ->children != NULL) { + xmlNodePtr child = templ->children; + /* + * Process xsl:param elements, which can only occur as the + * immediate children of xsl:template (well, and of any + * user-defined extension instruction if needed). + */ + do { + if ((child->type == XML_ELEMENT_NODE) && + IS_XSLT_ELEM_FAST(child) && + IS_XSLT_NAME(child, "param")) + { + XSLT_CCTXT(style)->inode->curChildType = XSLT_FUNC_PARAM; + xsltParseAnyXSLTElem(XSLT_CCTXT(style), child); + } else + break; + child = child->next; + } while (child != NULL); + /* + * Parse the content and register the pattern. + */ + xsltParseSequenceConstructor(XSLT_CCTXT(style), child); + } +} + +#else /* XSLT_REFACTORED */ + +/** + * xsltParseTemplateContent: + * @style: the XSLT stylesheet + * @templ: the container node (can be a document for literal results) + * + * parse a template content-model + * Clean-up the template content from unwanted ignorable blank nodes + * and process xslt:text + */ +void +xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ) { + xmlNodePtr cur, delete; + + if ((style == NULL) || (templ == NULL) || + (templ->type == XML_NAMESPACE_DECL)) return; + + /* + * This content comes from the stylesheet + * For stylesheets, the set of whitespace-preserving + * element names consists of just xsl:text. + */ + cur = templ->children; + delete = NULL; + while (cur != NULL) { + if (delete != NULL) { +#ifdef WITH_XSLT_DEBUG_BLANKS + xsltGenericDebug(xsltGenericDebugContext, + "xsltParseTemplateContent: removing text\n"); +#endif + xmlUnlinkNode(delete); + xmlFreeNode(delete); + delete = NULL; + } + if (IS_XSLT_ELEM(cur)) { + if (IS_XSLT_NAME(cur, "text")) { + /* + * TODO: Processing of xsl:text should be moved to + * xsltPrecomputeStylesheet(), since otherwise this + * will be performed for every multiply included + * stylesheet; i.e. this here is not skipped with + * the use of the style->nopreproc flag. + */ + if (cur->children != NULL) { + xmlChar *prop; + xmlNodePtr text = cur->children, next; + int noesc = 0; + + prop = xmlGetNsProp(cur, + (const xmlChar *)"disable-output-escaping", + NULL); + if (prop != NULL) { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "Disable escaping: %s\n", text->content); +#endif + if (xmlStrEqual(prop, (const xmlChar *)"yes")) { + noesc = 1; + } else if (!xmlStrEqual(prop, + (const xmlChar *)"no")){ + xsltTransformError(NULL, style, cur, + "xsl:text: disable-output-escaping allows only yes or no\n"); + style->warnings++; + + } + xmlFree(prop); + } + + while (text != NULL) { + if (text->type == XML_COMMENT_NODE) { + text = text->next; + continue; + } + if ((text->type != XML_TEXT_NODE) && + (text->type != XML_CDATA_SECTION_NODE)) { + xsltTransformError(NULL, style, cur, + "xsltParseTemplateContent: xslt:text content problem\n"); + style->errors++; + break; + } + if ((noesc) && (text->type != XML_CDATA_SECTION_NODE)) + text->name = xmlStringTextNoenc; + text = text->next; + } + + /* + * replace xsl:text by the list of childs + */ + if (text == NULL) { + text = cur->children; + while (text != NULL) { + if ((style->internalized) && + (text->content != NULL) && + (!xmlDictOwns(style->dict, text->content))) { + + /* + * internalize the text string + */ + if (text->doc->dict != NULL) { + const xmlChar *tmp; + + tmp = xmlDictLookup(text->doc->dict, + text->content, -1); + if (tmp != text->content) { + xmlNodeSetContent(text, NULL); + text->content = (xmlChar *) tmp; + } + } + } + + next = text->next; + xmlUnlinkNode(text); + xmlAddPrevSibling(cur, text); + text = next; + } + } + } + delete = cur; + goto skip_children; + } + } + else if ((cur->ns != NULL) && (style->nsDefs != NULL) && + (xsltCheckExtPrefix(style, cur->ns->prefix))) + { + /* + * okay this is an extension element compile it too + */ + xsltStylePreCompute(style, cur); + } + else if (cur->type == XML_ELEMENT_NODE) + { + /* + * This is an element which will be output as part of the + * template exectution, precompile AVT if found. + */ + if ((cur->ns == NULL) && (style->defaultAlias != NULL)) { + cur->ns = xmlSearchNsByHref(cur->doc, cur, + style->defaultAlias); + } + if (cur->properties != NULL) { + xmlAttrPtr attr = cur->properties; + + while (attr != NULL) { + xsltCompileAttr(style, attr); + attr = attr->next; + } + } + } + /* + * Skip to next node + */ + if (cur->children != NULL) { + if (cur->children->type != XML_ENTITY_DECL) { + cur = cur->children; + continue; + } + } +skip_children: + if (cur->next != NULL) { + cur = cur->next; + continue; + } + + do { + cur = cur->parent; + if (cur == NULL) + break; + if (cur == templ) { + cur = NULL; + break; + } + if (cur->next != NULL) { + cur = cur->next; + break; + } + } while (cur != NULL); + } + if (delete != NULL) { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltParseTemplateContent: removing text\n"); +#endif + xmlUnlinkNode(delete); + xmlFreeNode(delete); + delete = NULL; + } + + /* + * Skip the first params + */ + cur = templ->children; + while (cur != NULL) { + if ((IS_XSLT_ELEM(cur)) && (!(IS_XSLT_NAME(cur, "param")))) + break; + cur = cur->next; + } + + /* + * Browse the remainder of the template + */ + while (cur != NULL) { + if ((IS_XSLT_ELEM(cur)) && (IS_XSLT_NAME(cur, "param"))) { + xmlNodePtr param = cur; + + xsltTransformError(NULL, style, cur, + "xsltParseTemplateContent: ignoring misplaced param element\n"); + if (style != NULL) style->warnings++; + cur = cur->next; + xmlUnlinkNode(param); + xmlFreeNode(param); + } else + break; + } +} + +#endif /* else XSLT_REFACTORED */ + +/** + * xsltParseStylesheetKey: + * @style: the XSLT stylesheet + * @key: the "key" element + * + * + * + * + * parse an XSLT stylesheet key definition and register it + */ + +static void +xsltParseStylesheetKey(xsltStylesheetPtr style, xmlNodePtr key) { + xmlChar *prop = NULL; + xmlChar *use = NULL; + xmlChar *match = NULL; + xmlChar *name = NULL; + xmlChar *nameURI = NULL; + + if ((style == NULL) || (key == NULL) || (key->type != XML_ELEMENT_NODE)) + return; + + /* + * Get arguments + */ + prop = xmlGetNsProp(key, (const xmlChar *)"name", NULL); + if (prop != NULL) { + const xmlChar *URI; + + /* + * TODO: Don't use xsltGetQNameURI(). + */ + URI = xsltGetQNameURI(key, &prop); + if (prop == NULL) { + if (style != NULL) style->errors++; + goto error; + } else { + name = prop; + if (URI != NULL) + nameURI = xmlStrdup(URI); + } +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltParseStylesheetKey: name %s\n", name); +#endif + } else { + xsltTransformError(NULL, style, key, + "xsl:key : error missing name\n"); + if (style != NULL) style->errors++; + goto error; + } + + match = xmlGetNsProp(key, (const xmlChar *)"match", NULL); + if (match == NULL) { + xsltTransformError(NULL, style, key, + "xsl:key : error missing match\n"); + if (style != NULL) style->errors++; + goto error; + } + + use = xmlGetNsProp(key, (const xmlChar *)"use", NULL); + if (use == NULL) { + xsltTransformError(NULL, style, key, + "xsl:key : error missing use\n"); + if (style != NULL) style->errors++; + goto error; + } + + /* + * register the keys + */ + xsltAddKey(style, name, nameURI, match, use, key); + + +error: + if (use != NULL) + xmlFree(use); + if (match != NULL) + xmlFree(match); + if (name != NULL) + xmlFree(name); + if (nameURI != NULL) + xmlFree(nameURI); + + if (key->children != NULL) { + xsltParseContentError(style, key->children); + } +} + +#ifdef XSLT_REFACTORED +/** + * xsltParseXSLTTemplate: + * @style: the XSLT stylesheet + * @template: the "template" element + * + * parse an XSLT stylesheet template building the associated structures + * TODO: Is @style ever expected to be NULL? + * + * Called from: + * xsltParseXSLTStylesheet() + * xsltParseStylesheetTop() + */ + +static void +xsltParseXSLTTemplate(xsltCompilerCtxtPtr cctxt, xmlNodePtr templNode) { + xsltTemplatePtr templ; + xmlChar *prop; + double priority; + + if ((cctxt == NULL) || (templNode == NULL) || + (templNode->type != XML_ELEMENT_NODE)) + return; + + /* + * Create and link the structure + */ + templ = xsltNewTemplate(); + if (templ == NULL) + return; + + xsltCompilerNodePush(cctxt, templNode); + if (templNode->nsDef != NULL) + cctxt->inode->inScopeNs = + xsltCompilerBuildInScopeNsList(cctxt, templNode); + + templ->next = cctxt->style->templates; + cctxt->style->templates = templ; + templ->style = cctxt->style; + + /* + * Attribute "mode". + */ + prop = xmlGetNsProp(templNode, (const xmlChar *)"mode", NULL); + if (prop != NULL) { + const xmlChar *modeURI; + + /* + * TODO: We need a standardized function for extraction + * of namespace names and local names from QNames. + * Don't use xsltGetQNameURI() as it cannot channe� + * reports through the context. + */ + modeURI = xsltGetQNameURI(templNode, &prop); + if (prop == NULL) { + cctxt->style->errors++; + goto error; + } + templ->mode = xmlDictLookup(cctxt->style->dict, prop, -1); + xmlFree(prop); + prop = NULL; + if (xmlValidateNCName(templ->mode, 0)) { + xsltTransformError(NULL, cctxt->style, templNode, + "xsl:template: Attribute 'mode': The local part '%s' " + "of the value is not a valid NCName.\n", templ->name); + cctxt->style->errors++; + goto error; + } + if (modeURI != NULL) + templ->modeURI = xmlDictLookup(cctxt->style->dict, modeURI, -1); +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltParseXSLTTemplate: mode %s\n", templ->mode); +#endif + } + /* + * Attribute "match". + */ + prop = xmlGetNsProp(templNode, (const xmlChar *)"match", NULL); + if (prop != NULL) { + templ->match = prop; + prop = NULL; + } + /* + * Attribute "priority". + */ + prop = xmlGetNsProp(templNode, (const xmlChar *)"priority", NULL); + if (prop != NULL) { + priority = xmlXPathStringEvalNumber(prop); + templ->priority = (float) priority; + xmlFree(prop); + prop = NULL; + } + /* + * Attribute "name". + */ + prop = xmlGetNsProp(templNode, (const xmlChar *)"name", NULL); + if (prop != NULL) { + const xmlChar *nameURI; + xsltTemplatePtr curTempl; + + /* + * TODO: Don't use xsltGetQNameURI(). + */ + nameURI = xsltGetQNameURI(templNode, &prop); + if (prop == NULL) { + cctxt->style->errors++; + goto error; + } + templ->name = xmlDictLookup(cctxt->style->dict, prop, -1); + xmlFree(prop); + prop = NULL; + if (xmlValidateNCName(templ->name, 0)) { + xsltTransformError(NULL, cctxt->style, templNode, + "xsl:template: Attribute 'name': The local part '%s' of " + "the value is not a valid NCName.\n", templ->name); + cctxt->style->errors++; + goto error; + } + if (nameURI != NULL) + templ->nameURI = xmlDictLookup(cctxt->style->dict, nameURI, -1); + curTempl = templ->next; + while (curTempl != NULL) { + if ((nameURI != NULL && xmlStrEqual(curTempl->name, templ->name) && + xmlStrEqual(curTempl->nameURI, nameURI) ) || + (nameURI == NULL && curTempl->nameURI == NULL && + xmlStrEqual(curTempl->name, templ->name))) + { + xsltTransformError(NULL, cctxt->style, templNode, + "xsl:template: error duplicate name '%s'\n", templ->name); + cctxt->style->errors++; + goto error; + } + curTempl = curTempl->next; + } + } + if (templNode->children != NULL) { + xsltParseTemplateContent(cctxt->style, templNode); + /* + * MAYBE TODO: Custom behaviour: In order to stay compatible with + * Xalan and MSXML(.NET), we could allow whitespace + * to appear before an xml:param element; this whitespace + * will additionally become part of the "template". + * NOTE that this is totally deviates from the spec, but + * is the de facto behaviour of Xalan and MSXML(.NET). + * Personally I wouldn't allow this, since if we have: + * + * + * + * + * ... the whitespace between every xsl:param would be + * added to the result tree. + */ + } + + templ->elem = templNode; + templ->content = templNode->children; + xsltAddTemplate(cctxt->style, templ, templ->mode, templ->modeURI); + +error: + xsltCompilerNodePop(cctxt, templNode); + return; +} + +#else /* XSLT_REFACTORED */ + +/** + * xsltParseStylesheetTemplate: + * @style: the XSLT stylesheet + * @template: the "template" element + * + * parse an XSLT stylesheet template building the associated structures + */ + +static void +xsltParseStylesheetTemplate(xsltStylesheetPtr style, xmlNodePtr template) { + xsltTemplatePtr ret; + xmlChar *prop; + xmlChar *mode = NULL; + xmlChar *modeURI = NULL; + double priority; + + if ((style == NULL) || (template == NULL) || + (template->type != XML_ELEMENT_NODE)) + return; + + /* + * Create and link the structure + */ + ret = xsltNewTemplate(); + if (ret == NULL) + return; + ret->next = style->templates; + style->templates = ret; + ret->style = style; + + /* + * Get inherited namespaces + */ + /* + * TODO: Apply the optimized in-scope-namespace mechanism + * as for the other XSLT instructions. + */ + xsltGetInheritedNsList(style, ret, template); + + /* + * Get arguments + */ + prop = xmlGetNsProp(template, (const xmlChar *)"mode", NULL); + if (prop != NULL) { + const xmlChar *URI; + + /* + * TODO: Don't use xsltGetQNameURI(). + */ + URI = xsltGetQNameURI(template, &prop); + if (prop == NULL) { + if (style != NULL) style->errors++; + goto error; + } else { + mode = prop; + if (URI != NULL) + modeURI = xmlStrdup(URI); + } + ret->mode = xmlDictLookup(style->dict, mode, -1); + ret->modeURI = xmlDictLookup(style->dict, modeURI, -1); +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltParseStylesheetTemplate: mode %s\n", mode); +#endif + if (mode != NULL) xmlFree(mode); + if (modeURI != NULL) xmlFree(modeURI); + } + prop = xmlGetNsProp(template, (const xmlChar *)"match", NULL); + if (prop != NULL) { + if (ret->match != NULL) xmlFree(ret->match); + ret->match = prop; + } + + prop = xmlGetNsProp(template, (const xmlChar *)"priority", NULL); + if (prop != NULL) { + priority = xmlXPathStringEvalNumber(prop); + ret->priority = (float) priority; + xmlFree(prop); + } + + prop = xmlGetNsProp(template, (const xmlChar *)"name", NULL); + if (prop != NULL) { + const xmlChar *URI; + + /* + * TODO: Don't use xsltGetQNameURI(). + */ + URI = xsltGetQNameURI(template, &prop); + if (prop == NULL) { + if (style != NULL) style->errors++; + goto error; + } else { + if (xmlValidateNCName(prop,0)) { + xsltTransformError(NULL, style, template, + "xsl:template : error invalid name '%s'\n", prop); + if (style != NULL) style->errors++; + goto error; + } + ret->name = xmlDictLookup(style->dict, BAD_CAST prop, -1); + xmlFree(prop); + prop = NULL; + if (URI != NULL) + ret->nameURI = xmlDictLookup(style->dict, BAD_CAST URI, -1); + else + ret->nameURI = NULL; + } + } + + /* + * parse the content and register the pattern + */ + xsltParseTemplateContent(style, template); + ret->elem = template; + ret->content = template->children; + xsltAddTemplate(style, ret, ret->mode, ret->modeURI); + +error: + return; +} + +#endif /* else XSLT_REFACTORED */ + +#ifdef XSLT_REFACTORED + +/** + * xsltIncludeComp: + * @cctxt: the compilation contenxt + * @node: the xsl:include node + * + * Process the xslt include node on the source node + */ +static xsltStyleItemIncludePtr +xsltCompileXSLTIncludeElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) { + xsltStyleItemIncludePtr item; + + if ((cctxt == NULL) || (node == NULL) || (node->type != XML_ELEMENT_NODE)) + return(NULL); + + node->psvi = NULL; + item = (xsltStyleItemIncludePtr) xmlMalloc(sizeof(xsltStyleItemInclude)); + if (item == NULL) { + xsltTransformError(NULL, cctxt->style, node, + "xsltIncludeComp : malloc failed\n"); + cctxt->style->errors++; + return(NULL); + } + memset(item, 0, sizeof(xsltStyleItemInclude)); + + node->psvi = item; + item->inst = node; + item->type = XSLT_FUNC_INCLUDE; + + item->next = cctxt->style->preComps; + cctxt->style->preComps = (xsltElemPreCompPtr) item; + + return(item); +} + +/** + * xsltParseFindTopLevelElem: + */ +static int +xsltParseFindTopLevelElem(xsltCompilerCtxtPtr cctxt, + xmlNodePtr cur, + const xmlChar *name, + const xmlChar *namespaceURI, + int breakOnOtherElem, + xmlNodePtr *resultNode) +{ + if (name == NULL) + return(-1); + + *resultNode = NULL; + while (cur != NULL) { + if (cur->type == XML_ELEMENT_NODE) { + if ((cur->ns != NULL) && (cur->name != NULL)) { + if ((*(cur->name) == *name) && + xmlStrEqual(cur->name, name) && + xmlStrEqual(cur->ns->href, namespaceURI)) + { + *resultNode = cur; + return(1); + } + } + if (breakOnOtherElem) + break; + } + cur = cur->next; + } + *resultNode = cur; + return(0); +} + +static int +xsltParseTopLevelXSLTElem(xsltCompilerCtxtPtr cctxt, + xmlNodePtr node, + xsltStyleType type) +{ + int ret = 0; + + /* + * TODO: The reason why this function exists: + * due to historical reasons some of the + * top-level declarations are processed by functions + * in other files. Since we need still to set + * up the node-info and generate information like + * in-scope namespaces, this is a wrapper around + * those old parsing functions. + */ + xsltCompilerNodePush(cctxt, node); + if (node->nsDef != NULL) + cctxt->inode->inScopeNs = + xsltCompilerBuildInScopeNsList(cctxt, node); + cctxt->inode->type = type; + + switch (type) { + case XSLT_FUNC_INCLUDE: + { + int oldIsInclude; + + if (xsltCompileXSLTIncludeElem(cctxt, node) == NULL) + goto exit; + /* + * Mark this stylesheet tree as being currently included. + */ + oldIsInclude = cctxt->isInclude; + cctxt->isInclude = 1; + + if (xsltParseStylesheetInclude(cctxt->style, node) != 0) { + cctxt->style->errors++; + } + cctxt->isInclude = oldIsInclude; + } + break; + case XSLT_FUNC_PARAM: + xsltStylePreCompute(cctxt->style, node); + xsltParseGlobalParam(cctxt->style, node); + break; + case XSLT_FUNC_VARIABLE: + xsltStylePreCompute(cctxt->style, node); + xsltParseGlobalVariable(cctxt->style, node); + break; + case XSLT_FUNC_ATTRSET: + xsltParseStylesheetAttributeSet(cctxt->style, node); + break; + default: + xsltTransformError(NULL, cctxt->style, node, + "Internal error: (xsltParseTopLevelXSLTElem) " + "Cannot handle this top-level declaration.\n"); + cctxt->style->errors++; + ret = -1; + } + +exit: + xsltCompilerNodePop(cctxt, node); + + return(ret); +} + +#if 0 +static int +xsltParseRemoveWhitespace(xmlNodePtr node) +{ + if ((node == NULL) || (node->children == NULL)) + return(0); + else { + xmlNodePtr delNode = NULL, child = node->children; + + do { + if (delNode) { + xmlUnlinkNode(delNode); + xmlFreeNode(delNode); + delNode = NULL; + } + if (((child->type == XML_TEXT_NODE) || + (child->type == XML_CDATA_SECTION_NODE)) && + (IS_BLANK_NODE(child))) + delNode = child; + child = child->next; + } while (child != NULL); + if (delNode) { + xmlUnlinkNode(delNode); + xmlFreeNode(delNode); + delNode = NULL; + } + } + return(0); +} +#endif + +static int +xsltParseXSLTStylesheetElemCore(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) +{ +#ifdef WITH_XSLT_DEBUG_PARSING + int templates = 0; +#endif + xmlNodePtr cur, start = NULL; + xsltStylesheetPtr style; + + if ((cctxt == NULL) || (node == NULL) || + (node->type != XML_ELEMENT_NODE)) + return(-1); + + style = cctxt->style; + /* + * At this stage all import declarations of all stylesheet modules + * with the same stylesheet level have been processed. + * Now we can safely parse the rest of the declarations. + */ + if (IS_XSLT_ELEM_FAST(node) && IS_XSLT_NAME(node, "include")) + { + xsltDocumentPtr include; + /* + * URGENT TODO: Make this work with simplified stylesheets! + * I.e., when we won't find an xsl:stylesheet element. + */ + /* + * This is as include declaration. + */ + include = ((xsltStyleItemIncludePtr) node->psvi)->include; + if (include == NULL) { + /* TODO: raise error? */ + return(-1); + } + /* + * TODO: Actually an xsl:include should locate an embedded + * stylesheet as well; so the document-element won't always + * be the element where the actual stylesheet is rooted at. + * But such embedded stylesheets are not supported by Libxslt yet. + */ + node = xmlDocGetRootElement(include->doc); + if (node == NULL) { + return(-1); + } + } + + if (node->children == NULL) + return(0); + /* + * Push the xsl:stylesheet/xsl:transform element. + */ + xsltCompilerNodePush(cctxt, node); + cctxt->inode->isRoot = 1; + cctxt->inode->nsChanged = 0; + /* + * Start with the naked dummy info for literal result elements. + */ + cctxt->inode->litResElemInfo = cctxt->inodeList->litResElemInfo; + + /* + * In every case, we need to have + * the in-scope namespaces of the element, where the + * stylesheet is rooted at, regardless if it's an XSLT + * instruction or a literal result instruction (or if + * this is an embedded stylesheet). + */ + cctxt->inode->inScopeNs = + xsltCompilerBuildInScopeNsList(cctxt, node); + + /* + * Process attributes of xsl:stylesheet/xsl:transform. + * -------------------------------------------------- + * Allowed are: + * id = id + * extension-element-prefixes = tokens + * exclude-result-prefixes = tokens + * version = number (mandatory) + */ + if (xsltParseAttrXSLTVersion(cctxt, node, + XSLT_ELEMENT_CATEGORY_XSLT) == 0) + { + /* + * Attribute "version". + * XSLT 1.0: "An xsl:stylesheet element *must* have a version + * attribute, indicating the version of XSLT that the + * stylesheet requires". + * The root element of a simplified stylesheet must also have + * this attribute. + */ +#ifdef XSLT_REFACTORED_MANDATORY_VERSION + if (isXsltElem) + xsltTransformError(NULL, cctxt->style, node, + "The attribute 'version' is missing.\n"); + cctxt->style->errors++; +#else + /* OLD behaviour. */ + xsltTransformError(NULL, cctxt->style, node, + "xsl:version is missing: document may not be a stylesheet\n"); + cctxt->style->warnings++; +#endif + } + /* + * The namespaces declared by the attributes + * "extension-element-prefixes" and + * "exclude-result-prefixes" are local to *this* + * stylesheet tree; i.e., they are *not* visible to + * other stylesheet-modules, whether imported or included. + * + * Attribute "extension-element-prefixes". + */ + cctxt->inode->extElemNs = + xsltParseExtElemPrefixes(cctxt, node, NULL, + XSLT_ELEMENT_CATEGORY_XSLT); + /* + * Attribute "exclude-result-prefixes". + */ + cctxt->inode->exclResultNs = + xsltParseExclResultPrefixes(cctxt, node, NULL, + XSLT_ELEMENT_CATEGORY_XSLT); + /* + * Create/reuse info for the literal result element. + */ + if (cctxt->inode->nsChanged) + xsltLREInfoCreate(cctxt, node, 0); + /* + * Processed top-level elements: + * ---------------------------- + * xsl:variable, xsl:param (QName, in-scope ns, + * expression (vars allowed)) + * xsl:attribute-set (QName, in-scope ns) + * xsl:strip-space, xsl:preserve-space (XPath NameTests, + * in-scope ns) + * I *think* global scope, merge with includes + * xsl:output (QName, in-scope ns) + * xsl:key (QName, in-scope ns, pattern, + * expression (vars *not* allowed)) + * xsl:decimal-format (QName, needs in-scope ns) + * xsl:namespace-alias (in-scope ns) + * global scope, merge with includes + * xsl:template (last, QName, pattern) + * + * (whitespace-only text-nodes have *not* been removed + * yet; this will be done in xsltParseSequenceConstructor) + * + * Report misplaced child-nodes first. + */ + cur = node->children; + while (cur != NULL) { + if (cur->type == XML_TEXT_NODE) { + xsltTransformError(NULL, style, cur, + "Misplaced text node (content: '%s').\n", + (cur->content != NULL) ? cur->content : BAD_CAST ""); + style->errors++; + } else if (cur->type != XML_ELEMENT_NODE) { + xsltTransformError(NULL, style, cur, "Misplaced node.\n"); + style->errors++; + } + cur = cur->next; + } + /* + * Skip xsl:import elements; they have been processed + * already. + */ + cur = node->children; + while ((cur != NULL) && xsltParseFindTopLevelElem(cctxt, cur, + BAD_CAST "import", XSLT_NAMESPACE, 1, &cur) == 1) + cur = cur->next; + if (cur == NULL) + goto exit; + + start = cur; + /* + * Process all top-level xsl:param elements. + */ + while ((cur != NULL) && + xsltParseFindTopLevelElem(cctxt, cur, + BAD_CAST "param", XSLT_NAMESPACE, 0, &cur) == 1) + { + xsltParseTopLevelXSLTElem(cctxt, cur, XSLT_FUNC_PARAM); + cur = cur->next; + } + /* + * Process all top-level xsl:variable elements. + */ + cur = start; + while ((cur != NULL) && + xsltParseFindTopLevelElem(cctxt, cur, + BAD_CAST "variable", XSLT_NAMESPACE, 0, &cur) == 1) + { + xsltParseTopLevelXSLTElem(cctxt, cur, XSLT_FUNC_VARIABLE); + cur = cur->next; + } + /* + * Process all the rest of top-level elements. + */ + cur = start; + while (cur != NULL) { + /* + * Process element nodes. + */ + if (cur->type == XML_ELEMENT_NODE) { + if (cur->ns == NULL) { + xsltTransformError(NULL, style, cur, + "Unexpected top-level element in no namespace.\n"); + style->errors++; + cur = cur->next; + continue; + } + /* + * Process all XSLT elements. + */ + if (IS_XSLT_ELEM_FAST(cur)) { + /* + * xsl:import is only allowed at the beginning. + */ + if (IS_XSLT_NAME(cur, "import")) { + xsltTransformError(NULL, style, cur, + "Misplaced xsl:import element.\n"); + style->errors++; + cur = cur->next; + continue; + } + /* + * TODO: Change the return type of the parsing functions + * to int. + */ + if (IS_XSLT_NAME(cur, "template")) { +#ifdef WITH_XSLT_DEBUG_PARSING + templates++; +#endif + /* + * TODO: Is the position of xsl:template in the + * tree significant? If not it would be easier to + * parse them at a later stage. + */ + xsltParseXSLTTemplate(cctxt, cur); + } else if (IS_XSLT_NAME(cur, "variable")) { + /* NOP; done already */ + } else if (IS_XSLT_NAME(cur, "param")) { + /* NOP; done already */ + } else if (IS_XSLT_NAME(cur, "include")) { + if (cur->psvi != NULL) + xsltParseXSLTStylesheetElemCore(cctxt, cur); + else { + xsltTransformError(NULL, style, cur, + "Internal error: " + "(xsltParseXSLTStylesheetElemCore) " + "The xsl:include element was not compiled.\n"); + style->errors++; + } + } else if (IS_XSLT_NAME(cur, "strip-space")) { + /* No node info needed. */ + xsltParseStylesheetStripSpace(style, cur); + } else if (IS_XSLT_NAME(cur, "preserve-space")) { + /* No node info needed. */ + xsltParseStylesheetPreserveSpace(style, cur); + } else if (IS_XSLT_NAME(cur, "output")) { + /* No node-info needed. */ + xsltParseStylesheetOutput(style, cur); + } else if (IS_XSLT_NAME(cur, "key")) { + /* TODO: node-info needed for expressions ? */ + xsltParseStylesheetKey(style, cur); + } else if (IS_XSLT_NAME(cur, "decimal-format")) { + /* No node-info needed. */ + xsltParseStylesheetDecimalFormat(style, cur); + } else if (IS_XSLT_NAME(cur, "attribute-set")) { + xsltParseTopLevelXSLTElem(cctxt, cur, + XSLT_FUNC_ATTRSET); + } else if (IS_XSLT_NAME(cur, "namespace-alias")) { + /* NOP; done already */ + } else { + if (cctxt->inode->forwardsCompat) { + /* + * Forwards-compatible mode: + * + * XSLT-1: "if it is a top-level element and + * XSLT 1.0 does not allow such elements as top-level + * elements, then the element must be ignored along + * with its content;" + */ + /* + * TODO: I don't think we should generate a warning. + */ + xsltTransformError(NULL, style, cur, + "Forwards-compatible mode: Ignoring unknown XSLT " + "element '%s'.\n", cur->name); + style->warnings++; + } else { + xsltTransformError(NULL, style, cur, + "Unknown XSLT element '%s'.\n", cur->name); + style->errors++; + } + } + } else { + xsltTopLevelFunction function; + + /* + * Process non-XSLT elements, which are in a + * non-NULL namespace. + */ + /* + * QUESTION: What does xsltExtModuleTopLevelLookup() + * do exactly? + */ + function = xsltExtModuleTopLevelLookup(cur->name, + cur->ns->href); + if (function != NULL) + function(style, cur); +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltParseXSLTStylesheetElemCore : User-defined " + "data element '%s'.\n", cur->name); +#endif + } + } + cur = cur->next; + } + +exit: + +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "### END of parsing top-level elements of doc '%s'.\n", + node->doc->URL); + xsltGenericDebug(xsltGenericDebugContext, + "### Templates: %d\n", templates); +#ifdef XSLT_REFACTORED + xsltGenericDebug(xsltGenericDebugContext, + "### Max inodes: %d\n", cctxt->maxNodeInfos); + xsltGenericDebug(xsltGenericDebugContext, + "### Max LREs : %d\n", cctxt->maxLREs); +#endif /* XSLT_REFACTORED */ +#endif /* WITH_XSLT_DEBUG_PARSING */ + + xsltCompilerNodePop(cctxt, node); + return(0); +} + +/** + * xsltParseXSLTStylesheet: + * @cctxt: the compiler context + * @node: the xsl:stylesheet/xsl:transform element-node + * + * Parses the xsl:stylesheet and xsl:transform element. + * + * + * + * + * + * BIG TODO: The xsl:include stuff. + * + * Called by xsltParseStylesheetTree() + * + * Returns 0 on success, a positive result on errors and + * -1 on API or internal errors. + */ +static int +xsltParseXSLTStylesheetElem(xsltCompilerCtxtPtr cctxt, xmlNodePtr node) +{ + xmlNodePtr cur, start; + + if ((cctxt == NULL) || (node == NULL) || (node->type != XML_ELEMENT_NODE)) + return(-1); + + if (node->children == NULL) + goto exit; + + /* + * Process top-level elements: + * xsl:import (must be first) + * xsl:include (this is just a pre-processing) + */ + cur = node->children; + /* + * Process xsl:import elements. + * XSLT 1.0: "The xsl:import element children must precede all + * other element children of an xsl:stylesheet element, + * including any xsl:include element children." + */ + while ((cur != NULL) && + xsltParseFindTopLevelElem(cctxt, cur, + BAD_CAST "import", XSLT_NAMESPACE, 1, &cur) == 1) + { + if (xsltParseStylesheetImport(cctxt->style, cur) != 0) { + cctxt->style->errors++; + } + cur = cur->next; + } + if (cur == NULL) + goto exit; + start = cur; + /* + * Pre-process all xsl:include elements. + */ + cur = start; + while ((cur != NULL) && + xsltParseFindTopLevelElem(cctxt, cur, + BAD_CAST "include", XSLT_NAMESPACE, 0, &cur) == 1) + { + xsltParseTopLevelXSLTElem(cctxt, cur, XSLT_FUNC_INCLUDE); + cur = cur->next; + } + /* + * Pre-process all xsl:namespace-alias elements. + * URGENT TODO: This won't work correctly: the order of included + * aliases and aliases defined here is significant. + */ + cur = start; + while ((cur != NULL) && + xsltParseFindTopLevelElem(cctxt, cur, + BAD_CAST "namespace-alias", XSLT_NAMESPACE, 0, &cur) == 1) + { + xsltNamespaceAlias(cctxt->style, cur); + cur = cur->next; + } + + if (cctxt->isInclude) { + /* + * If this stylesheet is intended for inclusion, then + * we will process only imports and includes. + */ + goto exit; + } + /* + * Now parse the rest of the top-level elements. + */ + xsltParseXSLTStylesheetElemCore(cctxt, node); +exit: + + return(0); +} + +#else /* XSLT_REFACTORED */ + +/** + * xsltParseStylesheetTop: + * @style: the XSLT stylesheet + * @top: the top level "stylesheet" or "transform" element + * + * scan the top level elements of an XSL stylesheet + */ +static void +xsltParseStylesheetTop(xsltStylesheetPtr style, xmlNodePtr top) { + xmlNodePtr cur; + xmlChar *prop; +#ifdef WITH_XSLT_DEBUG_PARSING + int templates = 0; +#endif + + if ((top == NULL) || (top->type != XML_ELEMENT_NODE)) + return; + + prop = xmlGetNsProp(top, (const xmlChar *)"version", NULL); + if (prop == NULL) { + xsltTransformError(NULL, style, top, + "xsl:version is missing: document may not be a stylesheet\n"); + if (style != NULL) style->warnings++; + } else { + if ((!xmlStrEqual(prop, (const xmlChar *)"1.0")) && + (!xmlStrEqual(prop, (const xmlChar *)"1.1"))) { + xsltTransformError(NULL, style, top, + "xsl:version: only 1.0 features are supported\n"); + if (style != NULL) { + style->forwards_compatible = 1; + style->warnings++; + } + } + xmlFree(prop); + } + + /* + * process xsl:import elements + */ + cur = top->children; + while (cur != NULL) { + if (IS_BLANK_NODE(cur)) { + cur = cur->next; + continue; + } + if (IS_XSLT_ELEM(cur) && IS_XSLT_NAME(cur, "import")) { + if (xsltParseStylesheetImport(style, cur) != 0) + if (style != NULL) style->errors++; + } else + break; + cur = cur->next; + } + + /* + * process other top-level elements + */ + while (cur != NULL) { + if (IS_BLANK_NODE(cur)) { + cur = cur->next; + continue; + } + if (cur->type == XML_TEXT_NODE) { + if (cur->content != NULL) { + xsltTransformError(NULL, style, cur, + "misplaced text node: '%s'\n", cur->content); + } + if (style != NULL) style->errors++; + cur = cur->next; + continue; + } + if ((cur->type == XML_ELEMENT_NODE) && (cur->ns == NULL)) { + xsltGenericError(xsltGenericErrorContext, + "Found a top-level element %s with null namespace URI\n", + cur->name); + if (style != NULL) style->errors++; + cur = cur->next; + continue; + } + if ((cur->type == XML_ELEMENT_NODE) && (!(IS_XSLT_ELEM(cur)))) { + xsltTopLevelFunction function; + + function = xsltExtModuleTopLevelLookup(cur->name, + cur->ns->href); + if (function != NULL) + function(style, cur); + +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltParseStylesheetTop : found foreign element %s\n", + cur->name); +#endif + cur = cur->next; + continue; + } + if (IS_XSLT_NAME(cur, "import")) { + xsltTransformError(NULL, style, cur, + "xsltParseStylesheetTop: ignoring misplaced import element\n"); + if (style != NULL) style->errors++; + } else if (IS_XSLT_NAME(cur, "include")) { + if (xsltParseStylesheetInclude(style, cur) != 0) + if (style != NULL) style->errors++; + } else if (IS_XSLT_NAME(cur, "strip-space")) { + xsltParseStylesheetStripSpace(style, cur); + } else if (IS_XSLT_NAME(cur, "preserve-space")) { + xsltParseStylesheetPreserveSpace(style, cur); + } else if (IS_XSLT_NAME(cur, "output")) { + xsltParseStylesheetOutput(style, cur); + } else if (IS_XSLT_NAME(cur, "key")) { + xsltParseStylesheetKey(style, cur); + } else if (IS_XSLT_NAME(cur, "decimal-format")) { + xsltParseStylesheetDecimalFormat(style, cur); + } else if (IS_XSLT_NAME(cur, "attribute-set")) { + xsltParseStylesheetAttributeSet(style, cur); + } else if (IS_XSLT_NAME(cur, "variable")) { + xsltParseGlobalVariable(style, cur); + } else if (IS_XSLT_NAME(cur, "param")) { + xsltParseGlobalParam(style, cur); + } else if (IS_XSLT_NAME(cur, "template")) { +#ifdef WITH_XSLT_DEBUG_PARSING + templates++; +#endif + xsltParseStylesheetTemplate(style, cur); + } else if (IS_XSLT_NAME(cur, "namespace-alias")) { + xsltNamespaceAlias(style, cur); + } else { + if ((style != NULL) && (style->forwards_compatible == 0)) { + xsltTransformError(NULL, style, cur, + "xsltParseStylesheetTop: unknown %s element\n", + cur->name); + if (style != NULL) style->errors++; + } + else { + /* do Forwards-Compatible Processing */ + xsltTransformError(NULL, style, cur, + "xsltParseStylesheetTop: ignoring unknown %s element\n", + cur->name); + if (style != NULL) style->warnings++; + } + } + cur = cur->next; + } +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "parsed %d templates\n", templates); +#endif +} + +#endif /* else of XSLT_REFACTORED */ + +#ifdef XSLT_REFACTORED +/** + * xsltParseSimplifiedStylesheetTree: + * + * @style: the stylesheet (TODO: Change this to the compiler context) + * @doc: the document containing the stylesheet. + * @node: the node where the stylesheet is rooted at + * + * Returns 0 in case of success, a positive result if an error occurred + * and -1 on API and internal errors. + */ +static int +xsltParseSimplifiedStylesheetTree(xsltCompilerCtxtPtr cctxt, + xmlDocPtr doc, + xmlNodePtr node) +{ + xsltTemplatePtr templ; + + if ((cctxt == NULL) || (node == NULL)) + return(-1); + + if (xsltParseAttrXSLTVersion(cctxt, node, 0) == XSLT_ELEMENT_CATEGORY_LRE) + { + /* + * TODO: Adjust report, since this might be an + * embedded stylesheet. + */ + xsltTransformError(NULL, cctxt->style, node, + "The attribute 'xsl:version' is missing; cannot identify " + "this document as an XSLT stylesheet document.\n"); + cctxt->style->errors++; + return(1); + } + +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltParseSimplifiedStylesheetTree: document is stylesheet\n"); +#endif + + /* + * Create and link the template + */ + templ = xsltNewTemplate(); + if (templ == NULL) { + return(-1); + } + templ->next = cctxt->style->templates; + cctxt->style->templates = templ; + templ->match = xmlStrdup(BAD_CAST "/"); + + /* + * Note that we push the document-node in this special case. + */ + xsltCompilerNodePush(cctxt, (xmlNodePtr) doc); + /* + * In every case, we need to have + * the in-scope namespaces of the element, where the + * stylesheet is rooted at, regardless if it's an XSLT + * instruction or a literal result instruction (or if + * this is an embedded stylesheet). + */ + cctxt->inode->inScopeNs = + xsltCompilerBuildInScopeNsList(cctxt, node); + /* + * Parse the content and register the match-pattern. + */ + xsltParseSequenceConstructor(cctxt, node); + xsltCompilerNodePop(cctxt, (xmlNodePtr) doc); + + templ->elem = (xmlNodePtr) doc; + templ->content = node; + xsltAddTemplate(cctxt->style, templ, NULL, NULL); + cctxt->style->literal_result = 1; + return(0); +} + +#ifdef XSLT_REFACTORED_XSLT_NSCOMP +/** + * xsltRestoreDocumentNamespaces: + * @ns: map of namespaces + * @doc: the document + * + * Restore the namespaces for the document + * + * Returns 0 in case of success, -1 in case of failure + */ +int +xsltRestoreDocumentNamespaces(xsltNsMapPtr ns, xmlDocPtr doc) +{ + if (doc == NULL) + return(-1); + /* + * Revert the changes we have applied to the namespace-URIs of + * ns-decls. + */ + while (ns != NULL) { + if ((ns->doc == doc) && (ns->ns != NULL)) { + ns->ns->href = ns->origNsName; + ns->origNsName = NULL; + ns->ns = NULL; + } + ns = ns->next; + } + return(0); +} +#endif /* XSLT_REFACTORED_XSLT_NSCOMP */ + +/** + * xsltParseStylesheetProcess: + * @style: the XSLT stylesheet (the current stylesheet-level) + * @doc: and xmlDoc parsed XML + * + * Parses an XSLT stylesheet, adding the associated structures. + * Called by: + * xsltParseStylesheetImportedDoc() (xslt.c) + * xsltParseStylesheetInclude() (imports.c) + * + * Returns the value of the @style parameter if everything + * went right, NULL if something went amiss. + */ +xsltStylesheetPtr +xsltParseStylesheetProcess(xsltStylesheetPtr style, xmlDocPtr doc) +{ + xsltCompilerCtxtPtr cctxt; + xmlNodePtr cur; + int oldIsSimplifiedStylesheet; + + xsltInitGlobals(); + + if ((style == NULL) || (doc == NULL)) + return(NULL); + + cctxt = XSLT_CCTXT(style); + + cur = xmlDocGetRootElement(doc); + if (cur == NULL) { + xsltTransformError(NULL, style, (xmlNodePtr) doc, + "xsltParseStylesheetProcess : empty stylesheet\n"); + return(NULL); + } + oldIsSimplifiedStylesheet = cctxt->simplified; + + if ((IS_XSLT_ELEM(cur)) && + ((IS_XSLT_NAME(cur, "stylesheet")) || + (IS_XSLT_NAME(cur, "transform")))) { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltParseStylesheetProcess : found stylesheet\n"); +#endif + cctxt->simplified = 0; + style->literal_result = 0; + } else { + cctxt->simplified = 1; + style->literal_result = 1; + } + /* + * Pre-process the stylesheet if not already done before. + * This will remove PIs and comments, merge adjacent + * text nodes, internalize strings, etc. + */ + if (! style->nopreproc) + xsltParsePreprocessStylesheetTree(cctxt, cur); + /* + * Parse and compile the stylesheet. + */ + if (style->literal_result == 0) { + if (xsltParseXSLTStylesheetElem(cctxt, cur) != 0) + return(NULL); + } else { + if (xsltParseSimplifiedStylesheetTree(cctxt, doc, cur) != 0) + return(NULL); + } + + cctxt->simplified = oldIsSimplifiedStylesheet; + + return(style); +} + +#else /* XSLT_REFACTORED */ + +/** + * xsltParseStylesheetProcess: + * @ret: the XSLT stylesheet (the current stylesheet-level) + * @doc: and xmlDoc parsed XML + * + * Parses an XSLT stylesheet, adding the associated structures. + * Called by: + * xsltParseStylesheetImportedDoc() (xslt.c) + * xsltParseStylesheetInclude() (imports.c) + * + * Returns the value of the @style parameter if everything + * went right, NULL if something went amiss. + */ +xsltStylesheetPtr +xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc) { + xmlNodePtr cur; + + xsltInitGlobals(); + + if (doc == NULL) + return(NULL); + if (ret == NULL) + return(ret); + + /* + * First steps, remove blank nodes, + * locate the xsl:stylesheet element and the + * namespace declaration. + */ + cur = xmlDocGetRootElement(doc); + if (cur == NULL) { + xsltTransformError(NULL, ret, (xmlNodePtr) doc, + "xsltParseStylesheetProcess : empty stylesheet\n"); + return(NULL); + } + + if ((IS_XSLT_ELEM(cur)) && + ((IS_XSLT_NAME(cur, "stylesheet")) || + (IS_XSLT_NAME(cur, "transform")))) { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltParseStylesheetProcess : found stylesheet\n"); +#endif + ret->literal_result = 0; + xsltParseStylesheetExcludePrefix(ret, cur, 1); + xsltParseStylesheetExtPrefix(ret, cur, 1); + } else { + xsltParseStylesheetExcludePrefix(ret, cur, 0); + xsltParseStylesheetExtPrefix(ret, cur, 0); + ret->literal_result = 1; + } + if (!ret->nopreproc) { + xsltPrecomputeStylesheet(ret, cur); + } + if (ret->literal_result == 0) { + xsltParseStylesheetTop(ret, cur); + } else { + xmlChar *prop; + xsltTemplatePtr template; + + /* + * the document itself might be the template, check xsl:version + */ + prop = xmlGetNsProp(cur, (const xmlChar *)"version", XSLT_NAMESPACE); + if (prop == NULL) { + xsltTransformError(NULL, ret, cur, + "xsltParseStylesheetProcess : document is not a stylesheet\n"); + return(NULL); + } + +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltParseStylesheetProcess : document is stylesheet\n"); +#endif + + if (!xmlStrEqual(prop, (const xmlChar *)"1.0")) { + xsltTransformError(NULL, ret, cur, + "xsl:version: only 1.0 features are supported\n"); + /* TODO set up compatibility when not XSLT 1.0 */ + ret->warnings++; + } + xmlFree(prop); + + /* + * Create and link the template + */ + template = xsltNewTemplate(); + if (template == NULL) { + return(NULL); + } + template->next = ret->templates; + ret->templates = template; + template->match = xmlStrdup((const xmlChar *)"/"); + + /* + * parse the content and register the pattern + */ + xsltParseTemplateContent(ret, (xmlNodePtr) doc); + template->elem = (xmlNodePtr) doc; + template->content = doc->children; + xsltAddTemplate(ret, template, NULL, NULL); + ret->literal_result = 1; + } + + return(ret); +} + +#endif /* else of XSLT_REFACTORED */ + +/** + * xsltParseStylesheetImportedDoc: + * @doc: an xmlDoc parsed XML + * @parentStyle: pointer to the parent stylesheet (if it exists) + * + * parse an XSLT stylesheet building the associated structures + * except the processing not needed for imported documents. + * + * Returns a new XSLT stylesheet structure. + */ + +xsltStylesheetPtr +xsltParseStylesheetImportedDoc(xmlDocPtr doc, + xsltStylesheetPtr parentStyle) { + xsltStylesheetPtr retStyle; + + if (doc == NULL) + return(NULL); + + retStyle = xsltNewStylesheet(); + if (retStyle == NULL) + return(NULL); + /* + * Set the importing stylesheet module; also used to detect recursion. + */ + retStyle->parent = parentStyle; + /* + * Adjust the string dict. + */ + if (doc->dict != NULL) { + xmlDictFree(retStyle->dict); + retStyle->dict = doc->dict; +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "reusing dictionary from %s for stylesheet\n", + doc->URL); +#endif + xmlDictReference(retStyle->dict); + } + + /* + * TODO: Eliminate xsltGatherNamespaces(); we must not restrict + * the stylesheet to containt distinct namespace prefixes. + */ + xsltGatherNamespaces(retStyle); + +#ifdef XSLT_REFACTORED + { + xsltCompilerCtxtPtr cctxt; + xsltStylesheetPtr oldCurSheet; + + if (parentStyle == NULL) { + xsltPrincipalStylesheetDataPtr principalData; + /* + * Principal stylesheet + * -------------------- + */ + retStyle->principal = retStyle; + /* + * Create extra data for the principal stylesheet. + */ + principalData = xsltNewPrincipalStylesheetData(); + if (principalData == NULL) { + xsltFreeStylesheet(retStyle); + return(NULL); + } + retStyle->principalData = principalData; + /* + * Create the compilation context + * ------------------------------ + * (only once; for the principal stylesheet). + * This is currently the only function where the + * compilation context is created. + */ + cctxt = xsltCompilationCtxtCreate(retStyle); + if (cctxt == NULL) { + xsltFreeStylesheet(retStyle); + return(NULL); + } + retStyle->compCtxt = (void *) cctxt; + cctxt->style = retStyle; + cctxt->dict = retStyle->dict; + cctxt->psData = principalData; + /* + * Push initial dummy node info. + */ + cctxt->depth = -1; + xsltCompilerNodePush(cctxt, (xmlNodePtr) doc); + } else { + /* + * Imported stylesheet. + */ + retStyle->principal = parentStyle->principal; + cctxt = parentStyle->compCtxt; + retStyle->compCtxt = cctxt; + } + /* + * Save the old and set the current stylesheet structure in the + * compilation context. + */ + oldCurSheet = cctxt->style; + cctxt->style = retStyle; + + retStyle->doc = doc; + xsltParseStylesheetProcess(retStyle, doc); + + cctxt->style = oldCurSheet; + if (parentStyle == NULL) { + /* + * Pop the initial dummy node info. + */ + xsltCompilerNodePop(cctxt, (xmlNodePtr) doc); + } else { + /* + * Clear the compilation context of imported + * stylesheets. + * TODO: really? + */ + /* retStyle->compCtxt = NULL; */ + } + /* + * Free the stylesheet if there were errors. + */ + if (retStyle != NULL) { + if (retStyle->errors != 0) { +#ifdef XSLT_REFACTORED_XSLT_NSCOMP + /* + * Restore all changes made to namespace URIs of ns-decls. + */ + if (cctxt->psData->nsMap) + xsltRestoreDocumentNamespaces(cctxt->psData->nsMap, doc); +#endif + /* + * Detach the doc from the stylesheet; otherwise the doc + * will be freed in xsltFreeStylesheet(). + */ + retStyle->doc = NULL; + /* + * Cleanup the doc if its the main stylesheet. + */ + if (parentStyle == NULL) { + xsltCleanupStylesheetTree(doc, xmlDocGetRootElement(doc)); + if (retStyle->compCtxt != NULL) { + xsltCompilationCtxtFree(retStyle->compCtxt); + retStyle->compCtxt = NULL; + } + } + + xsltFreeStylesheet(retStyle); + retStyle = NULL; + } + } + } + +#else /* XSLT_REFACTORED */ + /* + * Old behaviour. + */ + retStyle->doc = doc; + if (xsltParseStylesheetProcess(retStyle, doc) == NULL) { + retStyle->doc = NULL; + xsltFreeStylesheet(retStyle); + retStyle = NULL; + } + if (retStyle != NULL) { + if (retStyle->errors != 0) { + retStyle->doc = NULL; + if (parentStyle == NULL) + xsltCleanupStylesheetTree(doc, + xmlDocGetRootElement(doc)); + xsltFreeStylesheet(retStyle); + retStyle = NULL; + } + } +#endif /* else of XSLT_REFACTORED */ + + return(retStyle); +} + +/** + * xsltParseStylesheetDoc: + * @doc: and xmlDoc parsed XML + * + * parse an XSLT stylesheet, building the associated structures. doc + * is kept as a reference within the returned stylesheet, so changes + * to doc after the parsing will be reflected when the stylesheet + * is applied, and the doc is automatically freed when the + * stylesheet is closed. + * + * Returns a new XSLT stylesheet structure. + */ + +xsltStylesheetPtr +xsltParseStylesheetDoc(xmlDocPtr doc) { + xsltStylesheetPtr ret; + + xsltInitGlobals(); + + ret = xsltParseStylesheetImportedDoc(doc, NULL); + if (ret == NULL) + return(NULL); + + xsltResolveStylesheetAttributeSet(ret); +#ifdef XSLT_REFACTORED + /* + * Free the compilation context. + * TODO: Check if it's better to move this cleanup to + * xsltParseStylesheetImportedDoc(). + */ + if (ret->compCtxt != NULL) { + xsltCompilationCtxtFree(XSLT_CCTXT(ret)); + ret->compCtxt = NULL; + } +#endif + return(ret); +} + +/** + * xsltParseStylesheetFile: + * @filename: the filename/URL to the stylesheet + * + * Load and parse an XSLT stylesheet + * + * Returns a new XSLT stylesheet structure. + */ + +xsltStylesheetPtr +xsltParseStylesheetFile(const xmlChar* filename) { + xsltSecurityPrefsPtr sec; + xsltStylesheetPtr ret; + xmlDocPtr doc; + + xsltInitGlobals(); + + if (filename == NULL) + return(NULL); + +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltParseStylesheetFile : parse %s\n", filename); +#endif + + /* + * Security framework check + */ + sec = xsltGetDefaultSecurityPrefs(); + if (sec != NULL) { + int res; + + res = xsltCheckRead(sec, NULL, filename); + if (res == 0) { + xsltTransformError(NULL, NULL, NULL, + "xsltParseStylesheetFile: read rights for %s denied\n", + filename); + return(NULL); + } + } + + doc = xsltDocDefaultLoader(filename, NULL, XSLT_PARSE_OPTIONS, + NULL, XSLT_LOAD_START); + if (doc == NULL) { + xsltTransformError(NULL, NULL, NULL, + "xsltParseStylesheetFile : cannot parse %s\n", filename); + return(NULL); + } + ret = xsltParseStylesheetDoc(doc); + if (ret == NULL) { + xmlFreeDoc(doc); + return(NULL); + } + + return(ret); +} + +/************************************************************************ + * * + * Handling of Stylesheet PI * + * * + ************************************************************************/ + +#define CUR (*cur) +#define SKIP(val) cur += (val) +#define NXT(val) cur[(val)] +#define SKIP_BLANKS \ + while (IS_BLANK(CUR)) NEXT +#define NEXT ((*cur) ? cur++ : cur) + +/** + * xsltParseStylesheetPI: + * @value: the value of the PI + * + * This function checks that the type is text/xml and extracts + * the URI-Reference for the stylesheet + * + * Returns the URI-Reference for the stylesheet or NULL (it need to + * be freed by the caller) + */ +static xmlChar * +xsltParseStylesheetPI(const xmlChar *value) { + const xmlChar *cur; + const xmlChar *start; + xmlChar *val; + xmlChar tmp; + xmlChar *href = NULL; + int isXml = 0; + + if (value == NULL) + return(NULL); + + cur = value; + while (CUR != 0) { + SKIP_BLANKS; + if ((CUR == 't') && (NXT(1) == 'y') && (NXT(2) == 'p') && + (NXT(3) == 'e')) { + SKIP(4); + SKIP_BLANKS; + if (CUR != '=') + continue; + NEXT; + if ((CUR != '\'') && (CUR != '"')) + continue; + tmp = CUR; + NEXT; + start = cur; + while ((CUR != 0) && (CUR != tmp)) + NEXT; + if (CUR != tmp) + continue; + val = xmlStrndup(start, cur - start); + NEXT; + if (val == NULL) + return(NULL); + if ((xmlStrcasecmp(val, BAD_CAST "text/xml")) && + (xmlStrcasecmp(val, BAD_CAST "text/xsl"))) { + xmlFree(val); + break; + } + isXml = 1; + xmlFree(val); + } else if ((CUR == 'h') && (NXT(1) == 'r') && (NXT(2) == 'e') && + (NXT(3) == 'f')) { + SKIP(4); + SKIP_BLANKS; + if (CUR != '=') + continue; + NEXT; + if ((CUR != '\'') && (CUR != '"')) + continue; + tmp = CUR; + NEXT; + start = cur; + while ((CUR != 0) && (CUR != tmp)) + NEXT; + if (CUR != tmp) + continue; + if (href == NULL) + href = xmlStrndup(start, cur - start); + NEXT; + } else { + while ((CUR != 0) && (!IS_BLANK(CUR))) + NEXT; + } + + } + + if (!isXml) { + if (href != NULL) + xmlFree(href); + href = NULL; + } + return(href); +} + +/** + * xsltLoadStylesheetPI: + * @doc: a document to process + * + * This function tries to locate the stylesheet PI in the given document + * If found, and if contained within the document, it will extract + * that subtree to build the stylesheet to process @doc (doc itself will + * be modified). If found but referencing an external document it will + * attempt to load it and generate a stylesheet from it. In both cases, + * the resulting stylesheet and the document need to be freed once the + * transformation is done. + * + * Returns a new XSLT stylesheet structure or NULL if not found. + */ +xsltStylesheetPtr +xsltLoadStylesheetPI(xmlDocPtr doc) { + xmlNodePtr child; + xsltStylesheetPtr ret = NULL; + xmlChar *href = NULL; + xmlURIPtr URI; + + xsltInitGlobals(); + + if (doc == NULL) + return(NULL); + + /* + * Find the text/xml stylesheet PI id any before the root + */ + child = doc->children; + while ((child != NULL) && (child->type != XML_ELEMENT_NODE)) { + if ((child->type == XML_PI_NODE) && + (xmlStrEqual(child->name, BAD_CAST "xml-stylesheet"))) { + href = xsltParseStylesheetPI(child->content); + if (href != NULL) + break; + } + child = child->next; + } + + /* + * If found check the href to select processing + */ + if (href != NULL) { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltLoadStylesheetPI : found PI href=%s\n", href); +#endif + URI = xmlParseURI((const char *) href); + if (URI == NULL) { + xsltTransformError(NULL, NULL, child, + "xml-stylesheet : href %s is not valid\n", href); + xmlFree(href); + return(NULL); + } + if ((URI->fragment != NULL) && (URI->scheme == NULL) && + (URI->opaque == NULL) && (URI->authority == NULL) && + (URI->server == NULL) && (URI->user == NULL) && + (URI->path == NULL) && (URI->query == NULL)) { + xmlAttrPtr ID; + +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltLoadStylesheetPI : Reference to ID %s\n", href); +#endif + if (URI->fragment[0] == '#') + ID = xmlGetID(doc, (const xmlChar *) &(URI->fragment[1])); + else + ID = xmlGetID(doc, (const xmlChar *) URI->fragment); + if (ID == NULL) { + xsltTransformError(NULL, NULL, child, + "xml-stylesheet : no ID %s found\n", URI->fragment); + } else { + xmlDocPtr fake; + xmlNodePtr subtree, newtree; + xmlNsPtr ns; + +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "creating new document from %s for embedded stylesheet\n", + doc->URL); +#endif + /* + * move the subtree in a new document passed to + * the stylesheet analyzer + */ + subtree = ID->parent; + fake = xmlNewDoc(NULL); + if (fake != NULL) { + /* + * Should the dictionary still be shared even though + * the nodes are being copied rather than moved? + */ + fake->dict = doc->dict; + xmlDictReference(doc->dict); +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "reusing dictionary from %s for embedded stylesheet\n", + doc->URL); +#endif + + newtree = xmlDocCopyNode(subtree, fake, 1); + + fake->URL = xmlNodeGetBase(doc, subtree->parent); +#ifdef WITH_XSLT_DEBUG + xsltGenericDebug(xsltGenericDebugContext, + "set base URI for embedded stylesheet as %s\n", + fake->URL); +#endif + + /* + * Add all namespaces in scope of embedded stylesheet to + * root element of newly created stylesheet document + */ + while ((subtree = subtree->parent) != (xmlNodePtr)doc) { + for (ns = subtree->ns; ns; ns = ns->next) { + xmlNewNs(newtree, ns->href, ns->prefix); + } + } + + xmlAddChild((xmlNodePtr)fake, newtree); + ret = xsltParseStylesheetDoc(fake); + if (ret == NULL) + xmlFreeDoc(fake); + } + } + } else { + xmlChar *URL, *base; + + /* + * Reference to an external stylesheet + */ + + base = xmlNodeGetBase(doc, (xmlNodePtr) doc); + URL = xmlBuildURI(href, base); + if (URL != NULL) { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltLoadStylesheetPI : fetching %s\n", URL); +#endif + ret = xsltParseStylesheetFile(URL); + xmlFree(URL); + } else { +#ifdef WITH_XSLT_DEBUG_PARSING + xsltGenericDebug(xsltGenericDebugContext, + "xsltLoadStylesheetPI : fetching %s\n", href); +#endif + ret = xsltParseStylesheetFile(href); + } + if (base != NULL) + xmlFree(base); + } + xmlFreeURI(URI); + xmlFree(href); + } + return(ret); +} diff --git a/libxslt/xslt.h b/libxslt/xslt.h new file mode 100644 index 0000000..02f491a --- /dev/null +++ b/libxslt/xslt.h @@ -0,0 +1,110 @@ +/* + * Summary: Interfaces, constants and types related to the XSLT engine + * Description: Interfaces, constants and types related to the XSLT engine + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XSLT_H__ +#define __XML_XSLT_H__ + +#include +#include "xsltexports.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * XSLT_DEFAULT_VERSION: + * + * The default version of XSLT supported. + */ +#define XSLT_DEFAULT_VERSION "1.0" + +/** + * XSLT_DEFAULT_VENDOR: + * + * The XSLT "vendor" string for this processor. + */ +#define XSLT_DEFAULT_VENDOR "libxslt" + +/** + * XSLT_DEFAULT_URL: + * + * The XSLT "vendor" URL for this processor. + */ +#define XSLT_DEFAULT_URL "http://xmlsoft.org/XSLT/" + +/** + * XSLT_NAMESPACE: + * + * The XSLT specification namespace. + */ +#define XSLT_NAMESPACE ((const xmlChar *)"http://www.w3.org/1999/XSL/Transform") + +/** + * XSLT_PARSE_OPTIONS: + * + * The set of options to pass to an xmlReadxxx when loading files for + * XSLT consumption. + */ +#define XSLT_PARSE_OPTIONS \ + XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_NOCDATA + +/** + * xsltMaxDepth: + * + * This value is used to detect templates loops. + */ +XSLTPUBVAR int xsltMaxDepth; + +/** + * * xsltMaxVars: + * * + * * This value is used to detect templates loops. + * */ +XSLTPUBVAR int xsltMaxVars; + +/** + * xsltEngineVersion: + * + * The version string for libxslt. + */ +XSLTPUBVAR const char *xsltEngineVersion; + +/** + * xsltLibxsltVersion: + * + * The version of libxslt compiled. + */ +XSLTPUBVAR const int xsltLibxsltVersion; + +/** + * xsltLibxmlVersion: + * + * The version of libxml libxslt was compiled against. + */ +XSLTPUBVAR const int xsltLibxmlVersion; + +/* + * Global initialization function. + */ + +XSLTPUBFUN void XSLTCALL + xsltInit (void); + +/* + * Global cleanup function. + */ +XSLTPUBFUN void XSLTCALL + xsltCleanupGlobals (void); + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XSLT_H__ */ + diff --git a/libxslt/xsltInternals.h b/libxslt/xsltInternals.h new file mode 100644 index 0000000..7123ace --- /dev/null +++ b/libxslt/xsltInternals.h @@ -0,0 +1,1972 @@ +/* + * Summary: internal data structures, constants and functions + * Description: Internal data structures, constants and functions used + * by the XSLT engine. + * They are not part of the API or ABI, i.e. they can change + * without prior notice, use carefully. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XSLT_INTERNALS_H__ +#define __XML_XSLT_INTERNALS_H__ + +#include +#include +#include +#include +#include +#include +#include +#include "xsltexports.h" +#include "xsltlocale.h" +#include "numbersInternals.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* #define XSLT_DEBUG_PROFILE_CACHE */ + +/** + * XSLT_IS_TEXT_NODE: + * + * check if the argument is a text node + */ +#define XSLT_IS_TEXT_NODE(n) ((n != NULL) && \ + (((n)->type == XML_TEXT_NODE) || \ + ((n)->type == XML_CDATA_SECTION_NODE))) + + +/** + * XSLT_MARK_RES_TREE_FRAG: + * + * internal macro to set up tree fragments + */ +#define XSLT_MARK_RES_TREE_FRAG(n) \ + (n)->name = (char *) xmlStrdup(BAD_CAST " fake node libxslt"); + +/** + * XSLT_IS_RES_TREE_FRAG: + * + * internal macro to test tree fragments + */ +#define XSLT_IS_RES_TREE_FRAG(n) \ + ((n != NULL) && ((n)->type == XML_DOCUMENT_NODE) && \ + ((n)->name != NULL) && ((n)->name[0] == ' ')) + +/** + * XSLT_REFACTORED_KEYCOMP: + * + * Internal define to enable on-demand xsl:key computation. + * That's the only mode now but the define is kept for compatibility + */ +#define XSLT_REFACTORED_KEYCOMP + +/** + * XSLT_FAST_IF: + * + * Internal define to enable usage of xmlXPathCompiledEvalToBoolean() + * for XSLT "tests"; e.g. in + */ +#define XSLT_FAST_IF + +/** + * XSLT_REFACTORED: + * + * Internal define to enable the refactored parts of Libxslt. + */ +/* #define XSLT_REFACTORED */ +/* ==================================================================== */ + +/** + * XSLT_REFACTORED_VARS: + * + * Internal define to enable the refactored variable part of libxslt + */ +#define XSLT_REFACTORED_VARS + +#ifdef XSLT_REFACTORED + +extern const xmlChar *xsltXSLTAttrMarker; + + +/* TODO: REMOVE: #define XSLT_REFACTORED_EXCLRESNS */ + +/* TODO: REMOVE: #define XSLT_REFACTORED_NSALIAS */ + +/** + * XSLT_REFACTORED_XSLT_NSCOMP + * + * Internal define to enable the pointer-comparison of + * namespaces of XSLT elements. + */ +/* #define XSLT_REFACTORED_XSLT_NSCOMP */ + +/** + * XSLT_REFACTORED_XPATHCOMP: + * + * Internal define to enable the optimization of the + * compilation of XPath expressions. + */ +#define XSLT_REFACTORED_XPATHCOMP + +#ifdef XSLT_REFACTORED_XSLT_NSCOMP + +extern const xmlChar *xsltConstNamespaceNameXSLT; + +/** + * IS_XSLT_ELEM_FAST: + * + * quick test to detect XSLT elements + */ +#define IS_XSLT_ELEM_FAST(n) \ + (((n) != NULL) && ((n)->ns != NULL) && \ + ((n)->ns->href == xsltConstNamespaceNameXSLT)) + +/** + * IS_XSLT_ATTR_FAST: + * + * quick test to detect XSLT attributes + */ +#define IS_XSLT_ATTR_FAST(a) \ + (((a) != NULL) && ((a)->ns != NULL) && \ + ((a)->ns->href == xsltConstNamespaceNameXSLT)) + +/** + * XSLT_HAS_INTERNAL_NSMAP: + * + * check for namespace mapping + */ +#define XSLT_HAS_INTERNAL_NSMAP(s) \ + (((s) != NULL) && ((s)->principal) && \ + ((s)->principal->principalData) && \ + ((s)->principal->principalData->nsMap)) + +/** + * XSLT_GET_INTERNAL_NSMAP: + * + * get pointer to namespace map + */ +#define XSLT_GET_INTERNAL_NSMAP(s) ((s)->principal->principalData->nsMap) + +#else /* XSLT_REFACTORED_XSLT_NSCOMP */ + +/** + * IS_XSLT_ELEM_FAST: + * + * quick check whether this is an xslt element + */ +#define IS_XSLT_ELEM_FAST(n) \ + (((n) != NULL) && ((n)->ns != NULL) && \ + (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE))) + +/** + * IS_XSLT_ATTR_FAST: + * + * quick check for xslt namespace attribute + */ +#define IS_XSLT_ATTR_FAST(a) \ + (((a) != NULL) && ((a)->ns != NULL) && \ + (xmlStrEqual((a)->ns->href, XSLT_NAMESPACE))) + + +#endif /* XSLT_REFACTORED_XSLT_NSCOMP */ + + +/** + * XSLT_REFACTORED_MANDATORY_VERSION: + * + * TODO: Currently disabled to surpress regression test failures, since + * the old behaviour was that a missing version attribute + * produced a only a warning and not an error, which was incerrect. + * So the regression tests need to be fixed if this is enabled. + */ +/* #define XSLT_REFACTORED_MANDATORY_VERSION */ + +/** + * xsltPointerList: + * + * Pointer-list for various purposes. + */ +typedef struct _xsltPointerList xsltPointerList; +typedef xsltPointerList *xsltPointerListPtr; +struct _xsltPointerList { + void **items; + int number; + int size; +}; + +#endif + +/** + * XSLT_REFACTORED_PARSING: + * + * Internal define to enable the refactored parts of Libxslt + * related to parsing. + */ +/* #define XSLT_REFACTORED_PARSING */ + +/** + * XSLT_MAX_SORT: + * + * Max number of specified xsl:sort on an element. + */ +#define XSLT_MAX_SORT 15 + +/** + * XSLT_PAT_NO_PRIORITY: + * + * Specific value for pattern without priority expressed. + */ +#define XSLT_PAT_NO_PRIORITY -12345789 + +/** + * xsltRuntimeExtra: + * + * Extra information added to the transformation context. + */ +typedef struct _xsltRuntimeExtra xsltRuntimeExtra; +typedef xsltRuntimeExtra *xsltRuntimeExtraPtr; +struct _xsltRuntimeExtra { + void *info; /* pointer to the extra data */ + xmlFreeFunc deallocate; /* pointer to the deallocation routine */ + union { /* dual-purpose field */ + void *ptr; /* data not needing deallocation */ + int ival; /* integer value storage */ + } val; +}; + +/** + * XSLT_RUNTIME_EXTRA_LST: + * @ctxt: the transformation context + * @nr: the index + * + * Macro used to access extra information stored in the context + */ +#define XSLT_RUNTIME_EXTRA_LST(ctxt, nr) (ctxt)->extras[(nr)].info +/** + * XSLT_RUNTIME_EXTRA_FREE: + * @ctxt: the transformation context + * @nr: the index + * + * Macro used to free extra information stored in the context + */ +#define XSLT_RUNTIME_EXTRA_FREE(ctxt, nr) (ctxt)->extras[(nr)].deallocate +/** + * XSLT_RUNTIME_EXTRA: + * @ctxt: the transformation context + * @nr: the index + * + * Macro used to define extra information stored in the context + */ +#define XSLT_RUNTIME_EXTRA(ctxt, nr, typ) (ctxt)->extras[(nr)].val.typ + +/** + * xsltTemplate: + * + * The in-memory structure corresponding to an XSLT Template. + */ +typedef struct _xsltTemplate xsltTemplate; +typedef xsltTemplate *xsltTemplatePtr; +struct _xsltTemplate { + struct _xsltTemplate *next;/* chained list sorted by priority */ + struct _xsltStylesheet *style;/* the containing stylesheet */ + xmlChar *match; /* the matching string */ + float priority; /* as given from the stylesheet, not computed */ + const xmlChar *name; /* the local part of the name QName */ + const xmlChar *nameURI; /* the URI part of the name QName */ + const xmlChar *mode;/* the local part of the mode QName */ + const xmlChar *modeURI;/* the URI part of the mode QName */ + xmlNodePtr content; /* the template replacement value */ + xmlNodePtr elem; /* the source element */ + + /* + * TODO: @inheritedNsNr and @inheritedNs won't be used in the + * refactored code. + */ + int inheritedNsNr; /* number of inherited namespaces */ + xmlNsPtr *inheritedNs;/* inherited non-excluded namespaces */ + + /* Profiling informations */ + int nbCalls; /* the number of time the template was called */ + unsigned long time; /* the time spent in this template */ + void *params; /* xsl:param instructions */ + + int templNr; /* Nb of templates in the stack */ + int templMax; /* Size of the templtes stack */ + xsltTemplatePtr *templCalledTab; /* templates called */ + int *templCountTab; /* .. and how often */ +}; + +/** + * xsltDecimalFormat: + * + * Data structure of decimal-format. + */ +typedef struct _xsltDecimalFormat xsltDecimalFormat; +typedef xsltDecimalFormat *xsltDecimalFormatPtr; +struct _xsltDecimalFormat { + struct _xsltDecimalFormat *next; /* chained list */ + xmlChar *name; + /* Used for interpretation of pattern */ + xmlChar *digit; + xmlChar *patternSeparator; + /* May appear in result */ + xmlChar *minusSign; + xmlChar *infinity; + xmlChar *noNumber; /* Not-a-number */ + /* Used for interpretation of pattern and may appear in result */ + xmlChar *decimalPoint; + xmlChar *grouping; + xmlChar *percent; + xmlChar *permille; + xmlChar *zeroDigit; +}; + +/** + * xsltDocument: + * + * Data structure associated to a parsed document. + */ +typedef struct _xsltDocument xsltDocument; +typedef xsltDocument *xsltDocumentPtr; +struct _xsltDocument { + struct _xsltDocument *next; /* documents are kept in a chained list */ + int main; /* is this the main document */ + xmlDocPtr doc; /* the parsed document */ + void *keys; /* key tables storage */ + struct _xsltDocument *includes; /* subsidiary includes */ + int preproc; /* pre-processing already done */ + int nbKeysComputed; +}; + +/** + * xsltKeyDef: + * + * Representation of an xsl:key. + */ +typedef struct _xsltKeyDef xsltKeyDef; +typedef xsltKeyDef *xsltKeyDefPtr; +struct _xsltKeyDef { + struct _xsltKeyDef *next; + xmlNodePtr inst; + xmlChar *name; + xmlChar *nameURI; + xmlChar *match; + xmlChar *use; + xmlXPathCompExprPtr comp; + xmlXPathCompExprPtr usecomp; + xmlNsPtr *nsList; /* the namespaces in scope */ + int nsNr; /* the number of namespaces in scope */ +}; + +/** + * xsltKeyTable: + * + * Holds the computed keys for key definitions of the same QName. + * Is owned by an xsltDocument. + */ +typedef struct _xsltKeyTable xsltKeyTable; +typedef xsltKeyTable *xsltKeyTablePtr; +struct _xsltKeyTable { + struct _xsltKeyTable *next; + xmlChar *name; + xmlChar *nameURI; + xmlHashTablePtr keys; +}; + +/* + * The in-memory structure corresponding to an XSLT Stylesheet. + * NOTE: most of the content is simply linked from the doc tree + * structure, no specific allocation is made. + */ +typedef struct _xsltStylesheet xsltStylesheet; +typedef xsltStylesheet *xsltStylesheetPtr; + +typedef struct _xsltTransformContext xsltTransformContext; +typedef xsltTransformContext *xsltTransformContextPtr; + +/** + * xsltElemPreComp: + * + * The in-memory structure corresponding to element precomputed data, + * designed to be extended by extension implementors. + */ +typedef struct _xsltElemPreComp xsltElemPreComp; +typedef xsltElemPreComp *xsltElemPreCompPtr; + +/** + * xsltTransformFunction: + * @ctxt: the XSLT transformation context + * @node: the input node + * @inst: the stylesheet node + * @comp: the compiled information from the stylesheet + * + * Signature of the function associated to elements part of the + * stylesheet language like xsl:if or xsl:apply-templates. + */ +typedef void (*xsltTransformFunction) (xsltTransformContextPtr ctxt, + xmlNodePtr node, + xmlNodePtr inst, + xsltElemPreCompPtr comp); + +/** + * xsltSortFunc: + * @ctxt: a transformation context + * @sorts: the node-set to sort + * @nbsorts: the number of sorts + * + * Signature of the function to use during sorting + */ +typedef void (*xsltSortFunc) (xsltTransformContextPtr ctxt, xmlNodePtr *sorts, + int nbsorts); + +typedef enum { + XSLT_FUNC_COPY=1, + XSLT_FUNC_SORT, + XSLT_FUNC_TEXT, + XSLT_FUNC_ELEMENT, + XSLT_FUNC_ATTRIBUTE, + XSLT_FUNC_COMMENT, + XSLT_FUNC_PI, + XSLT_FUNC_COPYOF, + XSLT_FUNC_VALUEOF, + XSLT_FUNC_NUMBER, + XSLT_FUNC_APPLYIMPORTS, + XSLT_FUNC_CALLTEMPLATE, + XSLT_FUNC_APPLYTEMPLATES, + XSLT_FUNC_CHOOSE, + XSLT_FUNC_IF, + XSLT_FUNC_FOREACH, + XSLT_FUNC_DOCUMENT, + XSLT_FUNC_WITHPARAM, + XSLT_FUNC_PARAM, + XSLT_FUNC_VARIABLE, + XSLT_FUNC_WHEN, + XSLT_FUNC_EXTENSION +#ifdef XSLT_REFACTORED + , + XSLT_FUNC_OTHERWISE, + XSLT_FUNC_FALLBACK, + XSLT_FUNC_MESSAGE, + XSLT_FUNC_INCLUDE, + XSLT_FUNC_ATTRSET, + XSLT_FUNC_LITERAL_RESULT_ELEMENT, + XSLT_FUNC_UNKOWN_FORWARDS_COMPAT +#endif +} xsltStyleType; + +/** + * xsltElemPreCompDeallocator: + * @comp: the #xsltElemPreComp to free up + * + * Deallocates an #xsltElemPreComp structure. + */ +typedef void (*xsltElemPreCompDeallocator) (xsltElemPreCompPtr comp); + +/** + * xsltElemPreComp: + * + * The basic structure for compiled items of the AST of the XSLT processor. + * This structure is also intended to be extended by extension implementors. + * TODO: This is somehow not nice, since it has a "free" field, which + * derived stylesheet-structs do not have. + */ +struct _xsltElemPreComp { + xsltElemPreCompPtr next; /* next item in the global chained + list hold by xsltStylesheet. */ + xsltStyleType type; /* type of the element */ + xsltTransformFunction func; /* handling function */ + xmlNodePtr inst; /* the node in the stylesheet's tree + corresponding to this item */ + + /* end of common part */ + xsltElemPreCompDeallocator free; /* the deallocator */ +}; + +/** + * xsltStylePreComp: + * + * The abstract basic structure for items of the XSLT processor. + * This includes: + * 1) compiled forms of XSLT instructions (xsl:if, xsl:attribute, etc.) + * 2) compiled forms of literal result elements + * 3) compiled forms of extension elements + */ +typedef struct _xsltStylePreComp xsltStylePreComp; +typedef xsltStylePreComp *xsltStylePreCompPtr; + +#ifdef XSLT_REFACTORED + +/* +* Some pointer-list utility functions. +*/ +XSLTPUBFUN xsltPointerListPtr XSLTCALL + xsltPointerListCreate (int initialSize); +XSLTPUBFUN void XSLTCALL + xsltPointerListFree (xsltPointerListPtr list); +XSLTPUBFUN void XSLTCALL + xsltPointerListClear (xsltPointerListPtr list); +XSLTPUBFUN int XSLTCALL + xsltPointerListAddSize (xsltPointerListPtr list, + void *item, + int initialSize); + +/************************************************************************ + * * + * Refactored structures * + * * + ************************************************************************/ + +typedef struct _xsltNsListContainer xsltNsListContainer; +typedef xsltNsListContainer *xsltNsListContainerPtr; +struct _xsltNsListContainer { + xmlNsPtr *list; + int totalNumber; + int xpathNumber; +}; + +/** + * XSLT_ITEM_COMPATIBILITY_FIELDS: + * + * Fields for API compatibility to the structure + * _xsltElemPreComp which is used for extension functions. + * Note that @next is used for storage; it does not reflect a next + * sibling in the tree. + * TODO: Evaluate if we really need such a compatibility. + */ +#define XSLT_ITEM_COMPATIBILITY_FIELDS \ + xsltElemPreCompPtr next;\ + xsltStyleType type;\ + xsltTransformFunction func;\ + xmlNodePtr inst; + +/** + * XSLT_ITEM_NAVIGATION_FIELDS: + * + * Currently empty. + * TODO: It is intended to hold navigational fields in the future. + */ +#define XSLT_ITEM_NAVIGATION_FIELDS +/* + xsltStylePreCompPtr parent;\ + xsltStylePreCompPtr children;\ + xsltStylePreCompPtr nextItem; +*/ + +/** + * XSLT_ITEM_NSINSCOPE_FIELDS: + * + * The in-scope namespaces. + */ +#define XSLT_ITEM_NSINSCOPE_FIELDS xsltNsListContainerPtr inScopeNs; + +/** + * XSLT_ITEM_COMMON_FIELDS: + * + * Common fields used for all items. + */ +#define XSLT_ITEM_COMMON_FIELDS \ + XSLT_ITEM_COMPATIBILITY_FIELDS \ + XSLT_ITEM_NAVIGATION_FIELDS \ + XSLT_ITEM_NSINSCOPE_FIELDS + +/** + * _xsltStylePreComp: + * + * The abstract basic structure for items of the XSLT processor. + * This includes: + * 1) compiled forms of XSLT instructions (e.g. xsl:if, xsl:attribute, etc.) + * 2) compiled forms of literal result elements + * 3) various properties for XSLT instructions (e.g. xsl:when, + * xsl:with-param) + * + * REVISIT TODO: Keep this structure equal to the fields + * defined by XSLT_ITEM_COMMON_FIELDS + */ +struct _xsltStylePreComp { + xsltElemPreCompPtr next; /* next item in the global chained + list hold by xsltStylesheet */ + xsltStyleType type; /* type of the item */ + xsltTransformFunction func; /* handling function */ + xmlNodePtr inst; /* the node in the stylesheet's tree + corresponding to this item. */ + /* Currently no navigational fields. */ + xsltNsListContainerPtr inScopeNs; +}; + +/** + * xsltStyleBasicEmptyItem: + * + * Abstract structure only used as a short-cut for + * XSLT items with no extra fields. + * NOTE that it is intended that this structure looks the same as + * _xsltStylePreComp. + */ +typedef struct _xsltStyleBasicEmptyItem xsltStyleBasicEmptyItem; +typedef xsltStyleBasicEmptyItem *xsltStyleBasicEmptyItemPtr; + +struct _xsltStyleBasicEmptyItem { + XSLT_ITEM_COMMON_FIELDS +}; + +/** + * xsltStyleBasicExpressionItem: + * + * Abstract structure only used as a short-cut for + * XSLT items with just an expression. + */ +typedef struct _xsltStyleBasicExpressionItem xsltStyleBasicExpressionItem; +typedef xsltStyleBasicExpressionItem *xsltStyleBasicExpressionItemPtr; + +struct _xsltStyleBasicExpressionItem { + XSLT_ITEM_COMMON_FIELDS + + const xmlChar *select; /* TODO: Change this to "expression". */ + xmlXPathCompExprPtr comp; /* TODO: Change this to compExpr. */ +}; + +/************************************************************************ + * * + * XSLT-instructions/declarations * + * * + ************************************************************************/ + +/** + * xsltStyleItemElement: + * + * + * + * + * + */ +typedef struct _xsltStyleItemElement xsltStyleItemElement; +typedef xsltStyleItemElement *xsltStyleItemElementPtr; + +struct _xsltStyleItemElement { + XSLT_ITEM_COMMON_FIELDS + + const xmlChar *use; + int has_use; + const xmlChar *name; + int has_name; + const xmlChar *ns; + const xmlChar *nsPrefix; + int has_ns; +}; + +/** + * xsltStyleItemAttribute: + * + * + * + * + * + */ +typedef struct _xsltStyleItemAttribute xsltStyleItemAttribute; +typedef xsltStyleItemAttribute *xsltStyleItemAttributePtr; + +struct _xsltStyleItemAttribute { + XSLT_ITEM_COMMON_FIELDS + const xmlChar *name; + int has_name; + const xmlChar *ns; + const xmlChar *nsPrefix; + int has_ns; +}; + +/** + * xsltStyleItemText: + * + * + * + * + * + */ +typedef struct _xsltStyleItemText xsltStyleItemText; +typedef xsltStyleItemText *xsltStyleItemTextPtr; + +struct _xsltStyleItemText { + XSLT_ITEM_COMMON_FIELDS + int noescape; /* text */ +}; + +/** + * xsltStyleItemComment: + * + * + * + * + * + */ +typedef xsltStyleBasicEmptyItem xsltStyleItemComment; +typedef xsltStyleItemComment *xsltStyleItemCommentPtr; + +/** + * xsltStyleItemPI: + * + * + * + * + * + */ +typedef struct _xsltStyleItemPI xsltStyleItemPI; +typedef xsltStyleItemPI *xsltStyleItemPIPtr; + +struct _xsltStyleItemPI { + XSLT_ITEM_COMMON_FIELDS + const xmlChar *name; + int has_name; +}; + +/** + * xsltStyleItemApplyImports: + * + * + * + */ +typedef xsltStyleBasicEmptyItem xsltStyleItemApplyImports; +typedef xsltStyleItemApplyImports *xsltStyleItemApplyImportsPtr; + +/** + * xsltStyleItemApplyTemplates: + * + * + * + * + * + */ +typedef struct _xsltStyleItemApplyTemplates xsltStyleItemApplyTemplates; +typedef xsltStyleItemApplyTemplates *xsltStyleItemApplyTemplatesPtr; + +struct _xsltStyleItemApplyTemplates { + XSLT_ITEM_COMMON_FIELDS + + const xmlChar *mode; /* apply-templates */ + const xmlChar *modeURI; /* apply-templates */ + const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ + xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ + /* TODO: with-params */ +}; + +/** + * xsltStyleItemCallTemplate: + * + * + * + * + * + */ +typedef struct _xsltStyleItemCallTemplate xsltStyleItemCallTemplate; +typedef xsltStyleItemCallTemplate *xsltStyleItemCallTemplatePtr; + +struct _xsltStyleItemCallTemplate { + XSLT_ITEM_COMMON_FIELDS + + xsltTemplatePtr templ; /* call-template */ + const xmlChar *name; /* element, attribute, pi */ + int has_name; /* element, attribute, pi */ + const xmlChar *ns; /* element */ + int has_ns; /* element */ + /* TODO: with-params */ +}; + +/** + * xsltStyleItemCopy: + * + * + * + * + * + */ +typedef struct _xsltStyleItemCopy xsltStyleItemCopy; +typedef xsltStyleItemCopy *xsltStyleItemCopyPtr; + +struct _xsltStyleItemCopy { + XSLT_ITEM_COMMON_FIELDS + const xmlChar *use; /* copy, element */ + int has_use; /* copy, element */ +}; + +/** + * xsltStyleItemIf: + * + * + * + * + * + */ +typedef struct _xsltStyleItemIf xsltStyleItemIf; +typedef xsltStyleItemIf *xsltStyleItemIfPtr; + +struct _xsltStyleItemIf { + XSLT_ITEM_COMMON_FIELDS + + const xmlChar *test; /* if */ + xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ +}; + + +/** + * xsltStyleItemCopyOf: + * + * + * + */ +typedef xsltStyleBasicExpressionItem xsltStyleItemCopyOf; +typedef xsltStyleItemCopyOf *xsltStyleItemCopyOfPtr; + +/** + * xsltStyleItemValueOf: + * + * + * + */ +typedef struct _xsltStyleItemValueOf xsltStyleItemValueOf; +typedef xsltStyleItemValueOf *xsltStyleItemValueOfPtr; + +struct _xsltStyleItemValueOf { + XSLT_ITEM_COMMON_FIELDS + + const xmlChar *select; + xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ + int noescape; +}; + +/** + * xsltStyleItemNumber: + * + * + * + */ +typedef struct _xsltStyleItemNumber xsltStyleItemNumber; +typedef xsltStyleItemNumber *xsltStyleItemNumberPtr; + +struct _xsltStyleItemNumber { + XSLT_ITEM_COMMON_FIELDS + xsltNumberData numdata; /* number */ +}; + +/** + * xsltStyleItemChoose: + * + * + * + * + * + */ +typedef xsltStyleBasicEmptyItem xsltStyleItemChoose; +typedef xsltStyleItemChoose *xsltStyleItemChoosePtr; + +/** + * xsltStyleItemFallback: + * + * + * + * + * + */ +typedef xsltStyleBasicEmptyItem xsltStyleItemFallback; +typedef xsltStyleItemFallback *xsltStyleItemFallbackPtr; + +/** + * xsltStyleItemForEach: + * + * + * + * + * + */ +typedef xsltStyleBasicExpressionItem xsltStyleItemForEach; +typedef xsltStyleItemForEach *xsltStyleItemForEachPtr; + +/** + * xsltStyleItemMessage: + * + * + * + * + * + */ +typedef struct _xsltStyleItemMessage xsltStyleItemMessage; +typedef xsltStyleItemMessage *xsltStyleItemMessagePtr; + +struct _xsltStyleItemMessage { + XSLT_ITEM_COMMON_FIELDS + int terminate; +}; + +/** + * xsltStyleItemDocument: + * + * NOTE: This is not an instruction of XSLT 1.0. + */ +typedef struct _xsltStyleItemDocument xsltStyleItemDocument; +typedef xsltStyleItemDocument *xsltStyleItemDocumentPtr; + +struct _xsltStyleItemDocument { + XSLT_ITEM_COMMON_FIELDS + int ver11; /* assigned: in xsltDocumentComp; + read: nowhere; + TODO: Check if we need. */ + const xmlChar *filename; /* document URL */ + int has_filename; +}; + +/************************************************************************ + * * + * Non-instructions (actually properties of instructions/declarations) * + * * + ************************************************************************/ + +/** + * xsltStyleBasicItemVariable: + * + * Basic struct for xsl:variable, xsl:param and xsl:with-param. + * It's currently important to have equal fields, since + * xsltParseStylesheetCallerParam() is used with xsl:with-param from + * the xslt side and with xsl:param from the exslt side (in + * exsltFuncFunctionFunction()). + * + * FUTURE NOTE: In XSLT 2.0 xsl:param, xsl:variable and xsl:with-param + * have additional different fields. + */ +typedef struct _xsltStyleBasicItemVariable xsltStyleBasicItemVariable; +typedef xsltStyleBasicItemVariable *xsltStyleBasicItemVariablePtr; + +struct _xsltStyleBasicItemVariable { + XSLT_ITEM_COMMON_FIELDS + + const xmlChar *select; + xmlXPathCompExprPtr comp; + + const xmlChar *name; + int has_name; + const xmlChar *ns; + int has_ns; +}; + +/** + * xsltStyleItemVariable: + * + * + * + * + * + */ +typedef xsltStyleBasicItemVariable xsltStyleItemVariable; +typedef xsltStyleItemVariable *xsltStyleItemVariablePtr; + +/** + * xsltStyleItemParam: + * + * + * + * + * + */ +typedef struct _xsltStyleItemParam xsltStyleItemParam; +typedef xsltStyleItemParam *xsltStyleItemParamPtr; + +struct _xsltStyleItemParam { + XSLT_ITEM_COMMON_FIELDS + + const xmlChar *select; + xmlXPathCompExprPtr comp; + + const xmlChar *name; + int has_name; + const xmlChar *ns; + int has_ns; +}; + +/** + * xsltStyleItemWithParam: + * + * + * + * + */ +typedef xsltStyleBasicItemVariable xsltStyleItemWithParam; +typedef xsltStyleItemWithParam *xsltStyleItemWithParamPtr; + +/** + * xsltStyleItemSort: + * + * Reflects the XSLT xsl:sort item. + * Allowed parents: xsl:apply-templates, xsl:for-each + * + */ +typedef struct _xsltStyleItemSort xsltStyleItemSort; +typedef xsltStyleItemSort *xsltStyleItemSortPtr; + +struct _xsltStyleItemSort { + XSLT_ITEM_COMMON_FIELDS + + const xmlChar *stype; /* sort */ + int has_stype; /* sort */ + int number; /* sort */ + const xmlChar *order; /* sort */ + int has_order; /* sort */ + int descending; /* sort */ + const xmlChar *lang; /* sort */ + int has_lang; /* sort */ + xsltLocale locale; /* sort */ + const xmlChar *case_order; /* sort */ + int lower_first; /* sort */ + + const xmlChar *use; + int has_use; + + const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ + + xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ +}; + + +/** + * xsltStyleItemWhen: + * + * + * + * + * Allowed parent: xsl:choose + */ +typedef struct _xsltStyleItemWhen xsltStyleItemWhen; +typedef xsltStyleItemWhen *xsltStyleItemWhenPtr; + +struct _xsltStyleItemWhen { + XSLT_ITEM_COMMON_FIELDS + + const xmlChar *test; + xmlXPathCompExprPtr comp; +}; + +/** + * xsltStyleItemOtherwise: + * + * Allowed parent: xsl:choose + * + * + * + */ +typedef struct _xsltStyleItemOtherwise xsltStyleItemOtherwise; +typedef xsltStyleItemOtherwise *xsltStyleItemOtherwisePtr; + +struct _xsltStyleItemOtherwise { + XSLT_ITEM_COMMON_FIELDS +}; + +typedef struct _xsltStyleItemInclude xsltStyleItemInclude; +typedef xsltStyleItemInclude *xsltStyleItemIncludePtr; + +struct _xsltStyleItemInclude { + XSLT_ITEM_COMMON_FIELDS + xsltDocumentPtr include; +}; + +/************************************************************************ + * * + * XSLT elements in forwards-compatible mode * + * * + ************************************************************************/ + +typedef struct _xsltStyleItemUknown xsltStyleItemUknown; +typedef xsltStyleItemUknown *xsltStyleItemUknownPtr; +struct _xsltStyleItemUknown { + XSLT_ITEM_COMMON_FIELDS +}; + + +/************************************************************************ + * * + * Extension elements * + * * + ************************************************************************/ + +/* + * xsltStyleItemExtElement: + * + * Reflects extension elements. + * + * NOTE: Due to the fact that the structure xsltElemPreComp is most + * probably already heavily in use out there by users, so we cannot + * easily change it, we'll create an intermediate structure which will + * hold an xsltElemPreCompPtr. + * BIG NOTE: The only problem I see here is that the user processes the + * content of the stylesheet tree, possibly he'll lookup the node->psvi + * fields in order to find subsequent extension functions. + * In this case, the user's code will break, since the node->psvi + * field will hold now the xsltStyleItemExtElementPtr and not + * the xsltElemPreCompPtr. + * However the place where the structure is anchored in the node-tree, + * namely node->psvi, has beed already once been moved from node->_private + * to node->psvi, so we have a precedent here, which, I think, should allow + * us to change such semantics without headaches. + */ +typedef struct _xsltStyleItemExtElement xsltStyleItemExtElement; +typedef xsltStyleItemExtElement *xsltStyleItemExtElementPtr; +struct _xsltStyleItemExtElement { + XSLT_ITEM_COMMON_FIELDS + xsltElemPreCompPtr item; +}; + +/************************************************************************ + * * + * Literal result elements * + * * + ************************************************************************/ + +typedef struct _xsltEffectiveNs xsltEffectiveNs; +typedef xsltEffectiveNs *xsltEffectiveNsPtr; +struct _xsltEffectiveNs { + xsltEffectiveNsPtr nextInStore; /* storage next */ + xsltEffectiveNsPtr next; /* next item in the list */ + const xmlChar *prefix; + const xmlChar *nsName; + /* + * Indicates if eclared on the literal result element; dunno if really + * needed. + */ + int holdByElem; +}; + +/* + * Info for literal result elements. + * This will be set on the elem->psvi field and will be + * shared by literal result elements, which have the same + * excluded result namespaces; i.e., this *won't* be created uniquely + * for every literal result element. + */ +typedef struct _xsltStyleItemLRElementInfo xsltStyleItemLRElementInfo; +typedef xsltStyleItemLRElementInfo *xsltStyleItemLRElementInfoPtr; +struct _xsltStyleItemLRElementInfo { + XSLT_ITEM_COMMON_FIELDS + /* + * @effectiveNs is the set of effective ns-nodes + * on the literal result element, which will be added to the result + * element if not already existing in the result tree. + * This means that excluded namespaces (via exclude-result-prefixes, + * extension-element-prefixes and the XSLT namespace) not added + * to the set. + * Namespace-aliasing was applied on the @effectiveNs. + */ + xsltEffectiveNsPtr effectiveNs; + +}; + +#ifdef XSLT_REFACTORED + +typedef struct _xsltNsAlias xsltNsAlias; +typedef xsltNsAlias *xsltNsAliasPtr; +struct _xsltNsAlias { + xsltNsAliasPtr next; /* next in the list */ + xmlNsPtr literalNs; + xmlNsPtr targetNs; + xmlDocPtr docOfTargetNs; +}; +#endif + +#ifdef XSLT_REFACTORED_XSLT_NSCOMP + +typedef struct _xsltNsMap xsltNsMap; +typedef xsltNsMap *xsltNsMapPtr; +struct _xsltNsMap { + xsltNsMapPtr next; /* next in the list */ + xmlDocPtr doc; + xmlNodePtr elem; /* the element holding the ns-decl */ + xmlNsPtr ns; /* the xmlNs structure holding the XML namespace name */ + const xmlChar *origNsName; /* the original XML namespace name */ + const xmlChar *newNsName; /* the mapped XML namespace name */ +}; +#endif + +/************************************************************************ + * * + * Compile-time structures for *internal* use only * + * * + ************************************************************************/ + +typedef struct _xsltPrincipalStylesheetData xsltPrincipalStylesheetData; +typedef xsltPrincipalStylesheetData *xsltPrincipalStylesheetDataPtr; + +typedef struct _xsltNsList xsltNsList; +typedef xsltNsList *xsltNsListPtr; +struct _xsltNsList { + xsltNsListPtr next; /* next in the list */ + xmlNsPtr ns; +}; + +/* +* xsltVarInfo: +* +* Used at compilation time for parameters and variables. +*/ +typedef struct _xsltVarInfo xsltVarInfo; +typedef xsltVarInfo *xsltVarInfoPtr; +struct _xsltVarInfo { + xsltVarInfoPtr next; /* next in the list */ + xsltVarInfoPtr prev; + int depth; /* the depth in the tree */ + const xmlChar *name; + const xmlChar *nsName; +}; + +/** + * xsltCompilerNodeInfo: + * + * Per-node information during compile-time. + */ +typedef struct _xsltCompilerNodeInfo xsltCompilerNodeInfo; +typedef xsltCompilerNodeInfo *xsltCompilerNodeInfoPtr; +struct _xsltCompilerNodeInfo { + xsltCompilerNodeInfoPtr next; + xsltCompilerNodeInfoPtr prev; + xmlNodePtr node; + int depth; + xsltTemplatePtr templ; /* The owning template */ + int category; /* XSLT element, LR-element or + extension element */ + xsltStyleType type; + xsltElemPreCompPtr item; /* The compiled information */ + /* The current in-scope namespaces */ + xsltNsListContainerPtr inScopeNs; + /* The current excluded result namespaces */ + xsltPointerListPtr exclResultNs; + /* The current extension instruction namespaces */ + xsltPointerListPtr extElemNs; + + /* The current info for literal result elements. */ + xsltStyleItemLRElementInfoPtr litResElemInfo; + /* + * Set to 1 if in-scope namespaces changed, + * or excluded result namespaces changed, + * or extension element namespaces changed. + * This will trigger creation of new infos + * for literal result elements. + */ + int nsChanged; + int preserveWhitespace; + int stripWhitespace; + int isRoot; /* whether this is the stylesheet's root node */ + int forwardsCompat; /* whether forwards-compatible mode is enabled */ + /* whether the content of an extension element was processed */ + int extContentHandled; + /* the type of the current child */ + xsltStyleType curChildType; +}; + +/** + * XSLT_CCTXT: + * + * get pointer to compiler context + */ +#define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt) + +typedef enum { + XSLT_ERROR_SEVERITY_ERROR = 0, + XSLT_ERROR_SEVERITY_WARNING +} xsltErrorSeverityType; + +typedef struct _xsltCompilerCtxt xsltCompilerCtxt; +typedef xsltCompilerCtxt *xsltCompilerCtxtPtr; +struct _xsltCompilerCtxt { + void *errorCtxt; /* user specific error context */ + /* + * used for error/warning reports; e.g. XSLT_ERROR_SEVERITY_WARNING */ + xsltErrorSeverityType errSeverity; + int warnings; /* TODO: number of warnings found at + compilation */ + int errors; /* TODO: number of errors found at + compilation */ + xmlDictPtr dict; + xsltStylesheetPtr style; + int simplified; /* whether this is a simplified stylesheet */ + /* TODO: structured/unstructured error contexts. */ + int depth; /* Current depth of processing */ + + xsltCompilerNodeInfoPtr inode; + xsltCompilerNodeInfoPtr inodeList; + xsltCompilerNodeInfoPtr inodeLast; + xsltPointerListPtr tmpList; /* Used for various purposes */ + /* + * The XSLT version as specified by the stylesheet's root element. + */ + int isInclude; + int hasForwardsCompat; /* whether forwards-compatible mode was used + in a parsing episode */ + int maxNodeInfos; /* TEMP TODO: just for the interest */ + int maxLREs; /* TEMP TODO: just for the interest */ + /* + * In order to keep the old behaviour, applying strict rules of + * the spec can be turned off. This has effect only on special + * mechanisms like whitespace-stripping in the stylesheet. + */ + int strict; + xsltPrincipalStylesheetDataPtr psData; +#ifdef XSLT_REFACTORED_XPATHCOMP + xmlXPathContextPtr xpathCtxt; +#endif + xsltStyleItemUknownPtr unknownItem; + int hasNsAliases; /* Indicator if there was an xsl:namespace-alias. */ + xsltNsAliasPtr nsAliases; + xsltVarInfoPtr ivars; /* Storage of local in-scope variables/params. */ + xsltVarInfoPtr ivar; /* topmost local variable/param. */ +}; + +#else /* XSLT_REFACTORED */ +/* +* The old structures before refactoring. +*/ + +/** + * _xsltStylePreComp: + * + * The in-memory structure corresponding to XSLT stylesheet constructs + * precomputed data. + */ +struct _xsltStylePreComp { + xsltElemPreCompPtr next; /* chained list */ + xsltStyleType type; /* type of the element */ + xsltTransformFunction func; /* handling function */ + xmlNodePtr inst; /* the instruction */ + + /* + * Pre computed values. + */ + + const xmlChar *stype; /* sort */ + int has_stype; /* sort */ + int number; /* sort */ + const xmlChar *order; /* sort */ + int has_order; /* sort */ + int descending; /* sort */ + const xmlChar *lang; /* sort */ + int has_lang; /* sort */ + xsltLocale locale; /* sort */ + const xmlChar *case_order; /* sort */ + int lower_first; /* sort */ + + const xmlChar *use; /* copy, element */ + int has_use; /* copy, element */ + + int noescape; /* text */ + + const xmlChar *name; /* element, attribute, pi */ + int has_name; /* element, attribute, pi */ + const xmlChar *ns; /* element */ + int has_ns; /* element */ + + const xmlChar *mode; /* apply-templates */ + const xmlChar *modeURI; /* apply-templates */ + + const xmlChar *test; /* if */ + + xsltTemplatePtr templ; /* call-template */ + + const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ + + int ver11; /* document */ + const xmlChar *filename; /* document URL */ + int has_filename; /* document */ + + xsltNumberData numdata; /* number */ + + xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ + xmlNsPtr *nsList; /* the namespaces in scope */ + int nsNr; /* the number of namespaces in scope */ +}; + +#endif /* XSLT_REFACTORED */ + + +/* + * The in-memory structure corresponding to an XSLT Variable + * or Param. + */ +typedef struct _xsltStackElem xsltStackElem; +typedef xsltStackElem *xsltStackElemPtr; +struct _xsltStackElem { + struct _xsltStackElem *next;/* chained list */ + xsltStylePreCompPtr comp; /* the compiled form */ + int computed; /* was the evaluation done */ + const xmlChar *name; /* the local part of the name QName */ + const xmlChar *nameURI; /* the URI part of the name QName */ + const xmlChar *select; /* the eval string */ + xmlNodePtr tree; /* the sequence constructor if no eval + string or the location */ + xmlXPathObjectPtr value; /* The value if computed */ + xmlDocPtr fragment; /* The Result Tree Fragments (needed for XSLT 1.0) + which are bound to the variable's lifetime. */ + int level; /* the depth in the tree; + -1 if persistent (e.g. a given xsl:with-param) */ + xsltTransformContextPtr context; /* The transformation context; needed to cache + the variables */ + int flags; +}; + +#ifdef XSLT_REFACTORED + +struct _xsltPrincipalStylesheetData { + /* + * Namespace dictionary for ns-prefixes and ns-names: + * TODO: Shared between stylesheets, and XPath mechanisms. + * Not used yet. + */ + xmlDictPtr namespaceDict; + /* + * Global list of in-scope namespaces. + */ + xsltPointerListPtr inScopeNamespaces; + /* + * Global list of information for [xsl:]excluded-result-prefixes. + */ + xsltPointerListPtr exclResultNamespaces; + /* + * Global list of information for [xsl:]extension-element-prefixes. + */ + xsltPointerListPtr extElemNamespaces; + xsltEffectiveNsPtr effectiveNs; +#ifdef XSLT_REFACTORED_XSLT_NSCOMP + /* + * Namespace name map to get rid of string comparison of namespace names. + */ + xsltNsMapPtr nsMap; +#endif +}; + + +#endif +/* + * Note that we added a @compCtxt field to anchor an stylesheet compilation + * context, since, due to historical reasons, various compile-time function + * take only the stylesheet as argument and not a compilation context. + */ +struct _xsltStylesheet { + /* + * The stylesheet import relation is kept as a tree. + */ + struct _xsltStylesheet *parent; + struct _xsltStylesheet *next; + struct _xsltStylesheet *imports; + + xsltDocumentPtr docList; /* the include document list */ + + /* + * General data on the style sheet document. + */ + xmlDocPtr doc; /* the parsed XML stylesheet */ + xmlHashTablePtr stripSpaces;/* the hash table of the strip-space and + preserve space elements */ + int stripAll; /* strip-space * (1) preserve-space * (-1) */ + xmlHashTablePtr cdataSection;/* the hash table of the cdata-section */ + + /* + * Global variable or parameters. + */ + xsltStackElemPtr variables; /* linked list of param and variables */ + + /* + * Template descriptions. + */ + xsltTemplatePtr templates; /* the ordered list of templates */ + void *templatesHash; /* hash table or wherever compiled templates + informations are stored */ + void *rootMatch; /* template based on / */ + void *keyMatch; /* template based on key() */ + void *elemMatch; /* template based on * */ + void *attrMatch; /* template based on @* */ + void *parentMatch; /* template based on .. */ + void *textMatch; /* template based on text() */ + void *piMatch; /* template based on processing-instruction() */ + void *commentMatch; /* template based on comment() */ + + /* + * Namespace aliases. + * NOTE: Not used in the refactored code. + */ + xmlHashTablePtr nsAliases; /* the namespace alias hash tables */ + + /* + * Attribute sets. + */ + xmlHashTablePtr attributeSets;/* the attribute sets hash tables */ + + /* + * Namespaces. + * TODO: Eliminate this. + */ + xmlHashTablePtr nsHash; /* the set of namespaces in use: + ATTENTION: This is used for + execution of XPath expressions; unfortunately + it restricts the stylesheet to have distinct + prefixes. + TODO: We need to get rid of this. + */ + void *nsDefs; /* ATTENTION TODO: This is currently used to store + xsltExtDefPtr (in extensions.c) and + *not* xmlNsPtr. + */ + + /* + * Key definitions. + */ + void *keys; /* key definitions */ + + /* + * Output related stuff. + */ + xmlChar *method; /* the output method */ + xmlChar *methodURI; /* associated namespace if any */ + xmlChar *version; /* version string */ + xmlChar *encoding; /* encoding string */ + int omitXmlDeclaration; /* omit-xml-declaration = "yes" | "no" */ + + /* + * Number formatting. + */ + xsltDecimalFormatPtr decimalFormat; + int standalone; /* standalone = "yes" | "no" */ + xmlChar *doctypePublic; /* doctype-public string */ + xmlChar *doctypeSystem; /* doctype-system string */ + int indent; /* should output being indented */ + xmlChar *mediaType; /* media-type string */ + + /* + * Precomputed blocks. + */ + xsltElemPreCompPtr preComps;/* list of precomputed blocks */ + int warnings; /* number of warnings found at compilation */ + int errors; /* number of errors found at compilation */ + + xmlChar *exclPrefix; /* last excluded prefixes */ + xmlChar **exclPrefixTab; /* array of excluded prefixes */ + int exclPrefixNr; /* number of excluded prefixes in scope */ + int exclPrefixMax; /* size of the array */ + + void *_private; /* user defined data */ + + /* + * Extensions. + */ + xmlHashTablePtr extInfos; /* the extension data */ + int extrasNr; /* the number of extras required */ + + /* + * For keeping track of nested includes + */ + xsltDocumentPtr includes; /* points to last nested include */ + + /* + * dictionary: shared between stylesheet, context and documents. + */ + xmlDictPtr dict; + /* + * precompiled attribute value templates. + */ + void *attVTs; + /* + * if namespace-alias has an alias for the default stylesheet prefix + * NOTE: Not used in the refactored code. + */ + const xmlChar *defaultAlias; + /* + * bypass pre-processing (already done) (used in imports) + */ + int nopreproc; + /* + * all document text strings were internalized + */ + int internalized; + /* + * Literal Result Element as Stylesheet c.f. section 2.3 + */ + int literal_result; + /* + * The principal stylesheet + */ + xsltStylesheetPtr principal; +#ifdef XSLT_REFACTORED + /* + * Compilation context used during compile-time. + */ + xsltCompilerCtxtPtr compCtxt; /* TODO: Change this to (void *). */ + + xsltPrincipalStylesheetDataPtr principalData; +#endif + /* + * Forwards-compatible processing + */ + int forwards_compatible; + + xmlHashTablePtr namedTemplates; /* hash table of named templates */ +}; + +typedef struct _xsltTransformCache xsltTransformCache; +typedef xsltTransformCache *xsltTransformCachePtr; +struct _xsltTransformCache { + xmlDocPtr RVT; + int nbRVT; + xsltStackElemPtr stackItems; + int nbStackItems; +#ifdef XSLT_DEBUG_PROFILE_CACHE + int dbgCachedRVTs; + int dbgReusedRVTs; + int dbgCachedVars; + int dbgReusedVars; +#endif +}; + +/* + * The in-memory structure corresponding to an XSLT Transformation. + */ +typedef enum { + XSLT_OUTPUT_XML = 0, + XSLT_OUTPUT_HTML, + XSLT_OUTPUT_TEXT +} xsltOutputType; + +typedef enum { + XSLT_STATE_OK = 0, + XSLT_STATE_ERROR, + XSLT_STATE_STOPPED +} xsltTransformState; + +struct _xsltTransformContext { + xsltStylesheetPtr style; /* the stylesheet used */ + xsltOutputType type; /* the type of output */ + + xsltTemplatePtr templ; /* the current template */ + int templNr; /* Nb of templates in the stack */ + int templMax; /* Size of the templtes stack */ + xsltTemplatePtr *templTab; /* the template stack */ + + xsltStackElemPtr vars; /* the current variable list */ + int varsNr; /* Nb of variable list in the stack */ + int varsMax; /* Size of the variable list stack */ + xsltStackElemPtr *varsTab; /* the variable list stack */ + int varsBase; /* the var base for current templ */ + + /* + * Extensions + */ + xmlHashTablePtr extFunctions; /* the extension functions */ + xmlHashTablePtr extElements; /* the extension elements */ + xmlHashTablePtr extInfos; /* the extension data */ + + const xmlChar *mode; /* the current mode */ + const xmlChar *modeURI; /* the current mode URI */ + + xsltDocumentPtr docList; /* the document list */ + + xsltDocumentPtr document; /* the current source document; can be NULL if an RTF */ + xmlNodePtr node; /* the current node being processed */ + xmlNodeSetPtr nodeList; /* the current node list */ + /* xmlNodePtr current; the node */ + + xmlDocPtr output; /* the resulting document */ + xmlNodePtr insert; /* the insertion node */ + + xmlXPathContextPtr xpathCtxt; /* the XPath context */ + xsltTransformState state; /* the current state */ + + /* + * Global variables + */ + xmlHashTablePtr globalVars; /* the global variables and params */ + + xmlNodePtr inst; /* the instruction in the stylesheet */ + + int xinclude; /* should XInclude be processed */ + + const char * outputFile; /* the output URI if known */ + + int profile; /* is this run profiled */ + long prof; /* the current profiled value */ + int profNr; /* Nb of templates in the stack */ + int profMax; /* Size of the templtaes stack */ + long *profTab; /* the profile template stack */ + + void *_private; /* user defined data */ + + int extrasNr; /* the number of extras used */ + int extrasMax; /* the number of extras allocated */ + xsltRuntimeExtraPtr extras; /* extra per runtime informations */ + + xsltDocumentPtr styleList; /* the stylesheet docs list */ + void * sec; /* the security preferences if any */ + + xmlGenericErrorFunc error; /* a specific error handler */ + void * errctx; /* context for the error handler */ + + xsltSortFunc sortfunc; /* a ctxt specific sort routine */ + + /* + * handling of temporary Result Value Tree + * (XSLT 1.0 term: "Result Tree Fragment") + */ + xmlDocPtr tmpRVT; /* list of RVT without persistance */ + xmlDocPtr persistRVT; /* list of persistant RVTs */ + int ctxtflags; /* context processing flags */ + + /* + * Speed optimization when coalescing text nodes + */ + const xmlChar *lasttext; /* last text node content */ + unsigned int lasttsize; /* last text node size */ + unsigned int lasttuse; /* last text node use */ + /* + * Per Context Debugging + */ + int debugStatus; /* the context level debug status */ + unsigned long* traceCode; /* pointer to the variable holding the mask */ + + int parserOptions; /* parser options xmlParserOption */ + + /* + * dictionary: shared between stylesheet, context and documents. + */ + xmlDictPtr dict; + xmlDocPtr tmpDoc; /* Obsolete; not used in the library. */ + /* + * all document text strings are internalized + */ + int internalized; + int nbKeys; + int hasTemplKeyPatterns; + xsltTemplatePtr currentTemplateRule; /* the Current Template Rule */ + xmlNodePtr initialContextNode; + xmlDocPtr initialContextDoc; + xsltTransformCachePtr cache; + void *contextVariable; /* the current variable item */ + xmlDocPtr localRVT; /* list of local tree fragments; will be freed when + the instruction which created the fragment + exits */ + xmlDocPtr localRVTBase; + int keyInitLevel; /* Needed to catch recursive keys issues */ + int funcLevel; /* Needed to catch recursive functions issues */ + int maxTemplateDepth; + int maxTemplateVars; +}; + +/** + * CHECK_STOPPED: + * + * Macro to check if the XSLT processing should be stopped. + * Will return from the function. + */ +#define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return; + +/** + * CHECK_STOPPEDE: + * + * Macro to check if the XSLT processing should be stopped. + * Will goto the error: label. + */ +#define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error; + +/** + * CHECK_STOPPED0: + * + * Macro to check if the XSLT processing should be stopped. + * Will return from the function with a 0 value. + */ +#define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0); + +/* + * The macro XML_CAST_FPTR is a hack to avoid a gcc warning about + * possible incompatibilities between function pointers and object + * pointers. It is defined in libxml/hash.h within recent versions + * of libxml2, but is put here for compatibility. + */ +#ifndef XML_CAST_FPTR +/** + * XML_CAST_FPTR: + * @fptr: pointer to a function + * + * Macro to do a casting from an object pointer to a + * function pointer without encountering a warning from + * gcc + * + * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr)) + * This macro violated ISO C aliasing rules (gcc4 on s390 broke) + * so it is disabled now + */ + +#define XML_CAST_FPTR(fptr) fptr +#endif +/* + * Functions associated to the internal types +xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet, + xmlChar *name); + */ +XSLTPUBFUN xsltStylesheetPtr XSLTCALL + xsltNewStylesheet (void); +XSLTPUBFUN xsltStylesheetPtr XSLTCALL + xsltParseStylesheetFile (const xmlChar* filename); +XSLTPUBFUN void XSLTCALL + xsltFreeStylesheet (xsltStylesheetPtr style); +XSLTPUBFUN int XSLTCALL + xsltIsBlank (xmlChar *str); +XSLTPUBFUN void XSLTCALL + xsltFreeStackElemList (xsltStackElemPtr elem); +XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL + xsltDecimalFormatGetByName(xsltStylesheetPtr style, + xmlChar *name); + +XSLTPUBFUN xsltStylesheetPtr XSLTCALL + xsltParseStylesheetProcess(xsltStylesheetPtr ret, + xmlDocPtr doc); +XSLTPUBFUN void XSLTCALL + xsltParseStylesheetOutput(xsltStylesheetPtr style, + xmlNodePtr cur); +XSLTPUBFUN xsltStylesheetPtr XSLTCALL + xsltParseStylesheetDoc (xmlDocPtr doc); +XSLTPUBFUN xsltStylesheetPtr XSLTCALL + xsltParseStylesheetImportedDoc(xmlDocPtr doc, + xsltStylesheetPtr style); +XSLTPUBFUN xsltStylesheetPtr XSLTCALL + xsltLoadStylesheetPI (xmlDocPtr doc); +XSLTPUBFUN void XSLTCALL + xsltNumberFormat (xsltTransformContextPtr ctxt, + xsltNumberDataPtr data, + xmlNodePtr node); +XSLTPUBFUN xmlXPathError XSLTCALL + xsltFormatNumberConversion(xsltDecimalFormatPtr self, + xmlChar *format, + double number, + xmlChar **result); + +XSLTPUBFUN void XSLTCALL + xsltParseTemplateContent(xsltStylesheetPtr style, + xmlNodePtr templ); +XSLTPUBFUN int XSLTCALL + xsltAllocateExtra (xsltStylesheetPtr style); +XSLTPUBFUN int XSLTCALL + xsltAllocateExtraCtxt (xsltTransformContextPtr ctxt); +/* + * Extra functions for Result Value Trees + */ +XSLTPUBFUN xmlDocPtr XSLTCALL + xsltCreateRVT (xsltTransformContextPtr ctxt); +XSLTPUBFUN int XSLTCALL + xsltRegisterTmpRVT (xsltTransformContextPtr ctxt, + xmlDocPtr RVT); +XSLTPUBFUN int XSLTCALL + xsltRegisterLocalRVT (xsltTransformContextPtr ctxt, + xmlDocPtr RVT); +XSLTPUBFUN int XSLTCALL + xsltRegisterPersistRVT (xsltTransformContextPtr ctxt, + xmlDocPtr RVT); +XSLTPUBFUN int XSLTCALL + xsltExtensionInstructionResultRegister( + xsltTransformContextPtr ctxt, + xmlXPathObjectPtr obj); +XSLTPUBFUN int XSLTCALL + xsltExtensionInstructionResultFinalize( + xsltTransformContextPtr ctxt); +XSLTPUBFUN void XSLTCALL + xsltFreeRVTs (xsltTransformContextPtr ctxt); +XSLTPUBFUN void XSLTCALL + xsltReleaseRVT (xsltTransformContextPtr ctxt, + xmlDocPtr RVT); +/* + * Extra functions for Attribute Value Templates + */ +XSLTPUBFUN void XSLTCALL + xsltCompileAttr (xsltStylesheetPtr style, + xmlAttrPtr attr); +XSLTPUBFUN xmlChar * XSLTCALL + xsltEvalAVT (xsltTransformContextPtr ctxt, + void *avt, + xmlNodePtr node); +XSLTPUBFUN void XSLTCALL + xsltFreeAVTList (void *avt); + +/* + * Extra function for successful xsltCleanupGlobals / xsltInit sequence. + */ + +XSLTPUBFUN void XSLTCALL + xsltUninit (void); + +/************************************************************************ + * * + * Compile-time functions for *internal* use only * + * * + ************************************************************************/ + +#ifdef XSLT_REFACTORED +XSLTPUBFUN void XSLTCALL + xsltParseSequenceConstructor( + xsltCompilerCtxtPtr cctxt, + xmlNodePtr start); +XSLTPUBFUN int XSLTCALL + xsltParseAnyXSLTElem (xsltCompilerCtxtPtr cctxt, + xmlNodePtr elem); +#ifdef XSLT_REFACTORED_XSLT_NSCOMP +XSLTPUBFUN int XSLTCALL + xsltRestoreDocumentNamespaces( + xsltNsMapPtr ns, + xmlDocPtr doc); +#endif +#endif /* XSLT_REFACTORED */ + +/************************************************************************ + * * + * Transformation-time functions for *internal* use only * + * * + ************************************************************************/ +XSLTPUBFUN int XSLTCALL + xsltInitCtxtKey (xsltTransformContextPtr ctxt, + xsltDocumentPtr doc, + xsltKeyDefPtr keyd); +XSLTPUBFUN int XSLTCALL + xsltInitAllDocKeys (xsltTransformContextPtr ctxt); +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XSLT_H__ */ + diff --git a/libxslt/xsltconfig.h.in b/libxslt/xsltconfig.h.in new file mode 100644 index 0000000..6e4e328 --- /dev/null +++ b/libxslt/xsltconfig.h.in @@ -0,0 +1,183 @@ +/* + * Summary: compile-time version informations for the XSLT engine + * Description: compile-time version informations for the XSLT engine + * this module is autogenerated. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XSLTCONFIG_H__ +#define __XML_XSLTCONFIG_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * LIBXSLT_DOTTED_VERSION: + * + * the version string like "1.2.3" + */ +#define LIBXSLT_DOTTED_VERSION "@VERSION@" + +/** + * LIBXSLT_VERSION: + * + * the version number: 1.2.3 value is 10203 + */ +#define LIBXSLT_VERSION @LIBXSLT_VERSION_NUMBER@ + +/** + * LIBXSLT_VERSION_STRING: + * + * the version number string, 1.2.3 value is "10203" + */ +#define LIBXSLT_VERSION_STRING "@LIBXSLT_VERSION_NUMBER@" + +/** + * LIBXSLT_VERSION_EXTRA: + * + * extra version information, used to show a CVS compilation + */ +#define LIBXSLT_VERSION_EXTRA "@LIBXSLT_VERSION_EXTRA@" + +/** + * WITH_XSLT_DEBUG: + * + * Activate the compilation of the debug reporting. Speed penalty + * is insignifiant and being able to run xsltpoc -v is useful. On + * by default unless --without-debug is passed to configure + */ +#if @WITH_XSLT_DEBUG@ +#define WITH_XSLT_DEBUG +#endif + +#if @WITH_MEM_DEBUG@ +/** + * DEBUG_MEMORY: + * + * should be activated only when debugging libxslt. It replaces the + * allocator with a collect and debug shell to the libc allocator. + * Use configure --with-mem-debug to activate it on both library + */ +#define DEBUG_MEMORY + +/** + * DEBUG_MEMORY_LOCATION: + * + * should be activated only when debugging libxslt. + * DEBUG_MEMORY_LOCATION should be activated only when libxml has + * been configured with --with-debug-mem too + */ +#define DEBUG_MEMORY_LOCATION +#endif + +/** + * XSLT_NEED_TRIO: + * + * should be activated if the existing libc library lacks some of the + * string formatting function, in that case reuse the Trio ones already + * compiled in the libxml2 library. + */ + +#if @WITH_TRIO@ +#define XSLT_NEED_TRIO +#endif +#ifdef __VMS +#define HAVE_MATH_H 1 +#define HAVE_SYS_STAT_H 1 +#ifndef XSLT_NEED_TRIO +#define XSLT_NEED_TRIO +#endif +#endif + +#ifdef XSLT_NEED_TRIO +#define TRIO_REPLACE_STDIO +#endif + +/** + * WITH_XSLT_DEBUGGER: + * + * Activate the compilation of the debugger support. Speed penalty + * is insignifiant. + * On by default unless --without-debugger is passed to configure + */ +#if @WITH_DEBUGGER@ +#ifndef WITH_DEBUGGER +#define WITH_DEBUGGER +#endif +#endif + +/** + * WITH_MODULES: + * + * Whether module support is configured into libxslt + * Note: no default module path for win32 platforms + */ +#if @WITH_MODULES@ +#ifndef WITH_MODULES +#define WITH_MODULES +#endif +#define LIBXSLT_DEFAULT_PLUGINS_PATH() "@LIBXSLT_DEFAULT_PLUGINS_PATH@" +#endif + +/** + * Locale support + */ +#if @XSLT_LOCALE_XLOCALE@ +#ifndef XSLT_LOCALE_XLOCALE +#define XSLT_LOCALE_XLOCALE +#endif +#elif @XSLT_LOCALE_WINAPI@ +#ifndef XSLT_LOCALE_WINAPI +#define XSLT_LOCALE_WINAPI +#endif +#endif + +/** + * ATTRIBUTE_UNUSED: + * + * This macro is used to flag unused function parameters to GCC + */ +#ifdef __GNUC__ +#ifdef HAVE_ANSIDECL_H +#include +#endif +#ifndef ATTRIBUTE_UNUSED +#define ATTRIBUTE_UNUSED __attribute__((unused)) +#endif +#else +#define ATTRIBUTE_UNUSED +#endif + +/** + * LIBXSLT_ATTR_FORMAT: + * + * This macro is used to indicate to GCC the parameters are printf-like + */ +#ifdef __GNUC__ +#define LIBXSLT_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args))) +#else +#define LIBXSLT_ATTR_FORMAT(fmt,args) +#endif + +/** + * LIBXSLT_PUBLIC: + * + * This macro is used to declare PUBLIC variables for Cygwin and for MSC on Windows + */ +#if !defined LIBXSLT_PUBLIC +#if (defined(__CYGWIN__) || defined _MSC_VER) && !defined IN_LIBXSLT && !defined LIBXSLT_STATIC +#define LIBXSLT_PUBLIC __declspec(dllimport) +#else +#define LIBXSLT_PUBLIC +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XSLTCONFIG_H__ */ diff --git a/libxslt/xsltexports.h b/libxslt/xsltexports.h new file mode 100644 index 0000000..825c122 --- /dev/null +++ b/libxslt/xsltexports.h @@ -0,0 +1,142 @@ +/* + * Summary: macros for marking symbols as exportable/importable. + * Description: macros for marking symbols as exportable/importable. + * + * Copy: See Copyright for the status of this software. + * + * Author: Igor Zlatkovic + */ + +#ifndef __XSLT_EXPORTS_H__ +#define __XSLT_EXPORTS_H__ + +/** + * XSLTPUBFUN: + * XSLTPUBFUN, XSLTPUBVAR, XSLTCALL + * + * Macros which declare an exportable function, an exportable variable and + * the calling convention used for functions. + * + * Please use an extra block for every platform/compiler combination when + * modifying this, rather than overlong #ifdef lines. This helps + * readability as well as the fact that different compilers on the same + * platform might need different definitions. + */ + +/** + * XSLTPUBFUN: + * + * Macros which declare an exportable function + */ +#define XSLTPUBFUN +/** + * XSLTPUBVAR: + * + * Macros which declare an exportable variable + */ +#define XSLTPUBVAR extern +/** + * XSLTCALL: + * + * Macros which declare the called convention for exported functions + */ +#define XSLTCALL + +/** DOC_DISABLE */ + +/* Windows platform with MS compiler */ +#if defined(_WIN32) && defined(_MSC_VER) + #undef XSLTPUBFUN + #undef XSLTPUBVAR + #undef XSLTCALL + #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) + #define XSLTPUBFUN __declspec(dllexport) + #define XSLTPUBVAR __declspec(dllexport) + #else + #define XSLTPUBFUN + #if !defined(LIBXSLT_STATIC) + #define XSLTPUBVAR __declspec(dllimport) extern + #else + #define XSLTPUBVAR extern + #endif + #endif + #define XSLTCALL __cdecl + #if !defined _REENTRANT + #define _REENTRANT + #endif +#endif + +/* Windows platform with Borland compiler */ +#if defined(_WIN32) && defined(__BORLANDC__) + #undef XSLTPUBFUN + #undef XSLTPUBVAR + #undef XSLTCALL + #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) + #define XSLTPUBFUN __declspec(dllexport) + #define XSLTPUBVAR __declspec(dllexport) extern + #else + #define XSLTPUBFUN + #if !defined(LIBXSLT_STATIC) + #define XSLTPUBVAR __declspec(dllimport) extern + #else + #define XSLTPUBVAR extern + #endif + #endif + #define XSLTCALL __cdecl + #if !defined _REENTRANT + #define _REENTRANT + #endif +#endif + +/* Windows platform with GNU compiler (Mingw) */ +#if defined(_WIN32) && defined(__MINGW32__) + #undef XSLTPUBFUN + #undef XSLTPUBVAR + #undef XSLTCALL +/* + #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) +*/ + #if !defined(LIBXSLT_STATIC) + #define XSLTPUBFUN __declspec(dllexport) + #define XSLTPUBVAR __declspec(dllexport) extern + #else + #define XSLTPUBFUN + #if !defined(LIBXSLT_STATIC) + #define XSLTPUBVAR __declspec(dllimport) extern + #else + #define XSLTPUBVAR extern + #endif + #endif + #define XSLTCALL __cdecl + #if !defined _REENTRANT + #define _REENTRANT + #endif +#endif + +/* Cygwin platform, GNU compiler */ +#if defined(_WIN32) && defined(__CYGWIN__) + #undef XSLTPUBFUN + #undef XSLTPUBVAR + #undef XSLTCALL + #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) + #define XSLTPUBFUN __declspec(dllexport) + #define XSLTPUBVAR __declspec(dllexport) + #else + #define XSLTPUBFUN + #if !defined(LIBXSLT_STATIC) + #define XSLTPUBVAR __declspec(dllimport) extern + #else + #define XSLTPUBVAR + #endif + #endif + #define XSLTCALL __cdecl +#endif + +/* Compatibility */ +#if !defined(LIBXSLT_PUBLIC) +#define LIBXSLT_PUBLIC XSLTPUBVAR +#endif + +#endif /* __XSLT_EXPORTS_H__ */ + + diff --git a/libxslt/xsltlocale.c b/libxslt/xsltlocale.c new file mode 100644 index 0000000..b5fe986 --- /dev/null +++ b/libxslt/xsltlocale.c @@ -0,0 +1,525 @@ +/* + * xsltlocale.c: locale handling + * + * Reference: + * RFC 3066: Tags for the Identification of Languages + * http://www.ietf.org/rfc/rfc3066.txt + * ISO 639-1, ISO 3166-1 + * + * Author: Nick Wellnhofer + * winapi port: Roumen Petrov + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#include +#include + +#include "xsltlocale.h" +#include "xsltutils.h" + +#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ <= 2 +#define newlocale __newlocale +#define freelocale __freelocale +#define strxfrm_l __strxfrm_l +#define LC_COLLATE_MASK (1 << LC_COLLATE) +#endif + +#define TOUPPER(c) (c & ~0x20) +#define TOLOWER(c) (c | 0x20) +#define ISALPHA(c) ((unsigned)(TOUPPER(c) - 'A') < 26) + +/*without terminating null character*/ +#define XSLTMAX_ISO639LANGLEN 8 +#define XSLTMAX_ISO3166CNTRYLEN 8 + /* - */ +#define XSLTMAX_LANGTAGLEN (XSLTMAX_ISO639LANGLEN+1+XSLTMAX_ISO3166CNTRYLEN) + +static const xmlChar* xsltDefaultRegion(const xmlChar *localeName); + +#ifdef XSLT_LOCALE_WINAPI +xmlRMutexPtr xsltLocaleMutex = NULL; + +struct xsltRFC1766Info_s { + /*note typedef unsigned char xmlChar !*/ + xmlChar tag[XSLTMAX_LANGTAGLEN+1]; + /*note typedef LCID xsltLocale !*/ + xsltLocale lcid; +}; +typedef struct xsltRFC1766Info_s xsltRFC1766Info; + +static int xsltLocaleListSize = 0; +static xsltRFC1766Info *xsltLocaleList = NULL; + + +static xsltLocale +xslt_locale_WINAPI(const xmlChar *languageTag) { + int k; + xsltRFC1766Info *p = xsltLocaleList; + + for (k=0; ktag, languageTag) == 0) return p->lcid; + return((xsltLocale)0); +} + +static void xsltEnumSupportedLocales(void); +#endif + +/** + * xsltFreeLocales: + * + * Cleanup function for the locale support on shutdown + */ +void +xsltFreeLocales(void) { +#ifdef XSLT_LOCALE_WINAPI + xmlRMutexLock(xsltLocaleMutex); + xmlFree(xsltLocaleList); + xsltLocaleList = NULL; + xmlRMutexUnlock(xsltLocaleMutex); +#endif +} + +/** + * xsltNewLocale: + * @languageTag: RFC 3066 language tag + * + * Creates a new locale of an opaque system dependent type based on the + * language tag. + * + * Returns the locale or NULL on error or if no matching locale was found + */ +xsltLocale +xsltNewLocale(const xmlChar *languageTag) { +#ifdef XSLT_LOCALE_XLOCALE + xsltLocale locale; + char localeName[XSLTMAX_LANGTAGLEN+6]; /* 6 chars for ".utf8\0" */ + const xmlChar *p = languageTag; + const char *region = NULL; + char *q = localeName; + int i, llen; + + /* Convert something like "pt-br" to "pt_BR.utf8" */ + + if (languageTag == NULL) + return(NULL); + + for (i=0; i= xstrlen) { + xsltTransformError(NULL, NULL, NULL, "xsltStrxfrm : strxfrm failed\n"); + xmlFree(xstr); + return(NULL); + } + + return(xstr); +#endif /* XSLT_LOCALE_NONE */ +} + +/** + * xsltLocaleStrcmp: + * @locale: a locale identifier + * @str1: a string transformed with xsltStrxfrm + * @str2: a string transformed with xsltStrxfrm + * + * Compares two strings transformed with xsltStrxfrm + * + * Returns a value < 0 if str1 sorts before str2, + * a value > 0 if str1 sorts after str2, + * 0 if str1 and str2 are equal wrt sorting + */ +int +xsltLocaleStrcmp(xsltLocale locale, const xsltLocaleChar *str1, const xsltLocaleChar *str2) { + (void)locale; +#ifdef XSLT_LOCALE_WINAPI +{ + int ret; + if (str1 == str2) return(0); + if (str1 == NULL) return(-1); + if (str2 == NULL) return(1); + ret = CompareStringW(locale, 0, str1, -1, str2, -1); + if (ret == 0) { + xsltTransformError(NULL, NULL, NULL, "xsltLocaleStrcmp : CompareStringW fail\n"); + return(0); + } + return(ret - 2); +} +#else + return(xmlStrcmp(str1, str2)); +#endif +} + +#ifdef XSLT_LOCALE_WINAPI +/** + * xsltCountSupportedLocales: + * @lcid: not used + * + * callback used to count locales + * + * Returns TRUE + */ +BOOL CALLBACK +xsltCountSupportedLocales(LPSTR lcid) { + (void) lcid; + ++xsltLocaleListSize; + return(TRUE); +} + +/** + * xsltIterateSupportedLocales: + * @lcid: not used + * + * callback used to track locales + * + * Returns TRUE if not at the end of the array + */ +BOOL CALLBACK +xsltIterateSupportedLocales(LPSTR lcid) { + static int count = 0; + xmlChar iso639lang [XSLTMAX_ISO639LANGLEN +1]; + xmlChar iso3136ctry[XSLTMAX_ISO3166CNTRYLEN+1]; + int k, l; + xsltRFC1766Info *p = xsltLocaleList + count; + + k = sscanf(lcid, "%lx", (long*)&p->lcid); + if (k < 1) goto end; + /*don't count terminating null character*/ + k = GetLocaleInfoA(p->lcid, LOCALE_SISO639LANGNAME , iso639lang , sizeof(iso639lang )); + if (--k < 1) goto end; + l = GetLocaleInfoA(p->lcid, LOCALE_SISO3166CTRYNAME, iso3136ctry, sizeof(iso3136ctry)); + if (--l < 1) goto end; + + { /*fill results*/ + xmlChar *q = p->tag; + memcpy(q, iso639lang, k); + q += k; + *q++ = '-'; + memcpy(q, iso3136ctry, l); + q += l; + *q = '\0'; + } + ++count; +end: + return((count < xsltLocaleListSize) ? TRUE : FALSE); +} + + +static void +xsltEnumSupportedLocales(void) { + xmlRMutexLock(xsltLocaleMutex); + if (xsltLocaleListSize <= 0) { + size_t len; + + EnumSystemLocalesA(xsltCountSupportedLocales, LCID_SUPPORTED); + + len = xsltLocaleListSize * sizeof(xsltRFC1766Info); + xsltLocaleList = xmlMalloc(len); + memset(xsltLocaleList, 0, len); + EnumSystemLocalesA(xsltIterateSupportedLocales, LCID_SUPPORTED); + } + xmlRMutexUnlock(xsltLocaleMutex); +} + +#endif /*def XSLT_LOCALE_WINAPI*/ diff --git a/libxslt/xsltlocale.h b/libxslt/xsltlocale.h new file mode 100644 index 0000000..8a9ca15 --- /dev/null +++ b/libxslt/xsltlocale.h @@ -0,0 +1,67 @@ +/* + * Summary: Locale handling + * Description: Interfaces for locale handling. Needed for language dependent + * sorting. + * + * Copy: See Copyright for the status of this software. + * + * Author: Nick Wellnhofer + */ + +#ifndef __XML_XSLTLOCALE_H__ +#define __XML_XSLTLOCALE_H__ + +#include +#include "xsltexports.h" + +#ifdef XSLT_LOCALE_XLOCALE + +#include +#include + +#ifdef __GLIBC__ +/*locale_t is defined only if _GNU_SOURCE is defined*/ +typedef __locale_t xsltLocale; +#else +typedef locale_t xsltLocale; +#endif +typedef xmlChar xsltLocaleChar; + +#elif defined(XSLT_LOCALE_WINAPI) + +#include +#include + +typedef LCID xsltLocale; +typedef wchar_t xsltLocaleChar; + +#else + +/* + * XSLT_LOCALE_NONE: + * Macro indicating that locale are not supported + */ +#ifndef XSLT_LOCALE_NONE +#define XSLT_LOCALE_NONE +#endif + +typedef void *xsltLocale; +typedef xmlChar xsltLocaleChar; + +#endif + +XSLTPUBFUN xsltLocale XSLTCALL + xsltNewLocale (const xmlChar *langName); +XSLTPUBFUN void XSLTCALL + xsltFreeLocale (xsltLocale locale); +XSLTPUBFUN xsltLocaleChar * XSLTCALL + xsltStrxfrm (xsltLocale locale, + const xmlChar *string); +XSLTPUBFUN int XSLTCALL + xsltLocaleStrcmp (xsltLocale locale, + const xsltLocaleChar *str1, + const xsltLocaleChar *str2); +XSLTPUBFUN void XSLTCALL + xsltFreeLocales (void); + +#endif /* __XML_XSLTLOCALE_H__ */ diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c new file mode 100644 index 0000000..1646c44 --- /dev/null +++ b/libxslt/xsltutils.c @@ -0,0 +1,2482 @@ +/* + * xsltutils.c: Utilities for the XSL Transformation 1.0 engine + * + * Reference: + * http://www.w3.org/TR/1999/REC-xslt-19991116 + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#define IN_LIBXSLT +#include "libxslt.h" + +#ifndef XSLT_NEED_TRIO +#include +#else +#include +#endif + +#include +#include +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#include + +#include +#include +#include +#include +#include +#include "xsltutils.h" +#include "templates.h" +#include "xsltInternals.h" +#include "imports.h" +#include "transform.h" + +/* gettimeofday on Windows ??? */ +#if defined(WIN32) && !defined(__CYGWIN__) +#ifdef _MSC_VER +#include +#pragma comment(lib, "ws2_32.lib") +#define gettimeofday(p1,p2) +#define HAVE_GETTIMEOFDAY +#define XSLT_WIN32_PERFORMANCE_COUNTER +#endif /* _MS_VER */ +#endif /* WIN32 */ + +/************************************************************************ + * * + * Convenience function * + * * + ************************************************************************/ + +/** + * xsltGetCNsProp: + * @style: the stylesheet + * @node: the node + * @name: the attribute name + * @nameSpace: the URI of the namespace + * + * Similar to xmlGetNsProp() but with a slightly different semantic + * + * Search and get the value of an attribute associated to a node + * This attribute has to be anchored in the namespace specified, + * or has no namespace and the element is in that namespace. + * + * This does the entity substitution. + * This function looks in DTD attribute declaration for #FIXED or + * default declaration values unless DTD use has been turned off. + * + * Returns the attribute value or NULL if not found. The string is allocated + * in the stylesheet dictionary. + */ +const xmlChar * +xsltGetCNsProp(xsltStylesheetPtr style, xmlNodePtr node, + const xmlChar *name, const xmlChar *nameSpace) { + xmlAttrPtr prop; + xmlDocPtr doc; + xmlNsPtr ns; + xmlChar *tmp; + const xmlChar *ret; + + if ((node == NULL) || (style == NULL) || (style->dict == NULL)) + return(NULL); + + if (nameSpace == NULL) + return xmlGetProp(node, name); + + if (node->type == XML_NAMESPACE_DECL) + return(NULL); + if (node->type == XML_ELEMENT_NODE) + prop = node->properties; + else + prop = NULL; + while (prop != NULL) { + /* + * One need to have + * - same attribute names + * - and the attribute carrying that namespace + */ + if ((xmlStrEqual(prop->name, name)) && + (((prop->ns == NULL) && (node->ns != NULL) && + (xmlStrEqual(node->ns->href, nameSpace))) || + ((prop->ns != NULL) && + (xmlStrEqual(prop->ns->href, nameSpace))))) { + + tmp = xmlNodeListGetString(node->doc, prop->children, 1); + if (tmp == NULL) + ret = xmlDictLookup(style->dict, BAD_CAST "", 0); + else { + ret = xmlDictLookup(style->dict, tmp, -1); + xmlFree(tmp); + } + return ret; + } + prop = prop->next; + } + tmp = NULL; + /* + * Check if there is a default declaration in the internal + * or external subsets + */ + doc = node->doc; + if (doc != NULL) { + if (doc->intSubset != NULL) { + xmlAttributePtr attrDecl; + + attrDecl = xmlGetDtdAttrDesc(doc->intSubset, node->name, name); + if ((attrDecl == NULL) && (doc->extSubset != NULL)) + attrDecl = xmlGetDtdAttrDesc(doc->extSubset, node->name, name); + + if ((attrDecl != NULL) && (attrDecl->prefix != NULL)) { + /* + * The DTD declaration only allows a prefix search + */ + ns = xmlSearchNs(doc, node, attrDecl->prefix); + if ((ns != NULL) && (xmlStrEqual(ns->href, nameSpace))) + return(xmlDictLookup(style->dict, + attrDecl->defaultValue, -1)); + } + } + } + return(NULL); +} +/** + * xsltGetNsProp: + * @node: the node + * @name: the attribute name + * @nameSpace: the URI of the namespace + * + * Similar to xmlGetNsProp() but with a slightly different semantic + * + * Search and get the value of an attribute associated to a node + * This attribute has to be anchored in the namespace specified, + * or has no namespace and the element is in that namespace. + * + * This does the entity substitution. + * This function looks in DTD attribute declaration for #FIXED or + * default declaration values unless DTD use has been turned off. + * + * Returns the attribute value or NULL if not found. + * It's up to the caller to free the memory. + */ +xmlChar * +xsltGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) { + xmlAttrPtr prop; + xmlDocPtr doc; + xmlNsPtr ns; + + if (node == NULL) + return(NULL); + + if (nameSpace == NULL) + return xmlGetProp(node, name); + + if (node->type == XML_NAMESPACE_DECL) + return(NULL); + if (node->type == XML_ELEMENT_NODE) + prop = node->properties; + else + prop = NULL; + /* + * TODO: Substitute xmlGetProp() for xmlGetNsProp(), since the former + * is not namespace-aware and will return an attribute with equal + * name regardless of its namespace. + * Example: + * + * So this would return "myName" even if an attribute @name + * in the XSLT was requested. + */ + while (prop != NULL) { + /* + * One need to have + * - same attribute names + * - and the attribute carrying that namespace + */ + if ((xmlStrEqual(prop->name, name)) && + (((prop->ns == NULL) && (node->ns != NULL) && + (xmlStrEqual(node->ns->href, nameSpace))) || + ((prop->ns != NULL) && + (xmlStrEqual(prop->ns->href, nameSpace))))) { + xmlChar *ret; + + ret = xmlNodeListGetString(node->doc, prop->children, 1); + if (ret == NULL) return(xmlStrdup((xmlChar *)"")); + return(ret); + } + prop = prop->next; + } + + /* + * Check if there is a default declaration in the internal + * or external subsets + */ + doc = node->doc; + if (doc != NULL) { + if (doc->intSubset != NULL) { + xmlAttributePtr attrDecl; + + attrDecl = xmlGetDtdAttrDesc(doc->intSubset, node->name, name); + if ((attrDecl == NULL) && (doc->extSubset != NULL)) + attrDecl = xmlGetDtdAttrDesc(doc->extSubset, node->name, name); + + if ((attrDecl != NULL) && (attrDecl->prefix != NULL)) { + /* + * The DTD declaration only allows a prefix search + */ + ns = xmlSearchNs(doc, node, attrDecl->prefix); + if ((ns != NULL) && (xmlStrEqual(ns->href, nameSpace))) + return(xmlStrdup(attrDecl->defaultValue)); + } + } + } + return(NULL); +} + +/** + * xsltGetUTF8Char: + * @utf: a sequence of UTF-8 encoded bytes + * @len: a pointer to @bytes len + * + * Read one UTF8 Char from @utf + * Function copied from libxml2 xmlGetUTF8Char() ... to discard ultimately + * and use the original API + * + * Returns the char value or -1 in case of error and update @len with the + * number of bytes used + */ +int +xsltGetUTF8Char(const unsigned char *utf, int *len) { + unsigned int c; + + if (utf == NULL) + goto error; + if (len == NULL) + goto error; + if (*len < 1) + goto error; + + c = utf[0]; + if (c & 0x80) { + if (*len < 2) + goto error; + if ((utf[1] & 0xc0) != 0x80) + goto error; + if ((c & 0xe0) == 0xe0) { + if (*len < 3) + goto error; + if ((utf[2] & 0xc0) != 0x80) + goto error; + if ((c & 0xf0) == 0xf0) { + if (*len < 4) + goto error; + if ((c & 0xf8) != 0xf0 || (utf[3] & 0xc0) != 0x80) + goto error; + *len = 4; + /* 4-byte code */ + c = (utf[0] & 0x7) << 18; + c |= (utf[1] & 0x3f) << 12; + c |= (utf[2] & 0x3f) << 6; + c |= utf[3] & 0x3f; + } else { + /* 3-byte code */ + *len = 3; + c = (utf[0] & 0xf) << 12; + c |= (utf[1] & 0x3f) << 6; + c |= utf[2] & 0x3f; + } + } else { + /* 2-byte code */ + *len = 2; + c = (utf[0] & 0x1f) << 6; + c |= utf[1] & 0x3f; + } + } else { + /* 1-byte code */ + *len = 1; + } + return(c); + +error: + if (len != NULL) + *len = 0; + return(-1); +} + +#ifdef XSLT_REFACTORED + +/** + * xsltPointerListAddSize: + * @list: the pointer list structure + * @item: the item to be stored + * @initialSize: the initial size of the list + * + * Adds an item to the list. + * + * Returns the position of the added item in the list or + * -1 in case of an error. + */ +int +xsltPointerListAddSize(xsltPointerListPtr list, + void *item, + int initialSize) +{ + if (list->items == NULL) { + if (initialSize <= 0) + initialSize = 1; + list->items = (void **) xmlMalloc( + initialSize * sizeof(void *)); + if (list->items == NULL) { + xsltGenericError(xsltGenericErrorContext, + "xsltPointerListAddSize: memory allocation failure.\n"); + return(-1); + } + list->number = 0; + list->size = initialSize; + } else if (list->size <= list->number) { + list->size *= 2; + list->items = (void **) xmlRealloc(list->items, + list->size * sizeof(void *)); + if (list->items == NULL) { + xsltGenericError(xsltGenericErrorContext, + "xsltPointerListAddSize: memory re-allocation failure.\n"); + list->size = 0; + return(-1); + } + } + list->items[list->number++] = item; + return(0); +} + +/** + * xsltPointerListCreate: + * @initialSize: the initial size for the list + * + * Creates an xsltPointerList structure. + * + * Returns a xsltPointerList structure or NULL in case of an error. + */ +xsltPointerListPtr +xsltPointerListCreate(int initialSize) +{ + xsltPointerListPtr ret; + + ret = xmlMalloc(sizeof(xsltPointerList)); + if (ret == NULL) { + xsltGenericError(xsltGenericErrorContext, + "xsltPointerListCreate: memory allocation failure.\n"); + return (NULL); + } + memset(ret, 0, sizeof(xsltPointerList)); + if (initialSize > 0) { + xsltPointerListAddSize(ret, NULL, initialSize); + ret->number = 0; + } + return (ret); +} + +/** + * xsltPointerListFree: + * @list: pointer to the list to be freed + * + * Frees the xsltPointerList structure. This does not free + * the content of the list. + */ +void +xsltPointerListFree(xsltPointerListPtr list) +{ + if (list == NULL) + return; + if (list->items != NULL) + xmlFree(list->items); + xmlFree(list); +} + +/** + * xsltPointerListClear: + * @list: pointer to the list to be cleared + * + * Resets the list, but does not free the allocated array + * and does not free the content of the list. + */ +void +xsltPointerListClear(xsltPointerListPtr list) +{ + if (list->items != NULL) { + xmlFree(list->items); + list->items = NULL; + } + list->number = 0; + list->size = 0; +} + +#endif /* XSLT_REFACTORED */ + +/************************************************************************ + * * + * Handling of XSLT stylesheets messages * + * * + ************************************************************************/ + +/** + * xsltMessage: + * @ctxt: an XSLT processing context + * @node: The current node + * @inst: The node containing the message instruction + * + * Process and xsl:message construct + */ +void +xsltMessage(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst) { + xmlGenericErrorFunc error = xsltGenericError; + void *errctx = xsltGenericErrorContext; + xmlChar *prop, *message; + int terminate = 0; + + if ((ctxt == NULL) || (inst == NULL)) + return; + + if (ctxt->error != NULL) { + error = ctxt->error; + errctx = ctxt->errctx; + } + + prop = xmlGetNsProp(inst, (const xmlChar *)"terminate", NULL); + if (prop != NULL) { + if (xmlStrEqual(prop, (const xmlChar *)"yes")) { + terminate = 1; + } else if (xmlStrEqual(prop, (const xmlChar *)"no")) { + terminate = 0; + } else { + error(errctx, + "xsl:message : terminate expecting 'yes' or 'no'\n"); + ctxt->state = XSLT_STATE_ERROR; + } + xmlFree(prop); + } + message = xsltEvalTemplateString(ctxt, node, inst); + if (message != NULL) { + int len = xmlStrlen(message); + + error(errctx, "%s", (const char *)message); + if ((len > 0) && (message[len - 1] != '\n')) + error(errctx, "\n"); + xmlFree(message); + } + if (terminate) + ctxt->state = XSLT_STATE_STOPPED; +} + +/************************************************************************ + * * + * Handling of out of context errors * + * * + ************************************************************************/ + +#define XSLT_GET_VAR_STR(msg, str) { \ + int size; \ + int chars; \ + char *larger; \ + va_list ap; \ + \ + str = (char *) xmlMalloc(150); \ + if (str == NULL) \ + return; \ + \ + size = 150; \ + \ + while (size < 64000) { \ + va_start(ap, msg); \ + chars = vsnprintf(str, size, msg, ap); \ + va_end(ap); \ + if ((chars > -1) && (chars < size)) \ + break; \ + if (chars > -1) \ + size += chars + 1; \ + else \ + size += 100; \ + if ((larger = (char *) xmlRealloc(str, size)) == NULL) {\ + xmlFree(str); \ + return; \ + } \ + str = larger; \ + } \ +} +/** + * xsltGenericErrorDefaultFunc: + * @ctx: an error context + * @msg: the message to display/transmit + * @...: extra parameters for the message display + * + * Default handler for out of context error messages. + */ +static void LIBXSLT_ATTR_FORMAT(2,3) +xsltGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) { + va_list args; + + if (xsltGenericErrorContext == NULL) + xsltGenericErrorContext = (void *) stderr; + + va_start(args, msg); + vfprintf((FILE *)xsltGenericErrorContext, msg, args); + va_end(args); +} + +xmlGenericErrorFunc xsltGenericError = xsltGenericErrorDefaultFunc; +void *xsltGenericErrorContext = NULL; + + +/** + * xsltSetGenericErrorFunc: + * @ctx: the new error handling context + * @handler: the new handler function + * + * Function to reset the handler and the error context for out of + * context error messages. + * This simply means that @handler will be called for subsequent + * error messages while not parsing nor validating. And @ctx will + * be passed as first argument to @handler + * One can simply force messages to be emitted to another FILE * than + * stderr by setting @ctx to this file handle and @handler to NULL. + */ +void +xsltSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) { + xsltGenericErrorContext = ctx; + if (handler != NULL) + xsltGenericError = handler; + else + xsltGenericError = xsltGenericErrorDefaultFunc; +} + +/** + * xsltGenericDebugDefaultFunc: + * @ctx: an error context + * @msg: the message to display/transmit + * @...: extra parameters for the message display + * + * Default handler for out of context error messages. + */ +static void LIBXSLT_ATTR_FORMAT(2,3) +xsltGenericDebugDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) { + va_list args; + + if (xsltGenericDebugContext == NULL) + return; + + va_start(args, msg); + vfprintf((FILE *)xsltGenericDebugContext, msg, args); + va_end(args); +} + +xmlGenericErrorFunc xsltGenericDebug = xsltGenericDebugDefaultFunc; +void *xsltGenericDebugContext = NULL; + + +/** + * xsltSetGenericDebugFunc: + * @ctx: the new error handling context + * @handler: the new handler function + * + * Function to reset the handler and the error context for out of + * context error messages. + * This simply means that @handler will be called for subsequent + * error messages while not parsing or validating. And @ctx will + * be passed as first argument to @handler + * One can simply force messages to be emitted to another FILE * than + * stderr by setting @ctx to this file handle and @handler to NULL. + */ +void +xsltSetGenericDebugFunc(void *ctx, xmlGenericErrorFunc handler) { + xsltGenericDebugContext = ctx; + if (handler != NULL) + xsltGenericDebug = handler; + else + xsltGenericDebug = xsltGenericDebugDefaultFunc; +} + +/** + * xsltPrintErrorContext: + * @ctxt: the transformation context + * @style: the stylesheet + * @node: the current node being processed + * + * Display the context of an error. + */ +void +xsltPrintErrorContext(xsltTransformContextPtr ctxt, + xsltStylesheetPtr style, xmlNodePtr node) { + int line = 0; + const xmlChar *file = NULL; + const xmlChar *name = NULL; + const char *type = "error"; + xmlGenericErrorFunc error = xsltGenericError; + void *errctx = xsltGenericErrorContext; + + if (ctxt != NULL) { + ctxt->state = XSLT_STATE_ERROR; + if (ctxt->error != NULL) { + error = ctxt->error; + errctx = ctxt->errctx; + } + } + if ((node == NULL) && (ctxt != NULL)) + node = ctxt->inst; + + if (node != NULL) { + if ((node->type == XML_DOCUMENT_NODE) || + (node->type == XML_HTML_DOCUMENT_NODE)) { + xmlDocPtr doc = (xmlDocPtr) node; + + file = doc->URL; + } else { + line = xmlGetLineNo(node); + if ((node->doc != NULL) && (node->doc->URL != NULL)) + file = node->doc->URL; + if (node->name != NULL) + name = node->name; + } + } + + if (ctxt != NULL) + type = "runtime error"; + else if (style != NULL) { +#ifdef XSLT_REFACTORED + if (XSLT_CCTXT(style)->errSeverity == XSLT_ERROR_SEVERITY_WARNING) + type = "compilation warning"; + else + type = "compilation error"; +#else + type = "compilation error"; +#endif + } + + if ((file != NULL) && (line != 0) && (name != NULL)) + error(errctx, "%s: file %s line %d element %s\n", + type, file, line, name); + else if ((file != NULL) && (name != NULL)) + error(errctx, "%s: file %s element %s\n", type, file, name); + else if ((file != NULL) && (line != 0)) + error(errctx, "%s: file %s line %d\n", type, file, line); + else if (file != NULL) + error(errctx, "%s: file %s\n", type, file); + else if (name != NULL) + error(errctx, "%s: element %s\n", type, name); + else + error(errctx, "%s\n", type); +} + +/** + * xsltSetTransformErrorFunc: + * @ctxt: the XSLT transformation context + * @ctx: the new error handling context + * @handler: the new handler function + * + * Function to reset the handler and the error context for out of + * context error messages specific to a given XSLT transromation. + * + * This simply means that @handler will be called for subsequent + * error messages while running the transformation. + */ +void +xsltSetTransformErrorFunc(xsltTransformContextPtr ctxt, + void *ctx, xmlGenericErrorFunc handler) +{ + ctxt->error = handler; + ctxt->errctx = ctx; +} + +/** + * xsltTransformError: + * @ctxt: an XSLT transformation context + * @style: the XSLT stylesheet used + * @node: the current node in the stylesheet + * @msg: the message to display/transmit + * @...: extra parameters for the message display + * + * Display and format an error messages, gives file, line, position and + * extra parameters, will use the specific transformation context if available + */ +void +xsltTransformError(xsltTransformContextPtr ctxt, + xsltStylesheetPtr style, + xmlNodePtr node, + const char *msg, ...) { + xmlGenericErrorFunc error = xsltGenericError; + void *errctx = xsltGenericErrorContext; + char * str; + + if (ctxt != NULL) { + ctxt->state = XSLT_STATE_ERROR; + if (ctxt->error != NULL) { + error = ctxt->error; + errctx = ctxt->errctx; + } + } + if ((node == NULL) && (ctxt != NULL)) + node = ctxt->inst; + xsltPrintErrorContext(ctxt, style, node); + XSLT_GET_VAR_STR(msg, str); + error(errctx, "%s", str); + if (str != NULL) + xmlFree(str); +} + +/************************************************************************ + * * + * QNames * + * * + ************************************************************************/ + +/** + * xsltSplitQName: + * @dict: a dictionary + * @name: the full QName + * @prefix: the return value + * + * Split QNames into prefix and local names, both allocated from a dictionary. + * + * Returns: the localname or NULL in case of error. + */ +const xmlChar * +xsltSplitQName(xmlDictPtr dict, const xmlChar *name, const xmlChar **prefix) { + int len = 0; + const xmlChar *ret = NULL; + + *prefix = NULL; + if ((name == NULL) || (dict == NULL)) return(NULL); + if (name[0] == ':') + return(xmlDictLookup(dict, name, -1)); + while ((name[len] != 0) && (name[len] != ':')) len++; + if (name[len] == 0) return(xmlDictLookup(dict, name, -1)); + *prefix = xmlDictLookup(dict, name, len); + ret = xmlDictLookup(dict, &name[len + 1], -1); + return(ret); +} + +/** + * xsltGetQNameURI: + * @node: the node holding the QName + * @name: pointer to the initial QName value + * + * This function analyzes @name, if the name contains a prefix, + * the function seaches the associated namespace in scope for it. + * It will also replace @name value with the NCName, the old value being + * freed. + * Errors in the prefix lookup are signalled by setting @name to NULL. + * + * NOTE: the namespace returned is a pointer to the place where it is + * defined and hence has the same lifespan as the document holding it. + * + * Returns the namespace URI if there is a prefix, or NULL if @name is + * not prefixed. + */ +const xmlChar * +xsltGetQNameURI(xmlNodePtr node, xmlChar ** name) +{ + int len = 0; + xmlChar *qname; + xmlNsPtr ns; + + if (name == NULL) + return(NULL); + qname = *name; + if ((qname == NULL) || (*qname == 0)) + return(NULL); + if (node == NULL) { + xsltGenericError(xsltGenericErrorContext, + "QName: no element for namespace lookup %s\n", + qname); + xmlFree(qname); + *name = NULL; + return(NULL); + } + + /* nasty but valid */ + if (qname[0] == ':') + return(NULL); + + /* + * we are not trying to validate but just to cut, and yes it will + * work even if this is a set of UTF-8 encoded chars + */ + while ((qname[len] != 0) && (qname[len] != ':')) + len++; + + if (qname[len] == 0) + return(NULL); + + /* + * handle xml: separately, this one is magical + */ + if ((qname[0] == 'x') && (qname[1] == 'm') && + (qname[2] == 'l') && (qname[3] == ':')) { + if (qname[4] == 0) + return(NULL); + *name = xmlStrdup(&qname[4]); + xmlFree(qname); + return(XML_XML_NAMESPACE); + } + + qname[len] = 0; + ns = xmlSearchNs(node->doc, node, qname); + if (ns == NULL) { + xsltGenericError(xsltGenericErrorContext, + "%s:%s : no namespace bound to prefix %s\n", + qname, &qname[len + 1], qname); + *name = NULL; + xmlFree(qname); + return(NULL); + } + *name = xmlStrdup(&qname[len + 1]); + xmlFree(qname); + return(ns->href); +} + +/** + * xsltGetQNameURI2: + * @style: stylesheet pointer + * @node: the node holding the QName + * @name: pointer to the initial QName value + * + * This function is similar to xsltGetQNameURI, but is used when + * @name is a dictionary entry. + * + * Returns the namespace URI if there is a prefix, or NULL if @name is + * not prefixed. + */ +const xmlChar * +xsltGetQNameURI2(xsltStylesheetPtr style, xmlNodePtr node, + const xmlChar **name) { + int len = 0; + xmlChar *qname; + xmlNsPtr ns; + + if (name == NULL) + return(NULL); + qname = (xmlChar *)*name; + if ((qname == NULL) || (*qname == 0)) + return(NULL); + if (node == NULL) { + xsltGenericError(xsltGenericErrorContext, + "QName: no element for namespace lookup %s\n", + qname); + *name = NULL; + return(NULL); + } + + /* + * we are not trying to validate but just to cut, and yes it will + * work even if this is a set of UTF-8 encoded chars + */ + while ((qname[len] != 0) && (qname[len] != ':')) + len++; + + if (qname[len] == 0) + return(NULL); + + /* + * handle xml: separately, this one is magical + */ + if ((qname[0] == 'x') && (qname[1] == 'm') && + (qname[2] == 'l') && (qname[3] == ':')) { + if (qname[4] == 0) + return(NULL); + *name = xmlDictLookup(style->dict, &qname[4], -1); + return(XML_XML_NAMESPACE); + } + + qname = xmlStrndup(*name, len); + ns = xmlSearchNs(node->doc, node, qname); + if (ns == NULL) { + if (style) { + xsltTransformError(NULL, style, node, + "No namespace bound to prefix '%s'.\n", + qname); + style->errors++; + } else { + xsltGenericError(xsltGenericErrorContext, + "%s : no namespace bound to prefix %s\n", + *name, qname); + } + *name = NULL; + xmlFree(qname); + return(NULL); + } + *name = xmlDictLookup(style->dict, (*name)+len+1, -1); + xmlFree(qname); + return(ns->href); +} + +/************************************************************************ + * * + * Sorting * + * * + ************************************************************************/ + +/** + * xsltDocumentSortFunction: + * @list: the node set + * + * reorder the current node list @list accordingly to the document order + * This function is slow, obsolete and should not be used anymore. + */ +void +xsltDocumentSortFunction(xmlNodeSetPtr list) { + int i, j; + int len, tst; + xmlNodePtr node; + + if (list == NULL) + return; + len = list->nodeNr; + if (len <= 1) + return; + /* TODO: sort is really not optimized, does it needs to ? */ + for (i = 0;i < len -1;i++) { + for (j = i + 1; j < len; j++) { + tst = xmlXPathCmpNodes(list->nodeTab[i], list->nodeTab[j]); + if (tst == -1) { + node = list->nodeTab[i]; + list->nodeTab[i] = list->nodeTab[j]; + list->nodeTab[j] = node; + } + } + } +} + +/** + * xsltComputeSortResult: + * @ctxt: a XSLT process context + * @sort: node list + * + * reorder the current node list accordingly to the set of sorting + * requirement provided by the array of nodes. + * + * Returns a ordered XPath nodeset or NULL in case of error. + */ +xmlXPathObjectPtr * +xsltComputeSortResult(xsltTransformContextPtr ctxt, xmlNodePtr sort) { +#ifdef XSLT_REFACTORED + xsltStyleItemSortPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + xmlXPathObjectPtr *results = NULL; + xmlNodeSetPtr list = NULL; + xmlXPathObjectPtr res; + int len = 0; + int i; + xmlNodePtr oldNode; + xmlNodePtr oldInst; + int oldPos, oldSize ; + int oldNsNr; + xmlNsPtr *oldNamespaces; + + comp = sort->psvi; + if (comp == NULL) { + xsltGenericError(xsltGenericErrorContext, + "xsl:sort : compilation failed\n"); + return(NULL); + } + + if ((comp->select == NULL) || (comp->comp == NULL)) + return(NULL); + + list = ctxt->nodeList; + if ((list == NULL) || (list->nodeNr <= 1)) + return(NULL); + + len = list->nodeNr; + + /* TODO: xsl:sort lang attribute */ + /* TODO: xsl:sort case-order attribute */ + + + results = xmlMalloc(len * sizeof(xmlXPathObjectPtr)); + if (results == NULL) { + xsltGenericError(xsltGenericErrorContext, + "xsltComputeSortResult: memory allocation failure\n"); + return(NULL); + } + + oldNode = ctxt->node; + oldInst = ctxt->inst; + oldPos = ctxt->xpathCtxt->proximityPosition; + oldSize = ctxt->xpathCtxt->contextSize; + oldNsNr = ctxt->xpathCtxt->nsNr; + oldNamespaces = ctxt->xpathCtxt->namespaces; + for (i = 0;i < len;i++) { + ctxt->inst = sort; + ctxt->xpathCtxt->contextSize = len; + ctxt->xpathCtxt->proximityPosition = i + 1; + ctxt->node = list->nodeTab[i]; + ctxt->xpathCtxt->node = ctxt->node; +#ifdef XSLT_REFACTORED + if (comp->inScopeNs != NULL) { + ctxt->xpathCtxt->namespaces = comp->inScopeNs->list; + ctxt->xpathCtxt->nsNr = comp->inScopeNs->xpathNumber; + } else { + ctxt->xpathCtxt->namespaces = NULL; + ctxt->xpathCtxt->nsNr = 0; + } +#else + ctxt->xpathCtxt->namespaces = comp->nsList; + ctxt->xpathCtxt->nsNr = comp->nsNr; +#endif + res = xmlXPathCompiledEval(comp->comp, ctxt->xpathCtxt); + if (res != NULL) { + if (res->type != XPATH_STRING) + res = xmlXPathConvertString(res); + if (comp->number) + res = xmlXPathConvertNumber(res); + res->index = i; /* Save original pos for dupl resolv */ + if (comp->number) { + if (res->type == XPATH_NUMBER) { + results[i] = res; + } else { +#ifdef WITH_XSLT_DEBUG_PROCESS + xsltGenericDebug(xsltGenericDebugContext, + "xsltComputeSortResult: select didn't evaluate to a number\n"); +#endif + results[i] = NULL; + } + } else { + if (res->type == XPATH_STRING) { + if (comp->locale != (xsltLocale)0) { + xmlChar *str = res->stringval; + res->stringval = (xmlChar *) xsltStrxfrm(comp->locale, str); + xmlFree(str); + } + + results[i] = res; + } else { +#ifdef WITH_XSLT_DEBUG_PROCESS + xsltGenericDebug(xsltGenericDebugContext, + "xsltComputeSortResult: select didn't evaluate to a string\n"); +#endif + results[i] = NULL; + } + } + } else { + ctxt->state = XSLT_STATE_STOPPED; + results[i] = NULL; + } + } + ctxt->node = oldNode; + ctxt->inst = oldInst; + ctxt->xpathCtxt->contextSize = oldSize; + ctxt->xpathCtxt->proximityPosition = oldPos; + ctxt->xpathCtxt->nsNr = oldNsNr; + ctxt->xpathCtxt->namespaces = oldNamespaces; + + return(results); +} + +/** + * xsltDefaultSortFunction: + * @ctxt: a XSLT process context + * @sorts: array of sort nodes + * @nbsorts: the number of sorts in the array + * + * reorder the current node list accordingly to the set of sorting + * requirement provided by the arry of nodes. + */ +void +xsltDefaultSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr *sorts, + int nbsorts) { +#ifdef XSLT_REFACTORED + xsltStyleItemSortPtr comp; +#else + xsltStylePreCompPtr comp; +#endif + xmlXPathObjectPtr *resultsTab[XSLT_MAX_SORT]; + xmlXPathObjectPtr *results = NULL, *res; + xmlNodeSetPtr list = NULL; + int descending, number, desc, numb; + int len = 0; + int i, j, incr; + int tst; + int depth; + xmlNodePtr node; + xmlXPathObjectPtr tmp; + int tempstype[XSLT_MAX_SORT], temporder[XSLT_MAX_SORT]; + + if ((ctxt == NULL) || (sorts == NULL) || (nbsorts <= 0) || + (nbsorts >= XSLT_MAX_SORT)) + return; + if (sorts[0] == NULL) + return; + comp = sorts[0]->psvi; + if (comp == NULL) + return; + + list = ctxt->nodeList; + if ((list == NULL) || (list->nodeNr <= 1)) + return; /* nothing to do */ + + for (j = 0; j < nbsorts; j++) { + comp = sorts[j]->psvi; + tempstype[j] = 0; + if ((comp->stype == NULL) && (comp->has_stype != 0)) { + comp->stype = + xsltEvalAttrValueTemplate(ctxt, sorts[j], + (const xmlChar *) "data-type", + XSLT_NAMESPACE); + if (comp->stype != NULL) { + tempstype[j] = 1; + if (xmlStrEqual(comp->stype, (const xmlChar *) "text")) + comp->number = 0; + else if (xmlStrEqual(comp->stype, (const xmlChar *) "number")) + comp->number = 1; + else { + xsltTransformError(ctxt, NULL, sorts[j], + "xsltDoSortFunction: no support for data-type = %s\n", + comp->stype); + comp->number = 0; /* use default */ + } + } + } + temporder[j] = 0; + if ((comp->order == NULL) && (comp->has_order != 0)) { + comp->order = xsltEvalAttrValueTemplate(ctxt, sorts[j], + (const xmlChar *) "order", + XSLT_NAMESPACE); + if (comp->order != NULL) { + temporder[j] = 1; + if (xmlStrEqual(comp->order, (const xmlChar *) "ascending")) + comp->descending = 0; + else if (xmlStrEqual(comp->order, + (const xmlChar *) "descending")) + comp->descending = 1; + else { + xsltTransformError(ctxt, NULL, sorts[j], + "xsltDoSortFunction: invalid value %s for order\n", + comp->order); + comp->descending = 0; /* use default */ + } + } + } + } + + len = list->nodeNr; + + resultsTab[0] = xsltComputeSortResult(ctxt, sorts[0]); + for (i = 1;i < XSLT_MAX_SORT;i++) + resultsTab[i] = NULL; + + results = resultsTab[0]; + + comp = sorts[0]->psvi; + descending = comp->descending; + number = comp->number; + if (results == NULL) + return; + + /* Shell's sort of node-set */ + for (incr = len / 2; incr > 0; incr /= 2) { + for (i = incr; i < len; i++) { + j = i - incr; + if (results[i] == NULL) + continue; + + while (j >= 0) { + if (results[j] == NULL) + tst = 1; + else { + if (number) { + /* We make NaN smaller than number in accordance + with XSLT spec */ + if (xmlXPathIsNaN(results[j]->floatval)) { + if (xmlXPathIsNaN(results[j + incr]->floatval)) + tst = 0; + else + tst = -1; + } else if (xmlXPathIsNaN(results[j + incr]->floatval)) + tst = 1; + else if (results[j]->floatval == + results[j + incr]->floatval) + tst = 0; + else if (results[j]->floatval > + results[j + incr]->floatval) + tst = 1; + else tst = -1; + } else if(comp->locale != (xsltLocale)0) { + tst = xsltLocaleStrcmp( + comp->locale, + (xsltLocaleChar *) results[j]->stringval, + (xsltLocaleChar *) results[j + incr]->stringval); + } else { + tst = xmlStrcmp(results[j]->stringval, + results[j + incr]->stringval); + } + if (descending) + tst = -tst; + } + if (tst == 0) { + /* + * Okay we need to use multi level sorts + */ + depth = 1; + while (depth < nbsorts) { + if (sorts[depth] == NULL) + break; + comp = sorts[depth]->psvi; + if (comp == NULL) + break; + desc = comp->descending; + numb = comp->number; + + /* + * Compute the result of the next level for the + * full set, this might be optimized ... or not + */ + if (resultsTab[depth] == NULL) + resultsTab[depth] = xsltComputeSortResult(ctxt, + sorts[depth]); + res = resultsTab[depth]; + if (res == NULL) + break; + if (res[j] == NULL) { + if (res[j+incr] != NULL) + tst = 1; + } else { + if (numb) { + /* We make NaN smaller than number in + accordance with XSLT spec */ + if (xmlXPathIsNaN(res[j]->floatval)) { + if (xmlXPathIsNaN(res[j + + incr]->floatval)) + tst = 0; + else + tst = -1; + } else if (xmlXPathIsNaN(res[j + incr]-> + floatval)) + tst = 1; + else if (res[j]->floatval == res[j + incr]-> + floatval) + tst = 0; + else if (res[j]->floatval > + res[j + incr]->floatval) + tst = 1; + else tst = -1; + } else if(comp->locale != (xsltLocale)0) { + tst = xsltLocaleStrcmp( + comp->locale, + (xsltLocaleChar *) res[j]->stringval, + (xsltLocaleChar *) res[j + incr]->stringval); + } else { + tst = xmlStrcmp(res[j]->stringval, + res[j + incr]->stringval); + } + if (desc) + tst = -tst; + } + + /* + * if we still can't differenciate at this level + * try one level deeper. + */ + if (tst != 0) + break; + depth++; + } + } + if (tst == 0) { + tst = results[j]->index > results[j + incr]->index; + } + if (tst > 0) { + tmp = results[j]; + results[j] = results[j + incr]; + results[j + incr] = tmp; + node = list->nodeTab[j]; + list->nodeTab[j] = list->nodeTab[j + incr]; + list->nodeTab[j + incr] = node; + depth = 1; + while (depth < nbsorts) { + if (sorts[depth] == NULL) + break; + if (resultsTab[depth] == NULL) + break; + res = resultsTab[depth]; + tmp = res[j]; + res[j] = res[j + incr]; + res[j + incr] = tmp; + depth++; + } + j -= incr; + } else + break; + } + } + } + + for (j = 0; j < nbsorts; j++) { + comp = sorts[j]->psvi; + if (tempstype[j] == 1) { + /* The data-type needs to be recomputed each time */ + xmlFree((void *)(comp->stype)); + comp->stype = NULL; + } + if (temporder[j] == 1) { + /* The order needs to be recomputed each time */ + xmlFree((void *)(comp->order)); + comp->order = NULL; + } + if (resultsTab[j] != NULL) { + for (i = 0;i < len;i++) + xmlXPathFreeObject(resultsTab[j][i]); + xmlFree(resultsTab[j]); + } + } +} + + +static xsltSortFunc xsltSortFunction = xsltDefaultSortFunction; + +/** + * xsltDoSortFunction: + * @ctxt: a XSLT process context + * @sorts: array of sort nodes + * @nbsorts: the number of sorts in the array + * + * reorder the current node list accordingly to the set of sorting + * requirement provided by the arry of nodes. + * This is a wrapper function, the actual function used is specified + * using xsltSetCtxtSortFunc() to set the context specific sort function, + * or xsltSetSortFunc() to set the global sort function. + * If a sort function is set on the context, this will get called. + * Otherwise the global sort function is called. + */ +void +xsltDoSortFunction(xsltTransformContextPtr ctxt, xmlNodePtr * sorts, + int nbsorts) +{ + if (ctxt->sortfunc != NULL) + (ctxt->sortfunc)(ctxt, sorts, nbsorts); + else if (xsltSortFunction != NULL) + xsltSortFunction(ctxt, sorts, nbsorts); +} + +/** + * xsltSetSortFunc: + * @handler: the new handler function + * + * Function to reset the global handler for XSLT sorting. + * If the handler is NULL, the default sort function will be used. + */ +void +xsltSetSortFunc(xsltSortFunc handler) { + if (handler != NULL) + xsltSortFunction = handler; + else + xsltSortFunction = xsltDefaultSortFunction; +} + +/** + * xsltSetCtxtSortFunc: + * @ctxt: a XSLT process context + * @handler: the new handler function + * + * Function to set the handler for XSLT sorting + * for the specified context. + * If the handler is NULL, then the global + * sort function will be called + */ +void +xsltSetCtxtSortFunc(xsltTransformContextPtr ctxt, xsltSortFunc handler) { + ctxt->sortfunc = handler; +} + +/************************************************************************ + * * + * Parsing options * + * * + ************************************************************************/ + +/** + * xsltSetCtxtParseOptions: + * @ctxt: a XSLT process context + * @options: a combination of libxml2 xmlParserOption + * + * Change the default parser option passed by the XSLT engine to the + * parser when using document() loading. + * + * Returns the previous options or -1 in case of error + */ +int +xsltSetCtxtParseOptions(xsltTransformContextPtr ctxt, int options) +{ + int oldopts; + + if (ctxt == NULL) + return(-1); + oldopts = ctxt->parserOptions; + if (ctxt->xinclude) + oldopts |= XML_PARSE_XINCLUDE; + ctxt->parserOptions = options; + if (options & XML_PARSE_XINCLUDE) + ctxt->xinclude = 1; + else + ctxt->xinclude = 0; + return(oldopts); +} + +/************************************************************************ + * * + * Output * + * * + ************************************************************************/ + +/** + * xsltSaveResultTo: + * @buf: an output buffer + * @result: the result xmlDocPtr + * @style: the stylesheet + * + * Save the result @result obtained by applying the @style stylesheet + * to an I/O output channel @buf + * + * Returns the number of byte written or -1 in case of failure. + */ +int +xsltSaveResultTo(xmlOutputBufferPtr buf, xmlDocPtr result, + xsltStylesheetPtr style) { + const xmlChar *encoding; + int base; + const xmlChar *method; + int indent; + + if ((buf == NULL) || (result == NULL) || (style == NULL)) + return(-1); + if ((result->children == NULL) || + ((result->children->type == XML_DTD_NODE) && + (result->children->next == NULL))) + return(0); + + if ((style->methodURI != NULL) && + ((style->method == NULL) || + (!xmlStrEqual(style->method, (const xmlChar *) "xhtml")))) { + xsltGenericError(xsltGenericErrorContext, + "xsltSaveResultTo : unknown ouput method\n"); + return(-1); + } + + base = buf->written; + + XSLT_GET_IMPORT_PTR(method, style, method) + XSLT_GET_IMPORT_PTR(encoding, style, encoding) + XSLT_GET_IMPORT_INT(indent, style, indent); + + if ((method == NULL) && (result->type == XML_HTML_DOCUMENT_NODE)) + method = (const xmlChar *) "html"; + + if ((method != NULL) && + (xmlStrEqual(method, (const xmlChar *) "html"))) { + if (encoding != NULL) { + htmlSetMetaEncoding(result, (const xmlChar *) encoding); + } else { + htmlSetMetaEncoding(result, (const xmlChar *) "UTF-8"); + } + if (indent == -1) + indent = 1; + htmlDocContentDumpFormatOutput(buf, result, (const char *) encoding, + indent); + xmlOutputBufferFlush(buf); + } else if ((method != NULL) && + (xmlStrEqual(method, (const xmlChar *) "xhtml"))) { + if (encoding != NULL) { + htmlSetMetaEncoding(result, (const xmlChar *) encoding); + } else { + htmlSetMetaEncoding(result, (const xmlChar *) "UTF-8"); + } + htmlDocContentDumpOutput(buf, result, (const char *) encoding); + xmlOutputBufferFlush(buf); + } else if ((method != NULL) && + (xmlStrEqual(method, (const xmlChar *) "text"))) { + xmlNodePtr cur; + + cur = result->children; + while (cur != NULL) { + if (cur->type == XML_TEXT_NODE) + xmlOutputBufferWriteString(buf, (const char *) cur->content); + + /* + * Skip to next node + */ + if (cur->children != NULL) { + if ((cur->children->type != XML_ENTITY_DECL) && + (cur->children->type != XML_ENTITY_REF_NODE) && + (cur->children->type != XML_ENTITY_NODE)) { + cur = cur->children; + continue; + } + } + if (cur->next != NULL) { + cur = cur->next; + continue; + } + + do { + cur = cur->parent; + if (cur == NULL) + break; + if (cur == (xmlNodePtr) style->doc) { + cur = NULL; + break; + } + if (cur->next != NULL) { + cur = cur->next; + break; + } + } while (cur != NULL); + } + xmlOutputBufferFlush(buf); + } else { + int omitXmlDecl; + int standalone; + + XSLT_GET_IMPORT_INT(omitXmlDecl, style, omitXmlDeclaration); + XSLT_GET_IMPORT_INT(standalone, style, standalone); + + if (omitXmlDecl != 1) { + xmlOutputBufferWriteString(buf, "version != NULL) { + xmlOutputBufferWriteString(buf, "\""); + xmlOutputBufferWriteString(buf, (const char *)result->version); + xmlOutputBufferWriteString(buf, "\""); + } else + xmlOutputBufferWriteString(buf, "\"1.0\""); + if (encoding == NULL) { + if (result->encoding != NULL) + encoding = result->encoding; + else if (result->charset != XML_CHAR_ENCODING_UTF8) + encoding = (const xmlChar *) + xmlGetCharEncodingName((xmlCharEncoding) + result->charset); + } + if (encoding != NULL) { + xmlOutputBufferWriteString(buf, " encoding="); + xmlOutputBufferWriteString(buf, "\""); + xmlOutputBufferWriteString(buf, (const char *) encoding); + xmlOutputBufferWriteString(buf, "\""); + } + switch (standalone) { + case 0: + xmlOutputBufferWriteString(buf, " standalone=\"no\""); + break; + case 1: + xmlOutputBufferWriteString(buf, " standalone=\"yes\""); + break; + default: + break; + } + xmlOutputBufferWriteString(buf, "?>\n"); + } + if (result->children != NULL) { + xmlNodePtr child = result->children; + + while (child != NULL) { + xmlNodeDumpOutput(buf, result, child, 0, (indent == 1), + (const char *) encoding); + if (indent && ((child->type == XML_DTD_NODE) || + ((child->type == XML_COMMENT_NODE) && + (child->next != NULL)))) + xmlOutputBufferWriteString(buf, "\n"); + child = child->next; + } + if (indent) + xmlOutputBufferWriteString(buf, "\n"); + } + xmlOutputBufferFlush(buf); + } + return(buf->written - base); +} + +/** + * xsltSaveResultToFilename: + * @URL: a filename or URL + * @result: the result xmlDocPtr + * @style: the stylesheet + * @compression: the compression factor (0 - 9 included) + * + * Save the result @result obtained by applying the @style stylesheet + * to a file or @URL + * + * Returns the number of byte written or -1 in case of failure. + */ +int +xsltSaveResultToFilename(const char *URL, xmlDocPtr result, + xsltStylesheetPtr style, int compression) { + xmlOutputBufferPtr buf; + const xmlChar *encoding; + int ret; + + if ((URL == NULL) || (result == NULL) || (style == NULL)) + return(-1); + if (result->children == NULL) + return(0); + + XSLT_GET_IMPORT_PTR(encoding, style, encoding) + if (encoding != NULL) { + xmlCharEncodingHandlerPtr encoder; + + encoder = xmlFindCharEncodingHandler((char *)encoding); + if ((encoder != NULL) && + (xmlStrEqual((const xmlChar *)encoder->name, + (const xmlChar *) "UTF-8"))) + encoder = NULL; + buf = xmlOutputBufferCreateFilename(URL, encoder, compression); + } else { + buf = xmlOutputBufferCreateFilename(URL, NULL, compression); + } + if (buf == NULL) + return(-1); + xsltSaveResultTo(buf, result, style); + ret = xmlOutputBufferClose(buf); + return(ret); +} + +/** + * xsltSaveResultToFile: + * @file: a FILE * I/O + * @result: the result xmlDocPtr + * @style: the stylesheet + * + * Save the result @result obtained by applying the @style stylesheet + * to an open FILE * I/O. + * This does not close the FILE @file + * + * Returns the number of bytes written or -1 in case of failure. + */ +int +xsltSaveResultToFile(FILE *file, xmlDocPtr result, xsltStylesheetPtr style) { + xmlOutputBufferPtr buf; + const xmlChar *encoding; + int ret; + + if ((file == NULL) || (result == NULL) || (style == NULL)) + return(-1); + if (result->children == NULL) + return(0); + + XSLT_GET_IMPORT_PTR(encoding, style, encoding) + if (encoding != NULL) { + xmlCharEncodingHandlerPtr encoder; + + encoder = xmlFindCharEncodingHandler((char *)encoding); + if ((encoder != NULL) && + (xmlStrEqual((const xmlChar *)encoder->name, + (const xmlChar *) "UTF-8"))) + encoder = NULL; + buf = xmlOutputBufferCreateFile(file, encoder); + } else { + buf = xmlOutputBufferCreateFile(file, NULL); + } + + if (buf == NULL) + return(-1); + xsltSaveResultTo(buf, result, style); + ret = xmlOutputBufferClose(buf); + return(ret); +} + +/** + * xsltSaveResultToFd: + * @fd: a file descriptor + * @result: the result xmlDocPtr + * @style: the stylesheet + * + * Save the result @result obtained by applying the @style stylesheet + * to an open file descriptor + * This does not close the descriptor. + * + * Returns the number of bytes written or -1 in case of failure. + */ +int +xsltSaveResultToFd(int fd, xmlDocPtr result, xsltStylesheetPtr style) { + xmlOutputBufferPtr buf; + const xmlChar *encoding; + int ret; + + if ((fd < 0) || (result == NULL) || (style == NULL)) + return(-1); + if (result->children == NULL) + return(0); + + XSLT_GET_IMPORT_PTR(encoding, style, encoding) + if (encoding != NULL) { + xmlCharEncodingHandlerPtr encoder; + + encoder = xmlFindCharEncodingHandler((char *)encoding); + if ((encoder != NULL) && + (xmlStrEqual((const xmlChar *)encoder->name, + (const xmlChar *) "UTF-8"))) + encoder = NULL; + buf = xmlOutputBufferCreateFd(fd, encoder); + } else { + buf = xmlOutputBufferCreateFd(fd, NULL); + } + if (buf == NULL) + return(-1); + xsltSaveResultTo(buf, result, style); + ret = xmlOutputBufferClose(buf); + return(ret); +} + +/** + * xsltSaveResultToString: + * @doc_txt_ptr: Memory pointer for allocated XML text + * @doc_txt_len: Length of the generated XML text + * @result: the result xmlDocPtr + * @style: the stylesheet + * + * Save the result @result obtained by applying the @style stylesheet + * to a new allocated string. + * + * Returns 0 in case of success and -1 in case of error + */ +int +xsltSaveResultToString(xmlChar **doc_txt_ptr, int * doc_txt_len, + xmlDocPtr result, xsltStylesheetPtr style) { + xmlOutputBufferPtr buf; + const xmlChar *encoding; + + *doc_txt_ptr = NULL; + *doc_txt_len = 0; + if (result->children == NULL) + return(0); + + XSLT_GET_IMPORT_PTR(encoding, style, encoding) + if (encoding != NULL) { + xmlCharEncodingHandlerPtr encoder; + + encoder = xmlFindCharEncodingHandler((char *)encoding); + if ((encoder != NULL) && + (xmlStrEqual((const xmlChar *)encoder->name, + (const xmlChar *) "UTF-8"))) + encoder = NULL; + buf = xmlAllocOutputBuffer(encoder); + } else { + buf = xmlAllocOutputBuffer(NULL); + } + if (buf == NULL) + return(-1); + xsltSaveResultTo(buf, result, style); +#ifdef LIBXML2_NEW_BUFFER + if (buf->conv != NULL) { + *doc_txt_len = xmlBufUse(buf->conv); + *doc_txt_ptr = xmlStrndup(xmlBufContent(buf->conv), *doc_txt_len); + } else { + *doc_txt_len = xmlBufUse(buf->buffer); + *doc_txt_ptr = xmlStrndup(xmlBufContent(buf->buffer), *doc_txt_len); + } +#else + if (buf->conv != NULL) { + *doc_txt_len = buf->conv->use; + *doc_txt_ptr = xmlStrndup(buf->conv->content, *doc_txt_len); + } else { + *doc_txt_len = buf->buffer->use; + *doc_txt_ptr = xmlStrndup(buf->buffer->content, *doc_txt_len); + } +#endif + (void)xmlOutputBufferClose(buf); + return 0; +} + +/************************************************************************ + * * + * Generating profiling informations * + * * + ************************************************************************/ + +static long calibration = -1; + +/** + * xsltCalibrateTimestamps: + * + * Used for to calibrate the xsltTimestamp() function + * Should work if launched at startup and we don't loose our quantum :-) + * + * Returns the number of milliseconds used by xsltTimestamp() + */ +static long +xsltCalibrateTimestamps(void) { + register int i; + + for (i = 0;i < 999;i++) + xsltTimestamp(); + return(xsltTimestamp() / 1000); +} + +/** + * xsltCalibrateAdjust: + * @delta: a negative dealy value found + * + * Used for to correct the calibration for xsltTimestamp() + */ +void +xsltCalibrateAdjust(long delta) { + calibration += delta; +} + +/** + * xsltTimestamp: + * + * Used for gathering profiling data + * + * Returns the number of tenth of milliseconds since the beginning of the + * profiling + */ +long +xsltTimestamp(void) +{ +#ifdef XSLT_WIN32_PERFORMANCE_COUNTER + BOOL ok; + LARGE_INTEGER performanceCount; + LARGE_INTEGER performanceFrequency; + LONGLONG quadCount; + double seconds; + static LONGLONG startupQuadCount = 0; + static LONGLONG startupQuadFreq = 0; + + ok = QueryPerformanceCounter(&performanceCount); + if (!ok) + return 0; + quadCount = performanceCount.QuadPart; + if (calibration < 0) { + calibration = 0; + ok = QueryPerformanceFrequency(&performanceFrequency); + if (!ok) + return 0; + startupQuadFreq = performanceFrequency.QuadPart; + startupQuadCount = quadCount; + return (0); + } + if (startupQuadFreq == 0) + return 0; + seconds = (quadCount - startupQuadCount) / (double) startupQuadFreq; + return (long) (seconds * XSLT_TIMESTAMP_TICS_PER_SEC); + +#else /* XSLT_WIN32_PERFORMANCE_COUNTER */ +#ifdef HAVE_CLOCK_GETTIME +# if defined(CLOCK_MONOTONIC) +# define XSLT_CLOCK CLOCK_MONOTONIC +# elif defined(CLOCK_HIGHRES) +# define XSLT_CLOCK CLOCK_HIGHRES +# else +# define XSLT_CLOCK CLOCK_REALTIME +# endif + static struct timespec startup; + struct timespec cur; + long tics; + + if (calibration < 0) { + clock_gettime(XSLT_CLOCK, &startup); + calibration = 0; + calibration = xsltCalibrateTimestamps(); + clock_gettime(XSLT_CLOCK, &startup); + return (0); + } + + clock_gettime(XSLT_CLOCK, &cur); + tics = (cur.tv_sec - startup.tv_sec) * XSLT_TIMESTAMP_TICS_PER_SEC; + tics += (cur.tv_nsec - startup.tv_nsec) / + (1000000000l / XSLT_TIMESTAMP_TICS_PER_SEC); + + tics -= calibration; + return(tics); + +#elif HAVE_GETTIMEOFDAY + static struct timeval startup; + struct timeval cur; + long tics; + + if (calibration < 0) { + gettimeofday(&startup, NULL); + calibration = 0; + calibration = xsltCalibrateTimestamps(); + gettimeofday(&startup, NULL); + return (0); + } + + gettimeofday(&cur, NULL); + tics = (cur.tv_sec - startup.tv_sec) * XSLT_TIMESTAMP_TICS_PER_SEC; + tics += (cur.tv_usec - startup.tv_usec) / + (1000000l / XSLT_TIMESTAMP_TICS_PER_SEC); + + tics -= calibration; + return(tics); +#else + + /* Neither gettimeofday() nor Win32 performance counter available */ + + return (0); + +#endif /* HAVE_GETTIMEOFDAY */ +#endif /* XSLT_WIN32_PERFORMANCE_COUNTER */ +} + +static char * +pretty_templ_match(xsltTemplatePtr templ) { + static char dst[1001]; + char *src = (char *)templ->match; + int i=0,j; + + /* strip white spaces */ + for (j=0; i<1000 && src[j]; i++,j++) { + for(;src[j]==' ';j++); + dst[i]=src[j]; + } + if(i<998 && templ->mode) { + /* append [mode] */ + dst[i++]='['; + src=(char *)templ->mode; + for (j=0; i<999 && src[j]; i++,j++) { + dst[i]=src[j]; + } + dst[i++]=']'; + } + dst[i]='\0'; + return dst; +} + +#define MAX_TEMPLATES 10000 + +/** + * xsltSaveProfiling: + * @ctxt: an XSLT context + * @output: a FILE * for saving the informations + * + * Save the profiling informations on @output + */ +void +xsltSaveProfiling(xsltTransformContextPtr ctxt, FILE *output) { + int nb, i,j,k,l; + int max; + int total; + unsigned long totalt; + xsltTemplatePtr *templates; + xsltStylesheetPtr style; + xsltTemplatePtr templ1,templ2; + int *childt; + + if ((output == NULL) || (ctxt == NULL)) + return; + if (ctxt->profile == 0) + return; + + nb = 0; + max = MAX_TEMPLATES; + templates = xmlMalloc(max * sizeof(xsltTemplatePtr)); + if (templates == NULL) + return; + + style = ctxt->style; + while (style != NULL) { + templ1 = style->templates; + while (templ1 != NULL) { + if (nb >= max) + break; + + if (templ1->nbCalls > 0) + templates[nb++] = templ1; + templ1 = templ1->next; + } + + style = xsltNextImport(style); + } + + for (i = 0;i < nb -1;i++) { + for (j = i + 1; j < nb; j++) { + if ((templates[i]->time <= templates[j]->time) || + ((templates[i]->time == templates[j]->time) && + (templates[i]->nbCalls <= templates[j]->nbCalls))) { + templ1 = templates[j]; + templates[j] = templates[i]; + templates[i] = templ1; + } + } + } + + + /* print flat profile */ + + fprintf(output, "%6s%20s%20s%10s Calls Tot 100us Avg\n\n", + "number", "match", "name", "mode"); + total = 0; + totalt = 0; + for (i = 0;i < nb;i++) { + templ1 = templates[i]; + fprintf(output, "%5d ", i); + if (templ1->match != NULL) { + if (xmlStrlen(templ1->match) > 20) + fprintf(output, "%s\n%26s", templ1->match, ""); + else + fprintf(output, "%20s", templ1->match); + } else { + fprintf(output, "%20s", ""); + } + if (templ1->name != NULL) { + if (xmlStrlen(templ1->name) > 20) + fprintf(output, "%s\n%46s", templ1->name, ""); + else + fprintf(output, "%20s", templ1->name); + } else { + fprintf(output, "%20s", ""); + } + if (templ1->mode != NULL) { + if (xmlStrlen(templ1->mode) > 10) + fprintf(output, "%s\n%56s", templ1->mode, ""); + else + fprintf(output, "%10s", templ1->mode); + } else { + fprintf(output, "%10s", ""); + } + fprintf(output, " %6d", templ1->nbCalls); + fprintf(output, " %6ld %6ld\n", templ1->time, + templ1->time / templ1->nbCalls); + total += templ1->nbCalls; + totalt += templ1->time; + } + fprintf(output, "\n%30s%26s %6d %6ld\n", "Total", "", total, totalt); + + + /* print call graph */ + + childt = xmlMalloc((nb + 1) * sizeof(int)); + if (childt == NULL) + return; + + /* precalculate children times */ + for (i = 0; i < nb; i++) { + templ1 = templates[i]; + + childt[i] = 0; + for (k = 0; k < nb; k++) { + templ2 = templates[k]; + for (l = 0; l < templ2->templNr; l++) { + if (templ2->templCalledTab[l] == templ1) { + childt[i] +=templ2->time; + } + } + } + } + childt[i] = 0; + + fprintf(output, "\nindex %% time self children called name\n"); + + for (i = 0; i < nb; i++) { + char ix_str[20], timep_str[20], times_str[20], timec_str[20], called_str[20]; + unsigned long t; + + templ1 = templates[i]; + /* callers */ + for (j = 0; j < templ1->templNr; j++) { + templ2 = templ1->templCalledTab[j]; + for (k = 0; k < nb; k++) { + if (templates[k] == templ2) + break; + } + t=templ2?templ2->time:totalt; + snprintf(times_str,sizeof(times_str),"%8.3f",(float)t/XSLT_TIMESTAMP_TICS_PER_SEC); + snprintf(timec_str,sizeof(timec_str),"%8.3f",(float)childt[k]/XSLT_TIMESTAMP_TICS_PER_SEC); + snprintf(called_str,sizeof(called_str),"%6d/%d", + templ1->templCountTab[j], /* number of times caller calls 'this' */ + templ1->nbCalls); /* total number of calls to 'this' */ + + fprintf(output, " %-8s %-8s %-12s %s [%d]\n", + times_str,timec_str,called_str, + (templ2?(templ2->name?(char *)templ2->name:pretty_templ_match(templ2)):"-"),k); + } + /* this */ + snprintf(ix_str,sizeof(ix_str),"[%d]",i); + snprintf(timep_str,sizeof(timep_str),"%6.2f",(float)templ1->time*100.0/totalt); + snprintf(times_str,sizeof(times_str),"%8.3f",(float)templ1->time/XSLT_TIMESTAMP_TICS_PER_SEC); + snprintf(timec_str,sizeof(timec_str),"%8.3f",(float)childt[i]/XSLT_TIMESTAMP_TICS_PER_SEC); + fprintf(output, "%-5s %-6s %-8s %-8s %6d %s [%d]\n", + ix_str, timep_str,times_str,timec_str, + templ1->nbCalls, + templ1->name?(char *)templ1->name:pretty_templ_match(templ1),i); + /* callees + * - go over templates[0..nb] and their templCalledTab[] + * - print those where we in the the call-stack + */ + total = 0; + for (k = 0; k < nb; k++) { + templ2 = templates[k]; + for (l = 0; l < templ2->templNr; l++) { + if (templ2->templCalledTab[l] == templ1) { + total+=templ2->templCountTab[l]; + } + } + } + for (k = 0; k < nb; k++) { + templ2 = templates[k]; + for (l = 0; l < templ2->templNr; l++) { + if (templ2->templCalledTab[l] == templ1) { + snprintf(times_str,sizeof(times_str),"%8.3f",(float)templ2->time/XSLT_TIMESTAMP_TICS_PER_SEC); + snprintf(timec_str,sizeof(timec_str),"%8.3f",(float)childt[k]/XSLT_TIMESTAMP_TICS_PER_SEC); + snprintf(called_str,sizeof(called_str),"%6d/%d", + templ2->templCountTab[l], /* number of times 'this' calls callee */ + total); /* total number of calls from 'this' */ + fprintf(output, " %-8s %-8s %-12s %s [%d]\n", + times_str,timec_str,called_str, + templ2->name?(char *)templ2->name:pretty_templ_match(templ2),k); + } + } + } + fprintf(output, "-----------------------------------------------\n"); + } + + fprintf(output, "\f\nIndex by function name\n"); + for (i = 0; i < nb; i++) { + templ1 = templates[i]; + fprintf(output, "[%d] %s (%s:%d)\n", + i, templ1->name?(char *)templ1->name:pretty_templ_match(templ1), + templ1->style->doc->URL,templ1->elem->line); + } + + fprintf(output, "\f\n"); + xmlFree(childt); + + xmlFree(templates); +} + +/************************************************************************ + * * + * Fetching profiling informations * + * * + ************************************************************************/ + +/** + * xsltGetProfileInformation: + * @ctxt: a transformation context + * + * This function should be called after the transformation completed + * to extract template processing profiling informations if availble. + * The informations are returned as an XML document tree like + * + * + *