mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 12:23:31 +00:00
-add libxslt 1.1.24
-update libxml2 to 2.7.3 -add a new lib "wineldr" to hack around wine's .so lib crap (attention this depends on kernel32!) -enable the usage of libxslt in msxml3 svn path=/trunk/; revision=38989
This commit is contained in:
@@ -109,6 +109,7 @@ base\system\smss\smss.exe 1
|
||||
; Dynamic Link Libraries
|
||||
dll\3rdparty\freetype\freetype.dll 1
|
||||
dll\3rdparty\mesa32\mesa32.dll 1
|
||||
dll\3rdparty\libxslt\ibxslt.dll 1
|
||||
dll\3rdparty\dxtn\dxtn.dll 1 optional
|
||||
|
||||
dll\cpl\access\access.cpl 1
|
||||
|
||||
Vendored
+3
@@ -7,6 +7,9 @@
|
||||
<directory name="mesa32">
|
||||
<xi:include href="mesa32/mesa32.rbuild" />
|
||||
</directory>
|
||||
<directory name="libxslt">
|
||||
<xi:include href="libxslt/libxslt.rbuild" />
|
||||
</directory>
|
||||
<if property="NSWPAT" value="1">
|
||||
<directory name="dxtn">
|
||||
<xi:include href="dxtn/dxtn.rbuild" />
|
||||
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
Daniel Veillard:
|
||||
[email protected]
|
||||
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 libxml upon which this library is based.
|
||||
|
||||
Bjorn Reese:
|
||||
[email protected]
|
||||
http://home1.stofanet.dk/breese/
|
||||
Software developer at http://www.systematic.dk/
|
||||
Member of the XML-MTF Mapping WG.
|
||||
|
||||
William Brack <[email protected]>
|
||||
|
||||
Thomas Broyer <[email protected]>
|
||||
|
||||
Igor Zlatkovic <[email protected]> for the Windows port
|
||||
Vendored
+53
@@ -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.
|
||||
----------------------------------------------------------------------
|
||||
+7573
File diff suppressed because it is too large
Load Diff
+64
@@ -0,0 +1,64 @@
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/libxslt $(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 \
|
||||
xsltconfig.h \
|
||||
xsltexports.h
|
||||
|
||||
libxslt_la_SOURCES = \
|
||||
attrvt.c \
|
||||
xslt.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 \
|
||||
xsltwin32config.h.in \
|
||||
libxslt.h
|
||||
|
||||
libxslt_la_LIBADD = $(EXTRA_LIBS)
|
||||
libxslt_la_LDFLAGS = -version-info @LIBXSLT_VERSION_INFO@
|
||||
|
||||
man_MANS = libxslt.3
|
||||
|
||||
EXTRA_DIST = $(man_MANS) trio.h triodef.h
|
||||
|
||||
xsltproc: all
|
||||
@(cd ../xsltproc ; $(MAKE))
|
||||
|
||||
install-exec-hook:
|
||||
$(mkinstalldirs) "$(DESTDIR)$(libdir)/libxslt-plugins"
|
||||
+679
@@ -0,0 +1,679 @@
|
||||
# Makefile.in generated by automake 1.10 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = libxslt
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
||||
$(srcdir)/xsltconfig.h.in $(srcdir)/xsltwin32config.h.in \
|
||||
$(xsltinc_HEADERS)
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES = xsltconfig.h xsltwin32config.h
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
|
||||
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man3dir)" \
|
||||
"$(DESTDIR)$(xsltincdir)"
|
||||
libLTLIBRARIES_INSTALL = $(INSTALL)
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
am__DEPENDENCIES_1 =
|
||||
libxslt_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
|
||||
am_libxslt_la_OBJECTS = attrvt.lo xslt.lo xsltutils.lo pattern.lo \
|
||||
templates.lo variables.lo keys.lo numbers.lo extensions.lo \
|
||||
extra.lo functions.lo namespaces.lo imports.lo attributes.lo \
|
||||
documents.lo preproc.lo transform.lo security.lo
|
||||
libxslt_la_OBJECTS = $(am_libxslt_la_OBJECTS)
|
||||
libxslt_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(libxslt_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
SOURCES = $(libxslt_la_SOURCES)
|
||||
DIST_SOURCES = $(libxslt_la_SOURCES)
|
||||
man3dir = $(mandir)/man3
|
||||
NROFF = nroff
|
||||
MANS = $(man_MANS)
|
||||
xsltincHEADERS_INSTALL = $(INSTALL_HEADER)
|
||||
HEADERS = $(xsltinc_HEADERS)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
EXSLT_INCLUDEDIR = @EXSLT_INCLUDEDIR@
|
||||
EXSLT_LIBDIR = @EXSLT_LIBDIR@
|
||||
EXSLT_LIBS = @EXSLT_LIBS@
|
||||
EXTRA_LIBS = @EXTRA_LIBS@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
GREP = @GREP@
|
||||
HTML_DIR = @HTML_DIR@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBEXSLT_MAJOR_VERSION = @LIBEXSLT_MAJOR_VERSION@
|
||||
LIBEXSLT_MICRO_VERSION = @LIBEXSLT_MICRO_VERSION@
|
||||
LIBEXSLT_MINOR_VERSION = @LIBEXSLT_MINOR_VERSION@
|
||||
LIBEXSLT_VERSION = @LIBEXSLT_VERSION@
|
||||
LIBEXSLT_VERSION_EXTRA = @LIBEXSLT_VERSION_EXTRA@
|
||||
LIBEXSLT_VERSION_INFO = @LIBEXSLT_VERSION_INFO@
|
||||
LIBEXSLT_VERSION_NUMBER = @LIBEXSLT_VERSION_NUMBER@
|
||||
LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
|
||||
LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
|
||||
LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIBXML_CFLAGS = @LIBXML_CFLAGS@
|
||||
LIBXML_LIBS = @LIBXML_LIBS@
|
||||
LIBXML_REQUIRED_VERSION = @LIBXML_REQUIRED_VERSION@
|
||||
LIBXML_SRC = @LIBXML_SRC@
|
||||
LIBXSLT_DEFAULT_PLUGINS_PATH = @LIBXSLT_DEFAULT_PLUGINS_PATH@
|
||||
LIBXSLT_MAJOR_MINOR_VERSION = @LIBXSLT_MAJOR_MINOR_VERSION@
|
||||
LIBXSLT_MAJOR_VERSION = @LIBXSLT_MAJOR_VERSION@
|
||||
LIBXSLT_MICRO_VERSION = @LIBXSLT_MICRO_VERSION@
|
||||
LIBXSLT_MINOR_VERSION = @LIBXSLT_MINOR_VERSION@
|
||||
LIBXSLT_VERSION = @LIBXSLT_VERSION@
|
||||
LIBXSLT_VERSION_EXTRA = @LIBXSLT_VERSION_EXTRA@
|
||||
LIBXSLT_VERSION_INFO = @LIBXSLT_VERSION_INFO@
|
||||
LIBXSLT_VERSION_NUMBER = @LIBXSLT_VERSION_NUMBER@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MV = @MV@
|
||||
M_LIBS = @M_LIBS@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL = @PERL@
|
||||
PYTHON = @PYTHON@
|
||||
PYTHONSODV = @PYTHONSODV@
|
||||
PYTHON_INCLUDES = @PYTHON_INCLUDES@
|
||||
PYTHON_SITE_PACKAGES = @PYTHON_SITE_PACKAGES@
|
||||
PYTHON_SUBDIR = @PYTHON_SUBDIR@
|
||||
PYTHON_VERSION = @PYTHON_VERSION@
|
||||
RANLIB = @RANLIB@
|
||||
RELDATE = @RELDATE@
|
||||
RM = @RM@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STATIC_BINARIES = @STATIC_BINARIES@
|
||||
STRIP = @STRIP@
|
||||
TAR = @TAR@
|
||||
VERSION = @VERSION@
|
||||
WIN32_EXTRA_LDFLAGS = @WIN32_EXTRA_LDFLAGS@
|
||||
WIN32_EXTRA_LIBADD = @WIN32_EXTRA_LIBADD@
|
||||
WITH_CRYPTO = @WITH_CRYPTO@
|
||||
WITH_DEBUGGER = @WITH_DEBUGGER@
|
||||
WITH_MEM_DEBUG = @WITH_MEM_DEBUG@
|
||||
WITH_MODULES = @WITH_MODULES@
|
||||
WITH_TRIO = @WITH_TRIO@
|
||||
WITH_XSLT_DEBUG = @WITH_XSLT_DEBUG@
|
||||
XML_CONFIG = @XML_CONFIG@
|
||||
XSLTPROCDV = @XSLTPROCDV@
|
||||
XSLT_INCLUDEDIR = @XSLT_INCLUDEDIR@
|
||||
XSLT_LIBDIR = @XSLT_LIBDIR@
|
||||
XSLT_LIBS = @XSLT_LIBS@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
pythondir = @pythondir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/libxslt $(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 \
|
||||
xsltconfig.h \
|
||||
xsltexports.h
|
||||
|
||||
libxslt_la_SOURCES = \
|
||||
attrvt.c \
|
||||
xslt.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 \
|
||||
xsltwin32config.h.in \
|
||||
libxslt.h
|
||||
|
||||
libxslt_la_LIBADD = $(EXTRA_LIBS)
|
||||
libxslt_la_LDFLAGS = -version-info @LIBXSLT_VERSION_INFO@
|
||||
man_MANS = libxslt.3
|
||||
EXTRA_DIST = $(man_MANS) trio.h triodef.h
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libxslt/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu libxslt/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
xsltconfig.h: $(top_builddir)/config.status $(srcdir)/xsltconfig.h.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||
xsltwin32config.h: $(top_builddir)/config.status $(srcdir)/xsltwin32config.h.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
f=$(am__strip_dir) \
|
||||
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
|
||||
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
p=$(am__strip_dir) \
|
||||
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
|
||||
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
|
||||
done
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libxslt.la: $(libxslt_la_OBJECTS) $(libxslt_la_DEPENDENCIES)
|
||||
$(libxslt_la_LINK) -rpath $(libdir) $(libxslt_la_OBJECTS) $(libxslt_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attributes.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attrvt.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/documents.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extensions.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extra.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/functions.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imports.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keys.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/namespaces.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/numbers.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pattern.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/preproc.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/security.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/templates.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transform.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/variables.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xslt.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xsltutils.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-man3: $(man3_MANS) $(man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)"
|
||||
@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
|
||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||
for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.3*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
|
||||
else file=$$i; fi; \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
case "$$ext" in \
|
||||
3*) ;; \
|
||||
*) ext='3' ;; \
|
||||
esac; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \
|
||||
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst"; \
|
||||
done
|
||||
uninstall-man3:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
|
||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
||||
for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.3*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
case "$$ext" in \
|
||||
3*) ;; \
|
||||
*) ext='3' ;; \
|
||||
esac; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " rm -f '$(DESTDIR)$(man3dir)/$$inst'"; \
|
||||
rm -f "$(DESTDIR)$(man3dir)/$$inst"; \
|
||||
done
|
||||
install-xsltincHEADERS: $(xsltinc_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(xsltincdir)" || $(MKDIR_P) "$(DESTDIR)$(xsltincdir)"
|
||||
@list='$(xsltinc_HEADERS)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
f=$(am__strip_dir) \
|
||||
echo " $(xsltincHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(xsltincdir)/$$f'"; \
|
||||
$(xsltincHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(xsltincdir)/$$f"; \
|
||||
done
|
||||
|
||||
uninstall-xsltincHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(xsltinc_HEADERS)'; for p in $$list; do \
|
||||
f=$(am__strip_dir) \
|
||||
echo " rm -f '$(DESTDIR)$(xsltincdir)/$$f'"; \
|
||||
rm -f "$(DESTDIR)$(xsltincdir)/$$f"; \
|
||||
done
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(MANS) $(HEADERS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(xsltincdir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-man install-xsltincHEADERS
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-exec-am: install-libLTLIBRARIES
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man: install-man3
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-libLTLIBRARIES uninstall-man \
|
||||
uninstall-xsltincHEADERS
|
||||
|
||||
uninstall-man: uninstall-man3
|
||||
|
||||
.MAKE: install-am install-exec-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libLTLIBRARIES clean-libtool ctags distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-exec-hook \
|
||||
install-html install-html-am install-info install-info-am \
|
||||
install-libLTLIBRARIES install-man install-man3 install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
install-xsltincHEADERS installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am uninstall-libLTLIBRARIES uninstall-man \
|
||||
uninstall-man3 uninstall-xsltincHEADERS
|
||||
|
||||
|
||||
xsltproc: all
|
||||
@(cd ../xsltproc ; $(MAKE))
|
||||
|
||||
install-exec-hook:
|
||||
$(mkinstalldirs) "$(DESTDIR)$(libdir)/libxslt-plugins"
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
Vendored
+790
@@ -0,0 +1,790 @@
|
||||
|
||||
NEWS file for libxslt
|
||||
|
||||
Note that this is automatically generated from the news webpage at:
|
||||
http://xmlsoft.org/XSLT/news.html
|
||||
|
||||
The change log at
|
||||
ChangeLog.html
|
||||
describes the recents commits
|
||||
to the SVN at
|
||||
http://svn.gnome.org/viewcvs/libxslt/trunk/
|
||||
code base.Those are the public releases made:
|
||||
1.1.24: May 13 20088:
|
||||
- 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 " (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
|
||||
Vendored
+24
@@ -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 [email protected] 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: README,v 1.7 2003/02/04 17:20:01 veillard Exp $
|
||||
+1132
File diff suppressed because it is too large
Load Diff
+38
@@ -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 <libxml/tree.h>
|
||||
#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__ */
|
||||
|
||||
+377
@@ -0,0 +1,377 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* [email protected]
|
||||
*/
|
||||
|
||||
#define IN_LIBXSLT
|
||||
#include "libxslt.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
#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 != '}')) 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);
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
#include <win32config.h>
|
||||
+434
@@ -0,0 +1,434 @@
|
||||
/*
|
||||
* documents.c: Implementation of the documents handling
|
||||
*
|
||||
* See Copyright for the status of this software.
|
||||
*
|
||||
* [email protected]
|
||||
*/
|
||||
|
||||
#define IN_LIBXSLT
|
||||
#include "libxslt.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/hash.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#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 <libxml/xinclude.h>
|
||||
#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);
|
||||
}
|
||||
|
||||
+93
@@ -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 <libxml/tree.h>
|
||||
#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__ */
|
||||
|
||||
+2196
File diff suppressed because it is too large
Load Diff
+256
@@ -0,0 +1,256 @@
|
||||
/*
|
||||
* 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 <libxml/xpath.h>
|
||||
#include "xsltexports.h"
|
||||
#include "xsltInternals.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Extension Modules API.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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
|
||||
xsltExtFunctionLookup (xsltTransformContextPtr ctxt,
|
||||
const xmlChar *name,
|
||||
const xmlChar *URI);
|
||||
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__ */
|
||||
|
||||
Vendored
+330
@@ -0,0 +1,330 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* [email protected]
|
||||
*/
|
||||
|
||||
#define IN_LIBXSLT
|
||||
#include "libxslt.h"
|
||||
|
||||
#include <string.h>
|
||||
#ifdef HAVE_TIME_H
|
||||
#define __USE_XOPEN
|
||||
#include <time.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/hash.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#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: 2002-10-15 18:06:47 +0200 (Tue, 15 Oct 2002) $" */
|
||||
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
|
||||
*/
|
||||
lmt = gmt - timezone;
|
||||
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
Vendored
+80
@@ -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 <libxml/xpath.h>
|
||||
#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__ */
|
||||
|
||||
+973
@@ -0,0 +1,973 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* [email protected]
|
||||
* Bjorn Reese <[email protected]> for number formatting
|
||||
*/
|
||||
|
||||
#define IN_LIBXSLT
|
||||
#include "libxslt.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_CTYPE_H
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/valid.h>
|
||||
#include <libxml/hash.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#include <libxml/uri.h>
|
||||
#include <libxml/xpointer.h>
|
||||
#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 <grin/>
|
||||
*/
|
||||
#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
|
||||
xmlFree(fragment);
|
||||
|
||||
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);
|
||||
return;
|
||||
|
||||
out_object:
|
||||
xmlXPathFreeObject(resObj);
|
||||
|
||||
out_fragment:
|
||||
valuePush(ctxt, xmlXPathNewNodeSet(NULL));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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->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);
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
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 {
|
||||
xsltTransformContextPtr tctxt;
|
||||
|
||||
tctxt = xsltXPathGetTransformContext(ctxt);
|
||||
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) {
|
||||
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){
|
||||
xmlNodePtr cur = NULL;
|
||||
unsigned long val;
|
||||
xmlChar str[20];
|
||||
|
||||
if (nargs == 0) {
|
||||
cur = ctxt->context->node;
|
||||
} else if (nargs == 1) {
|
||||
xmlXPathObjectPtr obj;
|
||||
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];
|
||||
}
|
||||
xmlXPathFreeObject(obj);
|
||||
} else {
|
||||
xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL,
|
||||
"generate-id() : invalid number of args %d\n", nargs);
|
||||
ctxt->error = XPATH_INVALID_ARITY;
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* Okay this is ugly but should work, use the NodePtr address
|
||||
* to forge the ID
|
||||
*/
|
||||
val = (unsigned long)((char *)cur - (char *)0);
|
||||
val /= sizeof(xmlNode);
|
||||
sprintf((char *)str, "id%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 *)""));
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
+78
@@ -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 <[email protected]>
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_FUNCTIONS_H__
|
||||
#define __XML_XSLT_FUNCTIONS_H__
|
||||
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
#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__ */
|
||||
|
||||
+414
@@ -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.
|
||||
*
|
||||
* [email protected]
|
||||
*/
|
||||
|
||||
#define IN_LIBXSLT
|
||||
#include "libxslt.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_MATH_H
|
||||
#include <math.h>
|
||||
#endif
|
||||
#ifdef HAVE_FLOAT_H
|
||||
#include <float.h>
|
||||
#endif
|
||||
#ifdef HAVE_IEEEFP_H
|
||||
#include <ieeefp.h>
|
||||
#endif
|
||||
#ifdef HAVE_NAN_H
|
||||
#include <nan.h>
|
||||
#endif
|
||||
#ifdef HAVE_CTYPE_H
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/hash.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/uri.h>
|
||||
#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);
|
||||
} 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) {
|
||||
cur = style->templates;
|
||||
while (cur != NULL) {
|
||||
if (xmlStrEqual(name, cur->name)) {
|
||||
if (((nameURI == NULL) && (cur->nameURI == NULL)) ||
|
||||
((nameURI != NULL) && (cur->nameURI != NULL) &&
|
||||
(xmlStrEqual(nameURI, cur->nameURI)))) {
|
||||
return(cur);
|
||||
}
|
||||
}
|
||||
cur = cur->next;
|
||||
}
|
||||
|
||||
style = xsltNextImport(style);
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
+75
@@ -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 <libxml/tree.h>
|
||||
#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__ */
|
||||
|
||||
Vendored
+916
@@ -0,0 +1,916 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* [email protected]
|
||||
*/
|
||||
|
||||
#define IN_LIBXSLT
|
||||
#include "libxslt.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/valid.h>
|
||||
#include <libxml/hash.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
#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,
|
||||
"key pattern is malformed: %s",
|
||||
key->match);
|
||||
if (style != NULL) style->errors++;
|
||||
goto error;
|
||||
}
|
||||
} else
|
||||
end++;
|
||||
}
|
||||
if (current == end) {
|
||||
xsltTransformError(NULL, style, inst,
|
||||
"key 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;
|
||||
}
|
||||
#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.
|
||||
*/
|
||||
key->comp = xsltXPathCompile(style, pattern);
|
||||
if (key->comp == NULL) {
|
||||
xsltTransformError(NULL, style, inst,
|
||||
"xsl:key : XPath pattern compilation failed '%s'\n",
|
||||
pattern);
|
||||
if (style != NULL) style->errors++;
|
||||
}
|
||||
key->usecomp = xsltXPathCompile(style, use);
|
||||
if (key->usecomp == NULL) {
|
||||
xsltTransformError(NULL, style, inst,
|
||||
"xsl:key : XPath pattern 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->inst,
|
||||
"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:
|
||||
*
|
||||
* INTERNAL ROUTINE ONLY
|
||||
*
|
||||
* Check if any keys on the current document need to be computed
|
||||
*/
|
||||
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;
|
||||
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);
|
||||
}
|
||||
|
||||
Vendored
+53
@@ -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 <libxml/xpath.h>
|
||||
#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__ */
|
||||
|
||||
+31
@@ -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 ([email protected]).
|
||||
If you download and install this package look at instructions on the
|
||||
Web site http://xmlsoft.org/XSLT/ .
|
||||
Manual page by Heiko W. Rupp ([email protected])
|
||||
.SH SEE ALSO
|
||||
.IR libexslt (3),
|
||||
.IR libxml (3),
|
||||
.IR xsltproc (1),
|
||||
.IR xmllint (1)
|
||||
.\" end of manual page
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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 <win32config.h>
|
||||
#else
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "xsltconfig.h"
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#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
|
||||
|
||||
#endif /* ! __XSLT_LIBXSLT_H__ */
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||
<module name="libxslt" type="win32dll" entrypoint="0" installbase="system32" installname="libxslt.dll" allowwarnings="true" crt="msvcrt">
|
||||
<define name="HAVE_CONFIG_H" />
|
||||
<define name="WIN32" />
|
||||
<define name="_WINDOWS" />
|
||||
<define name="_MBCS" />
|
||||
<define name="HAVE_WIN32_THREADS" />
|
||||
<define name="_REENTRANT" />
|
||||
<define name="_WINSOCKAPI_" />
|
||||
<define name="LIBXML_STATIC" />
|
||||
<include base="libxslt">include</include>
|
||||
<include base="libxslt">.</include>
|
||||
<library>libxml2</library>
|
||||
<library>ws2_32</library>
|
||||
<file>attributes.c</file>
|
||||
<file>attrvt.c</file>
|
||||
<file>documents.c</file>
|
||||
<file>extensions.c</file>
|
||||
<file>extra.c</file>
|
||||
<file>functions.c</file>
|
||||
<file>imports.c</file>
|
||||
<file>keys.c</file>
|
||||
<file>namespaces.c</file>
|
||||
<file>numbers.c</file>
|
||||
<file>pattern.c</file>
|
||||
<file>preproc.c</file>
|
||||
<file>security.c</file>
|
||||
<file>templates.c</file>
|
||||
<file>transform.c</file>
|
||||
<file>variables.c</file>
|
||||
<file>xslt.c</file>
|
||||
<file>xsltutils.c</file>
|
||||
</module>
|
||||
+847
@@ -0,0 +1,847 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* [email protected]
|
||||
*/
|
||||
|
||||
#define IN_LIBXSLT
|
||||
#include "libxslt.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_MATH_H
|
||||
#include <math.h>
|
||||
#endif
|
||||
#ifdef HAVE_FLOAT_H
|
||||
#include <float.h>
|
||||
#endif
|
||||
#ifdef HAVE_IEEEFP_H
|
||||
#include <ieeefp.h>
|
||||
#endif
|
||||
#ifdef HAVE_NAN_H
|
||||
#include <nan.h>
|
||||
#endif
|
||||
#ifdef HAVE_CTYPE_H
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
#ifndef XSLT_NEED_TRIO
|
||||
#include <stdio.h>
|
||||
#else
|
||||
#include <trio.h>
|
||||
#endif
|
||||
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/hash.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/uri.h>
|
||||
#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:
|
||||
* <xsl:namespace-alias stylesheet-prefix="foo"
|
||||
* result-prefix="bar"/>
|
||||
*
|
||||
* <xsl:namespace-alias stylesheet-prefix="foo"
|
||||
* result-prefix="zar"/>
|
||||
*
|
||||
* Same target namespace URI for multiple different aliases:
|
||||
* All alias-definitions will be used.
|
||||
* Example:
|
||||
* <xsl:namespace-alias stylesheet-prefix="bar"
|
||||
* result-prefix="foo"/>
|
||||
*
|
||||
* <xsl:namespace-alias stylesheet-prefix="zar"
|
||||
* result-prefix="foo"/>
|
||||
* Cases using #default:
|
||||
* <xsl:namespace-alias stylesheet-prefix="#default"
|
||||
* result-prefix="#default"/>
|
||||
* TODO: Has this an effect at all?
|
||||
*
|
||||
* <xsl:namespace-alias stylesheet-prefix="foo"
|
||||
* result-prefix="#default"/>
|
||||
* From namespace to no namespace.
|
||||
*
|
||||
* <xsl:namespace-alias stylesheet-prefix="#default"
|
||||
* result-prefix="foo"/>
|
||||
* 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:
|
||||
* <xsl:namespace-alias result-prefix="foo"
|
||||
* stylesheet-prefix="#default"/>
|
||||
* <xsl:namespace-alias result-prefix="bar"
|
||||
* stylesheet-prefix="#default"/>
|
||||
* 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.
|
||||
* <foo xmlns:a="urn:test:a">
|
||||
* <bar a:a="val-a">
|
||||
* <xsl:attribute xmlns:a="urn:test:b" name="a:b">
|
||||
* val-b</xsl:attribute>
|
||||
* </bar>
|
||||
* </foo>
|
||||
*/
|
||||
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;
|
||||
|
||||
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)
|
||||
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;
|
||||
}
|
||||
+68
@@ -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 <libxml/tree.h>
|
||||
#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__ */
|
||||
|
||||
+1351
File diff suppressed because it is too large
Load Diff
+69
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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 <[email protected]> and Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_NUMBERSINTERNALS_H__
|
||||
#define __XML_XSLT_NUMBERSINTERNALS_H__
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include "xsltexports.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/*
|
||||
* 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__ */
|
||||
+2619
File diff suppressed because it is too large
Load Diff
+81
@@ -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__ */
|
||||
|
||||
+2340
File diff suppressed because it is too large
Load Diff
+43
@@ -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 <libxml/tree.h>
|
||||
#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__ */
|
||||
|
||||
+475
@@ -0,0 +1,475 @@
|
||||
/*
|
||||
* security.c: Implementation of the XSLT security framework
|
||||
*
|
||||
* See Copyright for the status of this software.
|
||||
*
|
||||
* [email protected]
|
||||
*/
|
||||
|
||||
#define IN_LIBXSLT
|
||||
#include "libxslt.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MATH_H
|
||||
#include <math.h>
|
||||
#endif
|
||||
#ifdef HAVE_FLOAT_H
|
||||
#include <float.h>
|
||||
#endif
|
||||
#ifdef HAVE_IEEEFP_H
|
||||
#include <ieeefp.h>
|
||||
#endif
|
||||
#ifdef HAVE_NAN_H
|
||||
#include <nan.h>
|
||||
#endif
|
||||
#ifdef HAVE_CTYPE_H
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
#include <windows.h>
|
||||
#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 <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/uri.h>
|
||||
#include "xslt.h"
|
||||
#include "xsltInternals.h"
|
||||
#include "xsltutils.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;
|
||||
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
|
||||
+104
@@ -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 <libxml/tree.h>
|
||||
#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__ */
|
||||
|
||||
+822
@@ -0,0 +1,822 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* [email protected]
|
||||
*/
|
||||
|
||||
#define IN_LIBXSLT
|
||||
#include "libxslt.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/globals.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#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))
|
||||
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 != '}')) 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))
|
||||
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))
|
||||
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))
|
||||
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)) {
|
||||
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))
|
||||
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))
|
||||
{
|
||||
text->content = (xmlChar *) value;
|
||||
} else {
|
||||
text->content = xmlStrdup(value);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
+77
@@ -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 <libxml/xpath.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
#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__ */
|
||||
|
||||
+6457
File diff suppressed because it is too large
Load Diff
+203
@@ -0,0 +1,203 @@
|
||||
/*
|
||||
* 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 <libxml/parser.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#include "xsltexports.h"
|
||||
#include <libxslt/xsltInternals.h>
|
||||
|
||||
#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);
|
||||
/**
|
||||
* 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__ */
|
||||
|
||||
Vendored
+216
@@ -0,0 +1,216 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $Id: trio.h 897 2003-04-07 12:41:56Z veillard $
|
||||
*
|
||||
* 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 <config.h>
|
||||
#endif
|
||||
|
||||
#include "triodef.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if defined(TRIO_COMPILER_ANCIENT)
|
||||
# include <varargs.h>
|
||||
#else
|
||||
# include <stdarg.h>
|
||||
#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 <stdio.h> 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 */
|
||||
+220
@@ -0,0 +1,220 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* $Id: triodef.h 912 2003-04-26 12:06:36Z veillard $
|
||||
*
|
||||
* Copyright (C) 2001 Bjorn Reese <breese@users.sourceforge.net>
|
||||
*
|
||||
* 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 */
|
||||
+2308
File diff suppressed because it is too large
Load Diff
+91
@@ -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 <libxml/xpath.h>
|
||||
#include <libxml/xpathInternals.h>
|
||||
#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__ */
|
||||
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* 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 <io.h>
|
||||
|
||||
#define HAVE_ISINF
|
||||
#define HAVE_ISNAN
|
||||
|
||||
#include <math.h>
|
||||
#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 <float.h>
|
||||
/* 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 <direct.h>
|
||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
#define mkdir(p,m) _mkdir(p)
|
||||
#define snprintf _snprintf
|
||||
#if _MSC_VER < 1500
|
||||
#define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define HAVE_SYS_STAT_H
|
||||
#define HAVE__STAT
|
||||
#define HAVE_STRING_H
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#define ATTRIBUTE_UNUSED
|
||||
#endif
|
||||
|
||||
#endif /* __LIBXSLT_WIN32_CONFIG__ */
|
||||
|
||||
Vendored
+6923
File diff suppressed because it is too large
Load Diff
Vendored
+103
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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 <libxml/tree.h>
|
||||
#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 ((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;
|
||||
|
||||
/**
|
||||
* 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__ */
|
||||
|
||||
+1970
File diff suppressed because it is too large
Load Diff
+159
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* 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 "1.1.24"
|
||||
|
||||
/**
|
||||
* LIBXSLT_VERSION:
|
||||
*
|
||||
* the version number: 1.2.3 value is 10203
|
||||
*/
|
||||
#define LIBXSLT_VERSION 10124
|
||||
|
||||
/**
|
||||
* LIBXSLT_VERSION_STRING:
|
||||
*
|
||||
* the version number string, 1.2.3 value is "10203"
|
||||
*/
|
||||
#define LIBXSLT_VERSION_STRING "10124"
|
||||
|
||||
/**
|
||||
* LIBXSLT_VERSION_EXTRA:
|
||||
*
|
||||
* extra version information, used to show a CVS compilation
|
||||
*/
|
||||
#define LIBXSLT_VERSION_EXTRA "-CVS1070"
|
||||
|
||||
/**
|
||||
* 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 1
|
||||
#define WITH_XSLT_DEBUG
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
/**
|
||||
* 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 0
|
||||
#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 1
|
||||
#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 0
|
||||
#ifndef WITH_MODULES
|
||||
#define WITH_MODULES
|
||||
#endif
|
||||
#define LIBXSLT_DEFAULT_PLUGINS_PATH() "/usr/lib/libxslt-plugins"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_UNUSED:
|
||||
*
|
||||
* This macro is used to flag unused function parameters to GCC
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
#ifdef HAVE_ANSIDECL_H
|
||||
#include <ansidecl.h>
|
||||
#endif
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#define ATTRIBUTE_UNUSED __attribute__((unused))
|
||||
#endif
|
||||
#else
|
||||
#define ATTRIBUTE_UNUSED
|
||||
#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__ */
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_UNUSED:
|
||||
*
|
||||
* This macro is used to flag unused function parameters to GCC
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
#ifdef HAVE_ANSIDECL_H
|
||||
#include <ansidecl.h>
|
||||
#endif
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#define ATTRIBUTE_UNUSED __attribute__((unused))
|
||||
#endif
|
||||
#else
|
||||
#define ATTRIBUTE_UNUSED
|
||||
#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__ */
|
||||
+142
@@ -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 <igor@zlatkovic.com>
|
||||
*/
|
||||
|
||||
#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__ */
|
||||
|
||||
|
||||
+2265
File diff suppressed because it is too large
Load Diff
+309
@@ -0,0 +1,309 @@
|
||||
/*
|
||||
* Summary: set of utilities for the XSLT engine
|
||||
* Description: interfaces for the utilities module of the XSLT engine.
|
||||
* things like message handling, profiling, and other
|
||||
* generally useful routines.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLTUTILS_H__
|
||||
#define __XML_XSLTUTILS_H__
|
||||
|
||||
#include <libxslt/xsltconfig.h>
|
||||
#ifdef HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/dict.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include "xsltexports.h"
|
||||
#include "xsltInternals.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* XSLT_TODO:
|
||||
*
|
||||
* Macro to flag unimplemented blocks.
|
||||
*/
|
||||
#define XSLT_TODO \
|
||||
xsltGenericError(xsltGenericErrorContext, \
|
||||
"Unimplemented block at %s:%d\n", \
|
||||
__FILE__, __LINE__);
|
||||
|
||||
/**
|
||||
* XSLT_STRANGE:
|
||||
*
|
||||
* Macro to flag that a problem was detected internally.
|
||||
*/
|
||||
#define XSLT_STRANGE \
|
||||
xsltGenericError(xsltGenericErrorContext, \
|
||||
"Internal error at %s:%d\n", \
|
||||
__FILE__, __LINE__);
|
||||
|
||||
/**
|
||||
* IS_XSLT_ELEM:
|
||||
*
|
||||
* Checks that the element pertains to XSLT namespace.
|
||||
*/
|
||||
#define IS_XSLT_ELEM(n) \
|
||||
(((n) != NULL) && ((n)->ns != NULL) && \
|
||||
(xmlStrEqual((n)->ns->href, XSLT_NAMESPACE)))
|
||||
|
||||
/**
|
||||
* IS_XSLT_NAME:
|
||||
*
|
||||
* Checks the value of an element in XSLT namespace.
|
||||
*/
|
||||
#define IS_XSLT_NAME(n, val) \
|
||||
(xmlStrEqual((n)->name, (const xmlChar *) (val)))
|
||||
|
||||
/**
|
||||
* IS_XSLT_REAL_NODE:
|
||||
*
|
||||
* Check that a node is a 'real' one: document, element, text or attribute.
|
||||
*/
|
||||
#define IS_XSLT_REAL_NODE(n) \
|
||||
(((n) != NULL) && \
|
||||
(((n)->type == XML_ELEMENT_NODE) || \
|
||||
((n)->type == XML_TEXT_NODE) || \
|
||||
((n)->type == XML_CDATA_SECTION_NODE) || \
|
||||
((n)->type == XML_ATTRIBUTE_NODE) || \
|
||||
((n)->type == XML_DOCUMENT_NODE) || \
|
||||
((n)->type == XML_HTML_DOCUMENT_NODE) || \
|
||||
((n)->type == XML_COMMENT_NODE) || \
|
||||
((n)->type == XML_PI_NODE)))
|
||||
|
||||
/*
|
||||
* Our own version of namespaced atributes lookup.
|
||||
*/
|
||||
XSLTPUBFUN xmlChar * XSLTCALL
|
||||
xsltGetNsProp (xmlNodePtr node,
|
||||
const xmlChar *name,
|
||||
const xmlChar *nameSpace);
|
||||
XSLTPUBFUN const xmlChar * XSLTCALL
|
||||
xsltGetCNsProp (xsltStylesheetPtr style,
|
||||
xmlNodePtr node,
|
||||
const xmlChar *name,
|
||||
const xmlChar *nameSpace);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltGetUTF8Char (const unsigned char *utf,
|
||||
int *len);
|
||||
|
||||
/*
|
||||
* XSLT Debug Tracing Tracing Types
|
||||
*/
|
||||
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:
|
||||
*
|
||||
* Control the type of xsl debugtrace messages emitted.
|
||||
*/
|
||||
#define XSLT_TRACE(ctxt,code,call) \
|
||||
if (ctxt->traceCode && (*(ctxt->traceCode) & code)) \
|
||||
call
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltDebugSetDefaultTrace(xsltDebugTraceCodes val);
|
||||
XSLTPUBFUN xsltDebugTraceCodes XSLTCALL
|
||||
xsltDebugGetDefaultTrace(void);
|
||||
|
||||
/*
|
||||
* XSLT specific error and debug reporting functions.
|
||||
*/
|
||||
XSLTPUBVAR xmlGenericErrorFunc xsltGenericError;
|
||||
XSLTPUBVAR void *xsltGenericErrorContext;
|
||||
XSLTPUBVAR xmlGenericErrorFunc xsltGenericDebug;
|
||||
XSLTPUBVAR void *xsltGenericDebugContext;
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltPrintErrorContext (xsltTransformContextPtr ctxt,
|
||||
xsltStylesheetPtr style,
|
||||
xmlNodePtr node);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltMessage (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetGenericErrorFunc (void *ctx,
|
||||
xmlGenericErrorFunc handler);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetGenericDebugFunc (void *ctx,
|
||||
xmlGenericErrorFunc handler);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetTransformErrorFunc (xsltTransformContextPtr ctxt,
|
||||
void *ctx,
|
||||
xmlGenericErrorFunc handler);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltTransformError (xsltTransformContextPtr ctxt,
|
||||
xsltStylesheetPtr style,
|
||||
xmlNodePtr node,
|
||||
const char *msg,
|
||||
...);
|
||||
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSetCtxtParseOptions (xsltTransformContextPtr ctxt,
|
||||
int options);
|
||||
/*
|
||||
* Sorting.
|
||||
*/
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltDocumentSortFunction (xmlNodeSetPtr list);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetSortFunc (xsltSortFunc handler);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetCtxtSortFunc (xsltTransformContextPtr ctxt,
|
||||
xsltSortFunc handler);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltDefaultSortFunction (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr *sorts,
|
||||
int nbsorts);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltDoSortFunction (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr * sorts,
|
||||
int nbsorts);
|
||||
XSLTPUBFUN xmlXPathObjectPtr * XSLTCALL
|
||||
xsltComputeSortResult (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr sort);
|
||||
|
||||
/*
|
||||
* QNames handling.
|
||||
*/
|
||||
|
||||
XSLTPUBFUN const xmlChar * XSLTCALL
|
||||
xsltSplitQName (xmlDictPtr dict,
|
||||
const xmlChar *name,
|
||||
const xmlChar **prefix);
|
||||
XSLTPUBFUN const xmlChar * XSLTCALL
|
||||
xsltGetQNameURI (xmlNodePtr node,
|
||||
xmlChar **name);
|
||||
|
||||
XSLTPUBFUN const xmlChar * XSLTCALL
|
||||
xsltGetQNameURI2 (xsltStylesheetPtr style,
|
||||
xmlNodePtr node,
|
||||
const xmlChar **name);
|
||||
|
||||
/*
|
||||
* Output, reuse libxml I/O buffers.
|
||||
*/
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSaveResultTo (xmlOutputBufferPtr buf,
|
||||
xmlDocPtr result,
|
||||
xsltStylesheetPtr style);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSaveResultToFilename (const char *URI,
|
||||
xmlDocPtr result,
|
||||
xsltStylesheetPtr style,
|
||||
int compression);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSaveResultToFile (FILE *file,
|
||||
xmlDocPtr result,
|
||||
xsltStylesheetPtr style);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSaveResultToFd (int fd,
|
||||
xmlDocPtr result,
|
||||
xsltStylesheetPtr style);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSaveResultToString (xmlChar **doc_txt_ptr,
|
||||
int * doc_txt_len,
|
||||
xmlDocPtr result,
|
||||
xsltStylesheetPtr style);
|
||||
|
||||
/*
|
||||
* XPath interface
|
||||
*/
|
||||
XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL
|
||||
xsltXPathCompile (xsltStylesheetPtr style,
|
||||
const xmlChar *str);
|
||||
|
||||
/*
|
||||
* Profiling.
|
||||
*/
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSaveProfiling (xsltTransformContextPtr ctxt,
|
||||
FILE *output);
|
||||
XSLTPUBFUN xmlDocPtr XSLTCALL
|
||||
xsltGetProfileInformation (xsltTransformContextPtr ctxt);
|
||||
|
||||
XSLTPUBFUN long XSLTCALL
|
||||
xsltTimestamp (void);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltCalibrateAdjust (long delta);
|
||||
|
||||
/**
|
||||
* XSLT_TIMESTAMP_TICS_PER_SEC:
|
||||
*
|
||||
* Sampling precision for profiling
|
||||
*/
|
||||
#define XSLT_TIMESTAMP_TICS_PER_SEC 100000l
|
||||
|
||||
/*
|
||||
* Hooks for the debugger.
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
XSLTPUBVAR int xslDebugStatus;
|
||||
|
||||
typedef void (*xsltHandleDebuggerCallback) (xmlNodePtr cur, xmlNodePtr node,
|
||||
xsltTemplatePtr templ, xsltTransformContextPtr ctxt);
|
||||
typedef int (*xsltAddCallCallback) (xsltTemplatePtr templ, xmlNodePtr source);
|
||||
typedef void (*xsltDropCallCallback) (void);
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetDebuggerStatus (int value);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltGetDebuggerStatus (void);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSetDebuggerCallbacks (int no, void *block);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xslAddCall (xsltTemplatePtr templ,
|
||||
xmlNodePtr source);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xslDropCall (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLTUTILS_H__ */
|
||||
|
||||
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Summary: compile-time version informations for the XSLT engine
|
||||
* when compiled on windows
|
||||
* Description: compile-time version informations for the XSLT engine
|
||||
* when compiled on windows. This file is generated.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLTWIN32CONFIG_H__
|
||||
#define __XML_XSLTWIN32CONFIG_H__
|
||||
|
||||
#include "win32config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXSLT_DOTTED_VERSION:
|
||||
*
|
||||
* the version string like "1.2.3"
|
||||
*/
|
||||
#define LIBXSLT_DOTTED_VERSION "1.1.24"
|
||||
|
||||
/**
|
||||
* LIBXSLT_VERSION:
|
||||
*
|
||||
* the version number: 1.2.3 value is 1002003
|
||||
*/
|
||||
#define LIBXSLT_VERSION 10124
|
||||
|
||||
/**
|
||||
* LIBXSLT_VERSION_STRING:
|
||||
*
|
||||
* the version number string, 1.2.3 value is "1002003"
|
||||
*/
|
||||
#define LIBXSLT_VERSION_STRING "10124"
|
||||
|
||||
/**
|
||||
* LIBXSLT_VERSION_EXTRA:
|
||||
*
|
||||
* extra version information, used to show a CVS compilation
|
||||
*/
|
||||
#define LIBXSLT_VERSION_EXTRA "-win32"
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
#if 0
|
||||
#define WITH_XSLT_DEBUG
|
||||
#endif
|
||||
|
||||
/**
|
||||
* WITH_MODULES:
|
||||
*
|
||||
* Whether module support is configured into libxslt
|
||||
*/
|
||||
#if 0
|
||||
#ifndef WITH_MODULES
|
||||
#define WITH_MODULES
|
||||
#endif
|
||||
#define LIBXSLT_PLUGINS_PATH() getenv("LIBXSLT_PLUGINS_PATH")
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* 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
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_UNUSED:
|
||||
*
|
||||
* This macro is used to flag unused function parameters to GCC, useless here
|
||||
*/
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#define ATTRIBUTE_UNUSED
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLTWIN32CONFIG_H__ */
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Summary: compile-time version informations for the XSLT engine
|
||||
* when compiled on windows
|
||||
* Description: compile-time version informations for the XSLT engine
|
||||
* when compiled on windows. This file is generated.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLTWIN32CONFIG_H__
|
||||
#define __XML_XSLTWIN32CONFIG_H__
|
||||
|
||||
#include "win32config.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 1002003
|
||||
*/
|
||||
#define LIBXSLT_VERSION @LIBXSLT_VERSION_NUMBER@
|
||||
|
||||
/**
|
||||
* LIBXSLT_VERSION_STRING:
|
||||
*
|
||||
* the version number string, 1.2.3 value is "1002003"
|
||||
*/
|
||||
#define LIBXSLT_VERSION_STRING "@LIBXSLT_VERSION_NUMBER@"
|
||||
|
||||
/**
|
||||
* LIBXSLT_VERSION_EXTRA:
|
||||
*
|
||||
* extra version information, used to show a CVS compilation
|
||||
*/
|
||||
#define LIBXSLT_VERSION_EXTRA "-win32"
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
#if 1
|
||||
#define WITH_XSLT_DEBUG
|
||||
#endif
|
||||
|
||||
/**
|
||||
* WITH_MODULES:
|
||||
*
|
||||
* Whether module support is configured into libxslt
|
||||
*/
|
||||
#if @WITH_MODULES@
|
||||
#ifndef WITH_MODULES
|
||||
#define WITH_MODULES
|
||||
#endif
|
||||
#define LIBXSLT_PLUGINS_PATH() getenv("LIBXSLT_PLUGINS_PATH")
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* 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
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_UNUSED:
|
||||
*
|
||||
* This macro is used to flag unused function parameters to GCC, useless here
|
||||
*/
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#define ATTRIBUTE_UNUSED
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLTWIN32CONFIG_H__ */
|
||||
@@ -10,7 +10,9 @@
|
||||
<define name="_WIN32_WINNT">0x601</define>
|
||||
<define name="LIBXML_STATIC" />
|
||||
<library>libxml2</library>
|
||||
<library>libxslt</library>
|
||||
<library>wine</library>
|
||||
<library>wineldr</library>
|
||||
<library>urlmon</library>
|
||||
<library>wininet</library>
|
||||
<library>ws2_32</library>
|
||||
|
||||
@@ -89,7 +89,7 @@ interface IMXWriter;
|
||||
cpp_quote("#define DOMDocument DOMDocument2")
|
||||
cpp_quote("#define CLSID_DOMDocument CLSID_DOMDocument2")
|
||||
|
||||
cpp_quote("#ifndef __xmldom_h__")
|
||||
cpp_quote("#ifndef __WIDL_XMLDOM_H")
|
||||
typedef enum tagDOMNodeType
|
||||
{
|
||||
NODE_INVALID = 0,
|
||||
@@ -106,7 +106,7 @@ typedef enum tagDOMNodeType
|
||||
NODE_DOCUMENT_FRAGMENT = 11,
|
||||
NODE_NOTATION = 12
|
||||
} DOMNodeType;
|
||||
cpp_quote("#endif /* __xmldom_h__ */")
|
||||
cpp_quote("#endif /* __WIDL_XMLDOM_H */")
|
||||
|
||||
[
|
||||
local,
|
||||
|
||||
@@ -594,7 +594,7 @@ typedef void (*cdataBlockSAXFunc) (
|
||||
* Display and format a warning messages, callback.
|
||||
*/
|
||||
typedef void (XMLCDECL *warningSAXFunc) (void *ctx,
|
||||
const char *msg, ...);
|
||||
const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
|
||||
/**
|
||||
* errorSAXFunc:
|
||||
* @ctx: an XML parser context
|
||||
@@ -604,7 +604,7 @@ typedef void (XMLCDECL *warningSAXFunc) (void *ctx,
|
||||
* Display and format an error messages, callback.
|
||||
*/
|
||||
typedef void (XMLCDECL *errorSAXFunc) (void *ctx,
|
||||
const char *msg, ...);
|
||||
const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
|
||||
/**
|
||||
* fatalErrorSAXFunc:
|
||||
* @ctx: an XML parser context
|
||||
@@ -616,7 +616,7 @@ typedef void (XMLCDECL *errorSAXFunc) (void *ctx,
|
||||
* get all the callbacks for errors.
|
||||
*/
|
||||
typedef void (XMLCDECL *fatalErrorSAXFunc) (void *ctx,
|
||||
const char *msg, ...);
|
||||
const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
|
||||
/**
|
||||
* isStandaloneSAXFunc:
|
||||
* @ctx: the user data (XML parser context)
|
||||
@@ -1096,7 +1096,8 @@ typedef enum {
|
||||
crash if you try to modify the tree) */
|
||||
XML_PARSE_OLD10 = 1<<17,/* parse using XML-1.0 before update 5 */
|
||||
XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */
|
||||
XML_PARSE_HUGE = 1<<19 /* relax any hardcoded limit from the parser */
|
||||
XML_PARSE_HUGE = 1<<19, /* relax any hardcoded limit from the parser */
|
||||
XML_PARSE_OLDSAX = 1<<20 /* parse using SAX2 interface from before 2.7.0 */
|
||||
} xmlParserOption;
|
||||
|
||||
XMLPUBFUN void XMLCALL
|
||||
|
||||
@@ -24,18 +24,27 @@ extern "C" {
|
||||
/**
|
||||
* xmlParserMaxDepth:
|
||||
*
|
||||
* arbitrary depth limit for the XML documents that we allow to
|
||||
* process. This is not a limitation of the parser but a safety
|
||||
* boundary feature.
|
||||
* arbitrary depth limit for the XML documents that we allow to
|
||||
* process. This is not a limitation of the parser but a safety
|
||||
* boundary feature, use XML_PARSE_HUGE option to override it.
|
||||
*/
|
||||
XMLPUBVAR unsigned int xmlParserMaxDepth;
|
||||
|
||||
/**
|
||||
* XML_MAX_NAMELEN:
|
||||
*
|
||||
* Identifiers can be longer, but this will be more costly
|
||||
* at runtime.
|
||||
*/
|
||||
/**
|
||||
* XML_MAX_TEXT_LENGTH:
|
||||
*
|
||||
* Maximum size allowed for a single text node when building a tree.
|
||||
* This is not a limitation of the parser but a safety boundary feature,
|
||||
* use XML_PARSE_HUGE option to override it.
|
||||
*/
|
||||
#define XML_MAX_TEXT_LENGTH 10000000
|
||||
|
||||
/**
|
||||
* XML_MAX_NAMELEN:
|
||||
*
|
||||
* Identifiers can be longer, but this will be more costly
|
||||
* at runtime.
|
||||
*/
|
||||
#define XML_MAX_NAMELEN 100
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,7 @@ typedef xmlRelaxNG *xmlRelaxNGPtr;
|
||||
*
|
||||
* Signature of an error callback from a Relax-NG validation
|
||||
*/
|
||||
typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx, const char *msg, ...);
|
||||
typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx, const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
|
||||
|
||||
/**
|
||||
* xmlRelaxNGValidityWarningFunc:
|
||||
@@ -42,7 +42,7 @@ typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx, const char *msg
|
||||
*
|
||||
* Signature of a warning callback from a Relax-NG validation
|
||||
*/
|
||||
typedef void (XMLCDECL *xmlRelaxNGValidityWarningFunc) (void *ctx, const char *msg, ...);
|
||||
typedef void (XMLCDECL *xmlRelaxNGValidityWarningFunc) (void *ctx, const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
|
||||
|
||||
/**
|
||||
* A schemas validation context
|
||||
@@ -114,27 +114,27 @@ typedef enum {
|
||||
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlRelaxNGInitTypes (void);
|
||||
XMLPUBFUN void XMLCALL
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGCleanupTypes (void);
|
||||
|
||||
/*
|
||||
* Interfaces for parsing.
|
||||
*/
|
||||
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
|
||||
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
|
||||
xmlRelaxNGNewParserCtxt (const char *URL);
|
||||
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
|
||||
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
|
||||
xmlRelaxNGNewMemParserCtxt (const char *buffer,
|
||||
int size);
|
||||
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
|
||||
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
|
||||
xmlRelaxNGNewDocParserCtxt (xmlDocPtr doc);
|
||||
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlRelaxParserSetFlag (xmlRelaxNGParserCtxtPtr ctxt,
|
||||
int flag);
|
||||
int flag);
|
||||
|
||||
XMLPUBFUN void XMLCALL
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void XMLCALL
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
|
||||
xmlRelaxNGValidityErrorFunc err,
|
||||
xmlRelaxNGValidityWarningFunc warn,
|
||||
@@ -149,12 +149,12 @@ XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGParserCtxtPtr ctxt,
|
||||
xmlStructuredErrorFunc serror,
|
||||
void *ctx);
|
||||
XMLPUBFUN xmlRelaxNGPtr XMLCALL
|
||||
XMLPUBFUN xmlRelaxNGPtr XMLCALL
|
||||
xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void XMLCALL
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGFree (xmlRelaxNGPtr schema);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XMLPUBFUN void XMLCALL
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGDump (FILE *output,
|
||||
xmlRelaxNGPtr schema);
|
||||
XMLPUBFUN void XMLCALL
|
||||
@@ -164,12 +164,12 @@ XMLPUBFUN void XMLCALL
|
||||
/*
|
||||
* Interfaces for validating
|
||||
*/
|
||||
XMLPUBFUN void XMLCALL
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlRelaxNGValidityErrorFunc err,
|
||||
xmlRelaxNGValidityWarningFunc warn,
|
||||
void *ctx);
|
||||
XMLPUBFUN int XMLCALL
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlRelaxNGValidityErrorFunc *err,
|
||||
xmlRelaxNGValidityWarningFunc *warn,
|
||||
@@ -177,29 +177,29 @@ XMLPUBFUN int XMLCALL
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlStructuredErrorFunc serror, void *ctx);
|
||||
XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL
|
||||
XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL
|
||||
xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema);
|
||||
XMLPUBFUN void XMLCALL
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxtPtr ctxt);
|
||||
XMLPUBFUN int XMLCALL
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc);
|
||||
xmlDocPtr doc);
|
||||
/*
|
||||
* Interfaces for progressive validation when possible
|
||||
*/
|
||||
XMLPUBFUN int XMLCALL
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem);
|
||||
XMLPUBFUN int XMLCALL
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt,
|
||||
const xmlChar *data,
|
||||
int len);
|
||||
XMLPUBFUN int XMLCALL
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem);
|
||||
XMLPUBFUN int XMLCALL
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem);
|
||||
|
||||
@@ -1225,6 +1225,22 @@ XMLPUBFUN int XMLCALL
|
||||
int deep,
|
||||
int options);
|
||||
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
/*
|
||||
* 5 interfaces from DOM ElementTraversal, but different in entities
|
||||
* traversal.
|
||||
*/
|
||||
XMLPUBFUN unsigned long XMLCALL
|
||||
xmlChildElementCount (xmlNodePtr parent);
|
||||
XMLPUBFUN xmlNodePtr XMLCALL
|
||||
xmlNextElementSibling (xmlNodePtr node);
|
||||
XMLPUBFUN xmlNodePtr XMLCALL
|
||||
xmlFirstElementChild (xmlNodePtr parent);
|
||||
XMLPUBFUN xmlNodePtr XMLCALL
|
||||
xmlLastElementChild (xmlNodePtr parent);
|
||||
XMLPUBFUN xmlNodePtr XMLCALL
|
||||
xmlPreviousElementSibling (xmlNodePtr node);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -41,7 +41,7 @@ typedef xmlValidState *xmlValidStatePtr;
|
||||
*/
|
||||
typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx,
|
||||
const char *msg,
|
||||
...);
|
||||
...) ATTRIBUTE_PRINTF(2,3);
|
||||
|
||||
/**
|
||||
* xmlValidityWarningFunc:
|
||||
@@ -56,7 +56,7 @@ typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx,
|
||||
*/
|
||||
typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx,
|
||||
const char *msg,
|
||||
...);
|
||||
...) ATTRIBUTE_PRINTF(2,3);
|
||||
|
||||
#ifdef IN_LIBXML
|
||||
/**
|
||||
|
||||
@@ -61,7 +61,7 @@ typedef enum {
|
||||
XML_FROM_CHECK, /* The error checking module */
|
||||
XML_FROM_WRITER, /* The xmlwriter module */
|
||||
XML_FROM_MODULE, /* The dynamically loaded module module*/
|
||||
XML_FROM_I18N, /* The module handling character conversion */
|
||||
XML_FROM_I18N, /* The module handling character conversion */
|
||||
XML_FROM_SCHEMATRONV /* The Schematron validator module */
|
||||
} xmlErrorDomain;
|
||||
|
||||
@@ -645,7 +645,7 @@ typedef enum {
|
||||
XML_SCHEMAV_CVC_ELT_4_3, /* 1852 */
|
||||
XML_SCHEMAV_CVC_ELT_5_1_1, /* 1853 */
|
||||
XML_SCHEMAV_CVC_ELT_5_1_2, /* 1854 */
|
||||
XML_SCHEMAV_CVC_ELT_5_2_1, /* 1855 */
|
||||
XML_SCHEMAV_CVC_ELT_5_2_1, /* 1855 */
|
||||
XML_SCHEMAV_CVC_ELT_5_2_2_1, /* 1856 */
|
||||
XML_SCHEMAV_CVC_ELT_5_2_2_2_1, /* 1857 */
|
||||
XML_SCHEMAV_CVC_ELT_5_2_2_2_2, /* 1858 */
|
||||
@@ -670,7 +670,7 @@ typedef enum {
|
||||
XML_SCHEMAV_CVC_IDC, /* 1877 */
|
||||
XML_SCHEMAV_CVC_WILDCARD, /* 1878 */
|
||||
XML_SCHEMAV_MISC, /* 1879 */
|
||||
XML_XPTR_UNKNOWN_SCHEME = 1900,
|
||||
XML_XPTR_UNKNOWN_SCHEME = 1900,
|
||||
XML_XPTR_CHILDSEQ_START, /* 1901 */
|
||||
XML_XPTR_EVAL_FAILED, /* 1902 */
|
||||
XML_XPTR_EXTRA_OBJECTS, /* 1903 */
|
||||
@@ -691,15 +691,15 @@ typedef enum {
|
||||
XML_SCHEMAP_SRC_SIMPLE_TYPE_2, /* 3001 */
|
||||
XML_SCHEMAP_SRC_SIMPLE_TYPE_3, /* 3002 */
|
||||
XML_SCHEMAP_SRC_SIMPLE_TYPE_4, /* 3003 */
|
||||
XML_SCHEMAP_SRC_RESOLVE, /* 3004 */
|
||||
XML_SCHEMAP_SRC_RESOLVE, /* 3004 */
|
||||
XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE, /* 3005 */
|
||||
XML_SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE, /* 3006 */
|
||||
XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES, /* 3007 */
|
||||
XML_SCHEMAP_ST_PROPS_CORRECT_1, /* 3008 */
|
||||
XML_SCHEMAP_ST_PROPS_CORRECT_2, /* 3009 */
|
||||
XML_SCHEMAP_ST_PROPS_CORRECT_3, /* 3010 */
|
||||
XML_SCHEMAP_ST_PROPS_CORRECT_3, /* 3010 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_1_1, /* 3011 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_1_2, /* 3012 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_1_2, /* 3012 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1, /* 3013 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_1_3_2, /* 3014 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_2_1, /* 3015 */
|
||||
@@ -718,7 +718,7 @@ typedef enum {
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3, /* 3028 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4, /* 3029 */
|
||||
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_5, /* 3030 */
|
||||
XML_SCHEMAP_COS_ST_DERIVED_OK_2_1, /* 3031 */
|
||||
XML_SCHEMAP_COS_ST_DERIVED_OK_2_1, /* 3031 */
|
||||
XML_SCHEMAP_COS_ST_DERIVED_OK_2_2, /* 3032 */
|
||||
XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, /* 3033 */
|
||||
XML_SCHEMAP_S4S_ELEM_MISSING, /* 3034 */
|
||||
@@ -737,14 +737,14 @@ typedef enum {
|
||||
XML_SCHEMAP_E_PROPS_CORRECT_4, /* 3047 */
|
||||
XML_SCHEMAP_E_PROPS_CORRECT_5, /* 3048 */
|
||||
XML_SCHEMAP_E_PROPS_CORRECT_6, /* 3049 */
|
||||
XML_SCHEMAP_SRC_INCLUDE, /* 3050 */
|
||||
XML_SCHEMAP_SRC_INCLUDE, /* 3050 */
|
||||
XML_SCHEMAP_SRC_ATTRIBUTE_1, /* 3051 */
|
||||
XML_SCHEMAP_SRC_ATTRIBUTE_2, /* 3052 */
|
||||
XML_SCHEMAP_SRC_ATTRIBUTE_3_1, /* 3053 */
|
||||
XML_SCHEMAP_SRC_ATTRIBUTE_3_2, /* 3054 */
|
||||
XML_SCHEMAP_SRC_ATTRIBUTE_4, /* 3055 */
|
||||
XML_SCHEMAP_NO_XMLNS, /* 3056 */
|
||||
XML_SCHEMAP_NO_XSI, /* 3057 */
|
||||
XML_SCHEMAP_NO_XSI, /* 3057 */
|
||||
XML_SCHEMAP_COS_VALID_DEFAULT_1, /* 3058 */
|
||||
XML_SCHEMAP_COS_VALID_DEFAULT_2_1, /* 3059 */
|
||||
XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1, /* 3060 */
|
||||
@@ -843,7 +843,7 @@ typedef enum {
|
||||
*/
|
||||
typedef void (XMLCDECL *xmlGenericErrorFunc) (void *ctx,
|
||||
const char *msg,
|
||||
...);
|
||||
...) ATTRIBUTE_PRINTF(2,3);
|
||||
/**
|
||||
* xmlStructuredErrorFunc:
|
||||
* @userData: user provided data for the error callback
|
||||
@@ -858,38 +858,38 @@ typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr erro
|
||||
* Use the following function to reset the two global variables
|
||||
* xmlGenericError and xmlGenericErrorContext.
|
||||
*/
|
||||
XMLPUBFUN void XMLCALL
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlSetGenericErrorFunc (void *ctx,
|
||||
xmlGenericErrorFunc handler);
|
||||
XMLPUBFUN void XMLCALL
|
||||
XMLPUBFUN void XMLCALL
|
||||
initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler);
|
||||
|
||||
XMLPUBFUN void XMLCALL
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlSetStructuredErrorFunc (void *ctx,
|
||||
xmlStructuredErrorFunc handler);
|
||||
/*
|
||||
* Default message routines used by SAX and Valid context for error
|
||||
* and warning reporting.
|
||||
*/
|
||||
XMLPUBFUN void XMLCDECL
|
||||
XMLPUBFUN void XMLCDECL
|
||||
xmlParserError (void *ctx,
|
||||
const char *msg,
|
||||
...);
|
||||
XMLPUBFUN void XMLCDECL
|
||||
...) ATTRIBUTE_PRINTF(2,3);
|
||||
XMLPUBFUN void XMLCDECL
|
||||
xmlParserWarning (void *ctx,
|
||||
const char *msg,
|
||||
...);
|
||||
XMLPUBFUN void XMLCDECL
|
||||
...) ATTRIBUTE_PRINTF(2,3);
|
||||
XMLPUBFUN void XMLCDECL
|
||||
xmlParserValidityError (void *ctx,
|
||||
const char *msg,
|
||||
...);
|
||||
XMLPUBFUN void XMLCDECL
|
||||
...) ATTRIBUTE_PRINTF(2,3);
|
||||
XMLPUBFUN void XMLCDECL
|
||||
xmlParserValidityWarning (void *ctx,
|
||||
const char *msg,
|
||||
...);
|
||||
XMLPUBFUN void XMLCALL
|
||||
...) ATTRIBUTE_PRINTF(2,3);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlParserPrintFileInfo (xmlParserInputPtr input);
|
||||
XMLPUBFUN void XMLCALL
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlParserPrintFileContext (xmlParserInputPtr input);
|
||||
|
||||
/*
|
||||
@@ -907,19 +907,19 @@ XMLPUBFUN void XMLCALL
|
||||
xmlResetError (xmlErrorPtr err);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlCopyError (xmlErrorPtr from,
|
||||
xmlErrorPtr to);
|
||||
xmlErrorPtr to);
|
||||
|
||||
#ifdef IN_LIBXML
|
||||
/*
|
||||
* Internal callback reporting routine
|
||||
*/
|
||||
XMLPUBFUN void XMLCALL
|
||||
XMLPUBFUN void XMLCALL
|
||||
__xmlRaiseError (xmlStructuredErrorFunc schannel,
|
||||
xmlGenericErrorFunc channel,
|
||||
void *data,
|
||||
xmlGenericErrorFunc channel,
|
||||
void *data,
|
||||
void *ctx,
|
||||
void *node,
|
||||
int domain,
|
||||
void *node,
|
||||
int domain,
|
||||
int code,
|
||||
xmlErrorLevel level,
|
||||
const char *file,
|
||||
@@ -930,10 +930,10 @@ XMLPUBFUN void XMLCALL
|
||||
int int1,
|
||||
int col,
|
||||
const char *msg,
|
||||
...);
|
||||
XMLPUBFUN void XMLCALL
|
||||
...) ATTRIBUTE_PRINTF(16,17);
|
||||
XMLPUBFUN void XMLCALL
|
||||
__xmlSimpleError (int domain,
|
||||
int code,
|
||||
int code,
|
||||
xmlNodePtr node,
|
||||
const char *msg,
|
||||
const char *extra);
|
||||
|
||||
@@ -63,7 +63,7 @@ typedef void (XMLCALL *xmlFreeFunc)(void *mem);
|
||||
*
|
||||
* Returns a pointer to the newly allocated block or NULL in case of error.
|
||||
*/
|
||||
typedef void *(XMLCALL *xmlMallocFunc)(size_t size);
|
||||
typedef void *(ATTRIBUTE_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size);
|
||||
|
||||
/**
|
||||
* xmlReallocFunc:
|
||||
@@ -150,7 +150,7 @@ XMLPUBFUN void XMLCALL
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlMemoryDump (void);
|
||||
XMLPUBFUN void * XMLCALL
|
||||
xmlMemMalloc (size_t size);
|
||||
xmlMemMalloc (size_t size) ATTRIBUTE_ALLOC_SIZE(1);
|
||||
XMLPUBFUN void * XMLCALL
|
||||
xmlMemRealloc (void *ptr,size_t size);
|
||||
XMLPUBFUN void XMLCALL
|
||||
@@ -158,11 +158,11 @@ XMLPUBFUN void XMLCALL
|
||||
XMLPUBFUN char * XMLCALL
|
||||
xmlMemoryStrdup (const char *str);
|
||||
XMLPUBFUN void * XMLCALL
|
||||
xmlMallocLoc (size_t size, const char *file, int line);
|
||||
xmlMallocLoc (size_t size, const char *file, int line) ATTRIBUTE_ALLOC_SIZE(1);
|
||||
XMLPUBFUN void * XMLCALL
|
||||
xmlReallocLoc (void *ptr, size_t size, const char *file, int line);
|
||||
XMLPUBFUN void * XMLCALL
|
||||
xmlMallocAtomicLoc (size_t size, const char *file, int line);
|
||||
xmlMallocAtomicLoc (size_t size, const char *file, int line) ATTRIBUTE_ALLOC_SIZE(1);
|
||||
XMLPUBFUN char * XMLCALL
|
||||
xmlMemStrdupLoc (const char *str, const char *file, int line);
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ typedef xmlSchema *xmlSchemaPtr;
|
||||
*
|
||||
* Signature of an error callback from an XSD validation
|
||||
*/
|
||||
typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...);
|
||||
typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
|
||||
|
||||
/**
|
||||
* xmlSchemaValidityWarningFunc:
|
||||
@@ -102,7 +102,7 @@ typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg,
|
||||
*
|
||||
* Signature of a warning callback from an XSD validation
|
||||
*/
|
||||
typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...);
|
||||
typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...) ATTRIBUTE_PRINTF(2,3);
|
||||
|
||||
/**
|
||||
* A schemas validation context
|
||||
|
||||
@@ -29,21 +29,21 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
||||
*
|
||||
* the version string like "1.2.3"
|
||||
*/
|
||||
#define LIBXML_DOTTED_VERSION "2.7.2"
|
||||
#define LIBXML_DOTTED_VERSION "2.7.3"
|
||||
|
||||
/**
|
||||
* LIBXML_VERSION:
|
||||
*
|
||||
* the version number: 1.2.3 value is 10203
|
||||
*/
|
||||
#define LIBXML_VERSION 20702
|
||||
#define LIBXML_VERSION 20703
|
||||
|
||||
/**
|
||||
* LIBXML_VERSION_STRING:
|
||||
*
|
||||
* the version number string, 1.2.3 value is "10203"
|
||||
*/
|
||||
#define LIBXML_VERSION_STRING "20702"
|
||||
#define LIBXML_VERSION_STRING "20703"
|
||||
|
||||
/**
|
||||
* LIBXML_VERSION_EXTRA:
|
||||
@@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
||||
* Macro to check that the libxml version in use is compatible with
|
||||
* the version the software has been compiled against
|
||||
*/
|
||||
#define LIBXML_TEST_VERSION xmlCheckVersion(20702);
|
||||
#define LIBXML_TEST_VERSION xmlCheckVersion(20703);
|
||||
|
||||
#ifndef VMS
|
||||
#if 0
|
||||
@@ -382,22 +382,74 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
||||
#define LIBXML_ZLIB_ENABLED
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef HAVE_ANSIDECL_H
|
||||
#include <ansidecl.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_UNUSED:
|
||||
*
|
||||
* Macro used to signal to GCC unused function parameters
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
#ifdef HAVE_ANSIDECL_H
|
||||
#include <ansidecl.h>
|
||||
#endif
|
||||
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#define ATTRIBUTE_UNUSED __attribute__((unused))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_ALLOC_SIZE:
|
||||
*
|
||||
* Macro used to indicate to GCC this is an allocator function
|
||||
*/
|
||||
|
||||
#ifndef ATTRIBUTE_ALLOC_SIZE
|
||||
# if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
|
||||
# define ATTRIBUTE_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
|
||||
# else
|
||||
# define ATTRIBUTE_ALLOC_SIZE(x)
|
||||
# endif
|
||||
#else
|
||||
#define ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_ALLOC_SIZE(x)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_PRINTF:
|
||||
*
|
||||
* Macro used to indicate to GCC the parameter are printf like
|
||||
*/
|
||||
|
||||
#ifndef ATTRIBUTE_PRINTF
|
||||
# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
|
||||
# define ATTRIBUTE_PRINTF(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
|
||||
# else
|
||||
# define ATTRIBUTE_PRINTF(fmt,args)
|
||||
# endif
|
||||
#else
|
||||
# define ATTRIBUTE_PRINTF(fmt,args)
|
||||
#endif
|
||||
|
||||
#else /* ! __GNUC__ */
|
||||
/**
|
||||
* ATTRIBUTE_UNUSED:
|
||||
*
|
||||
* Macro used to signal to GCC unused function parameters
|
||||
*/
|
||||
#define ATTRIBUTE_UNUSED
|
||||
/**
|
||||
* ATTRIBUTE_ALLOC_SIZE:
|
||||
*
|
||||
* Macro used to indicate to GCC this is an allocator function
|
||||
*/
|
||||
#define ATTRIBUTE_ALLOC_SIZE(x)
|
||||
/**
|
||||
* ATTRIBUTE_PRINTF:
|
||||
*
|
||||
* Macro used to indicate to GCC the parameter are printf like
|
||||
*/
|
||||
#define ATTRIBUTE_PRINTF(fmt,args)
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -382,22 +382,74 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
||||
#define LIBXML_ZLIB_ENABLED
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef HAVE_ANSIDECL_H
|
||||
#include <ansidecl.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_UNUSED:
|
||||
*
|
||||
* Macro used to signal to GCC unused function parameters
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
#ifdef HAVE_ANSIDECL_H
|
||||
#include <ansidecl.h>
|
||||
#endif
|
||||
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#define ATTRIBUTE_UNUSED __attribute__((unused))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_ALLOC_SIZE:
|
||||
*
|
||||
* Macro used to indicate to GCC this is an allocator function
|
||||
*/
|
||||
|
||||
#ifndef ATTRIBUTE_ALLOC_SIZE
|
||||
# if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
|
||||
# define ATTRIBUTE_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
|
||||
# else
|
||||
# define ATTRIBUTE_ALLOC_SIZE(x)
|
||||
# endif
|
||||
#else
|
||||
#define ATTRIBUTE_UNUSED
|
||||
# define ATTRIBUTE_ALLOC_SIZE(x)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_PRINTF:
|
||||
*
|
||||
* Macro used to indicate to GCC the parameter are printf like
|
||||
*/
|
||||
|
||||
#ifndef ATTRIBUTE_PRINTF
|
||||
# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
|
||||
# define ATTRIBUTE_PRINTF(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
|
||||
# else
|
||||
# define ATTRIBUTE_PRINTF(fmt,args)
|
||||
# endif
|
||||
#else
|
||||
# define ATTRIBUTE_PRINTF(fmt,args)
|
||||
#endif
|
||||
|
||||
#else /* ! __GNUC__ */
|
||||
/**
|
||||
* ATTRIBUTE_UNUSED:
|
||||
*
|
||||
* Macro used to signal to GCC unused function parameters
|
||||
*/
|
||||
#define ATTRIBUTE_UNUSED
|
||||
/**
|
||||
* ATTRIBUTE_ALLOC_SIZE:
|
||||
*
|
||||
* Macro used to indicate to GCC this is an allocator function
|
||||
*/
|
||||
#define ATTRIBUTE_ALLOC_SIZE(x)
|
||||
/**
|
||||
* ATTRIBUTE_PRINTF:
|
||||
*
|
||||
* Macro used to indicate to GCC the parameter are printf like
|
||||
*/
|
||||
#define ATTRIBUTE_PRINTF(fmt,args)
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -69,11 +69,13 @@ extern "C" {
|
||||
XMLPUBFUN int XMLCALL xmlTextWriterEndComment(xmlTextWriterPtr writer);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer,
|
||||
const char *format, ...);
|
||||
const char *format, ...)
|
||||
ATTRIBUTE_PRINTF(2,3);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer,
|
||||
const char *format,
|
||||
va_list argptr);
|
||||
va_list argptr)
|
||||
ATTRIBUTE_PRINTF(2,0);
|
||||
XMLPUBFUN int XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr
|
||||
writer,
|
||||
const xmlChar *
|
||||
@@ -102,12 +104,14 @@ extern "C" {
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const char *format, ...);
|
||||
const char *format, ...)
|
||||
ATTRIBUTE_PRINTF(3,4);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const char *format,
|
||||
va_list argptr);
|
||||
va_list argptr)
|
||||
ATTRIBUTE_PRINTF(3,0);
|
||||
XMLPUBFUN int XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr
|
||||
writer,
|
||||
const xmlChar * name,
|
||||
@@ -118,14 +122,16 @@ extern "C" {
|
||||
const xmlChar * prefix,
|
||||
const xmlChar * name,
|
||||
const xmlChar * namespaceURI,
|
||||
const char *format, ...);
|
||||
const char *format, ...)
|
||||
ATTRIBUTE_PRINTF(5,6);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer,
|
||||
const xmlChar * prefix,
|
||||
const xmlChar * name,
|
||||
const xmlChar * namespaceURI,
|
||||
const char *format,
|
||||
va_list argptr);
|
||||
va_list argptr)
|
||||
ATTRIBUTE_PRINTF(5,0);
|
||||
XMLPUBFUN int XMLCALL xmlTextWriterWriteElementNS(xmlTextWriterPtr
|
||||
writer,
|
||||
const xmlChar *
|
||||
@@ -141,10 +147,12 @@ extern "C" {
|
||||
*/
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer,
|
||||
const char *format, ...);
|
||||
const char *format, ...)
|
||||
ATTRIBUTE_PRINTF(2,3);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer,
|
||||
const char *format, va_list argptr);
|
||||
const char *format, va_list argptr)
|
||||
ATTRIBUTE_PRINTF(2,0);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteRawLen(xmlTextWriterPtr writer,
|
||||
const xmlChar * content, int len);
|
||||
@@ -154,12 +162,14 @@ extern "C" {
|
||||
XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatString(xmlTextWriterPtr
|
||||
writer,
|
||||
const char
|
||||
*format, ...);
|
||||
*format, ...)
|
||||
ATTRIBUTE_PRINTF(2,3);
|
||||
XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr
|
||||
writer,
|
||||
const char
|
||||
*format,
|
||||
va_list argptr);
|
||||
va_list argptr)
|
||||
ATTRIBUTE_PRINTF(2,0);
|
||||
XMLPUBFUN int XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer,
|
||||
const xmlChar *
|
||||
content);
|
||||
@@ -193,12 +203,14 @@ extern "C" {
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const char *format, ...);
|
||||
const char *format, ...)
|
||||
ATTRIBUTE_PRINTF(3,4);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const char *format,
|
||||
va_list argptr);
|
||||
va_list argptr)
|
||||
ATTRIBUTE_PRINTF(3,0);
|
||||
XMLPUBFUN int XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr
|
||||
writer,
|
||||
const xmlChar * name,
|
||||
@@ -209,14 +221,16 @@ extern "C" {
|
||||
const xmlChar * prefix,
|
||||
const xmlChar * name,
|
||||
const xmlChar * namespaceURI,
|
||||
const char *format, ...);
|
||||
const char *format, ...)
|
||||
ATTRIBUTE_PRINTF(5,6);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer,
|
||||
const xmlChar * prefix,
|
||||
const xmlChar * name,
|
||||
const xmlChar * namespaceURI,
|
||||
const char *format,
|
||||
va_list argptr);
|
||||
va_list argptr)
|
||||
ATTRIBUTE_PRINTF(5,0);
|
||||
XMLPUBFUN int XMLCALL xmlTextWriterWriteAttributeNS(xmlTextWriterPtr
|
||||
writer,
|
||||
const xmlChar *
|
||||
@@ -242,11 +256,13 @@ extern "C" {
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer,
|
||||
const xmlChar * target,
|
||||
const char *format, ...);
|
||||
const char *format, ...)
|
||||
ATTRIBUTE_PRINTF(3,4);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer,
|
||||
const xmlChar * target,
|
||||
const char *format, va_list argptr);
|
||||
const char *format, va_list argptr)
|
||||
ATTRIBUTE_PRINTF(3,0);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWritePI(xmlTextWriterPtr writer,
|
||||
const xmlChar * target,
|
||||
@@ -270,10 +286,12 @@ extern "C" {
|
||||
*/
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer,
|
||||
const char *format, ...);
|
||||
const char *format, ...)
|
||||
ATTRIBUTE_PRINTF(2,3);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer,
|
||||
const char *format, va_list argptr);
|
||||
const char *format, va_list argptr)
|
||||
ATTRIBUTE_PRINTF(2,0);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteCDATA(xmlTextWriterPtr writer,
|
||||
const xmlChar * content);
|
||||
@@ -296,13 +314,15 @@ extern "C" {
|
||||
const xmlChar * name,
|
||||
const xmlChar * pubid,
|
||||
const xmlChar * sysid,
|
||||
const char *format, ...);
|
||||
const char *format, ...)
|
||||
ATTRIBUTE_PRINTF(5,6);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const xmlChar * pubid,
|
||||
const xmlChar * sysid,
|
||||
const char *format, va_list argptr);
|
||||
const char *format, va_list argptr)
|
||||
ATTRIBUTE_PRINTF(5,0);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteDTD(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
@@ -332,12 +352,14 @@ extern "C" {
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const char *format, ...);
|
||||
const char *format, ...)
|
||||
ATTRIBUTE_PRINTF(3,4);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const char *format,
|
||||
va_list argptr);
|
||||
va_list argptr)
|
||||
ATTRIBUTE_PRINTF(3,0);
|
||||
XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDElement(xmlTextWriterPtr
|
||||
writer,
|
||||
const xmlChar *
|
||||
@@ -360,12 +382,14 @@ extern "C" {
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const char *format, ...);
|
||||
const char *format, ...)
|
||||
ATTRIBUTE_PRINTF(3,4);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer,
|
||||
const xmlChar * name,
|
||||
const char *format,
|
||||
va_list argptr);
|
||||
va_list argptr)
|
||||
ATTRIBUTE_PRINTF(3,0);
|
||||
XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr
|
||||
writer,
|
||||
const xmlChar *
|
||||
@@ -389,13 +413,15 @@ extern "C" {
|
||||
xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer,
|
||||
int pe,
|
||||
const xmlChar * name,
|
||||
const char *format, ...);
|
||||
const char *format, ...)
|
||||
ATTRIBUTE_PRINTF(4,5);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer,
|
||||
int pe,
|
||||
const xmlChar * name,
|
||||
const char *format,
|
||||
va_list argptr);
|
||||
va_list argptr)
|
||||
ATTRIBUTE_PRINTF(4,0);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer,
|
||||
int pe,
|
||||
|
||||
@@ -0,0 +1,256 @@
|
||||
/*
|
||||
* 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 <libxml/xpath.h>
|
||||
#include "xsltexports.h"
|
||||
#include "xsltInternals.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Extension Modules API.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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
|
||||
xsltExtFunctionLookup (xsltTransformContextPtr ctxt,
|
||||
const xmlChar *name,
|
||||
const xmlChar *URI);
|
||||
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__ */
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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 <win32config.h>
|
||||
#else
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "xsltconfig.h"
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#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
|
||||
|
||||
#endif /* ! __XSLT_LIBXSLT_H__ */
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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 <breese@users.sourceforge.net> and Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLT_NUMBERSINTERNALS_H__
|
||||
#define __XML_XSLT_NUMBERSINTERNALS_H__
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include "xsltexports.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/*
|
||||
* 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__ */
|
||||
@@ -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__ */
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
/*
|
||||
* 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 <libxml/parser.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#include "xsltexports.h"
|
||||
#include <libxslt/xsltInternals.h>
|
||||
|
||||
#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);
|
||||
/**
|
||||
* 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__ */
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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 <libxml/tree.h>
|
||||
#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 ((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;
|
||||
|
||||
/**
|
||||
* 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__ */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* 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 "1.1.24"
|
||||
|
||||
/**
|
||||
* LIBXSLT_VERSION:
|
||||
*
|
||||
* the version number: 1.2.3 value is 10203
|
||||
*/
|
||||
#define LIBXSLT_VERSION 10124
|
||||
|
||||
/**
|
||||
* LIBXSLT_VERSION_STRING:
|
||||
*
|
||||
* the version number string, 1.2.3 value is "10203"
|
||||
*/
|
||||
#define LIBXSLT_VERSION_STRING "10124"
|
||||
|
||||
/**
|
||||
* LIBXSLT_VERSION_EXTRA:
|
||||
*
|
||||
* extra version information, used to show a CVS compilation
|
||||
*/
|
||||
#define LIBXSLT_VERSION_EXTRA "-CVS1070"
|
||||
|
||||
/**
|
||||
* 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 1
|
||||
#define WITH_XSLT_DEBUG
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
/**
|
||||
* 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 0
|
||||
#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 1
|
||||
#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 1
|
||||
#ifndef WITH_MODULES
|
||||
#define WITH_MODULES
|
||||
#endif
|
||||
#define LIBXSLT_DEFAULT_PLUGINS_PATH() "/usr/lib/libxslt-plugins"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_UNUSED:
|
||||
*
|
||||
* This macro is used to flag unused function parameters to GCC
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
#ifdef HAVE_ANSIDECL_H
|
||||
#include <ansidecl.h>
|
||||
#endif
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#define ATTRIBUTE_UNUSED __attribute__((unused))
|
||||
#endif
|
||||
#else
|
||||
#define ATTRIBUTE_UNUSED
|
||||
#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__ */
|
||||
@@ -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 <igor@zlatkovic.com>
|
||||
*/
|
||||
|
||||
#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__ */
|
||||
|
||||
|
||||
@@ -0,0 +1,309 @@
|
||||
/*
|
||||
* Summary: set of utilities for the XSLT engine
|
||||
* Description: interfaces for the utilities module of the XSLT engine.
|
||||
* things like message handling, profiling, and other
|
||||
* generally useful routines.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_XSLTUTILS_H__
|
||||
#define __XML_XSLTUTILS_H__
|
||||
|
||||
#include <libxslt/xsltconfig.h>
|
||||
#ifdef HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/dict.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include "xsltexports.h"
|
||||
#include "xsltInternals.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* XSLT_TODO:
|
||||
*
|
||||
* Macro to flag unimplemented blocks.
|
||||
*/
|
||||
#define XSLT_TODO \
|
||||
xsltGenericError(xsltGenericErrorContext, \
|
||||
"Unimplemented block at %s:%d\n", \
|
||||
__FILE__, __LINE__);
|
||||
|
||||
/**
|
||||
* XSLT_STRANGE:
|
||||
*
|
||||
* Macro to flag that a problem was detected internally.
|
||||
*/
|
||||
#define XSLT_STRANGE \
|
||||
xsltGenericError(xsltGenericErrorContext, \
|
||||
"Internal error at %s:%d\n", \
|
||||
__FILE__, __LINE__);
|
||||
|
||||
/**
|
||||
* IS_XSLT_ELEM:
|
||||
*
|
||||
* Checks that the element pertains to XSLT namespace.
|
||||
*/
|
||||
#define IS_XSLT_ELEM(n) \
|
||||
(((n) != NULL) && ((n)->ns != NULL) && \
|
||||
(xmlStrEqual((n)->ns->href, XSLT_NAMESPACE)))
|
||||
|
||||
/**
|
||||
* IS_XSLT_NAME:
|
||||
*
|
||||
* Checks the value of an element in XSLT namespace.
|
||||
*/
|
||||
#define IS_XSLT_NAME(n, val) \
|
||||
(xmlStrEqual((n)->name, (const xmlChar *) (val)))
|
||||
|
||||
/**
|
||||
* IS_XSLT_REAL_NODE:
|
||||
*
|
||||
* Check that a node is a 'real' one: document, element, text or attribute.
|
||||
*/
|
||||
#define IS_XSLT_REAL_NODE(n) \
|
||||
(((n) != NULL) && \
|
||||
(((n)->type == XML_ELEMENT_NODE) || \
|
||||
((n)->type == XML_TEXT_NODE) || \
|
||||
((n)->type == XML_CDATA_SECTION_NODE) || \
|
||||
((n)->type == XML_ATTRIBUTE_NODE) || \
|
||||
((n)->type == XML_DOCUMENT_NODE) || \
|
||||
((n)->type == XML_HTML_DOCUMENT_NODE) || \
|
||||
((n)->type == XML_COMMENT_NODE) || \
|
||||
((n)->type == XML_PI_NODE)))
|
||||
|
||||
/*
|
||||
* Our own version of namespaced atributes lookup.
|
||||
*/
|
||||
XSLTPUBFUN xmlChar * XSLTCALL
|
||||
xsltGetNsProp (xmlNodePtr node,
|
||||
const xmlChar *name,
|
||||
const xmlChar *nameSpace);
|
||||
XSLTPUBFUN const xmlChar * XSLTCALL
|
||||
xsltGetCNsProp (xsltStylesheetPtr style,
|
||||
xmlNodePtr node,
|
||||
const xmlChar *name,
|
||||
const xmlChar *nameSpace);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltGetUTF8Char (const unsigned char *utf,
|
||||
int *len);
|
||||
|
||||
/*
|
||||
* XSLT Debug Tracing Tracing Types
|
||||
*/
|
||||
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:
|
||||
*
|
||||
* Control the type of xsl debugtrace messages emitted.
|
||||
*/
|
||||
#define XSLT_TRACE(ctxt,code,call) \
|
||||
if (ctxt->traceCode && (*(ctxt->traceCode) & code)) \
|
||||
call
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltDebugSetDefaultTrace(xsltDebugTraceCodes val);
|
||||
XSLTPUBFUN xsltDebugTraceCodes XSLTCALL
|
||||
xsltDebugGetDefaultTrace(void);
|
||||
|
||||
/*
|
||||
* XSLT specific error and debug reporting functions.
|
||||
*/
|
||||
XSLTPUBVAR xmlGenericErrorFunc xsltGenericError;
|
||||
XSLTPUBVAR void *xsltGenericErrorContext;
|
||||
XSLTPUBVAR xmlGenericErrorFunc xsltGenericDebug;
|
||||
XSLTPUBVAR void *xsltGenericDebugContext;
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltPrintErrorContext (xsltTransformContextPtr ctxt,
|
||||
xsltStylesheetPtr style,
|
||||
xmlNodePtr node);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltMessage (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr node,
|
||||
xmlNodePtr inst);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetGenericErrorFunc (void *ctx,
|
||||
xmlGenericErrorFunc handler);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetGenericDebugFunc (void *ctx,
|
||||
xmlGenericErrorFunc handler);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetTransformErrorFunc (xsltTransformContextPtr ctxt,
|
||||
void *ctx,
|
||||
xmlGenericErrorFunc handler);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltTransformError (xsltTransformContextPtr ctxt,
|
||||
xsltStylesheetPtr style,
|
||||
xmlNodePtr node,
|
||||
const char *msg,
|
||||
...);
|
||||
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSetCtxtParseOptions (xsltTransformContextPtr ctxt,
|
||||
int options);
|
||||
/*
|
||||
* Sorting.
|
||||
*/
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltDocumentSortFunction (xmlNodeSetPtr list);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetSortFunc (xsltSortFunc handler);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetCtxtSortFunc (xsltTransformContextPtr ctxt,
|
||||
xsltSortFunc handler);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltDefaultSortFunction (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr *sorts,
|
||||
int nbsorts);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltDoSortFunction (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr * sorts,
|
||||
int nbsorts);
|
||||
XSLTPUBFUN xmlXPathObjectPtr * XSLTCALL
|
||||
xsltComputeSortResult (xsltTransformContextPtr ctxt,
|
||||
xmlNodePtr sort);
|
||||
|
||||
/*
|
||||
* QNames handling.
|
||||
*/
|
||||
|
||||
XSLTPUBFUN const xmlChar * XSLTCALL
|
||||
xsltSplitQName (xmlDictPtr dict,
|
||||
const xmlChar *name,
|
||||
const xmlChar **prefix);
|
||||
XSLTPUBFUN const xmlChar * XSLTCALL
|
||||
xsltGetQNameURI (xmlNodePtr node,
|
||||
xmlChar **name);
|
||||
|
||||
XSLTPUBFUN const xmlChar * XSLTCALL
|
||||
xsltGetQNameURI2 (xsltStylesheetPtr style,
|
||||
xmlNodePtr node,
|
||||
const xmlChar **name);
|
||||
|
||||
/*
|
||||
* Output, reuse libxml I/O buffers.
|
||||
*/
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSaveResultTo (xmlOutputBufferPtr buf,
|
||||
xmlDocPtr result,
|
||||
xsltStylesheetPtr style);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSaveResultToFilename (const char *URI,
|
||||
xmlDocPtr result,
|
||||
xsltStylesheetPtr style,
|
||||
int compression);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSaveResultToFile (FILE *file,
|
||||
xmlDocPtr result,
|
||||
xsltStylesheetPtr style);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSaveResultToFd (int fd,
|
||||
xmlDocPtr result,
|
||||
xsltStylesheetPtr style);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSaveResultToString (xmlChar **doc_txt_ptr,
|
||||
int * doc_txt_len,
|
||||
xmlDocPtr result,
|
||||
xsltStylesheetPtr style);
|
||||
|
||||
/*
|
||||
* XPath interface
|
||||
*/
|
||||
XSLTPUBFUN xmlXPathCompExprPtr XSLTCALL
|
||||
xsltXPathCompile (xsltStylesheetPtr style,
|
||||
const xmlChar *str);
|
||||
|
||||
/*
|
||||
* Profiling.
|
||||
*/
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSaveProfiling (xsltTransformContextPtr ctxt,
|
||||
FILE *output);
|
||||
XSLTPUBFUN xmlDocPtr XSLTCALL
|
||||
xsltGetProfileInformation (xsltTransformContextPtr ctxt);
|
||||
|
||||
XSLTPUBFUN long XSLTCALL
|
||||
xsltTimestamp (void);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltCalibrateAdjust (long delta);
|
||||
|
||||
/**
|
||||
* XSLT_TIMESTAMP_TICS_PER_SEC:
|
||||
*
|
||||
* Sampling precision for profiling
|
||||
*/
|
||||
#define XSLT_TIMESTAMP_TICS_PER_SEC 100000l
|
||||
|
||||
/*
|
||||
* Hooks for the debugger.
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
XSLTPUBVAR int xslDebugStatus;
|
||||
|
||||
typedef void (*xsltHandleDebuggerCallback) (xmlNodePtr cur, xmlNodePtr node,
|
||||
xsltTemplatePtr templ, xsltTransformContextPtr ctxt);
|
||||
typedef int (*xsltAddCallCallback) (xsltTemplatePtr templ, xmlNodePtr source);
|
||||
typedef void (*xsltDropCallCallback) (void);
|
||||
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xsltSetDebuggerStatus (int value);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltGetDebuggerStatus (void);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xsltSetDebuggerCallbacks (int no, void *block);
|
||||
XSLTPUBFUN int XSLTCALL
|
||||
xslAddCall (xsltTemplatePtr templ,
|
||||
xmlNodePtr source);
|
||||
XSLTPUBFUN void XSLTCALL
|
||||
xslDropCall (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XML_XSLTUTILS_H__ */
|
||||
|
||||
|
||||
@@ -296,10 +296,10 @@
|
||||
/* #undef HAVE_LIBXSLT */
|
||||
|
||||
/* Define to 1 if you have the <libxslt/pattern.h> header file. */
|
||||
/* #undef HAVE_LIBXSLT_PATTERN_H */
|
||||
#define HAVE_LIBXSLT_PATTERN_H
|
||||
|
||||
/* Define to 1 if you have the <libxslt/transform.h> header file. */
|
||||
/* #undef HAVE_LIBXSLT_TRANSFORM_H */
|
||||
#define HAVE_LIBXSLT_TRANSFORM_H
|
||||
|
||||
/* Define if you have the Xxf86dga library version 2 */
|
||||
/* #undef HAVE_LIBXXF86DGA2 */
|
||||
@@ -952,6 +952,9 @@
|
||||
/* Define to the soname of the libXrender library. */
|
||||
/* #undef SONAME_LIBXRENDER */
|
||||
|
||||
/* Define to the soname of the libxslt library. */
|
||||
#define SONAME_LIBXSLT "libxslt"
|
||||
|
||||
/* Define if the struct statfs is defined by <sys/mount.h> */
|
||||
/* #undef STATFS_DEFINED_BY_SYS_MOUNT */
|
||||
|
||||
|
||||
@@ -42,9 +42,9 @@ extern void wine_exec_wine_binary( const char *name, char **argv, char **envp, i
|
||||
|
||||
typedef void (*load_dll_callback_t)( void *, const char * );
|
||||
|
||||
extern void *wine_dlopen( const char *filename, int flag, char *error, int errorsize );
|
||||
extern void *wine_dlsym( void *handle, const char *symbol, char *error, int errorsize );
|
||||
extern int wine_dlclose( void *handle, char *error, int errorsize );
|
||||
extern void *wine_dlopen( const char *filename, int flag, char *error, size_t errorsize );
|
||||
extern void *wine_dlsym( void *handle, const char *symbol, char *error, size_t errorsize );
|
||||
extern int wine_dlclose( void *handle, char *error, size_t errorsize );
|
||||
extern void wine_dll_set_callback( load_dll_callback_t load );
|
||||
extern void *wine_dll_load( const char *filename, char *error, int errorsize, int *file_exists );
|
||||
extern void *wine_dll_load_main_exe( const char *name, char *error, int errorsize,
|
||||
|
||||
+9
@@ -1,10 +1,19 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||
<group>
|
||||
<module name="wine" type="staticlibrary">
|
||||
<include base="ReactOS">include/reactos/wine</include>
|
||||
<define name="_DISABLE_TIDENTS" />
|
||||
<define name="__WINESRC__" />
|
||||
<file>config.c</file>
|
||||
<file>debug_ros.c</file>
|
||||
<file>loader.c</file>
|
||||
<file>string.c</file>
|
||||
</module>
|
||||
<module name="wineldr" type="staticlibrary">
|
||||
<include base="ReactOS">include/reactos/wine</include>
|
||||
<define name="_DISABLE_TIDENTS" />
|
||||
<define name="__WINESRC__" />
|
||||
<file>loader.c</file>
|
||||
</module>
|
||||
</group>
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Win32 builtin dlls support
|
||||
*
|
||||
* Copyright 2000 Alexandre Julliard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
# include <sys/resource.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#define NONAMELESSUNION
|
||||
#define NONAMELESSSTRUCT
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wine/library.h"
|
||||
|
||||
void *wine_dlsym( void *handle, const char *symbol, char *error, size_t errorsize )
|
||||
{
|
||||
return GetProcAddress(handle, symbol);
|
||||
}
|
||||
|
||||
void *wine_dlopen( const char *filename, int flag, char *error, size_t errorsize )
|
||||
{
|
||||
return LoadLibraryA(filename);
|
||||
}
|
||||
|
||||
int wine_dlclose( void *handle, char *error, size_t errorsize )
|
||||
{
|
||||
return FreeLibrary(handle);
|
||||
}
|
||||
+89
@@ -1,3 +1,92 @@
|
||||
Sun Jan 18 22:37:59 CET 2009 Daniel Veillard <[email protected]>
|
||||
|
||||
* configure.in doc/xml.html doc/*: preparing 0.7.3 release
|
||||
* include/libxml/parserInternals.h SAX2.c: fix a typo in an name
|
||||
|
||||
Sun Jan 18 21:48:28 CET 2009 Daniel Veillard <[email protected]>
|
||||
|
||||
* include/libxml/parser.h include/libxml/xmlwriter.h
|
||||
include/libxml/relaxng.h include/libxml/xmlversion.h.in
|
||||
include/libxml/xmlwin32version.h.in include/libxml/valid.h
|
||||
include/libxml/xmlschemas.h include/libxml/xmlerror.h:
|
||||
port patch from Marcus Meissner to add gcc checking for
|
||||
printf like functions parameters, should fix #65068
|
||||
* doc/apibuild.py doc/*: modified the script accordingly
|
||||
and regenerated
|
||||
* xpath.c xmlmemory.c threads.c: fix a few warnings
|
||||
|
||||
Sun Jan 18 20:40:42 CET 2009 Daniel Veillard <[email protected]>
|
||||
|
||||
* include/libxml/xmlwin32version.h.in: windows header should
|
||||
get the same define
|
||||
|
||||
Sun Jan 18 18:22:33 CET 2009 Daniel Veillard <[email protected]>
|
||||
|
||||
* include/libxml/xmlversion.h.in include/libxml/xmlmemory.h:
|
||||
apply patch from Marcus Meissner to add gcc attribute alloc_size
|
||||
should fix #552505
|
||||
* doc/apibuild.py doc/* testapi.c: regenerate the API
|
||||
* include/libxml/parserInternals.h: fix a comment problem raised
|
||||
by apibuild.py
|
||||
|
||||
Sun Jan 18 16:39:01 CET 2009 Daniel Veillard <[email protected]>
|
||||
|
||||
* threads.c: also remove pthread key when stopping thread
|
||||
support, patch based on Alex Ott one should fix #564723
|
||||
|
||||
Sun Jan 18 15:55:18 CET 2009 Daniel Veillard <[email protected]>
|
||||
|
||||
* threads.c: patch from Daniel Zimmermann fixing a memory leak
|
||||
in an edge case, solves #562230
|
||||
|
||||
Sun Jan 18 15:06:05 CET 2009 Daniel Veillard <[email protected]>
|
||||
|
||||
* include/libxml/parserInternals.h SAX2.c: add a new define
|
||||
XML_MAX_TEXT_LENGTH limiting the maximum size of a single text
|
||||
node, the defaultis 10MB and can be removed with the HUGE
|
||||
parsing option
|
||||
|
||||
Mon Jan 05 18:28:41 CET 2009 Rob Richards <[email protected]>
|
||||
|
||||
* include/libxml/parser.h parser.c: add XML_PARSE_OLDSAX parser
|
||||
option to enable pre 2.7 SAX behavior.
|
||||
|
||||
Wed Dec 31 23:11:37 CET 2008 Rob Richards <[email protected]>
|
||||
|
||||
* tree.c: set doc on last child tree in xmlAddChildList for
|
||||
bug #546772. Fix problem adding an attribute via with xmlAddChild
|
||||
reported by Kris Breuker.
|
||||
|
||||
Sun Dec 27 14:16:13 CET 2008 Rob Richards <[email protected]>
|
||||
|
||||
* xmlwriter.c: fix indenting in xmlTextWriterFullEndElement for
|
||||
bug# 554353.
|
||||
|
||||
Thu Nov 27 16:24:52 CET 2008 Daniel Veillard <[email protected]>
|
||||
|
||||
* include/libxml/tree.h tree.c python/generator.py: adds
|
||||
element traversal support
|
||||
* valid.c: avoid a warning
|
||||
* doc/*: regenerated
|
||||
|
||||
Mon Nov 17 16:56:18 CET 2008 Daniel Veillard <[email protected]>
|
||||
|
||||
* SAX2.c parser.c: fix for CVE-2008-4226, a memory overflow
|
||||
when building gigantic text nodes, and a bit of cleanup
|
||||
to better handled out of memory problem in that code.
|
||||
* tree.c: fix for CVE-2008-4225, lack of testing leads to
|
||||
a busy loop test assuming one have enough core memory.
|
||||
|
||||
Thu Nov 6 14:34:35 CET 2008 Daniel Veillard <[email protected]>
|
||||
|
||||
* xmllint.c: Matthias Kaehlcke reported a build problem when
|
||||
not compiling HTML support in.
|
||||
|
||||
Fri Oct 17 15:24:08 CEST 2008 Daniel Veillard <[email protected]>
|
||||
|
||||
* configure.in doc/Makefile.am: patch from Adrian Bunk which
|
||||
adds --disable-rebuild-docs to avoid rebuilding them
|
||||
|
||||
Fri Oct 3 09:43:45 CEST 2008 Daniel Veillard <[email protected]>
|
||||
|
||||
* configure.in doc/* NEWS: preparing the release of 2.7.2
|
||||
|
||||
Vendored
+17
-1
@@ -11,6 +11,7 @@
|
||||
#include "libxml.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parser.h>
|
||||
@@ -26,6 +27,11 @@
|
||||
#include <libxml/HTMLtree.h>
|
||||
#include <libxml/globals.h>
|
||||
|
||||
/* Define SIZE_T_MAX unless defined through <limits.h>. */
|
||||
#ifndef SIZE_T_MAX
|
||||
# define SIZE_T_MAX ((size_t)-1)
|
||||
#endif /* !SIZE_T_MAX */
|
||||
|
||||
/* #define DEBUG_SAX2 */
|
||||
/* #define DEBUG_SAX2_TREE */
|
||||
|
||||
@@ -2455,9 +2461,19 @@ xmlSAX2Characters(void *ctx, const xmlChar *ch, int len)
|
||||
(xmlDictOwns(ctxt->dict, lastChild->content))) {
|
||||
lastChild->content = xmlStrdup(lastChild->content);
|
||||
}
|
||||
if (((size_t)ctxt->nodelen + (size_t)len > XML_MAX_TEXT_LENGTH) &&
|
||||
((ctxt->options & XML_PARSE_HUGE) == 0)) {
|
||||
xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: huge text node");
|
||||
return;
|
||||
}
|
||||
if ((size_t)ctxt->nodelen > SIZE_T_MAX - (size_t)len ||
|
||||
(size_t)ctxt->nodemem + (size_t)len > SIZE_T_MAX / 2) {
|
||||
xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters overflow prevented");
|
||||
return;
|
||||
}
|
||||
if (ctxt->nodelen + len >= ctxt->nodemem) {
|
||||
xmlChar *newbuf;
|
||||
int size;
|
||||
size_t size;
|
||||
|
||||
size = ctxt->nodemem + len;
|
||||
size *= 2;
|
||||
|
||||
+59
-33
@@ -889,6 +889,8 @@ FFLAGS
|
||||
ac_ct_F77
|
||||
LIBTOOL
|
||||
HTML_DIR
|
||||
REBUILD_DOCS_TRUE
|
||||
REBUILD_DOCS_FALSE
|
||||
Z_CFLAGS
|
||||
Z_LIBS
|
||||
WITH_ZLIB
|
||||
@@ -1585,6 +1587,7 @@ Optional Features:
|
||||
--enable-fast-install[=PKGS]
|
||||
optimize for fast installation [default=yes]
|
||||
--disable-libtool-lock avoid locking (might break parallel builds)
|
||||
--enable-rebuild-docs[=yes/no] rebuild some generated docs [default=yes]
|
||||
--enable-ipv6[=yes/no] enables compilation of IPv6 code [default=yes]
|
||||
|
||||
Optional Packages:
|
||||
@@ -2191,7 +2194,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
|
||||
|
||||
LIBXML_MAJOR_VERSION=2
|
||||
LIBXML_MINOR_VERSION=7
|
||||
LIBXML_MICRO_VERSION=2
|
||||
LIBXML_MICRO_VERSION=3
|
||||
LIBXML_MICRO_VERSION_SUFFIX=
|
||||
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
|
||||
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
|
||||
@@ -5508,7 +5511,7 @@ ia64-*-hpux*)
|
||||
;;
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '#line 5511 "configure"' > conftest.$ac_ext
|
||||
echo '#line 5514 "configure"' > conftest.$ac_ext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
@@ -8062,11 +8065,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:8065: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:8068: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:8069: \$? = $ac_status" >&5
|
||||
echo "$as_me:8072: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@@ -8352,11 +8355,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:8355: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:8358: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:8359: \$? = $ac_status" >&5
|
||||
echo "$as_me:8362: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@@ -8456,11 +8459,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:8459: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:8462: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:8463: \$? = $ac_status" >&5
|
||||
echo "$as_me:8466: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@@ -10807,7 +10810,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 10810 "configure"
|
||||
#line 10813 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@@ -10907,7 +10910,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 10910 "configure"
|
||||
#line 10913 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@@ -13327,11 +13330,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:13330: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:13333: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:13334: \$? = $ac_status" >&5
|
||||
echo "$as_me:13337: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@@ -13431,11 +13434,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:13434: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:13437: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:13438: \$? = $ac_status" >&5
|
||||
echo "$as_me:13441: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@@ -14995,11 +14998,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:14998: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:15001: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:15002: \$? = $ac_status" >&5
|
||||
echo "$as_me:15005: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@@ -15099,11 +15102,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:15102: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:15105: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:15106: \$? = $ac_status" >&5
|
||||
echo "$as_me:15109: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@@ -17288,11 +17291,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:17291: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:17294: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:17295: \$? = $ac_status" >&5
|
||||
echo "$as_me:17298: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@@ -17578,11 +17581,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:17581: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:17584: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:17585: \$? = $ac_status" >&5
|
||||
echo "$as_me:17588: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@@ -17682,11 +17685,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:17685: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:17688: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:17689: \$? = $ac_status" >&5
|
||||
echo "$as_me:17692: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@@ -20588,6 +20591,20 @@ if test "${with_coverage+set}" = set; then
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --enable-rebuild-docs was given.
|
||||
if test "${enable_rebuild_docs+set}" = set; then
|
||||
enableval=$enable_rebuild_docs;
|
||||
fi
|
||||
|
||||
if test "$enable_rebuild_docs" = "no"; then
|
||||
REBUILD_DOCS_TRUE=
|
||||
REBUILD_DOCS_FALSE='#'
|
||||
else
|
||||
REBUILD_DOCS_TRUE='#'
|
||||
REBUILD_DOCS_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
if test "$with_schemas" = "yes"
|
||||
then
|
||||
with_pattern=yes
|
||||
@@ -26662,7 +26679,7 @@ fi
|
||||
{ echo "$as_me:$LINENO: checking for type of socket length (socklen_t)" >&5
|
||||
echo $ECHO_N "checking for type of socket length (socklen_t)... $ECHO_C" >&6; }
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 26665 "configure"
|
||||
#line 26682 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#include <stddef.h>
|
||||
@@ -26673,7 +26690,7 @@ int main(void) {
|
||||
(void)getsockopt (1, 1, 1, NULL, (socklen_t *)NULL)
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:26676: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
|
||||
if { (eval echo configure:26693: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
|
||||
rm -rf conftest*
|
||||
|
||||
{ echo "$as_me:$LINENO: result: socklen_t *" >&5
|
||||
@@ -26685,7 +26702,7 @@ else
|
||||
rm -rf conftest*
|
||||
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 26688 "configure"
|
||||
#line 26705 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#include <stddef.h>
|
||||
@@ -26696,7 +26713,7 @@ int main(void) {
|
||||
(void)getsockopt (1, 1, 1, NULL, (size_t *)NULL)
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:26699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
|
||||
if { (eval echo configure:26716: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
|
||||
rm -rf conftest*
|
||||
|
||||
{ echo "$as_me:$LINENO: result: size_t *" >&5
|
||||
@@ -26708,7 +26725,7 @@ else
|
||||
rm -rf conftest*
|
||||
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 26711 "configure"
|
||||
#line 26728 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#include <stddef.h>
|
||||
@@ -26719,7 +26736,7 @@ int main(void) {
|
||||
(void)getsockopt (1, 1, 1, NULL, (int *)NULL)
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:26722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
|
||||
if { (eval echo configure:26739: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; _out=`eval $ac_compile 2>&1` && test "x$_out" = x; }; then
|
||||
rm -rf conftest*
|
||||
|
||||
{ echo "$as_me:$LINENO: result: int *" >&5
|
||||
@@ -29703,6 +29720,13 @@ echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
if test -z "${REBUILD_DOCS_TRUE}" && test -z "${REBUILD_DOCS_FALSE}"; then
|
||||
{ { echo "$as_me:$LINENO: error: conditional \"REBUILD_DOCS\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&5
|
||||
echo "$as_me: error: conditional \"REBUILD_DOCS\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
if test -z "${WITH_PYTHON_TRUE}" && test -z "${WITH_PYTHON_FALSE}"; then
|
||||
{ { echo "$as_me:$LINENO: error: conditional \"WITH_PYTHON\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&5
|
||||
@@ -30427,6 +30451,8 @@ FFLAGS!$FFLAGS$ac_delim
|
||||
ac_ct_F77!$ac_ct_F77$ac_delim
|
||||
LIBTOOL!$LIBTOOL$ac_delim
|
||||
HTML_DIR!$HTML_DIR$ac_delim
|
||||
REBUILD_DOCS_TRUE!$REBUILD_DOCS_TRUE$ac_delim
|
||||
REBUILD_DOCS_FALSE!$REBUILD_DOCS_FALSE$ac_delim
|
||||
Z_CFLAGS!$Z_CFLAGS$ac_delim
|
||||
Z_LIBS!$Z_LIBS$ac_delim
|
||||
WITH_ZLIB!$WITH_ZLIB$ac_delim
|
||||
@@ -30497,8 +30523,6 @@ WITH_SCHEMAS!$WITH_SCHEMAS$ac_delim
|
||||
TEST_SCHEMAS!$TEST_SCHEMAS$ac_delim
|
||||
WITH_REGEXPS!$WITH_REGEXPS$ac_delim
|
||||
TEST_REGEXPS!$TEST_REGEXPS$ac_delim
|
||||
WITH_DEBUG!$WITH_DEBUG$ac_delim
|
||||
DEBUG_OBJ!$DEBUG_OBJ$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
|
||||
@@ -30540,6 +30564,8 @@ _ACEOF
|
||||
ac_delim='%!_!# '
|
||||
for ac_last_try in false false false false false :; do
|
||||
cat >conf$$subs.sed <<_ACEOF
|
||||
WITH_DEBUG!$WITH_DEBUG$ac_delim
|
||||
DEBUG_OBJ!$DEBUG_OBJ$ac_delim
|
||||
TEST_DEBUG!$TEST_DEBUG$ac_delim
|
||||
WITH_MEM_DEBUG!$WITH_MEM_DEBUG$ac_delim
|
||||
WITH_RUN_DEBUG!$WITH_RUN_DEBUG$ac_delim
|
||||
@@ -30566,7 +30592,7 @@ LIBOBJS!$LIBOBJS$ac_delim
|
||||
LTLIBOBJS!$LTLIBOBJS$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 24; then
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 26; then
|
||||
break
|
||||
elif $ac_last_try; then
|
||||
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
|
||||
|
||||
+5
-1
@@ -5,7 +5,7 @@ AC_CANONICAL_HOST
|
||||
|
||||
LIBXML_MAJOR_VERSION=2
|
||||
LIBXML_MINOR_VERSION=7
|
||||
LIBXML_MICRO_VERSION=2
|
||||
LIBXML_MICRO_VERSION=3
|
||||
LIBXML_MICRO_VERSION_SUFFIX=
|
||||
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
|
||||
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
|
||||
@@ -166,6 +166,10 @@ AC_ARG_WITH(zlib,
|
||||
AC_ARG_WITH(coverage,
|
||||
[ --with-coverage build for code coverage with GCC (off)])
|
||||
|
||||
AC_ARG_ENABLE(rebuild-docs,
|
||||
[ --enable-rebuild-docs[[=yes/no]] rebuild some generated docs [[default=yes]]])
|
||||
AM_CONDITIONAL([REBUILD_DOCS], [test "$enable_rebuild_docs" = "no"])
|
||||
|
||||
dnl
|
||||
dnl hard dependancies on options
|
||||
dnl
|
||||
|
||||
+80
@@ -1991,6 +1991,18 @@ extern __typeof (xmlCheckVersion) xmlCheckVersion__internal_alias __attribute((v
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
#ifdef bottom_tree
|
||||
#undef xmlChildElementCount
|
||||
extern __typeof (xmlChildElementCount) xmlChildElementCount __attribute((alias("xmlChildElementCount__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlChildElementCount
|
||||
extern __typeof (xmlChildElementCount) xmlChildElementCount__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlChildElementCount xmlChildElementCount__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef bottom_encoding
|
||||
#undef xmlCleanupCharEncodingHandlers
|
||||
extern __typeof (xmlCleanupCharEncodingHandlers) xmlCleanupCharEncodingHandlers __attribute((alias("xmlCleanupCharEncodingHandlers__internal_alias")));
|
||||
@@ -3419,6 +3431,18 @@ extern __typeof (xmlFindCharEncodingHandler) xmlFindCharEncodingHandler__interna
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
#ifdef bottom_tree
|
||||
#undef xmlFirstElementChild
|
||||
extern __typeof (xmlFirstElementChild) xmlFirstElementChild __attribute((alias("xmlFirstElementChild__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlFirstElementChild
|
||||
extern __typeof (xmlFirstElementChild) xmlFirstElementChild__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlFirstElementChild xmlFirstElementChild__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef bottom_valid
|
||||
#undef xmlFreeAttributeTable
|
||||
extern __typeof (xmlFreeAttributeTable) xmlFreeAttributeTable __attribute((alias("xmlFreeAttributeTable__internal_alias")));
|
||||
@@ -4759,6 +4783,18 @@ extern __typeof (xmlKeepBlanksDefault) xmlKeepBlanksDefault__internal_alias __at
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
#ifdef bottom_tree
|
||||
#undef xmlLastElementChild
|
||||
extern __typeof (xmlLastElementChild) xmlLastElementChild __attribute((alias("xmlLastElementChild__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlLastElementChild
|
||||
extern __typeof (xmlLastElementChild) xmlLastElementChild__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlLastElementChild xmlLastElementChild__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef bottom_parserInternals
|
||||
#undef xmlLineNumbersDefault
|
||||
extern __typeof (xmlLineNumbersDefault) xmlLineNumbersDefault __attribute((alias("xmlLineNumbersDefault__internal_alias")));
|
||||
@@ -5161,6 +5197,16 @@ extern __typeof (xmlMemDisplay) xmlMemDisplay__internal_alias __attribute((visib
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef bottom_xmlmemory
|
||||
#undef xmlMemDisplayLast
|
||||
extern __typeof (xmlMemDisplayLast) xmlMemDisplayLast __attribute((alias("xmlMemDisplayLast__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlMemDisplayLast
|
||||
extern __typeof (xmlMemDisplayLast) xmlMemDisplayLast__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlMemDisplayLast xmlMemDisplayLast__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef bottom_xmlmemory
|
||||
#undef xmlMemFree
|
||||
extern __typeof (xmlMemFree) xmlMemFree __attribute((alias("xmlMemFree__internal_alias")));
|
||||
@@ -6043,6 +6089,16 @@ extern __typeof (xmlNewElementContent) xmlNewElementContent__internal_alias __at
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef bottom_entities
|
||||
#undef xmlNewEntity
|
||||
extern __typeof (xmlNewEntity) xmlNewEntity __attribute((alias("xmlNewEntity__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlNewEntity
|
||||
extern __typeof (xmlNewEntity) xmlNewEntity__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlNewEntity xmlNewEntity__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef bottom_parserInternals
|
||||
#undef xmlNewEntityInputStream
|
||||
extern __typeof (xmlNewEntityInputStream) xmlNewEntityInputStream __attribute((alias("xmlNewEntityInputStream__internal_alias")));
|
||||
@@ -6367,6 +6423,18 @@ extern __typeof (xmlNextChar) xmlNextChar__internal_alias __attribute((visibilit
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
#ifdef bottom_tree
|
||||
#undef xmlNextElementSibling
|
||||
extern __typeof (xmlNextElementSibling) xmlNextElementSibling __attribute((alias("xmlNextElementSibling__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlNextElementSibling
|
||||
extern __typeof (xmlNextElementSibling) xmlNextElementSibling__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlNextElementSibling xmlNextElementSibling__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef bottom_xmlIO
|
||||
#undef xmlNoNetExternalEntityLoader
|
||||
extern __typeof (xmlNoNetExternalEntityLoader) xmlNoNetExternalEntityLoader __attribute((alias("xmlNoNetExternalEntityLoader__internal_alias")));
|
||||
@@ -7769,6 +7837,18 @@ extern __typeof (xmlPopInputCallbacks) xmlPopInputCallbacks__internal_alias __at
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
#ifdef bottom_tree
|
||||
#undef xmlPreviousElementSibling
|
||||
extern __typeof (xmlPreviousElementSibling) xmlPreviousElementSibling __attribute((alias("xmlPreviousElementSibling__internal_alias")));
|
||||
#else
|
||||
#ifndef xmlPreviousElementSibling
|
||||
extern __typeof (xmlPreviousElementSibling) xmlPreviousElementSibling__internal_alias __attribute((visibility("hidden")));
|
||||
#define xmlPreviousElementSibling xmlPreviousElementSibling__internal_alias
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef bottom_uri
|
||||
#undef xmlPrintURI
|
||||
extern __typeof (xmlPrintURI) xmlPrintURI __attribute((alias("xmlPrintURI__internal_alias")));
|
||||
|
||||
-1
@@ -7,7 +7,6 @@
|
||||
<define name="_MBCS" />
|
||||
<define name="HAVE_WIN32_THREADS" />
|
||||
<define name="_REENTRANT" />
|
||||
<define name="_WINSOCKAPI_" />
|
||||
<define name="LIBXML_STATIC" />
|
||||
<include base="libxml2">include</include>
|
||||
<include base="libxml2">.</include>
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
Summary: Library providing XML and HTML support
|
||||
Name: libxml2
|
||||
Version: 2.7.2
|
||||
Version: 2.7.3
|
||||
Release: 1
|
||||
License: MIT
|
||||
Group: Development/Libraries
|
||||
@@ -128,6 +128,6 @@ rm -fr %{buildroot}
|
||||
%doc doc/python.html
|
||||
|
||||
%changelog
|
||||
* Fri Oct 3 2008 Daniel Veillard <[email protected]>
|
||||
- upstream release 2.7.2 see http://xmlsoft.org/news.html
|
||||
* Sun Jan 18 2009 Daniel Veillard <[email protected]>
|
||||
- upstream release 2.7.3 see http://xmlsoft.org/news.html
|
||||
|
||||
|
||||
+29
-8
@@ -4142,6 +4142,9 @@ get_more:
|
||||
line = ctxt->input->line;
|
||||
col = ctxt->input->col;
|
||||
}
|
||||
/* something really bad happened in the SAX callback */
|
||||
if (ctxt->instate != XML_PARSER_CONTENT)
|
||||
return;
|
||||
}
|
||||
ctxt->input->cur = in;
|
||||
if (*in == 0xD) {
|
||||
@@ -4222,6 +4225,9 @@ xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) {
|
||||
}
|
||||
}
|
||||
nbchar = 0;
|
||||
/* something really bad happened in the SAX callback */
|
||||
if (ctxt->instate != XML_PARSER_CONTENT)
|
||||
return;
|
||||
}
|
||||
count++;
|
||||
if (count > 50) {
|
||||
@@ -7041,9 +7047,11 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
|
||||
/*
|
||||
* Predefined entites override any extra definition
|
||||
*/
|
||||
ent = xmlGetPredefinedEntity(name);
|
||||
if (ent != NULL)
|
||||
return(ent);
|
||||
if ((ctxt->options & XML_PARSE_OLDSAX) == 0) {
|
||||
ent = xmlGetPredefinedEntity(name);
|
||||
if (ent != NULL)
|
||||
return(ent);
|
||||
}
|
||||
|
||||
/*
|
||||
* Increate the number of entity references parsed
|
||||
@@ -7057,6 +7065,9 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
|
||||
if (ctxt->sax != NULL) {
|
||||
if (ctxt->sax->getEntity != NULL)
|
||||
ent = ctxt->sax->getEntity(ctxt->userData, name);
|
||||
if ((ctxt->wellFormed == 1 ) && (ent == NULL) &&
|
||||
(ctxt->options & XML_PARSE_OLDSAX))
|
||||
ent = xmlGetPredefinedEntity(name);
|
||||
if ((ctxt->wellFormed == 1 ) && (ent == NULL) &&
|
||||
(ctxt->userData==ctxt)) {
|
||||
ent = xmlSAX2GetEntity(ctxt, name);
|
||||
@@ -7129,6 +7140,7 @@ xmlParseEntityRef(xmlParserCtxtPtr ctxt) {
|
||||
*/
|
||||
else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) &&
|
||||
(ent != NULL) && (ent->content != NULL) &&
|
||||
(ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) &&
|
||||
(xmlStrchr(ent->content, '<'))) {
|
||||
xmlFatalErrMsgStr(ctxt, XML_ERR_LT_IN_ATTRIBUTE,
|
||||
"'<' in entity '%s' is not allowed in attributes values\n", name);
|
||||
@@ -7225,11 +7237,13 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
|
||||
/*
|
||||
* Predefined entites override any extra definition
|
||||
*/
|
||||
ent = xmlGetPredefinedEntity(name);
|
||||
if (ent != NULL) {
|
||||
xmlFree(name);
|
||||
*str = ptr;
|
||||
return(ent);
|
||||
if ((ctxt->options & XML_PARSE_OLDSAX) == 0) {
|
||||
ent = xmlGetPredefinedEntity(name);
|
||||
if (ent != NULL) {
|
||||
xmlFree(name);
|
||||
*str = ptr;
|
||||
return(ent);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -7244,6 +7258,8 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
|
||||
if (ctxt->sax != NULL) {
|
||||
if (ctxt->sax->getEntity != NULL)
|
||||
ent = ctxt->sax->getEntity(ctxt->userData, name);
|
||||
if ((ent == NULL) && (ctxt->options & XML_PARSE_OLDSAX))
|
||||
ent = xmlGetPredefinedEntity(name);
|
||||
if ((ent == NULL) && (ctxt->userData==ctxt)) {
|
||||
ent = xmlSAX2GetEntity(ctxt, name);
|
||||
}
|
||||
@@ -7312,6 +7328,7 @@ xmlParseStringEntityRef(xmlParserCtxtPtr ctxt, const xmlChar ** str) {
|
||||
*/
|
||||
else if ((ctxt->instate == XML_PARSER_ATTRIBUTE_VALUE) &&
|
||||
(ent != NULL) && (ent->content != NULL) &&
|
||||
(ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) &&
|
||||
(xmlStrchr(ent->content, '<'))) {
|
||||
xmlFatalErrMsgStr(ctxt, XML_ERR_LT_IN_ATTRIBUTE,
|
||||
"'<' in entity '%s' is not allowed in attributes values\n",
|
||||
@@ -14205,6 +14222,10 @@ xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, const char *encodi
|
||||
ctxt->options |= XML_PARSE_HUGE;
|
||||
options -= XML_PARSE_HUGE;
|
||||
}
|
||||
if (options & XML_PARSE_OLDSAX) {
|
||||
ctxt->options |= XML_PARSE_OLDSAX;
|
||||
options -= XML_PARSE_OLDSAX;
|
||||
}
|
||||
ctxt->linenumbers = 1;
|
||||
return (options);
|
||||
}
|
||||
|
||||
+178
-3
@@ -19056,6 +19056,40 @@ test_xmlBuildQName(void) {
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_xmlChildElementCount(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
int mem_base;
|
||||
unsigned long ret_val;
|
||||
xmlNodePtr parent; /* the parent node */
|
||||
int n_parent;
|
||||
|
||||
for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
|
||||
mem_base = xmlMemBlocks();
|
||||
parent = gen_xmlNodePtr(n_parent, 0);
|
||||
|
||||
ret_val = xmlChildElementCount(parent);
|
||||
desret_unsigned_long(ret_val);
|
||||
call_tests++;
|
||||
des_xmlNodePtr(n_parent, parent, 0);
|
||||
xmlResetLastError();
|
||||
if (mem_base != xmlMemBlocks()) {
|
||||
printf("Leak of %d blocks found in xmlChildElementCount",
|
||||
xmlMemBlocks() - mem_base);
|
||||
test_ret++;
|
||||
printf(" %d", n_parent);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
function_tests++;
|
||||
#endif
|
||||
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_xmlCopyDoc(void) {
|
||||
int test_ret = 0;
|
||||
@@ -20170,6 +20204,40 @@ test_xmlElemDump(void) {
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_xmlFirstElementChild(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
int mem_base;
|
||||
xmlNodePtr ret_val;
|
||||
xmlNodePtr parent; /* the parent node */
|
||||
int n_parent;
|
||||
|
||||
for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
|
||||
mem_base = xmlMemBlocks();
|
||||
parent = gen_xmlNodePtr(n_parent, 0);
|
||||
|
||||
ret_val = xmlFirstElementChild(parent);
|
||||
desret_xmlNodePtr(ret_val);
|
||||
call_tests++;
|
||||
des_xmlNodePtr(n_parent, parent, 0);
|
||||
xmlResetLastError();
|
||||
if (mem_base != xmlMemBlocks()) {
|
||||
printf("Leak of %d blocks found in xmlFirstElementChild",
|
||||
xmlMemBlocks() - mem_base);
|
||||
test_ret++;
|
||||
printf(" %d", n_parent);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
function_tests++;
|
||||
#endif
|
||||
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_xmlGetBufferAllocationScheme(void) {
|
||||
int test_ret = 0;
|
||||
@@ -20672,6 +20740,40 @@ test_xmlIsXHTML(void) {
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_xmlLastElementChild(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
int mem_base;
|
||||
xmlNodePtr ret_val;
|
||||
xmlNodePtr parent; /* the parent node */
|
||||
int n_parent;
|
||||
|
||||
for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
|
||||
mem_base = xmlMemBlocks();
|
||||
parent = gen_xmlNodePtr(n_parent, 0);
|
||||
|
||||
ret_val = xmlLastElementChild(parent);
|
||||
desret_xmlNodePtr(ret_val);
|
||||
call_tests++;
|
||||
des_xmlNodePtr(n_parent, parent, 0);
|
||||
xmlResetLastError();
|
||||
if (mem_base != xmlMemBlocks()) {
|
||||
printf("Leak of %d blocks found in xmlLastElementChild",
|
||||
xmlMemBlocks() - mem_base);
|
||||
test_ret++;
|
||||
printf(" %d", n_parent);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
function_tests++;
|
||||
#endif
|
||||
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_xmlNewCDataBlock(void) {
|
||||
int test_ret = 0;
|
||||
@@ -21831,6 +21933,40 @@ test_xmlNewTextLen(void) {
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_xmlNextElementSibling(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
int mem_base;
|
||||
xmlNodePtr ret_val;
|
||||
xmlNodePtr node; /* the current node */
|
||||
int n_node;
|
||||
|
||||
for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
|
||||
mem_base = xmlMemBlocks();
|
||||
node = gen_xmlNodePtr(n_node, 0);
|
||||
|
||||
ret_val = xmlNextElementSibling(node);
|
||||
desret_xmlNodePtr(ret_val);
|
||||
call_tests++;
|
||||
des_xmlNodePtr(n_node, node, 0);
|
||||
xmlResetLastError();
|
||||
if (mem_base != xmlMemBlocks()) {
|
||||
printf("Leak of %d blocks found in xmlNextElementSibling",
|
||||
xmlMemBlocks() - mem_base);
|
||||
test_ret++;
|
||||
printf(" %d", n_node);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
function_tests++;
|
||||
#endif
|
||||
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_xmlNodeAddContent(void) {
|
||||
int test_ret = 0;
|
||||
@@ -22580,6 +22716,40 @@ test_xmlNodeSetSpacePreserve(void) {
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_xmlPreviousElementSibling(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
int mem_base;
|
||||
xmlNodePtr ret_val;
|
||||
xmlNodePtr node; /* the current node */
|
||||
int n_node;
|
||||
|
||||
for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
|
||||
mem_base = xmlMemBlocks();
|
||||
node = gen_xmlNodePtr(n_node, 0);
|
||||
|
||||
ret_val = xmlPreviousElementSibling(node);
|
||||
desret_xmlNodePtr(ret_val);
|
||||
call_tests++;
|
||||
des_xmlNodePtr(n_node, node, 0);
|
||||
xmlResetLastError();
|
||||
if (mem_base != xmlMemBlocks()) {
|
||||
printf("Leak of %d blocks found in xmlPreviousElementSibling",
|
||||
xmlMemBlocks() - mem_base);
|
||||
test_ret++;
|
||||
printf(" %d", n_node);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
function_tests++;
|
||||
#endif
|
||||
|
||||
return(test_ret);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test_xmlReconciliateNs(void) {
|
||||
int test_ret = 0;
|
||||
@@ -23845,7 +24015,7 @@ static int
|
||||
test_tree(void) {
|
||||
int test_ret = 0;
|
||||
|
||||
if (quiet == 0) printf("Testing tree : 133 of 152 functions ...\n");
|
||||
if (quiet == 0) printf("Testing tree : 138 of 157 functions ...\n");
|
||||
test_ret += test_xmlAddChild();
|
||||
test_ret += test_xmlAddChildList();
|
||||
test_ret += test_xmlAddNextSibling();
|
||||
@@ -23870,6 +24040,7 @@ test_tree(void) {
|
||||
test_ret += test_xmlBufferWriteChar();
|
||||
test_ret += test_xmlBufferWriteQuotedString();
|
||||
test_ret += test_xmlBuildQName();
|
||||
test_ret += test_xmlChildElementCount();
|
||||
test_ret += test_xmlCopyDoc();
|
||||
test_ret += test_xmlCopyDtd();
|
||||
test_ret += test_xmlCopyNamespace();
|
||||
@@ -23895,6 +24066,7 @@ test_tree(void) {
|
||||
test_ret += test_xmlDocGetRootElement();
|
||||
test_ret += test_xmlDocSetRootElement();
|
||||
test_ret += test_xmlElemDump();
|
||||
test_ret += test_xmlFirstElementChild();
|
||||
test_ret += test_xmlGetBufferAllocationScheme();
|
||||
test_ret += test_xmlGetCompressMode();
|
||||
test_ret += test_xmlGetDocCompressMode();
|
||||
@@ -23910,6 +24082,7 @@ test_tree(void) {
|
||||
test_ret += test_xmlHasProp();
|
||||
test_ret += test_xmlIsBlankNode();
|
||||
test_ret += test_xmlIsXHTML();
|
||||
test_ret += test_xmlLastElementChild();
|
||||
test_ret += test_xmlNewCDataBlock();
|
||||
test_ret += test_xmlNewCharRef();
|
||||
test_ret += test_xmlNewChild();
|
||||
@@ -23936,6 +24109,7 @@ test_tree(void) {
|
||||
test_ret += test_xmlNewText();
|
||||
test_ret += test_xmlNewTextChild();
|
||||
test_ret += test_xmlNewTextLen();
|
||||
test_ret += test_xmlNextElementSibling();
|
||||
test_ret += test_xmlNodeAddContent();
|
||||
test_ret += test_xmlNodeAddContentLen();
|
||||
test_ret += test_xmlNodeBufGetContent();
|
||||
@@ -23954,6 +24128,7 @@ test_tree(void) {
|
||||
test_ret += test_xmlNodeSetLang();
|
||||
test_ret += test_xmlNodeSetName();
|
||||
test_ret += test_xmlNodeSetSpacePreserve();
|
||||
test_ret += test_xmlPreviousElementSibling();
|
||||
test_ret += test_xmlReconciliateNs();
|
||||
test_ret += test_xmlRemoveProp();
|
||||
test_ret += test_xmlReplaceNode();
|
||||
@@ -25969,9 +26144,9 @@ test_xmlValidateAttributeValue(void) {
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
int mem_base;
|
||||
int ret_val;
|
||||
xmlAttributeType type; /* */
|
||||
xmlAttributeType type; /* an attribute type */
|
||||
int n_type;
|
||||
xmlChar * value; /* */
|
||||
xmlChar * value; /* an attribute value */
|
||||
int n_value;
|
||||
|
||||
for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
|
||||
|
||||
+9
@@ -63,6 +63,8 @@ extern int pthread_setspecific (pthread_key_t __key,
|
||||
extern int pthread_key_create (pthread_key_t *__key,
|
||||
void (*__destr_function) (void *))
|
||||
__attribute((weak));
|
||||
extern int pthread_key_delete (pthread_key_t __key)
|
||||
__attribute((weak));
|
||||
extern int pthread_mutex_init ()
|
||||
__attribute((weak));
|
||||
extern int pthread_mutex_destroy ()
|
||||
@@ -83,6 +85,8 @@ extern pthread_t pthread_self ()
|
||||
__attribute((weak));
|
||||
extern int pthread_key_create ()
|
||||
__attribute((weak));
|
||||
extern int pthread_key_delete ()
|
||||
__attribute((weak));
|
||||
extern int pthread_cond_signal ()
|
||||
__attribute((weak));
|
||||
#endif
|
||||
@@ -698,6 +702,7 @@ xmlGetGlobalState(void)
|
||||
if (p == NULL) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlGetGlobalState: out of memory\n");
|
||||
xmlFreeGlobalState(tsd);
|
||||
return(NULL);
|
||||
}
|
||||
p->memory = tsd;
|
||||
@@ -859,6 +864,7 @@ xmlInitThreads(void)
|
||||
(pthread_getspecific != NULL) &&
|
||||
(pthread_setspecific != NULL) &&
|
||||
(pthread_key_create != NULL) &&
|
||||
(pthread_key_delete != NULL) &&
|
||||
(pthread_mutex_init != NULL) &&
|
||||
(pthread_mutex_destroy != NULL) &&
|
||||
(pthread_mutex_lock != NULL) &&
|
||||
@@ -912,6 +918,9 @@ xmlCleanupThreads(void)
|
||||
globalkey = TLS_OUT_OF_INDEXES;
|
||||
}
|
||||
DeleteCriticalSection(&cleanup_helpers_cs);
|
||||
#elif defined HAVE_PTHREAD_H
|
||||
if ((libxml_is_threaded) && (pthread_key_delete != NULL))
|
||||
pthread_key_delete(globalkey);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Vendored
+212
-7
@@ -14,7 +14,7 @@
|
||||
#include "libxml.h"
|
||||
|
||||
#include <string.h> /* for memset() only ! */
|
||||
|
||||
#include <limits.h>
|
||||
#ifdef HAVE_CTYPE_H
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
@@ -3216,7 +3216,10 @@ xmlAddChildList(xmlNodePtr parent, xmlNodePtr cur) {
|
||||
cur = cur->next;
|
||||
}
|
||||
cur->parent = parent;
|
||||
cur->doc = parent->doc; /* the parent may not be linked to a doc ! */
|
||||
/* the parent may not be linked to a doc ! */
|
||||
if (cur->doc != parent->doc) {
|
||||
xmlSetTreeDoc(cur, parent->doc);
|
||||
}
|
||||
parent->last = cur;
|
||||
|
||||
return(cur);
|
||||
@@ -3309,9 +3312,7 @@ xmlAddChild(xmlNodePtr parent, xmlNodePtr cur) {
|
||||
if (cur->type == XML_ATTRIBUTE_NODE) {
|
||||
if (parent->type != XML_ELEMENT_NODE)
|
||||
return(NULL);
|
||||
if (parent->properties == NULL) {
|
||||
parent->properties = (xmlAttrPtr) cur;
|
||||
} else {
|
||||
if (parent->properties != NULL) {
|
||||
/* check if an attribute with the same name exists */
|
||||
xmlAttrPtr lastattr;
|
||||
|
||||
@@ -3326,8 +3327,13 @@ xmlAddChild(xmlNodePtr parent, xmlNodePtr cur) {
|
||||
}
|
||||
if (lastattr == (xmlAttrPtr) cur)
|
||||
return(cur);
|
||||
|
||||
}
|
||||
if (parent->properties == NULL) {
|
||||
parent->properties = (xmlAttrPtr) cur;
|
||||
} else {
|
||||
/* find the end */
|
||||
lastattr = parent->properties;
|
||||
xmlAttrPtr lastattr = parent->properties;
|
||||
while (lastattr->next != NULL) {
|
||||
lastattr = lastattr->next;
|
||||
}
|
||||
@@ -3367,6 +3373,199 @@ xmlGetLastChild(xmlNodePtr parent) {
|
||||
return(parent->last);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
/*
|
||||
* 5 interfaces from DOM ElementTraversal
|
||||
*/
|
||||
|
||||
/**
|
||||
* xmlChildElementCount:
|
||||
* @parent: the parent node
|
||||
*
|
||||
* Finds the current number of child nodes of that element which are
|
||||
* element nodes.
|
||||
* Note the handling of entities references is different than in
|
||||
* the W3C DOM element traversal spec since we don't have back reference
|
||||
* from entities content to entities references.
|
||||
*
|
||||
* Returns the count of element child or 0 if not available
|
||||
*/
|
||||
unsigned long
|
||||
xmlChildElementCount(xmlNodePtr parent) {
|
||||
unsigned long ret = 0;
|
||||
xmlNodePtr cur = NULL;
|
||||
|
||||
if (parent == NULL)
|
||||
return(0);
|
||||
switch (parent->type) {
|
||||
case XML_ELEMENT_NODE:
|
||||
case XML_ENTITY_NODE:
|
||||
case XML_DOCUMENT_NODE:
|
||||
case XML_HTML_DOCUMENT_NODE:
|
||||
cur = parent->children;
|
||||
break;
|
||||
default:
|
||||
return(0);
|
||||
}
|
||||
while (cur != NULL) {
|
||||
if (cur->type == XML_ELEMENT_NODE)
|
||||
ret++;
|
||||
cur = cur->next;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlFirstElementChild:
|
||||
* @parent: the parent node
|
||||
*
|
||||
* Finds the first child node of that element which is a Element node
|
||||
* Note the handling of entities references is different than in
|
||||
* the W3C DOM element traversal spec since we don't have back reference
|
||||
* from entities content to entities references.
|
||||
*
|
||||
* Returns the first element child or NULL if not available
|
||||
*/
|
||||
xmlNodePtr
|
||||
xmlFirstElementChild(xmlNodePtr parent) {
|
||||
xmlNodePtr cur = NULL;
|
||||
|
||||
if (parent == NULL)
|
||||
return(NULL);
|
||||
switch (parent->type) {
|
||||
case XML_ELEMENT_NODE:
|
||||
case XML_ENTITY_NODE:
|
||||
case XML_DOCUMENT_NODE:
|
||||
case XML_HTML_DOCUMENT_NODE:
|
||||
cur = parent->children;
|
||||
break;
|
||||
default:
|
||||
return(NULL);
|
||||
}
|
||||
while (cur != NULL) {
|
||||
if (cur->type == XML_ELEMENT_NODE)
|
||||
return(cur);
|
||||
cur = cur->next;
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlLastElementChild:
|
||||
* @parent: the parent node
|
||||
*
|
||||
* Finds the last child node of that element which is a Element node
|
||||
* Note the handling of entities references is different than in
|
||||
* the W3C DOM element traversal spec since we don't have back reference
|
||||
* from entities content to entities references.
|
||||
*
|
||||
* Returns the last element child or NULL if not available
|
||||
*/
|
||||
xmlNodePtr
|
||||
xmlLastElementChild(xmlNodePtr parent) {
|
||||
xmlNodePtr cur = NULL;
|
||||
|
||||
if (parent == NULL)
|
||||
return(NULL);
|
||||
switch (parent->type) {
|
||||
case XML_ELEMENT_NODE:
|
||||
case XML_ENTITY_NODE:
|
||||
case XML_DOCUMENT_NODE:
|
||||
case XML_HTML_DOCUMENT_NODE:
|
||||
cur = parent->last;
|
||||
break;
|
||||
default:
|
||||
return(NULL);
|
||||
}
|
||||
while (cur != NULL) {
|
||||
if (cur->type == XML_ELEMENT_NODE)
|
||||
return(cur);
|
||||
cur = cur->prev;
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlPreviousElementSibling:
|
||||
* @node: the current node
|
||||
*
|
||||
* Finds the first closest previous sibling of the node which is an
|
||||
* element node.
|
||||
* Note the handling of entities references is different than in
|
||||
* the W3C DOM element traversal spec since we don't have back reference
|
||||
* from entities content to entities references.
|
||||
*
|
||||
* Returns the previous element sibling or NULL if not available
|
||||
*/
|
||||
xmlNodePtr
|
||||
xmlPreviousElementSibling(xmlNodePtr node) {
|
||||
if (node == NULL)
|
||||
return(NULL);
|
||||
switch (node->type) {
|
||||
case XML_ELEMENT_NODE:
|
||||
case XML_TEXT_NODE:
|
||||
case XML_CDATA_SECTION_NODE:
|
||||
case XML_ENTITY_REF_NODE:
|
||||
case XML_ENTITY_NODE:
|
||||
case XML_PI_NODE:
|
||||
case XML_COMMENT_NODE:
|
||||
case XML_XINCLUDE_START:
|
||||
case XML_XINCLUDE_END:
|
||||
node = node->prev;
|
||||
break;
|
||||
default:
|
||||
return(NULL);
|
||||
}
|
||||
while (node != NULL) {
|
||||
if (node->type == XML_ELEMENT_NODE)
|
||||
return(node);
|
||||
node = node->next;
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlNextElementSibling:
|
||||
* @node: the current node
|
||||
*
|
||||
* Finds the first closest next sibling of the node which is an
|
||||
* element node.
|
||||
* Note the handling of entities references is different than in
|
||||
* the W3C DOM element traversal spec since we don't have back reference
|
||||
* from entities content to entities references.
|
||||
*
|
||||
* Returns the next element sibling or NULL if not available
|
||||
*/
|
||||
xmlNodePtr
|
||||
xmlNextElementSibling(xmlNodePtr node) {
|
||||
if (node == NULL)
|
||||
return(NULL);
|
||||
switch (node->type) {
|
||||
case XML_ELEMENT_NODE:
|
||||
case XML_TEXT_NODE:
|
||||
case XML_CDATA_SECTION_NODE:
|
||||
case XML_ENTITY_REF_NODE:
|
||||
case XML_ENTITY_NODE:
|
||||
case XML_PI_NODE:
|
||||
case XML_COMMENT_NODE:
|
||||
case XML_DTD_NODE:
|
||||
case XML_XINCLUDE_START:
|
||||
case XML_XINCLUDE_END:
|
||||
node = node->next;
|
||||
break;
|
||||
default:
|
||||
return(NULL);
|
||||
}
|
||||
while (node != NULL) {
|
||||
if (node->type == XML_ELEMENT_NODE)
|
||||
return(node);
|
||||
node = node->next;
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#endif /* LIBXML_TREE_ENABLED */
|
||||
|
||||
/**
|
||||
* xmlFreeNodeList:
|
||||
* @cur: the first node in the list
|
||||
@@ -6996,7 +7195,13 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size)
|
||||
case XML_BUFFER_ALLOC_DOUBLEIT:
|
||||
/*take care of empty case*/
|
||||
newSize = (buf->size ? buf->size*2 : size + 10);
|
||||
while (size > newSize) newSize *= 2;
|
||||
while (size > newSize) {
|
||||
if (newSize > UINT_MAX / 2) {
|
||||
xmlTreeErrMemory("growing buffer");
|
||||
return 0;
|
||||
}
|
||||
newSize *= 2;
|
||||
}
|
||||
break;
|
||||
case XML_BUFFER_ALLOC_EXACT:
|
||||
newSize = size+10;
|
||||
|
||||
Vendored
+26
-16
@@ -3792,27 +3792,13 @@ xmlValidateNotationDecl(xmlValidCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlDocPtr doc ATT
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlValidateAttributeValue:
|
||||
* xmlValidateAttributeValueInternal:
|
||||
* @doc: the document
|
||||
* @type: an attribute type
|
||||
* @value: an attribute value
|
||||
*
|
||||
* Validate that the given attribute value match the proper production
|
||||
*
|
||||
* [ VC: ID ]
|
||||
* Values of type ID must match the Name production....
|
||||
*
|
||||
* [ VC: IDREF ]
|
||||
* Values of type IDREF must match the Name production, and values
|
||||
* of type IDREFS must match Names ...
|
||||
*
|
||||
* [ VC: Entity Name ]
|
||||
* Values of type ENTITY must match the Name production, values
|
||||
* of type ENTITIES must match Names ...
|
||||
*
|
||||
* [ VC: Name Token ]
|
||||
* Values of type NMTOKEN must match the Nmtoken production; values
|
||||
* of type NMTOKENS must match Nmtokens.
|
||||
*
|
||||
* returns 1 if valid or 0 otherwise
|
||||
*/
|
||||
|
||||
@@ -3839,6 +3825,30 @@ xmlValidateAttributeValueInternal(xmlDocPtr doc, xmlAttributeType type,
|
||||
return(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlValidateAttributeValue:
|
||||
* @type: an attribute type
|
||||
* @value: an attribute value
|
||||
*
|
||||
* Validate that the given attribute value match the proper production
|
||||
*
|
||||
* [ VC: ID ]
|
||||
* Values of type ID must match the Name production....
|
||||
*
|
||||
* [ VC: IDREF ]
|
||||
* Values of type IDREF must match the Name production, and values
|
||||
* of type IDREFS must match Names ...
|
||||
*
|
||||
* [ VC: Entity Name ]
|
||||
* Values of type ENTITY must match the Name production, values
|
||||
* of type ENTITIES must match Names ...
|
||||
*
|
||||
* [ VC: Name Token ]
|
||||
* Values of type NMTOKEN must match the Nmtoken production; values
|
||||
* of type NMTOKENS must match Nmtokens.
|
||||
*
|
||||
* returns 1 if valid or 0 otherwise
|
||||
*/
|
||||
int
|
||||
xmlValidateAttributeValue(xmlAttributeType type, const xmlChar *value) {
|
||||
return(xmlValidateAttributeValueInternal(NULL, type, value));
|
||||
|
||||
+2
@@ -2753,8 +2753,10 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
|
||||
#endif
|
||||
|
||||
#ifdef LIBXML_DEBUG_ENABLED
|
||||
#if defined(LIBXML_HTML_ENABLED) || defined(LIBXML_VALID_ENABLED)
|
||||
if ((debugent) && (!html))
|
||||
xmlDebugDumpEntities(stderr, doc);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
+8
@@ -1240,8 +1240,16 @@ xmlTextWriterFullEndElement(xmlTextWriterPtr writer)
|
||||
if (count < 0)
|
||||
return -1;
|
||||
sum += count;
|
||||
if (writer->indent)
|
||||
writer->doindent = 0;
|
||||
/* fallthrough */
|
||||
case XML_TEXTWRITER_TEXT:
|
||||
if ((writer->indent) && (writer->doindent)) {
|
||||
count = xmlTextWriterWriteIndent(writer);
|
||||
sum += count;
|
||||
writer->doindent = 1;
|
||||
} else
|
||||
writer->doindent = 1;
|
||||
count = xmlOutputBufferWriteString(writer->out, "</");
|
||||
if (count < 0)
|
||||
return -1;
|
||||
|
||||
Vendored
+6
-6
@@ -13329,8 +13329,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
||||
URI = xmlXPathNsLookup(ctxt->context, op->value5);
|
||||
if (URI == NULL) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlXPathCompOpEval: variable %s bound to undefined prefix %s\n",
|
||||
op->value4, op->value5);
|
||||
"xmlXPathCompOpEval: variable %s bound to undefined prefix %s\n",
|
||||
(char *) op->value4, (char *)op->value5);
|
||||
return (total);
|
||||
}
|
||||
val = xmlXPathVariableLookupNS(ctxt->context,
|
||||
@@ -13377,8 +13377,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
||||
URI = xmlXPathNsLookup(ctxt->context, op->value5);
|
||||
if (URI == NULL) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlXPathCompOpEval: function %s bound to undefined prefix %s\n",
|
||||
op->value4, op->value5);
|
||||
"xmlXPathCompOpEval: function %s bound to undefined prefix %s\n",
|
||||
(char *)op->value4, (char *)op->value5);
|
||||
return (total);
|
||||
}
|
||||
func = xmlXPathFunctionLookupNS(ctxt->context,
|
||||
@@ -13386,8 +13386,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
|
||||
}
|
||||
if (func == NULL) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"xmlXPathCompOpEval: function %s not found\n",
|
||||
op->value4);
|
||||
"xmlXPathCompOpEval: function %s not found\n",
|
||||
(char *)op->value4);
|
||||
XP_ERROR0(XPATH_UNKNOWN_FUNC_ERROR);
|
||||
}
|
||||
op->cache = XML_CAST_FPTR(func);
|
||||
|
||||
Reference in New Issue
Block a user