[mapserver-commits] r9858 - in trunk/mapserver: . xmlmapfile
svn at osgeo.org
svn at osgeo.org
Mon Feb 22 10:05:02 EST 2010
Author: aboudreault
Date: 2010-02-22 10:05:01 -0500 (Mon, 22 Feb 2010)
New Revision: 9858
Added:
trunk/mapserver/mapxml.c
Modified:
trunk/mapserver/Makefile.in
trunk/mapserver/configure
trunk/mapserver/configure.in
trunk/mapserver/mapfile.c
trunk/mapserver/mapserver.h
trunk/mapserver/xmlmapfile/mapfile.xsl
Log:
Added XML mapfile loading support (#3334)
Modified: trunk/mapserver/Makefile.in
===================================================================
--- trunk/mapserver/Makefile.in 2010-02-22 14:29:13 UTC (rev 9857)
+++ trunk/mapserver/Makefile.in 2010-02-22 15:05:01 UTC (rev 9858)
@@ -179,6 +179,16 @@
XML2_INC=@XML2_INC@
XML2_LIB=@XML2_LIB@
+# libxslt ... required for xml mapfile
+XSLT_INC=@XSLT_INC@
+XSLT_LIB=@XSLT_LIB@
+
+# libexslt ... required for xml mapfile
+EXSLT_INC=@EXSLT_INC@
+EXSLT_LIB=@EXSLT_LIB@
+
+
+
# Optional FastCGI
FASTCGI=@FASTCGI_ENABLED@
FASTCGI_INC=@FASTCGI_INC@
@@ -257,7 +267,7 @@
SUP_LIBS = $(GD_LIB) $(AGG_LIB) $(OGL_LIB) $(FTGL_LIB) $(PDF_LIB) $(TIFF_LIB) $(PROJ_LIBS) \
$(JPEG_LIB) $(PNG_LIB) $(SDE_LIB) $(GDAL_LIB) $(MING_LIB) $(POSTGIS_LIB) \
$(MYGIS_LIB) $(CURL_LIB) $(ORACLESPATIAL_LIB) $(GEOS_LIB) \
- $(THREAD_LIB) $(ICONV_LIB) $(FASTCGI_LIB) \
+ $(THREAD_LIB) $(ICONV_LIB) $(FASTCGI_LIB) $(XSLT_LIB) $(EXSLT_LIB) \
$(ZLIB_LIB) $(XML2_LIB) $(FRIBIDI_LIB) $(XTRALIBS) $(CAIRO_LIB)
# STATIC_LIBS is full filename with path of libs that will be statically linked
@@ -267,7 +277,7 @@
RM= /bin/rm -f
-OBJS= $(AGG_OBJ) mapogl.o mapoglrenderer.o mapoglcontext.o mapimageio.o mapcairo.o maprendering.o mapgeomtransform.o maprgbapng.o maptemplate.o mapbits.o maphash.o mapshape.o mapxbase.o mapparser.o maplexer.o maptree.o mapsearch.o mapstring.o mapsymbol.o mapfile.o maplegend.o maputil.o mapscale.o mapquery.o maplabel.o maperror.o mapprimitive.o mapproject.o mapraster.o mapsde.o mapogr.o mappostgis.o mapmygis.o maplayer.o mapresample.o mapwms.o mapwmslayer.o maporaclespatial.o mapgml.o mapprojhack.o mapthread.o mapdraw.o mapgd.o mapagg.o mapagg2.o mapoutput.o mapgdal.o mapswf.o mapimagemap.o mapows.o mapwfs.o mapwfs11.o mapwfslayer.o mapcontext.o maphttp.o mapdrawgdal.o mappdf.o mapjoin.o mapgraticule.o mapcopy.o mapogcfilter.o mapogcsld.o maptime.o mapwcs.o mapwcs11.o mapcpl.o cgiutil.o maprasterquery.o mapobject.o mapgeos.o classobject.o layerobject.o mapio.o mappool.o mapsvg.o mapregex.o mappluginlayer.o mapogcsos.o mappostgresql.o mapcrypto.o mapowscommon.o maplibxml2.o mapdebug.o mapchart.o maptclutf.o $(EPPL_OBJ)
+OBJS= $(AGG_OBJ) mapogl.o mapoglrenderer.o mapoglcontext.o mapimageio.o mapcairo.o maprendering.o mapgeomtransform.o maprgbapng.o maptemplate.o mapbits.o maphash.o mapshape.o mapxbase.o mapparser.o maplexer.o maptree.o mapsearch.o mapstring.o mapsymbol.o mapfile.o maplegend.o maputil.o mapscale.o mapquery.o maplabel.o maperror.o mapprimitive.o mapproject.o mapraster.o mapsde.o mapogr.o mappostgis.o mapmygis.o maplayer.o mapresample.o mapwms.o mapwmslayer.o maporaclespatial.o mapgml.o mapprojhack.o mapthread.o mapdraw.o mapgd.o mapagg.o mapagg2.o mapoutput.o mapgdal.o mapswf.o mapimagemap.o mapows.o mapwfs.o mapwfs11.o mapwfslayer.o mapcontext.o maphttp.o mapdrawgdal.o mappdf.o mapjoin.o mapgraticule.o mapcopy.o mapogcfilter.o mapogcsld.o maptime.o mapwcs.o mapwcs11.o mapcpl.o cgiutil.o maprasterquery.o mapobject.o mapgeos.o classobject.o layerobject.o mapio.o mappool.o mapsvg.o mapregex.o mappluginlayer.o mapogcsos.o mappostgresql.o mapcrypto.o mapowscommon.o maplibxml2.o mapdebug.o mapchart.o maptclutf.o mapxml.o $(EPPL_OBJ)
EXE_LIST = shp2img shp2pdf legend mapserv shptree shptreevis \
shptreetst scalebar sortshp mapscriptvars tile4ms \
@@ -302,7 +312,7 @@
mapagg.o: mapagg.cpp mapagg.h
$(CXX) -c $(CXXFLAGS) -Wno-uninitialized mapagg.cpp -o mapagg.o
-mapagg2.o: mapagg2.cpp mapagg.h
+mapagg2.o: mapagg2.cpp mapagg.h
$(CXX) -c $(CXXFLAGS) -Wno-uninitialized mapagg2.cpp -o mapagg2.o
php3_mapscript:: $(LIBMAP_STATIC)
Modified: trunk/mapserver/configure
===================================================================
--- trunk/mapserver/configure 2010-02-22 14:29:13 UTC (rev 9857)
+++ trunk/mapserver/configure 2010-02-22 15:05:01 UTC (rev 9858)
@@ -309,7 +309,7 @@
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX RANLIB ac_ct_RANLIB LEX LEXLIB LEX_OUTPUT_ROOT YACC XTRALIBS CPP EGREP C_PIC STRINGS MS_VERSION PKG_CONFIG FT_BIN ZLIB_ENABLED ZLIB_INC ZLIB_LIB JPEG_ENABLED JPEG_INC JPEG_LIB ICONV_ENABLED ICONV_INC ICONV_LIB GD_DEF GD_INC GD_LIB GD_STATIC MAKE_GD MAKE_GD_CLEAN PDF_ENABLED PDF_INC PDF_LIB FTGL_ENABLED FTGL_INC FTGL_LIB OGL_ENABLED OGL_INC OGL_LIB AGG_ENABLED AGG_INC AGG_OBJ RGBA_PNG_ENABLED PNG_INC PNG_LIB EPPL_ENABLED EPPL_OBJ PROJ_ENABLED PROJ_INC PROJ_LIBS THREAD_FLAG THREAD_LIB SDE_ENABLED SDE_INC SDE_LIB GEOS_CONFIG GEOS_ENABLED GEOS_INC GEOS_LIB GDAL_CONFIG GDAL_ENABLED OGR_ENABLED GDAL_INC GDAL_LIB TIFF_ENABLED TIFF_INC TIFF_LIB PG_CONFIG POSTGIS_ENABLED POSTGIS_INC POSTGIS_LIB MY_CONFIG MYGIS_ENABLED MYGIS_INC MYGIS_LIB ORACLESPATIAL_ENABLED ORACLESPATIAL_INC ORACLESPATIAL_LIB MING_ENABLED MING_INC MING_LIB WMS_SVR_ENABLED WFS_SVR_ENABLED WCS_SVR_ENABLED LIBCURL_CONFIG CURL_INC CURL_LIB LIBXML2_CONFIG XML2_INC XML2_LIB WMS_LYR_ENABLED WFS_LYR_ENABLED SOS_SVR_ENABLED FRIBIDI_CONFIG FRIBIDI_ENABLED FRIBIDI_INC FRIBIDI_LIB CAIRO_ENABLED CAIRO_INC CAIRO_LIB FASTCGI_ENABLED FASTCGI_INC FASTCGI_LIB HTTPD MS_INC MS_LIB IGNORE_MISSING_DATA USE_POINT_Z_M USE_NINT DEBUG_FLAGS LD_SHARED SO_EXT SO_COMMAND_NAME PHP_LD_SHARED PHP_VERSION_FLAG PHP_SRC_DIR PHP_CC PHP_LD PHP_REGEX_INC PHP_REGEX_OBJ USE_PHP_REGEX MAKE_PHPMS MAKE_PHPMS_CLEAN APACHE_INC OS_INCLUDE_DIR ALL_ENABLED ALL_INC ALL_LIB ALL_STATIC_LIB RPATHS LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX RANLIB ac_ct_RANLIB LEX LEXLIB LEX_OUTPUT_ROOT YACC XTRALIBS CPP EGREP C_PIC STRINGS MS_VERSION PKG_CONFIG FT_BIN ZLIB_ENABLED ZLIB_INC ZLIB_LIB JPEG_ENABLED JPEG_INC JPEG_LIB ICONV_ENABLED ICONV_INC ICONV_LIB GD_DEF GD_INC GD_LIB GD_STATIC MAKE_GD MAKE_GD_CLEAN PDF_ENABLED PDF_INC PDF_LIB FTGL_ENABLED FTGL_INC FTGL_LIB OGL_ENABLED OGL_INC OGL_LIB AGG_ENABLED AGG_INC AGG_OBJ RGBA_PNG_ENABLED PNG_INC PNG_LIB EPPL_ENABLED EPPL_OBJ PROJ_ENABLED PROJ_INC PROJ_LIBS THREAD_FLAG THREAD_LIB SDE_ENABLED SDE_INC SDE_LIB GEOS_CONFIG GEOS_ENABLED GEOS_INC GEOS_LIB GDAL_CONFIG GDAL_ENABLED OGR_ENABLED GDAL_INC GDAL_LIB TIFF_ENABLED TIFF_INC TIFF_LIB PG_CONFIG POSTGIS_ENABLED POSTGIS_INC POSTGIS_LIB MY_CONFIG MYGIS_ENABLED MYGIS_INC MYGIS_LIB ORACLESPATIAL_ENABLED ORACLESPATIAL_INC ORACLESPATIAL_LIB MING_ENABLED MING_INC MING_LIB WMS_SVR_ENABLED WFS_SVR_ENABLED WCS_SVR_ENABLED LIBCURL_CONFIG CURL_INC CURL_LIB LIBXML2_CONFIG XML2_INC XML2_LIB WMS_LYR_ENABLED WFS_LYR_ENABLED SOS_SVR_ENABLED XSLT_ENABLED XSLT_INC XSLT_LIB EXSLT_ENABLED EXSLT_INC EXSLT_LIB FRIBIDI_CONFIG FRIBIDI_ENABLED FRIBIDI_INC FRIBIDI_LIB CAIRO_ENABLED CAIRO_INC CAIRO_LIB FASTCGI_ENABLED FASTCGI_INC FASTCGI_LIB HTTPD MS_INC MS_LIB IGNORE_MISSING_DATA USE_POINT_Z_M USE_NINT DEBUG_FLAGS LD_SHARED SO_EXT SO_COMMAND_NAME PHP_LD_SHARED PHP_VERSION_FLAG PHP_SRC_DIR PHP_CC PHP_LD PHP_REGEX_INC PHP_REGEX_OBJ USE_PHP_REGEX MAKE_PHPMS MAKE_PHPMS_CLEAN APACHE_INC OS_INCLUDE_DIR ALL_ENABLED ALL_INC ALL_LIB ALL_STATIC_LIB RPATHS LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -922,6 +922,11 @@
OGR required).
--with-curl-config=PATH Specify path to curl-config.
--with-xml2-config=PATH Specify path to xml2-config.
+ --with-xml-mapfile= Include xml-mapfile Support (ARG=yes/no).
+ --with-xslt=DIR Include xslt Support (ARG=yes/path to
+ to xslt install dir).
+ --with-exslt=DIR Include exslt Support (ARG=yes/path to
+ to exslt install dir).
--with-fribidi-config[=ARG]
Include FriBidi Support (ARG=yes/path to
fribidi-config or fribidi.pc)
@@ -11416,8 +11421,81 @@
POSTGIS_LIB="-L`$PG_CONFIG --libdir` -lpq"
fi
POSTGIS_INC="-I`$PG_CONFIG --includedir`"
+
+ old_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -L`$PG_CONFIG --libdir`"
+ echo "$as_me:$LINENO: checking for PQserverVersion in -lpq" >&5
+echo $ECHO_N "checking for PQserverVersion in -lpq... $ECHO_C" >&6
+if test "${ac_cv_lib_pq_PQserverVersion+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpq $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char PQserverVersion ();
+int
+main ()
+{
+PQserverVersion ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_pq_PQserverVersion=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_pq_PQserverVersion=no
fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_pq_PQserverVersion" >&5
+echo "${ECHO_T}$ac_cv_lib_pq_PQserverVersion" >&6
+if test $ac_cv_lib_pq_PQserverVersion = yes; then
+ POSTGIS_ENABLED="$POSTGIS_ENABLED -DPOSTGIS_HAS_SERVER_VERSION"
+fi
+ LDFLAGS="$old_LDFLAGS"
+
+fi
+
POSTGIS_ENABLED=$POSTGIS_ENABLED
POSTGIS_INC=$POSTGIS_INC
@@ -12089,6 +12167,174 @@
+# Check whether --with-xml-mapfile or --without-xml-mapfile was given.
+if test "${with_xml_mapfile+set}" = set; then
+ withval="$with_xml_mapfile"
+ XMLMAPFILE_REQUESTED=""
+fi;
+
+echo "$as_me:$LINENO: checking if xml-mapfile is requested" >&5
+echo $ECHO_N "checking if xml-mapfile is requested... $ECHO_C" >&6
+XMLMAPFILE_ENABLED=""
+
+if test "$with_xml_mapfile" = "yes"; then
+ XMLMAPFILE_ENABLED="-DUSE_XMLMAPFILE"
+ echo "$as_me:$LINENO: result: yes.. xslt and exslt support needed" >&5
+echo "${ECHO_T}yes.. xslt and exslt support needed" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ALL_ENABLED="$XMLMAPFILE_ENABLED $ALL_ENABLED"
+
+
+
+# Check whether --with-xslt or --without-xslt was given.
+if test "${with_xslt+set}" = set; then
+ withval="$with_xslt"
+ XSLT_DIR=$withval
+else
+ XSLT_DIR=''
+fi;
+
+echo "$as_me:$LINENO: checking if xslt is requested" >&5
+echo $ECHO_N "checking if xslt is requested... $ECHO_C" >&6
+XSLT_LIB=''
+
+if test -z "$XMLMAPFILE_ENABLED" -a \( "$with_xslt" = "no" -o "$with_xslt" = "" \); then
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+else
+
+ if test "$XSLT_DIR" = "yes" -o "$XSLT_DIR" = ""; then
+ XSLT_DIR="/usr"
+ fi
+
+ test -f $XSLT_DIR/include/libxslt/xslt.h && XSLT_INCDIR="$XSLT_DIR/include"
+ test -f $XSLT_DIR/lib/libxslt.so && XSLT_LIBDIR="$XSLT_DIR/lib"
+
+ if test -n "$XSLT_LIBDIR" -a -n "$XSLT_INCDIR" ; then
+ XSLT_ENABLED="-DUSE_XSLT"
+ XSLT_INC="-I$XSLT_INCDIR"
+ XSLT_LIB="-L$XSLT_LIBDIR -lxslt"
+ echo "$as_me:$LINENO: result: using xslt from $XSLT_LIB ($XSLT_ENABLED)" >&5
+echo "${ECHO_T}using xslt from $XSLT_LIB ($XSLT_ENABLED)" >&6
+
+ if test ""$XSLT_DIR"" != "/usr/lib"; then
+
+ if test -z ""$XSLT_DIR"" || echo ""$XSLT_DIR"" | grep '^/' >/dev/null ; then
+ ai_p=""$XSLT_DIR""
+ else
+ ai_p="`pwd`/"$XSLT_DIR""
+ fi
+
+
+ unique=`echo $ac_n "$ai_p$ac_c" | tr -c -d a-zA-Z0-9`
+ cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\""
+ if test -n "$unique" && test "`eval $cmd`" = "" ; then
+ eval "LIBPATH$unique=set"
+
+ EXTRA_LIBS="$EXTRA_LIBS -L$ai_p"
+ RPATHS="$RPATHS ${ld_runpath_switch}$ai_p"
+
+ fi
+
+ fi
+
+
+ else
+ { { echo "$as_me:$LINENO: error: '$XSLT_DIR' not a valid installation path of xslt." >&5
+echo "$as_me: error: '$XSLT_DIR' not a valid installation path of xslt." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+fi
+
+XSLT_ENABLED=$XSLT_ENABLED
+
+XSLT_INC=$XSLT_INC
+
+XSLT_LIB=$XSLT_LIB
+
+
+ALL_ENABLED="$XSLT_ENABLED $ALL_ENABLED"
+ALL_INC="$XSLT_INC $ALL_INC"
+ALL_LIB="$XSLT_LIB $ALL_LIB"
+
+
+
+# Check whether --with-exslt or --without-exslt was given.
+if test "${with_exslt+set}" = set; then
+ withval="$with_exslt"
+ EXSLT_DIR=$withval
+else
+ EXSLT_DIR=''
+fi;
+
+echo "$as_me:$LINENO: checking if exslt is requested" >&5
+echo $ECHO_N "checking if exslt is requested... $ECHO_C" >&6
+EXSLT_LIB=''
+
+if test -z "$XMLMAPFILE_ENABLED" -a \( "$with_exslt" = "no" -o "$with_exslt" = "" \); then
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+else
+
+ if test "$EXSLT_DIR" = "yes" -o "$EXSLT_DIR" = ""; then
+ EXSLT_DIR="/usr"
+ fi
+
+ test -f $EXSLT_DIR/include/libexslt/exslt.h && EXSLT_INCDIR="$EXSLT_DIR/include"
+ test -f $EXSLT_DIR/lib/libexslt.so && EXSLT_LIBDIR="$EXSLT_DIR/lib"
+
+ if test -n "$EXSLT_LIBDIR" -a -n "$EXSLT_INCDIR" ; then
+ EXSLT_ENABLED="-DUSE_EXSLT"
+ EXSLT_INC="-I$EXSLT_INCDIR"
+ EXSLT_LIB="-L$EXSLT_LIBDIR -lexslt"
+ echo "$as_me:$LINENO: result: using exslt from $EXSLT_LIB ($EXSLT_ENABLED)" >&5
+echo "${ECHO_T}using exslt from $EXSLT_LIB ($EXSLT_ENABLED)" >&6
+
+ if test ""$EXSLT_DIR"" != "/usr/lib"; then
+
+ if test -z ""$EXSLT_DIR"" || echo ""$EXSLT_DIR"" | grep '^/' >/dev/null ; then
+ ai_p=""$EXSLT_DIR""
+ else
+ ai_p="`pwd`/"$EXSLT_DIR""
+ fi
+
+
+ unique=`echo $ac_n "$ai_p$ac_c" | tr -c -d a-zA-Z0-9`
+ cmd="echo $ac_n \"\$LIBPATH$unique$ac_c\""
+ if test -n "$unique" && test "`eval $cmd`" = "" ; then
+ eval "LIBPATH$unique=set"
+
+ EXTRA_LIBS="$EXTRA_LIBS -L$ai_p"
+ RPATHS="$RPATHS ${ld_runpath_switch}$ai_p"
+
+ fi
+
+ fi
+
+ else
+ { { echo "$as_me:$LINENO: error: '$EXSLT_DIR' not a valid installation path of exslt." >&5
+echo "$as_me: error: '$EXSLT_DIR' not a valid installation path of exslt." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+fi
+
+EXSLT_ENABLED=$EXSLT_ENABLED
+
+EXSLT_INC=$EXSLT_INC
+
+EXSLT_LIB=$EXSLT_LIB
+
+
+ALL_ENABLED="$EXSLT_ENABLED $ALL_ENABLED"
+ALL_INC="$EXSLT_INC $ALL_INC"
+ALL_LIB="$EXSLT_LIB $ALL_LIB"
+
+
+
echo "$as_me:$LINENO: checking if FriBidi support requested" >&5
echo $ECHO_N "checking if FriBidi support requested... $ECHO_C" >&6
@@ -14116,6 +14362,12 @@
s, at WMS_LYR_ENABLED@,$WMS_LYR_ENABLED,;t t
s, at WFS_LYR_ENABLED@,$WFS_LYR_ENABLED,;t t
s, at SOS_SVR_ENABLED@,$SOS_SVR_ENABLED,;t t
+s, at XSLT_ENABLED@,$XSLT_ENABLED,;t t
+s, at XSLT_INC@,$XSLT_INC,;t t
+s, at XSLT_LIB@,$XSLT_LIB,;t t
+s, at EXSLT_ENABLED@,$EXSLT_ENABLED,;t t
+s, at EXSLT_INC@,$EXSLT_INC,;t t
+s, at EXSLT_LIB@,$EXSLT_LIB,;t t
s, at FRIBIDI_CONFIG@,$FRIBIDI_CONFIG,;t t
s, at FRIBIDI_ENABLED@,$FRIBIDI_ENABLED,;t t
s, at FRIBIDI_INC@,$FRIBIDI_INC,;t t
@@ -14480,6 +14732,12 @@
echo "${ECHO_T} Threading support: ${THREAD_FLAG}" >&6
echo "$as_me:$LINENO: result: GEOS support: ${GEOS_ENABLED}" >&5
echo "${ECHO_T} GEOS support: ${GEOS_ENABLED}" >&6
+echo "$as_me:$LINENO: result: XML Mapfile support: ${XMLMAPFILE_ENABLED}" >&5
+echo "${ECHO_T} XML Mapfile support: ${XMLMAPFILE_ENABLED}" >&6
+echo "$as_me:$LINENO: result: XSLT support: ${XSLT_ENABLED}" >&5
+echo "${ECHO_T} XSLT support: ${XSLT_ENABLED}" >&6
+echo "$as_me:$LINENO: result: EXSLT support: ${EXSLT_ENABLED}" >&5
+echo "${ECHO_T} EXSLT support: ${EXSLT_ENABLED}" >&6
echo "$as_me:$LINENO: result: " >&5
echo "${ECHO_T}" >&6
Modified: trunk/mapserver/configure.in
===================================================================
--- trunk/mapserver/configure.in 2010-02-22 14:29:13 UTC (rev 9857)
+++ trunk/mapserver/configure.in 2010-02-22 15:05:01 UTC (rev 9858)
@@ -2042,7 +2042,118 @@
ALL_ENABLED="$WMS_LYR_ENABLED $WFS_LYR_ENABLED $SOS_SVR_ENABLED $XML2_ENABLED $CURL_ENABLED $ALL_ENABLED"
+dnl ---------------------------------------------------------------------
+dnl Check if xml-mapfile requested
+dnl ---------------------------------------------------------------------
+AC_ARG_WITH(xml-mapfile,
+[ --with-xml-mapfile= Include xml-mapfile Support (ARG=yes/no).],
+ XMLMAPFILE_REQUESTED="")
+
+AC_MSG_CHECKING(if xml-mapfile is requested)
+XMLMAPFILE_ENABLED=""
+
+if test "$with_xml_mapfile" = "yes"; then
+ XMLMAPFILE_ENABLED="-DUSE_XMLMAPFILE"
+ AC_MSG_RESULT(yes.. xslt and exslt support needed)
+else
+ AC_MSG_RESULT(no)
+fi
+
+ALL_ENABLED="$XMLMAPFILE_ENABLED $ALL_ENABLED"
+
+dnl ---------------------------------------------------------------------
+dnl Check if xslt requested
+dnl ---------------------------------------------------------------------
+
+AC_ARG_WITH(xslt,
+[ --with-xslt=DIR Include xslt Support (ARG=yes/path to
+ to xslt install dir).],
+ XSLT_DIR=$withval,XSLT_DIR='')
+
+AC_MSG_CHECKING(if xslt is requested)
+XSLT_LIB=''
+
+if test -z "$XMLMAPFILE_ENABLED" -a \( "$with_xslt" = "no" -o "$with_xslt" = "" \); then
+ AC_MSG_RESULT(no)
+else
+
+ if test "$XSLT_DIR" = "yes" -o "$XSLT_DIR" = ""; then
+ XSLT_DIR="/usr"
+ fi
+
+ test -f $XSLT_DIR/include/libxslt/xslt.h && XSLT_INCDIR="$XSLT_DIR/include"
+ test -f $XSLT_DIR/lib/libxslt.so && XSLT_LIBDIR="$XSLT_DIR/lib"
+
+ if test -n "$XSLT_LIBDIR" -a -n "$XSLT_INCDIR" ; then
+ dnl
+ dnl Found xslt runtime and headers. Enable USE_XSLT .
+ dnl
+ XSLT_ENABLED="-DUSE_XSLT"
+ XSLT_INC="-I$XSLT_INCDIR"
+ XSLT_LIB="-L$XSLT_LIBDIR -lxslt"
+ AC_MSG_RESULT([using xslt from $XSLT_LIB ($XSLT_ENABLED)])
+ AC_ADD_RUNPATH("$XSLT_DIR")
+
+ else
+ AC_MSG_ERROR(['$XSLT_DIR' not a valid installation path of xslt.])
+ fi
+fi
+
+AC_SUBST(XSLT_ENABLED,$XSLT_ENABLED)
+AC_SUBST(XSLT_INC, $XSLT_INC)
+AC_SUBST(XSLT_LIB, $XSLT_LIB)
+
+ALL_ENABLED="$XSLT_ENABLED $ALL_ENABLED"
+ALL_INC="$XSLT_INC $ALL_INC"
+ALL_LIB="$XSLT_LIB $ALL_LIB"
+
+dnl ---------------------------------------------------------------------
+dnl Check if exslt requested
+dnl ---------------------------------------------------------------------
+
+AC_ARG_WITH(exslt,
+[ --with-exslt=DIR Include exslt Support (ARG=yes/path to
+ to exslt install dir).],
+ EXSLT_DIR=$withval,EXSLT_DIR='')
+
+AC_MSG_CHECKING(if exslt is requested)
+EXSLT_LIB=''
+
+if test -z "$XMLMAPFILE_ENABLED" -a \( "$with_exslt" = "no" -o "$with_exslt" = "" \); then
+ AC_MSG_RESULT(no)
+else
+
+ if test "$EXSLT_DIR" = "yes" -o "$EXSLT_DIR" = ""; then
+ EXSLT_DIR="/usr"
+ fi
+
+ test -f $EXSLT_DIR/include/libexslt/exslt.h && EXSLT_INCDIR="$EXSLT_DIR/include"
+ test -f $EXSLT_DIR/lib/libexslt.so && EXSLT_LIBDIR="$EXSLT_DIR/lib"
+
+ if test -n "$EXSLT_LIBDIR" -a -n "$EXSLT_INCDIR" ; then
+ dnl
+ dnl Found exslt runtime and headers. Enable USE_EXSLT .
+ dnl
+ EXSLT_ENABLED="-DUSE_EXSLT"
+ EXSLT_INC="-I$EXSLT_INCDIR"
+ EXSLT_LIB="-L$EXSLT_LIBDIR -lexslt"
+ AC_MSG_RESULT([using exslt from $EXSLT_LIB ($EXSLT_ENABLED)])
+ AC_ADD_RUNPATH("$EXSLT_DIR")
+ else
+ AC_MSG_ERROR(['$EXSLT_DIR' not a valid installation path of exslt.])
+ fi
+fi
+
+AC_SUBST(EXSLT_ENABLED,$EXSLT_ENABLED)
+AC_SUBST(EXSLT_INC, $EXSLT_INC)
+AC_SUBST(EXSLT_LIB, $EXSLT_LIB)
+
+ALL_ENABLED="$EXSLT_ENABLED $ALL_ENABLED"
+ALL_INC="$EXSLT_INC $ALL_INC"
+ALL_LIB="$EXSLT_LIB $ALL_LIB"
+
+
dnl ---------------------------------------------------------------------------
dnl Look for FriBidi if requested.
dnl ---------------------------------------------------------------------------
@@ -2755,6 +2866,9 @@
AC_MSG_RESULT([ FastCGI support: ${FASTCGI_ENABLED}])
AC_MSG_RESULT([ Threading support: ${THREAD_FLAG}])
AC_MSG_RESULT([ GEOS support: ${GEOS_ENABLED}])
+AC_MSG_RESULT([ XML Mapfile support: ${XMLMAPFILE_ENABLED}])
+AC_MSG_RESULT([ XSLT support: ${XSLT_ENABLED}])
+AC_MSG_RESULT([ EXSLT support: ${EXSLT_ENABLED}])
AC_MSG_RESULT()
AC_MSG_RESULT([ -------------- Data Format Drivers ------- ])
Modified: trunk/mapserver/mapfile.c
===================================================================
--- trunk/mapserver/mapfile.c 2010-02-22 14:29:13 UTC (rev 9857)
+++ trunk/mapserver/mapfile.c 2010-02-22 15:05:01 UTC (rev 9858)
@@ -5236,7 +5236,7 @@
return(NULL);
}
}
-
+
/*
** Allocate mapObj structure
*/
@@ -5252,12 +5252,37 @@
}
msAcquireLock( TLOCK_PARSER ); /* Steve: might need to move this lock a bit higher; Umberto: done */
-
- if((msyyin = fopen(filename,"r")) == NULL) {
- msSetError(MS_IOERR, "(%s)", "msLoadMap()", filename);
- msReleaseLock( TLOCK_PARSER );
- return(NULL);
+
+#ifdef USE_XMLMAPFILE
+ /* If the mapfile is an xml mapfile, transform it */
+ if ((getenv("MS_XMLMAPFILE_XSLT")) &&
+ (msEvalRegex(MS_DEFAULT_XMLMAPFILE_PATTERN, filename) == MS_TRUE)) {
+
+ msyyin = tmpfile();
+ if (msyyin == NULL)
+ {
+ msSetError(MS_IOERR, "tmpfile() failed to create temporary file", "msLoadMap()");
+ msReleaseLock( TLOCK_PARSER );
+ }
+
+ if (msTransformXmlMapfile(getenv("MS_XMLMAPFILE_XSLT"), filename, msyyin) != MS_SUCCESS)
+ {
+ fclose(msyyin);
+ return NULL;
+ }
+ fseek ( msyyin , 0 , SEEK_SET );
}
+ else
+ {
+#endif
+ if((msyyin = fopen(filename,"r")) == NULL) {
+ msSetError(MS_IOERR, "(%s)", "msLoadMap()", filename);
+ msReleaseLock( TLOCK_PARSER );
+ return NULL;
+ }
+#ifdef USE_XMLMAPFILE
+ }
+#endif
msyystate = MS_TOKENIZE_FILE;
msyylex(); /* sets things up, but doesn't process any tokens */
Modified: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h 2010-02-22 14:29:13 UTC (rev 9857)
+++ trunk/mapserver/mapserver.h 2010-02-22 15:05:01 UTC (rev 9858)
@@ -182,8 +182,12 @@
/* General defines, not wrapable */
#ifndef SWIG
+#ifdef USE_XMLMAPFILE
+#define MS_DEFAULT_MAPFILE_PATTERN "\\.(map|xml)$"
+#define MS_DEFAULT_XMLMAPFILE_PATTERN "\\.xml$"
+#else
#define MS_DEFAULT_MAPFILE_PATTERN "\\.map$"
-
+#endif
#define MS_TEMPLATE_MAGIC_STRING "MapServer Template"
#define MS_TEMPLATE_EXPR "\\.(xml|wml|html|htm|svg|kml|gml|js|tmpl)$"
@@ -1679,6 +1683,7 @@
MS_DLL_EXPORT int msGetLayerIndex(mapObj *map, char *name);
MS_DLL_EXPORT int msGetSymbolIndex(symbolSetObj *set, char *name, int try_addimage_if_notfound);
MS_DLL_EXPORT mapObj *msLoadMap(char *filename, char *new_mappath);
+MS_DLL_EXPORT int msTransformXmlMapfile(const char *stylesheet, const char *xmlMapfile, FILE *tmpfile);
MS_DLL_EXPORT int msSaveMap(mapObj *map, char *filename);
MS_DLL_EXPORT void msFreeCharArray(char **array, int num_items);
MS_DLL_EXPORT int msUpdateScalebarFromString(scalebarObj *scalebar, char *string, int url_string);
Added: trunk/mapserver/mapxml.c
===================================================================
--- trunk/mapserver/mapxml.c (rev 0)
+++ trunk/mapserver/mapxml.c 2010-02-22 15:05:01 UTC (rev 9858)
@@ -0,0 +1,91 @@
+/******************************************************************************
+ * $id: mapfile.c 7854 2008-08-14 19:22:48Z dmorissette $
+ *
+ * Project: MapServer
+ * Purpose: High level Map file parsing code.
+ * Author: Steve Lime and the MapServer team.
+ *
+ ******************************************************************************
+ * Copyright (c) 1996-2005 Regents of the University of Minnesota.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies of this Software or works derived from this Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ****************************************************************************/
+#ifdef USE_XMLMAPFILE
+
+#include "mapserver.h"
+#include <libxslt/xslt.h>
+#include "libexslt/exslt.h"
+#include <libxslt/transform.h>
+#include <libxslt/xsltInternals.h>
+#include <libxslt/extensions.h>
+#include <libxslt/xsltutils.h>
+
+extern int xmlLoadExtDtdDefaultValue;
+
+int msTransformXmlMapfile(const char *stylesheet, const char *xmlMapfile, FILE *tmpfile)
+{
+ xsltStylesheetPtr cur = NULL;
+ int status = MS_FAILURE;
+ xmlDocPtr doc, res;
+
+ exsltRegisterAll();
+ xsltRegisterTestModule();
+
+ xmlSubstituteEntitiesDefault(1);
+ xmlLoadExtDtdDefaultValue = 1;
+
+ cur = xsltParseStylesheetFile((const xmlChar *)stylesheet);
+ if (cur == NULL)
+ {
+ msSetError(MS_MISCERR, "Failed to load xslt stylesheet", "msTransformXmlMapfile()");
+ goto done;
+ }
+
+ doc = xmlParseFile(xmlMapfile);
+ if (doc == NULL)
+ {
+ msSetError(MS_MISCERR, "Failed to load xml mapfile", "msTransformXmlMapfile()");
+ goto done;
+ }
+
+ res = xsltApplyStylesheet(cur, doc, NULL);
+ if (res == NULL)
+ {
+ msSetError(MS_MISCERR, "Failed to apply style sheet to %s", "msTransformXmlMapfile()", xmlMapfile);
+ goto done;
+ }
+
+ if ( xsltSaveResultToFile(tmpfile, res, cur) != -1 )
+ status = MS_SUCCESS;
+
+done:
+ if (cur)
+ xsltFreeStylesheet(cur);
+ if (res)
+ xmlFreeDoc(res);
+ if (doc)
+ xmlFreeDoc(doc);
+
+ xsltCleanupGlobals();
+ xmlCleanupParser();
+
+ return status;
+}
+
+#endif
Modified: trunk/mapserver/xmlmapfile/mapfile.xsl
===================================================================
--- trunk/mapserver/xmlmapfile/mapfile.xsl 2010-02-22 14:29:13 UTC (rev 9857)
+++ trunk/mapserver/xmlmapfile/mapfile.xsl 2010-02-22 15:05:01 UTC (rev 9858)
@@ -1282,7 +1282,7 @@
<xsl:with-param name="indent" select="$indent + 1"/>
</xsl:apply-templates>
<xsl:call-template name="print">
- <xsl:with-param name="text" select="'END'"/>
+ <xsl:with-param name="text" select="'END
'"/>
<xsl:with-param name="indent" select="$indent - 1"/>
</xsl:call-template>
</xsl:template>
More information about the mapserver-commits
mailing list