--- /dev/null
+gdome2-xslt-cpp-smart.pc
+gdome2-xslt.pc
+autom4te.cache
+Makefile
+Makefile.in
+aclocal.m4
+config.h
+config.h.in
+config.log
+config.status
+configure
+libtool
+stamp-h
+stamp-h.in
--- /dev/null
+Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+Stefano Zacchiroli <zacchiro@cs.unibo.it>
+Luca Padovani <lpadovan@cs.unibo.it>
--- /dev/null
+Makefile
+Makefile.in
--- /dev/null
+SUBDIRS = gdome_xslt test
--- /dev/null
+Makefile
+Makefile.in
+.deps
--- /dev/null
+
+#ifndef __GdomeSmartDOMXSLT_hh__
+#define __GdomeSmartDOMXSLT_hh__
+
+#include "GdomeSmartDOMXSLTStylesheet.hh"
+
+#endif // __GdomeSmartDOMXSLT_hh__
--- /dev/null
+// This file is part of a XSLT engine working on Gdome documents. In fact,
+// it just maps Gdome documents to libxml documents back and forth, and
+// applies the transformation on libxml documents using libxlt.
+//
+// Copyright (C) 2002: Luca Padovani <lpadovan@cs.unibo.it>
+//
+// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// For more information, please send an email to lpadovan@cs.unibo.it
+
+#include "config.h"
+
+#include <string>
+#include <cassert>
+
+#include <stdio.h>
+#include <GdomeSmartDOM.hh>
+
+#include "GdomeSmartDOMXSLTStylesheet.hh"
+
+namespace GdomeSmartDOMExt {
+
+ XSLTStylesheet::XSLTStylesheet(const Document& doc)
+ {
+ assert(doc);
+ GdomeDocument* _doc = gdome_cast_doc(doc.gdome_object());
+ assert(_doc);
+ stylesheet = processStylesheet(_doc);
+ GdomeException _exc = 0;
+ gdome_doc_unref(_doc, &_exc);
+ assert(_exc == 0);
+ }
+
+ XSLTStylesheet::~XSLTStylesheet()
+ {
+ if (stylesheet)
+ {
+ xsltFreeStylesheet(stylesheet);
+ stylesheet = 0;
+ }
+ }
+
+ Document
+ XSLTStylesheet::apply(const Document& source) const
+ {
+ std::vector< std::pair<GdomeString,GdomeString> > noParams;
+ return apply(source, noParams);
+ }
+
+ Document
+ XSLTStylesheet::apply(const Document& source, const std::vector< std::pair<GdomeString,GdomeString> >& params) const
+ {
+ assert(source);
+
+ char** _params = (char**) malloc(sizeof(char*) * (2 * params.size() + 1));
+ for (unsigned i = 0; i < params.size(); i++)
+ {
+ std::string param = params[i].first;
+ _params[2 * i] = strdup(param.c_str());
+ std::string value = params[i].second;
+ _params[2 * i + 1] = strdup(value.c_str());
+ }
+ _params[2 * params.size()] = 0;
+
+ GdomeDocument* _source = gdome_cast_doc(source.gdome_object());
+ assert(_source);
+ GdomeDocument* _result = applyStylesheet(_source, stylesheet, const_cast<const char**>(_params));
+
+ GdomeException _exc = 0;
+ gdome_doc_unref(_source, &_exc);
+ assert(_exc == 0);
+
+ for (unsigned i = 0; i < 2 * params.size(); i++) free(_params[i]);
+ free(_params);
+
+ Document result(_result);
+ gdome_doc_unref(_result, &_exc);
+ assert(_exc == 0);
+
+ return result;
+ }
+
+ void
+ XSLTStylesheet::save(const Document& doc, const std::string& filename) const
+ {
+ assert(doc);
+ GdomeException _exc = 0;
+ GdomeDocument* _doc = gdome_cast_doc(doc.gdome_object());
+ assert(_doc);
+ if (saveResultToFilename(filename.c_str(), _doc, stylesheet, 0) < 0) throw SaveException();
+ gdome_doc_unref(_doc, &_exc);
+ assert(_exc == 0);
+ }
+
+ void
+ XSLTStylesheet::save(const Document& doc, FILE* f) const
+ {
+ assert(doc);
+ GdomeException _exc = 0;
+ GdomeDocument* _doc = gdome_cast_doc(doc.gdome_object());
+ assert(_doc);
+ if (saveResultToFile(f, _doc, stylesheet) < 0) throw SaveException();
+ gdome_doc_unref(_doc, &_exc);
+ assert(_exc == 0);
+ }
+
+ void
+ XSLTStylesheet::save(const Document& doc, int fd) const
+ {
+ assert(doc);
+ GdomeException _exc = 0;
+ GdomeDocument* _doc = gdome_cast_doc(doc.gdome_object());
+ assert(_doc);
+ if (saveResultToFd(fd, _doc, stylesheet) < 0) throw SaveException();
+ gdome_doc_unref(_doc, &_exc);
+ assert(_exc == 0);
+ }
+
+}
--- /dev/null
+// This file is part of a XSLT engine working on Gdome documents. In fact,
+// it just maps Gdome documents to libxml documents back and forth, and
+// applies the transformation on libxml documents using libxlt.
+//
+// Copyright (C) 2002: Luca Padovani <lpadovan@cs.unibo.it>
+//
+// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// For more information, please send an email to lpadovan@cs.unibo.it
+
+#ifndef __GdomeSmartDOMXSLTStylesheet_hh__
+#define __GdomeSmartDOMXSLTStylesheet_hh__
+
+#include <vector>
+#include <string>
+#include <stdio.h>
+
+#include "gdome_xslt.h"
+#include <GdomeSmartDOM.hh>
+
+namespace GdomeSmartDOMExt {
+
+ using namespace GdomeSmartDOM;
+
+ class XSLTStylesheet
+ {
+ public:
+ explicit XSLTStylesheet(const Document& doc);
+ ~XSLTStylesheet();
+
+ Document apply(const Document& source) const;
+ Document apply(const Document& source, const std::vector< std::pair<GdomeString, GdomeString> >& params) const;
+ void save(const Document& result, const std::string& filename) const;
+ void save(const Document& result, FILE* f) const;
+ void save(const Document& result, int fd) const;
+
+ class SaveException { };
+
+ private:
+ XSLTStylesheet(const XSLTStylesheet&);
+
+ xsltStylesheet* stylesheet;
+ };
+
+}
+
+#endif // __GdomeSmartDOMXSLTStylesheet_hh__
--- /dev/null
+
+lib_LTLIBRARIES = libgdome_xslt_cpp_smart.la
+
+libgdome_xslt_cpp_smart_la_LIBADD = $(top_builddir)/C/gdome_xslt/libgdome_xslt.la
+
+libgdome_xslt_cpp_smart_la_LDFLAGS = -version-info @VERSION_INFO@
+
+libgdome_xslt_cpp_smart_la_SOURCES = \
+ GdomeSmartDOMXSLTStylesheet.cc
+
+pkginclude_HEADERS = \
+ GdomeSmartDOMXSLTStylesheet.hh \
+ GdomeSmartDOMXSLT.hh
+
+INCLUDES = \
+ $(GMETADOM_CFLAGS) \
+ $(LIBXSLT_CFLAGS) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/C/gdome_xslt
--- /dev/null
+Makefile
+Makefile.in
+.deps
--- /dev/null
+
+noinst_PROGRAMS = test
+
+test_SOURCES = main.cc
+
+LDADDS = \
+ $(GMETADOM_LIBS) \
+ $(LIBXSLT_LIBS) \
+ $(top_builddir)/C++/gdome_xslt/libgdome_xslt_cpp_smart.la
+
+test_LDADD = $(LDADDS)
+
+INCLUDES = \
+ $(GMETADOM_CFLAGS) \
+ $(LIBXSLT_CFLAGS) \
+ -I$(top_srcdir)/C/gdome_xslt \
+ -I$(top_srcdir)/C++/gdome_xslt
+
--- /dev/null
+/* This file is a test for the XSLT engine working on Gdome documents.
+ *
+ * Copyright (C) 2002 Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * For more information, please send an email to <sacerdot@cs.unibo.it>
+ */
+
+#include <string>
+#include <iostream>
+#include "GdomeSmartDOMXSLT.hh"
+
+namespace DOM = GdomeSmartDOM;
+namespace DOMX = GdomeSmartDOMExt;
+
+#define OUTPUT_FILE "../../test_files/output.xml"
+#define CORRECT_OUTPUT_FILE "../../test_files/output.xml.correct"
+
+int
+main(void)
+{
+ int bytes;
+ DOM::DOMImplementation di;
+ std::vector< std::pair<DOM::GdomeString, DOM::GdomeString> > params;
+
+ params.push_back(std::make_pair(DOM::GdomeString("parameter1"), DOM::GdomeString("'value1'")));
+ params.push_back(std::make_pair(DOM::GdomeString("parameter2"), DOM::GdomeString("'value2'")));
+ params.push_back(std::make_pair(DOM::GdomeString("parameter3"), DOM::GdomeString("'value3'")));
+
+ DOM::Document input = di.createDocumentFromURI("../../test_files/input.xml");
+ DOM::Document style = di.createDocumentFromURI("../../test_files/stylesheet.xsl");
+
+ DOMX::XSLTStylesheet style_libxslt(style);
+ DOM::Document output = style_libxslt.apply(input, params);
+ style_libxslt.save(output, OUTPUT_FILE);
+
+ std::cout << "The test was successful iff " << OUTPUT_FILE << " is equal to " << CORRECT_OUTPUT_FILE << std::endl;
+
+ return 0;
+}
--- /dev/null
+Makefile
+Makefile.in
--- /dev/null
+
+SUBDIRS = gdome_xslt test
+
--- /dev/null
+gdome_xslt.o
+Makefile
+Makefile.in
+.deps
--- /dev/null
+
+lib_LTLIBRARIES = libgdome_xslt.la
+
+libgdome_xslt_la_LDFLAGS = -version-info @VERSION_INFO@
+
+libgdome_xslt_la_SOURCES = gdome_xslt.c
+
+pkginclude_HEADERS = gdome_xslt.h
+
+INCLUDES = \
+ $(GDOME_CFLAGS) \
+ $(LIBXSLT_CFLAGS) \
+ -I$(top_srcdir)
+
--- /dev/null
+/* This file implements a XSLT engine working on Gdome documents. In fact,
+ * it just maps Gdome documents to libxml documents back and forth, and
+ * applyes the transformation on libxml documents using libxlt.
+ *
+ * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT
+ * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT)
+ *
+ * Copyright (C) 2002:
+ * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ * Stefano Zacchiroli <zack@cs.unibo.it>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * For more information, please send an email to {sacerdot,zack}@cs.unibo.it
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <gdome.h>
+#include <libxslt/xsltconfig.h>
+#include <libxslt/xslt.h>
+#include <libxslt/xsltutils.h>
+#include <libxslt/transform.h>
+#include <libxslt/imports.h>
+#include "gdome_xslt.h"
+
+// Begin of Gdome internals exposed
+typedef struct _Gdome_xml_Document Gdome_xml_Document;
+struct _Gdome_xml_Document {
+ GdomeDocument super;
+ const GdomeDocumentVtab* vtab;
+ int refcnt;
+ xmlDocPtr n;
+ GdomeAccessType accessType;
+};
+
+GdomeNode* gdome_xml_n_mkref(xmlNode* n);
+// End of Gdome internals exposed
+
+// Begin of the abstraction of Gdome internals. Uses the Gdome internals exposed
+xmlDocPtr libxml_of_gdome(GdomeDocument* doc)
+{
+ return ((Gdome_xml_Document*)doc)->n;
+}
+
+GdomeDocument* gdome_of_libxml(xmlDocPtr n)
+{
+ return (GdomeDocument*)gdome_xml_n_mkref((xmlNode*)n);
+}
+// End of the abstraction of Gdome internals. Uses the Gdome internals exposed.
+
+
+
+// From now on no Gdome internal should be used directly.
+
+ /******************************/
+ /* XSLT stylesheet Processing */
+ /******************************/
+
+xsltStylesheetPtr processStylesheet(GdomeDocument* style)
+{
+ xmlDocPtr style_copy;
+ xmlDocPtr style_libxml;
+
+ if (style == NULL) {
+ return NULL;
+ }
+ style_libxml = libxml_of_gdome(style);
+ style_copy = xmlCopyDoc(style_libxml, 1);
+ style_copy->URL = xmlStrdup(style_libxml->URL);
+
+ xsltSetGenericDebugFunc(NULL, NULL);
+
+ return xsltParseStylesheetDoc(style_copy);
+}
+
+ /*******************************/
+ /* XSLT stylesheet Application */
+ /*******************************/
+
+GdomeDocument* applyStylesheet(GdomeDocument* source, xsltStylesheetPtr
+ style_libxslt, const char** params)
+{
+ xmlDocPtr source_libxml;
+ xmlDocPtr output_libxml;
+
+ if (source == NULL) return NULL;
+ source_libxml = libxml_of_gdome(source);
+
+ xsltSetGenericDebugFunc(NULL, NULL);
+
+ output_libxml = xsltApplyStylesheet(style_libxslt, source_libxml,
+ params);
+
+ if (output_libxml == NULL) return NULL;
+
+ return gdome_of_libxml(output_libxml);
+}
+
+ /******************/
+ /* Results Output */
+ /******************/
+
+int saveResultToFilename (const char* name, GdomeDocument* result,
+ xsltStylesheetPtr style_libxslt, int compression)
+{
+ xmlDocPtr result_libxml;
+
+ if (result == NULL) return -1;
+ result_libxml = libxml_of_gdome(result);
+
+ xsltSetGenericDebugFunc(NULL, NULL);
+
+ return xsltSaveResultToFilename(name, result_libxml,
+ style_libxslt, compression);
+}
+
+int saveResultToFile (FILE* file, GdomeDocument* result,
+ xsltStylesheetPtr style_libxslt)
+{
+ xmlDocPtr result_libxml;
+
+ if (result == NULL) return -1;
+ result_libxml = libxml_of_gdome(result);
+
+ xsltSetGenericDebugFunc(NULL, NULL);
+
+ return xsltSaveResultToFile(file, result_libxml, style_libxslt);
+}
+
+int saveResultToFd (int fd, GdomeDocument* result, xsltStylesheetPtr
+ style_libxslt)
+{
+ xmlDocPtr result_libxml;
+
+ if (result == NULL) return -1;
+ result_libxml = libxml_of_gdome(result);
+
+ xsltSetGenericDebugFunc(NULL, NULL);
+
+ return xsltSaveResultToFd(fd, result_libxml, style_libxslt);
+}
+
+ /**********************************************/
+ /* Error and Debugging Callbacks Registration */
+ /**********************************************/
+
+ /* max size of a single message passed to callbacks */
+#define MAX_MSG_SIZE 1024
+#define TRUNCATED_MSG "... TRUNCATED ..."
+#define TRUNCATED_MSG_LEN strlen(TRUNCATED_MSG)
+
+ /* ERROR callbacks */
+
+ /* user provided error callback, needs a string input */
+static gdomeXsltMsgCallback errorUserCallback = NULL;
+
+ /* libxslt like error callback, ignore context, builds a string
+ * input for user provided error callback and invoke it */
+void gdomeXsltErrorCallback (void *ctx, const char *msg, ...) {
+ va_list args;
+ char buf[MAX_MSG_SIZE];
+
+ if (errorUserCallback == NULL)
+ return;
+
+ va_start(args, msg);
+ if (vsnprintf(buf, MAX_MSG_SIZE, msg, args) > MAX_MSG_SIZE - 1)
+ { /* message truncated; write TRUNCATED_MSG on it */
+ strncpy(buf+(strlen(buf) - TRUNCATED_MSG_LEN),
+ TRUNCATED_MSG, TRUNCATED_MSG_LEN);
+ }
+ va_end(args);
+
+ (*errorUserCallback) (buf);
+
+ return;
+}
+
+ /* set user provided error callback */
+void setErrorCallback (gdomeXsltMsgCallback callback)
+{
+ errorUserCallback = callback;
+ xsltSetGenericErrorFunc(NULL,
+ (callback == NULL ? NULL : gdomeXsltErrorCallback));
+
+ return;
+}
+
+ /* DEBUG callbacks */
+
+ /* user provided debug callback, needs a string input */
+static gdomeXsltMsgCallback debugUserCallback = NULL;
+
+ /* libxslt like debug callback, ignore context, builds a string
+ * input for user provided debug callback and invoke it */
+void gdomeXsltDebugCallback (void *ctx, const char *msg, ...) {
+ va_list args;
+ char buf[MAX_MSG_SIZE];
+
+ if (debugUserCallback == NULL)
+ return;
+
+ va_start(args, msg);
+ if (vsnprintf(buf, MAX_MSG_SIZE, msg, args) > MAX_MSG_SIZE - 1)
+ { /* message truncated; write TRUNCATED_MSG on it */
+ strncpy(buf+(strlen(buf) - TRUNCATED_MSG_LEN),
+ TRUNCATED_MSG, TRUNCATED_MSG_LEN);
+ }
+ va_end(args);
+
+ (*debugUserCallback) (buf);
+
+ return;
+}
+
+ /* set user provided debug callback */
+void setDebugCallback (gdomeXsltMsgCallback callback)
+{
+ debugUserCallback = callback;
+ xsltSetGenericDebugFunc(NULL,
+ (callback == NULL ? NULL : gdomeXsltDebugCallback));
+
+ return;
+}
+
--- /dev/null
+
+/* This file implements a XSLT engine working on Gdome documents. In fact,
+ * it just maps Gdome documents to libxml documents back and forth, and
+ * applies the transformation on libxml documents using libxlt.
+ *
+ * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT
+ * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT)
+ *
+ * Copyright (C) 2002:
+ * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ * Stefano Zacchiroli <zack@cs.unibo.it>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * For more information, please send an email to {sacerdot,zack}@cs.unibo.it
+ */
+
+#ifndef __gdome_xslt_h__
+#define __gdome_xslt_h__
+
+#include <gdome.h>
+#include <libxslt/xsltconfig.h>
+#include <libxslt/xslt.h>
+#include <libxslt/xsltutils.h>
+#include <libxslt/transform.h>
+#include <libxslt/imports.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+ /******************************/
+ /* XSLT stylesheet Processing */
+ /******************************/
+
+xsltStylesheetPtr processStylesheet (GdomeDocument* style);
+
+
+ /*******************************/
+ /* XSLT stylesheet Application */
+ /*******************************/
+
+GdomeDocument* applyStylesheet (GdomeDocument* source,
+ xsltStylesheetPtr style_libxslt,
+ const char** params);
+
+ /******************/
+ /* Results Output */
+ /******************/
+
+int saveResultToFilename (const char* name,
+ GdomeDocument* result,
+ xsltStylesheetPtr style_libxslt,
+ int compression);
+int saveResultToFile (FILE* file,
+ GdomeDocument* result,
+ xsltStylesheetPtr style_libxslt);
+int saveResultToFd (int fd,
+ GdomeDocument* result,
+ xsltStylesheetPtr style_libxslt);
+
+ /**********************************************/
+ /* Error and Debugging Callbacks Registration */
+ /**********************************************/
+
+typedef void(*gdomeXsltMsgCallback)(const char *);
+
+void setErrorCallback (gdomeXsltMsgCallback callback);
+void setDebugCallback (gdomeXsltMsgCallback callback);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __gdome_xslt_h__ */
--- /dev/null
+test
+.deps
+Makefile
+Makefile.in
--- /dev/null
+
+noinst_PROGRAMS = test
+
+test_SOURCES = test.c
+
+LDADDS = \
+ $(GDOME_LIBS) \
+ $(LIBXSLT_LIBS) \
+ $(top_builddir)/C/gdome_xslt/libgdome_xslt.la
+
+test_LDADD = $(LDADDS)
+
+INCLUDES = \
+ $(GDOME_CFLAGS) \
+ $(LIBXSLT_CFLAGS) \
+ -I$(top_srcdir)/C/gdome_xslt
+
--- /dev/null
+/* This file is a test for the XSLT engine working on Gdome documents.
+ *
+ * Copyright (C) 2002 Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * For more information, please send an email to <sacerdot@cs.unibo.it>
+ */
+
+#include <stdio.h>
+#include <gdome.h>
+#include <libxslt/xsltconfig.h>
+#include <libxslt/xslt.h>
+#include <libxslt/imports.h>
+
+#include "gdome_xslt.h"
+
+#define OUTPUT_FILE "../../test_files/output.xml"
+#define CORRECT_OUTPUT_FILE "../../test_files/output.xml.correct"
+
+GdomeDocument* loadDocument(GdomeDOMImplementation *domimpl, char *uri)
+{
+ GdomeDocument *doc;
+ GdomeException exc;
+
+ doc = gdome_di_createDocFromURI(domimpl, uri, GDOME_LOAD_PARSING, &exc);
+ if (doc == NULL) {
+ fprintf (stderr,
+ "DOMImplementation.createDocFromURI: failed\n\tException #%d\n",
+ exc);
+ }
+
+ return doc;
+}
+
+/* // old version: use gdome serialization
+int saveDocument(GdomeDOMImplementation *domimpl, GdomeDocument* doc, char *uri)
+{
+ GdomeException exc;
+
+ if (!gdome_di_saveDocToFile (domimpl, doc, uri, GDOME_SAVE_STANDARD, &exc)) {
+ fprintf (stderr,
+ "DOMImplementation.saveDocToFile: failed\n\tException #%d\n",
+ exc);
+ return 0;
+ }
+
+ return 1;
+}
+*/
+
+ /* new version, use libxslt serialization */
+int saveDocument(char* fname, GdomeDocument* result, xsltStylesheetPtr style) {
+ return saveResultToFilename(fname, result, style, 0);
+}
+
+int main(void)
+{
+ int bytes;
+ GdomeDOMImplementation *domimpl;
+ GdomeDocument *input;
+ GdomeDocument *style;
+ xsltStylesheetPtr style_libxslt;
+ GdomeDocument *output;
+ GdomeException exc;
+ const char* params[] = {"parameter1", "'value1'",
+ "parameter2", "'value2'",
+ "parameter3", "'value3'",
+ NULL};
+
+ domimpl = gdome_di_mkref();
+
+ if (!(input = loadDocument(domimpl, "../../test_files/input.xml"))) return 1;
+ if (!(style = loadDocument(domimpl, "../../test_files/stylesheet.xsl"))) return 1;
+
+ style_libxslt = processStylesheet(style);
+
+ output = applyStylesheet(input, style_libxslt, params);
+
+/* if (!(saveDocument(domimpl, output, "../../test_files/output.xml"))) return 1; */
+ bytes = saveDocument("../../test_files/output.xml", output, style_libxslt);
+
+ xsltFreeStylesheet(style_libxslt);
+ gdome_di_freeDoc (domimpl, input, &exc);
+ gdome_di_freeDoc (domimpl, style, &exc);
+ gdome_di_freeDoc (domimpl, output, &exc);
+ gdome_di_unref (domimpl, &exc);
+
+ printf("The test was successful iff %s is equal to %s\n",
+ OUTPUT_FILE,
+ CORRECT_OUTPUT_FILE);
+
+ return 0;
+}
--- /dev/null
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations
+below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+^L
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it
+becomes a de-facto standard. To achieve this, non-free programs must
+be allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+^L
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control
+compilation and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+\f
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+^L
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+^L
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at least
+ three years, to give the same user the materials specified in
+ Subsection 6a, above, for a charge no more than the cost of
+ performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+^L
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+^L
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply, and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License
+may add an explicit geographical distribution limitation excluding those
+countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+^L
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+^L
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms
+of the ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library.
+It is safest to attach them to the start of each source file to most
+effectively convey the exclusion of warranty; and each file should
+have at least the "copyright" line and a pointer to where the full
+notice is found.
+
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or
+your school, if any, to sign a "copyright disclaimer" for the library,
+if necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James
+ Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
--- /dev/null
+As a special exception to the GNU Library General Public License, you
+may link, statically or dynamically, a "work that uses the Library"
+with a publicly distributed version of the Library to produce an
+executable file containing portions of the Library, and distribute
+that executable file under terms of your choice, without any of the
+additional requirements listed in clause 6 of the GNU Library General
+Public License. By "a publicly distributed version of the Library",
+we mean either the unmodified Library as distributed by INRIA, or a
+modified version of the Library that is distributed under the
+conditions defined in clause 3 of the GNU Library General Public
+License. This exception does not however invalidate any other reasons
+why the executable file might be covered by the GNU Library General
+Public License.
--- /dev/null
+DISTDIR = @PACKAGE@-@VERSION@
+
+EXTRA_DIST = BUGS LICENSE aclocal.m4 debian gdome2-xslt.pc.in gdome2-xslt-cpp-smart.pc.in
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = gdome2-xslt.pc gdome2-xslt-cpp-smart.pc
+
+## SUBDIRS = C C++ test_files
+SUBDIRS = C C++ ocaml test_files
+
+deb: dist
+ if [ -d $(DISTDIR)/ ]; then rm -rf $(DISTDIR); else true; fi
+ tar xvzf $(DISTDIR).tar.gz
+ (cd $(DISTDIR)/ && find . -type d -name .svn -exec rm -rf {} \; ; debuild)
+ rm -rf $(DISTDIR)
+
--- /dev/null
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT
+AC_CONFIG_SRCDIR([C/gdome_xslt/gdome_xslt.h])
+
+PACKAGE=gdome2-xslt
+VERSION=0.0.8
+VERSION_INFO=`echo $VERSION | awk -F. '{ printf "%d:%d:%d", $1+$2, $3, $2 }'`
+AC_SUBST(VERSION_INFO)
+
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_INSTALL
+
+AM_CONFIG_HEADER(config.h)
+AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
+AM_PROG_LIBTOOL
+
+PKG_CHECK_MODULES(GDOME, gdome2 >= 0.7.0,, AC_MSG_ERROR(could not find Gdome2))
+AC_SUBST(GDOME_CFLAGS)
+AC_SUBST(GDOME_LIBS)
+
+PKG_CHECK_MODULES(GMETADOM, gdome2-cpp-smart >= 0.1.8,, AC_MSG_ERROR(could not find GMetaDOM))
+AC_SUBST(GMETADOM_CFLAGS)
+AC_SUBST(GMETADOM_LIBS)
+
+PKG_CHECK_MODULES(LIBXSLT, libxslt,, AC_MSG_ERROR(could not find libxslt))
+AC_SUBST(LIBXSLT_CFLAGS)
+AC_SUBST(LIBXSLT_LIBS)
+
+AC_CHECK_PROG(HAVE_OCAMLC, ocamlc, yes, no)
+if test $HAVE_OCAMLC = "no"; then
+ AC_MSG_ERROR(could not find ocamlc in PATH, please make sure ocaml is installed)
+else
+ OCAMLC=ocamlc
+ OCAMLSTDLIBDIR="`ocamlc -where`"
+ OCAMLSTUBDIR="`ocamlc -where`/stublibs"
+ AC_SUBST(OCAMLC)
+ AC_SUBST(OCAMLSTDLIBDIR)
+ AC_SUBST(OCAMLSTUBDIR)
+fi
+
+AC_CHECK_PROG(HAVE_OCAMLOPT, ocamlopt, yes, no)
+if test $HAVE_OCAMLOPT = "no"; then
+ AC_MSG_WARN(ocaml native libraries won't be compiled since ocamlopt was not found)
+else
+ OCAMLOPT=ocamlopt
+ AC_SUBST(OCAMLOPT)
+fi
+AM_CONDITIONAL(HAVE_OCAMLOPT_COND, test x$HAVE_OCAMLOPT = xyes)
+
+AC_CHECK_PROG(HAVE_OCAMLFIND, ocamlfind, yes, no)
+if test $HAVE_OCAMLFIND = "no"; then
+ AC_MSG_ERROR(could not find ocamlfind in PATH, please make sure findlib is installed)
+else
+ OCAMLFIND=ocamlfind
+ AC_SUBST(OCAMLFIND)
+fi
+
+AC_CHECK_PROG(HAVE_OCAMLDEP, ocamldep, yes, no)
+if test $HAVE_OCAMLDEP = "yes"; then
+ OCAMLDEP=ocamldep
+ AC_SUBST(OCAMLDEP)
+fi
+
+AC_CHECK_PROG(HAVE_OCAMLMKLIB, ocamlmklib, yes, no)
+if test $HAVE_OCAMLMKLIB = "no"; then
+ AC_MSG_ERROR(could not find ocamlmklib in PATH, please make sure ocamlmklib is installed)
+else
+ OCAMLMKLIB=ocamlmklib
+ AC_SUBST(OCAMLMKLIB)
+fi
+
+AC_MSG_CHECKING(for gdome2 ocaml binding)
+ocamlfind query gdome2 ||
+ AC_MSG_ERROR(gdome2 not installed (according to findlib))
+MLGDOME_CFLAGS="`$OCAMLFIND query -i-format gdome2`"
+AC_SUBST(MLGDOME_CFLAGS)
+
+AC_MSG_CHECKING(for the ocaml library dir)
+OCAML_LIB_DIR=`ocamlc -where`
+AC_MSG_RESULT($OCAML_LIB_DIR)
+
+AC_CHECK_FILE(/usr/include/caml/mlvalues.h,
+ OCAML_INCLUDE_DIR=/usr/include/caml,
+ OCAML_INCLUDE_DIR=$OCAML_LIB_DIR/caml
+)
+
+AC_SUBST(PACKAGE)
+AC_SUBST(VERSION)
+AC_SUBST(OCAML_INCLUDE_DIR)
+
+AC_CONFIG_FILES([
+ Makefile
+ C/Makefile
+ C/gdome_xslt/Makefile
+ C/test/Makefile
+ C++/gdome_xslt/Makefile
+ C++/test/Makefile
+ C++/Makefile
+ ocaml/Makefile
+ ocaml/gdome_xslt/Makefile
+ ocaml/gdome_xslt/META
+ ocaml/test/Makefile
+ gdome2-xslt.pc
+ gdome2-xslt-cpp-smart.pc
+ test_files/Makefile])
+AC_OUTPUT
--- /dev/null
+gdome2-xslt (0.0.8-1) unstable; urgency=low
+
+ * convert comments in .mli interface files to ocamldoc comments
+ * bump debhelper compatibility level and dependency to 5
+ * debian/rules
+ - use ocaml.mk cdbs class
+ - enable generation of ocamldoc api reference (via CDBS)
+ * debian/control
+ - added XS-Vcs-* fields pointing to the svn repository
+ - bumped build dependency on ocaml-nox to >= 3.10.0
+ - s/Source-Version/binary:Version/ substvar
+ * debian/control.in
+ - file removed, no longer needed
+ * debian/*.dirs, debian/*.install
+ - removed the files that are generated at build time
+
+ -- Stefano Zacchiroli <zack@debian.org> Sat, 08 Sep 2007 11:41:26 +0200
+
+gdome2-xslt (0.0.7-5) unstable; urgency=low
+
+ * debian/control
+ - bumped gmetadom dependencies to ensure the package is rebuilt
+ against a version of gmetadom who does not contain a spurious -lz
+ linker flag. Fixes FTBFS.
+
+ -- Stefano Zacchiroli <zack@debian.org> Sun, 6 Aug 2006 11:41:23 +0200
+
+gdome2-xslt (0.0.7-4) unstable; urgency=low
+
+ * Rebuilt against OCaml 3.09.2, bumped deps accordingly.
+ * debian/control
+ - bumped Standards-Version to 3.7.2 (no changes needed)
+
+ -- Stefano Zacchiroli <zack@debian.org> Tue, 16 May 2006 22:47:32 +0000
+
+gdome2-xslt (0.0.7-3) unstable; urgency=low
+
+ * Rebuilt against OCaml 3.09.1, bumped deps accordingly.
+
+ -- Stefano Zacchiroli <zack@debian.org> Sat, 7 Jan 2006 18:52:27 +0100
+
+gdome2-xslt (0.0.7-2) unstable; urgency=low
+
+ * ocaml 3.09 transition
+ * rebuild/renaming due to changed libstdc++ configuration
+ (closes: #339167)
+ * debian/*
+ - no longer hard coding of ocaml abi number anywhere
+ * debian/control
+ - bumped standards version
+
+ -- Stefano Zacchiroli <zack@debian.org> Wed, 23 Nov 2005 10:30:16 +0000
+
+gdome2-xslt (0.0.7-1) unstable; urgency=low
+
+ * New upstream release
+ - enable static linking of C/OCaml glue code
+ * debian/control
+ - bumped dependencies to gmetadom 0.2.3
+ * debian/*
+ - ABI transition for gcc 4
+
+ -- Stefano Zacchiroli <zack@debian.org> Thu, 7 Jul 2005 10:39:37 +0000
+
+gdome2-xslt (0.0.6-8) unstable; urgency=low
+
+ * debian/rules
+ - uses cdbs
+ * debian/control
+ - added build dependency on cdbs, bumped debhelper dependency as needed
+
+ -- Stefano Zacchiroli <zack@debian.org> Sun, 22 May 2005 23:46:24 +0200
+
+gdome2-xslt (0.0.6-7) unstable; urgency=low
+
+ * rebuilt against ocaml 3.08.3
+
+ -- Stefano Zacchiroli <zack@debian.org> Sat, 26 Mar 2005 00:38:05 +0100
+
+gdome2-xslt (0.0.6-6) unstable; urgency=medium
+
+ * debian/control
+ - depend on ocaml-base-nox-3.08 instead of ocaml-base-3.08 since
+ this package doesn't directly need ocaml X libraries
+
+ -- Stefano Zacchiroli <zack@debian.org> Tue, 24 Aug 2004 12:25:28 +0200
+
+gdome2-xslt (0.0.6-5) unstable; urgency=low
+
+ * re-run autotools chain to get rid of spurious shared objects created
+ without .so suffixes
+
+ -- Stefano Zacchiroli <zack@debian.org> Tue, 27 Jul 2004 10:00:09 +0200
+
+gdome2-xslt (0.0.6-4) unstable; urgency=low
+
+ * rebuilt with ocaml 3.08
+ * debian/control
+ - bumped ocaml deps to 3.08
+ - bumped standards-version to 3.6.1.1
+ - changed ocaml deps to ocaml-nox
+ - bumped gmetadom (ocaml part) versions to >= 0.2.1-3 (first version
+ rebuilt with ocaml 3.08)
+
+ -- Stefano Zacchiroli <zack@debian.org> Mon, 26 Jul 2004 16:47:13 +0200
+
+gdome2-xslt (0.0.6-3) unstable; urgency=high
+
+ * ocaml/gdome_xslt/Makefile.am
+ - use .o PIC objects from .libs directory
+ (should fix build failure on hppa)
+ * debian/control
+ - versione build dep on findlib to >= 0.8-5
+
+ -- Stefano Zacchiroli <zack@debian.org> Tue, 21 Oct 2003 14:43:09 +0200
+
+gdome2-xslt (0.0.6-2) unstable; urgency=low
+
+ * Rebuilt against gmetadom 0.2.1, gdome2 0.8.1 (should link against glib2)
+
+ -- Stefano Zacchiroli <zack@debian.org> Fri, 10 Oct 2003 09:38:27 +0200
+
+gdome2-xslt (0.0.6-1) unstable; urgency=low
+
+ * ocaml binding
+ - wrapped XSLT stylesheet application in a blocking section so that
+ it can be interrupted by ocaml exceptions, signals, ...
+ * restructured/cleaned up Makefiles
+
+ -- Stefano Zacchiroli <zack@debian.org> Sat, 4 Oct 2003 17:09:37 +0200
+
+gdome2-xslt (0.0.4-9) unstable; urgency=low
+
+ * Rebuilt with ocaml 3.07
+
+ -- Stefano Zacchiroli <zack@debian.org> Wed, 1 Oct 2003 14:18:19 +0200
+
+gdome2-xslt (0.0.4-8) unstable; urgency=low
+
+ * Rebuilt with ocaml 3.07beta2
+
+ -- Stefano Zacchiroli <zack@debian.org> Mon, 22 Sep 2003 18:26:04 +0200
+
+gdome2-xslt (0.0.4-7) unstable; urgency=low
+
+ * rebuilt against gmetadom 0.1.10-3
+ * debian/control
+ - strictly depends on gmetadom >= 0.1.10-3 (older version are buggy
+ on mips)
+
+ -- Stefano Zacchiroli <zack@debian.org> Mon, 14 Jul 2003 11:16:59 +0200
+
+gdome2-xslt (0.0.4-6) unstable; urgency=low
+
+ * debian/control
+ - bumped gmetadom dependencies to >= 0.1.10-2 (to ensure that .pc
+ is available)
+
+ -- Stefano Zacchiroli <zack@debian.org> Tue, 1 Jul 2003 10:14:14 +0200
+
+gdome2-xslt (0.0.4-5) unstable; urgency=low
+
+ * rebuilt using gmetadom 0.1.9
+ * debian/control
+ - added build-dep on pkg-config
+ - bumped dependencies on gmetadom to 0.1.9
+ - bumped standards-version to 3.5.10
+ - changed section of -dev packages to libdevel
+ - added ${misc:Depends}
+ * debian/rules
+ - removed DH_COMPAT in favour of debian/compat
+ - removed dh_movefiles in favour of dh_install
+ - cosmetic changes
+
+ -- Stefano Zacchiroli <zack@debian.org> Thu, 19 Jun 2003 17:05:47 +0200
+
+gdome2-xslt (0.0.4-4) unstable; urgency=low
+
+ * Bugfix: ships also -config script
+ * Bumped Standards-Version to 3.5.9
+
+ -- Stefano Zacchiroli <zack@debian.org> Thu, 20 Mar 2003 20:45:27 +0100
+
+gdome2-xslt (0.0.4-3) unstable; urgency=low
+
+ * Implemented "high" level functions to set handlers for libxslt error and
+ debugging messages: setErrorCallback, setDebugCallback (C flavour)
+ * Implemented binding for the above functions (OCaml flavour)
+ * Bugfix: installs also i_gdome_xslt.ml, gdome_xslt_init.o
+
+ -- Stefano Zacchiroli <zack@debian.org> Thu, 13 Mar 2003 18:07:22 +0100
+
+gdome2-xslt (0.0.4-2) unstable; urgency=low
+
+ * Bugfix: installs also i_gdome_xslt.cmi
+
+ -- Stefano Zacchiroli <zack@debian.org> Wed, 12 Mar 2003 18:28:27 +0100
+
+gdome2-xslt (0.0.4-1) unstable; urgency=low
+
+ * New release
+ * Added a new interface for apply method which requires no arguments
+ * Bumped gmetadom dependencies to 0.1.6
+ * Removed << dependencies on gmetadom
+ * Bumpetd gdome2 version to 0.7.4
+
+ -- Stefano Zacchiroli <zack@debian.org> Mon, 10 Mar 2003 17:50:42 +0100
+
+gdome2-xslt (0.0.3-3) unstable; urgency=low
+
+ * No longer use virtual dependencies on other ocaml libraries, reverted to
+ >=/<< dependencies approach
+ * Bumped dependencies on gmetadom to version 0.1.5
+
+ -- Stefano Zacchiroli <zack@debian.org> Fri, 24 Jan 2003 13:10:22 +0100
+
+gdome2-xslt (0.0.3-2) unstable; urgency=low
+
+ * Use versioned ocaml standard library directory
+ * Changed deps and build-deps to ocaml-3.06-1
+ * Source named changed to gdome2-xslt
+ * Moved OCaml .so stub in <stdlib>/stublibs
+ * Moved ocaml stuff in /usr/lib/ocaml/3.06
+ * Ship also C and C++ flavours
+ * Added dep from libgdome2-xslt-ocaml to libgdome2-ocaml
+ * Added dep from libgdome2-xslt-ocaml-dev to libgdome2-ocaml-dev-0.1.4
+ * Added build-dep to libgdome2-cpp-smart-dev
+ * Provided a better Description
+ * Bumped Standards-Version to 3.5.8
+ * Better test for ocamlopt existence
+
+ -- Stefano Zacchiroli <zack@debian.org> Sun, 8 Dec 2002 16:09:56 +0100
+
+libxslt-ocaml (0.0.2-1) unstable; urgency=low
+
+ * Added serialization functions
+
+ -- Stefano Zacchiroli <zack@debian.org> Thu, 28 Nov 2002 17:59:29 +0100
+
+libxslt-ocaml (0.0.1-3) unstable; urgency=low
+
+ * Rebuilt with ocaml 3.06 (Closes: Bug#158225, Bug#158217)
+ * Upgraded Standards-Version to 3.5.6
+ * Switched deps and build-deps to ocaml-3.06 and ocaml-base-3.06
+ * Switched to debhelper 4
+
+ -- Stefano Zacchiroli <zack@debian.org> Wed, 28 Aug 2002 11:09:04 +0200
+
+libxslt-ocaml (0.0.1-2) unstable; urgency=low
+
+ * Added -fPIC option when compiled some .o in order to succesfully build
+ also on HPPA (Closes: Bug#142485).
+ * Renamed binary packages to libgdome2-xslt-ocaml and -dev.
+
+ -- Stefano Zacchiroli <zack@debian.org> Fri, 12 Apr 2002 14:55:57 +0200
+
+libxslt-ocaml (0.0.1-1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Stefano Zacchiroli <zack@debian.org> Sat, 6 Apr 2002 13:00:49 +0200
+
--- /dev/null
+Source: gdome2-xslt
+Section: devel
+Priority: optional
+Maintainer: Stefano Zacchiroli <zack@debian.org>
+Build-Depends: debhelper (>= 5.0.0), ocaml-nox (>= 3.10.0), ocaml-findlib (>= 1.1), libgdome2-ocaml-dev (>= 0.2.5-3), libgdome2-dev (>= 0.8.1), libxslt1-dev, libgdome2-cpp-smart-dev (>= 0.2.4), pkg-config, cdbs
+Standards-Version: 3.7.2
+XS-Vcs-Svn: svn://mowgli.cs.unibo.it/trunk/helm/software/DEVEL/gdome_xslt
+XS-Vcs-Browser: http://helm.cs.unibo.it/websvn/listing.php?path=/trunk/helm/software/DEVEL/gdome_xslt/
+
+Package: libgdome2-xslt0c2a
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Replaces: libgdome2-xslt0, libgdome2-xslt0c2
+Conflicts: libgdome2-xslt0, libgdome2-xslt0c2
+Description: Minimal XSLT processor working on GDome2 documents
+ gdome2-xslt is a very small C library that implements a minimal
+ XSLT processor that can be used to apply XSLT stylesheets to
+ gdome2 documents.
+ .
+ This package includes shared libraries for the C implementation
+ and for the C++ bindings.
+
+Package: libgdome2-xslt-dev
+Section: libdevel
+Architecture: any
+Depends: libgdome2-xslt0c2a (= ${binary:Version}), libxslt1-dev, libgdome2-dev (>= 0.8.1), libgdome2-cpp-smart-dev (>= 0.2.4), ${misc:Depends}
+Description: Minimal XSLT processor working on GDome2 documents
+ gdome2-xslt is a very small C library that implements a minimal
+ XSLT processor that can be used to apply XSLT stylesheets to
+ gdome2 documents.
+ .
+ This package includes development support files for the C
+ library and for its C++ bindings.
+
+Package: libgdome2-xslt-ocaml
+Architecture: any
+Depends: ocaml-base-nox-${F:OCamlABI}, libgdome2-ocaml (>= 0.2.5-3), ${shlibs:Depends}, ${misc:Depends}
+Description: OCaml bindings for a minimal GDome2 based XSLT processor
+ gdome2-xslt is a very small C library that implements a minimal
+ XSLT processor that can be used to apply XSLT stylesheets to
+ gdome2 documents.
+ .
+ This package ships the OCaml language bindings for gdome2-xslt.
+ .
+ This package contains only the OCaml shared runtime stub libraries.
+
+Package: libgdome2-xslt-ocaml-dev
+Architecture: any
+Section: libdevel
+Depends: ocaml-nox-${F:OCamlABI}, libgdome2-xslt-ocaml (= ${binary:Version}), libgdome2-ocaml-dev (>= 0.2.5-3), libxslt1-dev, libgdome2-dev (>= 0.8.1), ${misc:Depends}
+Description: OCaml bindings for a minimal GDome2 based XSLT processor
+ gdome2-xslt is a very small C library that implements a minimal
+ XSLT processor that can be used to apply XSLT stylesheets to
+ gdome2 documents.
+ .
+ This package ships the OCaml language bindings for gdome2-xslt.
+ .
+ This package contains OCaml development stuff for gdome2-xslt.
+
--- /dev/null
+This package was debianized by Stefano Zacchiroli <zack@dalamar.krynn.it> on
+Sat, 6 Apr 2002 13:00:49 +0200.
+
+It was exported from the HELM CVS which is accesible using ViewCVS from:
+ http://www.cs.unibo.it/helm/
+
+Upstream Author:
+ Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+
+Copyright:
+
+ 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.
+
+ On a Debian GNU/Linux system, the LGPL can be found as
+ /usr/share/common-licenses/LGPL-2.1.
--- /dev/null
+ocaml/test/test.ml
+test_files/*
--- /dev/null
+debian/tmp/usr/include/
+debian/tmp/usr/lib/*.a
+debian/tmp/usr/lib/*.la
+debian/tmp/usr/lib/*.so
+debian/tmp/usr/lib/pkgconfig/
--- /dev/null
+usr/lib/ocaml/@OCamlABI@
--- /dev/null
+C/test/test.c
+C++/test/main.cc
+test_files/*
--- /dev/null
+debian/tmp/usr/lib/ocaml/@OCamlABI@/stublibs/*.owner
+debian/tmp/usr/lib/ocaml/@OCamlABI@/gdome2-xslt/
--- /dev/null
+usr/lib/ocaml/@OCamlABI@
--- /dev/null
+debian/tmp/usr/lib/ocaml/@OCamlABI@/stublibs/dll*.so
--- /dev/null
+debian/tmp/usr/lib/*.so.*
--- /dev/null
+#!/usr/bin/make -f
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/autotools.mk
+include /usr/share/cdbs/1/class/ocaml.mk
+OCAML_OCAMLDOC_PACKAGES = $(OCAML_LIBDEV_PACKAGES)
+OCAML_OCAMLDOC_FLAGS = -I $(OCAML_STDLIB_DIR)/gdome2
--- /dev/null
+# This is a comment
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+datadir=@datadir@
+
+Name: Gdome2/XSLT C++ Binding
+Description: API for applying XSLT stylesheets to Gdome2 documents
+Version: @VERSION@
+Requires: gdome2 libxslt
+Libs: @LIBXSLT_LIBS@ -L${libdir} -lgdome_xslt_cpp_smart
+Cflags: @LIBXSLT_CFLAGS@ -I${includedir}/@PACKAGE@
+
--- /dev/null
+# This is a comment
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+datadir=@datadir@
+
+Name: Gdome2/XSLT C Binding
+Description: API for applying XSLT stylesheets to Gdome2 documents
+Version: @VERSION@
+Requires: gdome2 libxslt
+Libs: @LIBXSLT_LIBS@ -L${libdir} -lgdome_xslt
+Cflags: @LIBXSLT_CFLAGS@ -I${includedir}/@PACKAGE@
+
--- /dev/null
+Makefile
+Makefile.in
--- /dev/null
+SUBDIRS = gdome_xslt test
--- /dev/null
+META
+Makefile
+Makefile.in
+config.cache
+config.log
+config.status
+configure
+gdome2-xslt.cma
+gdome_xslt.cmi
+gdome_xslt.cmo
+gdome_xslt.cmx
+gdome2-xslt.cmxa
+gdome_xslt.o
+gdome_xslt_init.cmi
+gdome_xslt_init.cmo
+gdome_xslt_init.cmx
+gdome_xslt_init.o
+i_gdome_xslt.cmi
+i_gdome_xslt.cmo
+i_gdome_xslt.cmx
+i_gdome_xslt.o
+ml_gdome_xslt.o
+.deps
--- /dev/null
+gdome_xslt.cmo: i_gdome_xslt.cmo gdome_xslt.cmi
+gdome_xslt.cmx: i_gdome_xslt.cmx gdome_xslt.cmi
+gdome_xslt_init.cmo: i_gdome_xslt.cmo gdome_xslt_init.cmi
+gdome_xslt_init.cmx: i_gdome_xslt.cmx gdome_xslt_init.cmi
+gdome_xslt.cmi: i_gdome_xslt.cmo
--- /dev/null
+requires="gdome2"
+version="@VERSION@"
+archive(byte)="mlgdome2-xslt.cma gdome_xslt_init.cmo"
+archive(native)="mlgdome2-xslt.cmxa gdome_xslt_init.cmx"
--- /dev/null
+
+ARCHIVE = mlgdome2-xslt
+PKGNAME = gdome2-xslt
+OCAMLINSTALLDIR = $(DESTDIR)$(OCAMLSTDLIBDIR)/$(PKGNAME)
+STUBSDIR = $(DESTDIR)$(OCAMLSTUBDIR)
+OCAMLFLAGS = -I +gdome2
+OCAMLC = @OCAMLC@ ${OCAMLFLAGS}
+OCAMLOPT = @OCAMLOPT@ ${OCAMLFLAGS}
+OCAMLDEP = @OCAMLDEP@
+OCAML_CFLAGS = @OCAML_CFLAGS@
+OCAMLFIND = @OCAMLFIND@
+OCAMLMKLIB = ocamlmklib
+DLL = dll$(ARCHIVE).so
+
+BUILT_SOURCES = x_gdome_xslt.c
+
+CLEANFILES = \
+ $(ARCHIVE).cma $(ARCHIVE).cmxa $(ARCHIVE).a lib$(ARCHIVE).a $(DLL) \
+ *.cmo *.cmx *.cmi $(BUILT_SOURCES)
+
+EXTRA_DIST = \
+ META.in .depend \
+ gdome_xslt.ml gdome_xslt.mli gdome_xslt_init.ml gdome_xslt_init.mli \
+ i_gdome_xslt.ml \
+ ocaml-io.h
+
+if HAVE_OCAMLOPT_COND
+noinst_DATA = \
+ $(ARCHIVE).cma $(DLL) $(ARCHIVE).cmxa $(ARCHIVE).a lib$(ARCHIVE).a \
+ gdome_xslt_init.cmo gdome_xslt_init.cmx
+else
+noinst_DATA = \
+ $(ARCHIVE).cma $(DLL) gdome_xslt_init.cmo lib$(ARCHIVE).a
+endif
+
+noinst_LTLIBRARIES = libmlgdome2-xslt.la
+C_SRC = ml_gdome_xslt.c x_gdome_xslt.c
+libmlgdome2_xslt_la_SOURCES = $(C_SRC)
+
+O_S = $(C_SRC:%.c=.libs/%.o)
+LO_S = $(O_S:%.o=%.lo)
+CMA_DEPS = i_gdome_xslt.cmo gdome_xslt.cmo
+CMXA_DEPS = $(CMA_DEPS:%.cmo=%.cmx)
+SHARED_LIBS = $(LIBXSLT_LIBS) $(GDOME_LIBS)
+
+x_gdome_xslt.c: $(top_srcdir)/C/gdome_xslt/gdome_xslt.c
+ cp $< $@
+
+$(ARCHIVE).cma: $(CMA_DEPS)
+ $(OCAMLMKLIB) -o $(ARCHIVE) $^ $(SHARED_LIBS)
+$(ARCHIVE).cmxa: $(CMXA_DEPS)
+ $(OCAMLMKLIB) -o $(ARCHIVE) $^ $(SHARED_LIBS)
+lib$(ARCHIVE).a $(DLL): $(O_S)
+ $(OCAMLMKLIB) -o $(ARCHIVE) $^ $(SHARED_LIBS)
+
+INCLUDES = $(GDOME_CFLAGS) $(MLGDOME_CFLAGS) -I/usr/include/caml -I$(top_srcdir)/C/gdome_xslt
+
+BYTECODE_STUFF = \
+ $(ARCHIVE).cma $(DLL) i_gdome_xslt.cmi i_gdome_xslt.ml gdome_xslt.cmi \
+ gdome_xslt.mli gdome_xslt_init.cmi gdome_xslt_init.mli gdome_xslt_init.cmo \
+ lib$(ARCHIVE).a
+NATIVECODE_STUFF = \
+ $(ARCHIVE).cmxa $(ARCHIVE).a gdome_xslt_init.cmx gdome_xslt_init.o
+if HAVE_OCAMLOPT_COND
+install-data-local: $(BYTECODE_STUFF) $(NATIVECODE_STUFF)
+else
+install-data-local: $(BYTECODE_STUFF)
+endif
+ $(mkinstalldirs) $(OCAMLINSTALLDIR) $(STUBSDIR)
+ chmod -x $(DLL)
+ for i in $^; do \
+ if [ "$$i" != "$(DLL)" ]; then \
+ $(INSTALL_DATA) $$i $(OCAMLINSTALLDIR)/$$i; \
+ fi \
+ done
+ if [ "x$(OCAMLFIND)" != "x" ]; then \
+ mv $(OCAMLINSTALLDIR) $(OCAMLINSTALLDIR).saved; \
+ $(OCAMLFIND) install -destdir $(DESTDIR)$(OCAMLSTDLIBDIR)/ $(PKGNAME) META $(DLL); \
+ $(INSTALL_DATA) $(OCAMLINSTALLDIR).saved/* $(OCAMLINSTALLDIR)/; \
+ rm -rf $(OCAMLINSTALLDIR).saved/; \
+ else \
+ $(INSTALL_DATA) $(DLL) $(STUBSDIR); \
+ fi
+
+uninstall-local:
+ if [ "x$(OCAMLFIND)" != "x" ]; then \
+ $(OCAMLFIND) remove -destdir $(DESTDIR)$(OCAMLSTDLIBDIR)/ $(PKGNAME); \
+ else \
+ rm -rf $(OCAMLINSTALLDIR); \
+ rm $(STUBSDIR)/$(DLL); \
+ fi
+ rm $(STUBSDIR)/lib$(ARCHIVE).so
+
+#### OCaml only stuff from now on
+
+DEPOBJS = *.ml *.mli
+
+depend:
+ $(OCAMLDEP) $(DEPOBJS) > .depend
+
+%.cmi : $(srcdir)/%.mli
+ if test ! -e $(@:%.cmi=%.mli) -a "x$(srcdir)" != "x." ; then $(LN_S) $< . ; fi
+ $(OCAMLC) -c $(@:%.cmi=%.mli)
+
+%.cmo : $(srcdir)/%.ml
+ if test ! -e $(@:%.cmo=%.ml) -a "x$(srcdir)" != "x." ; then $(LN_S) $< . ; fi
+ $(OCAMLC) -c $(@:%.cmo=%.ml)
+
+%.cmx %.o : $(srcdir)/%.ml
+ if test ! -e $(@:%.cmx=%.ml) -a "x$(srcdir)" != "x." ; then $(LN_S) $< . ; fi
+ $(OCAMLOPT) -c $(@:%.cmx=%.ml)
+
+include .depend
+
--- /dev/null
+(* This file is part of an ocaml binding of an XSLT engine working on Gdome
+ * documents.
+ *
+ * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT
+ * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT)
+ *
+ * Copyright (C) 2002:
+ * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ * Stefano Zacchiroli <zack@cs.unibo.it>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * For more information, please send an email to {sacerdot,zack}@cs.unibo.it
+ *)
+
+let processStylesheet style =
+ I_gdome_xslt.processStylesheet style#as_Document
+;;
+
+let applyStylesheet ~source ~stylesheet ~params =
+ let res =
+ I_gdome_xslt.applyStylesheet ~source:(source#as_Document) ~stylesheet
+ ~params
+ in
+ new Gdome.document res
+;;
+
+let saveResultToChannel ~outchan ~result ~stylesheet =
+ I_gdome_xslt.saveResultToChannel
+ ~outchan
+ ~result:result#as_Document
+ ~stylesheet
+;;
+
+let setErrorCallback = function
+ | None -> I_gdome_xslt.disableErrorCallback ()
+ | Some (callback: string -> unit) ->
+ Callback.register "error_callback" callback;
+ I_gdome_xslt.enableErrorCallback ()
+;;
+let setDebugCallback = function
+ | None -> I_gdome_xslt.disableDebugCallback ()
+ | Some (callback: string -> unit) ->
+ Callback.register "debug_callback" callback;
+ I_gdome_xslt.enableDebugCallback ()
+;;
+
--- /dev/null
+(* This file is part of an ocaml binding of an XSLT engine working on Gdome
+ * documents.
+ *
+ * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT
+ * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT)
+ *
+ * Copyright (C) 2002:
+ * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ * Stefano Zacchiroli <zack@cs.unibo.it>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * For more information, please send an email to {sacerdot,zack}@cs.unibo.it
+ *)
+
+(** Main interface to GDome XSLT functionalities *)
+
+(** processStylesheet stylesheet
+ *
+ * Process a stylesheet so that it can be subsequently used with
+ * applyStylesheet. *)
+val processStylesheet:
+ Gdome.document ->
+ I_gdome_xslt.processed_stylesheet
+
+(** applyStylesheet source stylesheet params
+ * Applies a processed stylesheet to a source document, using the given list of
+ * parameters (couples name,value) *)
+val applyStylesheet:
+ source: Gdome.document ->
+ stylesheet:I_gdome_xslt.processed_stylesheet ->
+ params:(string * string) list ->
+ Gdome.document
+
+(** output the result of a previous XSLT transformation to an output channel *)
+val saveResultToChannel:
+ outchan: out_channel ->
+ result: Gdome.document ->
+ stylesheet: I_gdome_xslt.processed_stylesheet ->
+ unit
+
+(** set error callback, that is a function invoked each time an error message is
+ * generated. If None is passed, libxslt default error callback is used *)
+val setErrorCallback: (string -> unit) option -> unit
+
+(** set debug callback, that is a function invoked each time a debugging message
+ * is generated. If None is passed, libxslt default error callback is used *)
+val setDebugCallback: (string -> unit) option -> unit
+
--- /dev/null
+(* This file is part of an ocaml binding of an XSLT engine working on Gdome
+ * documents.
+ *
+ * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT
+ * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT)
+ *
+ * Copyright (C) 2002:
+ * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ * Stefano Zacchiroli <zack@cs.unibo.it>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * For more information, please send an email to {sacerdot,zack}@cs.unibo.it
+ *)
+
+exception ProcessStylesheetException
+exception ApplyStylesheetException
+
+let _ =
+ Callback.register_exception
+ "ProcessStylesheetException" ProcessStylesheetException
+;;
+
+let _ =
+ Callback.register_exception
+ "ApplyStylesheetException" ApplyStylesheetException
+;;
+
+I_gdome_xslt.setXsltMaxDepth 2000;;
--- /dev/null
+(* This file is part of an ocaml binding of an XSLT engine working on Gdome
+ * documents.
+ *
+ * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT
+ * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT)
+ *
+ * Copyright (C) 2002:
+ * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ * Stefano Zacchiroli <zack@cs.unibo.it>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * For more information, please send an email to {sacerdot,zack}@cs.unibo.it
+ *)
+
+(** GDome XSLT initialization module *)
+
+(** WARNING!!!
+ * This file must always be linked with any code using gdome_xslt
+ * and must be linked as the first file. It is responsible of initializing the
+ * whole binding, registering some ocaml values to the C level. *)
+
+exception ProcessStylesheetException
+exception ApplyStylesheetException
+
--- /dev/null
+(* This file is part of an ocaml binding of an XSLT engine working on Gdome
+ * documents.
+ *
+ * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT
+ * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT)
+ *
+ * Copyright (C) 2002:
+ * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ * Stefano Zacchiroli <zack@cs.unibo.it>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * For more information, please send an email to {sacerdot,zack}@cs.unibo.it
+ *)
+
+type processed_stylesheet
+
+external setXsltMaxDepth:
+ int ->
+ unit
+ = "setXsltMaxDepth"
+
+external processStylesheet:
+ [> `Document] GdomeT.t ->
+ processed_stylesheet
+ = "ml_processStylesheet"
+
+external applyStylesheet:
+ source: [> `Document] GdomeT.t ->
+ stylesheet: processed_stylesheet ->
+ params: (string * string) list ->
+ TDocument.t
+ = "ml_applyStylesheet"
+
+external saveResultToChannel:
+ outchan: out_channel ->
+ result: TDocument.t ->
+ stylesheet: processed_stylesheet ->
+ unit
+ = "ml_saveResultToChannel"
+
+external enableErrorCallback : unit -> unit = "ml_enableErrorCallback"
+external disableErrorCallback : unit -> unit = "ml_disableErrorCallback"
+external enableDebugCallback : unit -> unit = "ml_enableDebugCallback"
+external disableDebugCallback : unit -> unit = "ml_disableDebugCallback"
+
--- /dev/null
+/* This file is part of an ocaml binding of an XSLT engine working on Gdome
+ * documents.
+ *
+ * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT
+ * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT)
+ *
+ * Copyright (C) 2002:
+ * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ * Stefano Zacchiroli <zack@cs.unibo.it>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * For more information, please send an email to {sacerdot,zack}@cs.unibo.it
+ */
+
+#include <assert.h>
+
+#include <caml/memory.h>
+#include <caml/custom.h>
+#include <caml/callback.h>
+#include <caml/mlvalues.h>
+
+#include <libxslt/xsltconfig.h>
+#include <libxslt/imports.h>
+
+#include "ocaml-io.h"
+#include "mlgdomevalue.h"
+#include "gdome_xslt.h"
+
+xsltStylesheetPtr XsltStylesheetPtr_val(value);
+
+static void ml_xsltFreeStylesheet(value v)
+{
+ xsltFreeStylesheet(XsltStylesheetPtr_val(v));
+}
+
+xsltStylesheetPtr XsltStylesheetPtr_val(value v)
+{
+ CAMLparam1(v);
+ xsltStylesheetPtr res = *((xsltStylesheetPtr*) Data_custom_val(v));
+ CAMLreturn(res);
+}
+
+value Val_XsltStylesheetPtr(xsltStylesheetPtr obj)
+{
+ CAMLparam0();
+ CAMLlocal1(v);
+ static struct custom_operations ops = {
+ "http://www.cs.unibo.it/helm/gdome_xslt/XsltStylesheetPtr",
+ ml_xsltFreeStylesheet,
+ custom_compare_default,
+ custom_hash_default,
+ custom_serialize_default,
+ custom_deserialize_default
+ };
+
+ v = alloc_custom(&ops, sizeof(xsltStylesheetPtr), 0, 1);
+ *((xsltStylesheetPtr*) Data_custom_val(v)) = obj;
+
+ CAMLreturn(v);
+}
+
+value ml_processStylesheet(value style)
+{
+ CAMLparam1(style);
+ xsltStylesheetPtr res;
+ res = processStylesheet(Document_val(style));
+ if (res == NULL) {
+ value* excp;
+ excp = caml_named_value("ProcessStylesheetException");
+ assert(excp != NULL);
+ raise_constant(*excp);
+ }
+ CAMLreturn(Val_XsltStylesheetPtr(res));
+}
+
+value setXsltMaxDepth(value depth)
+{
+ CAMLparam1(depth);
+ xsltMaxDepth = Int_val(depth);
+ CAMLreturn0;
+}
+
+value ml_applyStylesheet(value source, value style, value params)
+{
+ CAMLparam3(source,style,params);
+ CAMLlocal1(list);
+ GdomeDocument* res;
+ int i;
+ const char** c_params;
+
+ i = 0 ; list = params;
+ while(list != Val_int(0)) {
+ list = Field(list,1);
+ i++;
+ }
+ c_params = (const char **)malloc(sizeof(char *) * (i * 2 + 1));
+
+ i = 0; list = params;
+ while(list != Val_int(0)) {
+ c_params[i] = String_val(Field(Field(list,0),0));
+ c_params[i+1] = String_val(Field(Field(list,0),1));
+ list = Field(list,1);
+ i+=2;
+ }
+ c_params[i] = NULL;
+ enter_blocking_section();
+ res = applyStylesheet(Document_val(source),
+ XsltStylesheetPtr_val(style),
+ c_params);
+ leave_blocking_section();
+ free(c_params);
+ if (res == NULL) {
+ value* excp;
+ excp = caml_named_value("ApplyStylesheetException");
+ assert(excp != NULL);
+ raise_constant(*excp);
+ }
+ CAMLreturn(Val_Document(res));
+}
+
+value ml_saveResultToChannel(value channel,
+ value result,
+ value stylesheet)
+{
+ CAMLparam3(channel, result, stylesheet);
+
+ saveResultToFd((Channel(channel))->fd,
+ Document_val(result),
+ XsltStylesheetPtr_val(stylesheet));
+
+ CAMLreturn0;
+}
+
+ /* error callback handling */
+
+static void ml_gdomeXsltErrorCallback(const char *msg) {
+ callback(*caml_named_value("error_callback"), copy_string(msg));
+
+ return;
+}
+
+value ml_enableErrorCallback(value unit) {
+ CAMLparam1(unit);
+ setErrorCallback(ml_gdomeXsltErrorCallback);
+ CAMLreturn(Val_unit);
+}
+
+value ml_disableErrorCallback(value unit) {
+ CAMLparam1(unit);
+ setErrorCallback(NULL);
+ CAMLreturn(Val_unit);
+}
+
+ /* debug callback handling */
+
+static void ml_gdomeXsltDebugCallback(const char *msg) {
+ callback(*caml_named_value("debug_callback"), copy_string(msg));
+
+ return;
+}
+
+value ml_enableDebugCallback(value unit) {
+ CAMLparam1(unit);
+ setDebugCallback(ml_gdomeXsltDebugCallback);
+ CAMLreturn(Val_unit);
+}
+
+value ml_disableDebugCallback(value unit) {
+ CAMLparam1(unit);
+ setDebugCallback(NULL);
+ CAMLreturn(Val_unit);
+}
+
--- /dev/null
+/* This file is part of an ocaml binding of an XSLT engine working on Gdome
+ * documents.
+ *
+ * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT
+ * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT)
+ *
+ * Copyright (C) 2002:
+ * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ * Stefano Zacchiroli <zack@cs.unibo.it>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * For more information, please send an email to {sacerdot,zack}@cs.unibo.it
+ */
+
+xsltStylesheetPtr XsltStylesheetPtr_val(value);
+value Val_XsltStylesheetPtr(xsltStylesheetPtr);
+
+value ml_processStylesheet(value style);
+value ml_applyStylesheet(value source, value style, value params);
+
+value ml_saveResultToChannel(value channel, value result, value stylesheet);
+
+value ml_enableErrorCallback(value unit);
+value ml_disableErrorCallback(value unit);
+value ml_enableDebugCallback(value unit);
+value ml_disableDebugCallback(value unit);
+
--- /dev/null
+/**********************************************************************/
+/* */
+/* Objective Caml */
+/* */
+/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
+/* */
+/* Copyright 1996 Institut National de Recherche en Informatique et */
+/* en Automatique. All rights reserved. This file is distributed */
+/* under the terms of the GNU Library General Public License, with */
+/* the special exception on linking described in file */
+/* ../../LICENSE-INRIA. */
+/* */
+/**********************************************************************/
+
+/* Buffered input/output */
+
+#ifndef __IO_H__
+#define __IO_H__
+
+#ifndef IO_BUFFER_SIZE
+#define IO_BUFFER_SIZE 4096
+#endif
+
+typedef long file_offset;
+
+struct channel {
+ int fd; /* Unix file descriptor */
+ file_offset offset; /* Absolute position of fd in the file */
+ char * end; /* Physical end of the buffer */
+ char * curr; /* Current position in the buffer */
+ char * max; /* Logical end of the buffer (for input) */
+ void * mutex; /* Placeholder for mutex (for systhreads) */
+ struct channel * next; /* Linear chaining of channels (flush_all) */
+ int revealed; /* For Cash only */
+ int old_revealed; /* For Cash only */
+ int refcount; /* For flush_all and for Cash */
+ char buff[IO_BUFFER_SIZE]; /* The buffer itself */
+};
+
+/* For an output channel:
+ [offset] is the absolute position of the beginning of the buffer [buff].
+ For an input channel:
+ [offset] is the absolute position of the logical end of the buffer, [max].
+*/
+
+/* Functions and macros that can be called from C. Take arguments of
+ type struct channel *. No locking is performed. */
+
+/* Extract a struct channel * from the heap object representing it */
+
+#define Channel(v) (*((struct channel **) (Data_custom_val(v))))
+
+#endif /* __IO_H__ */
+
--- /dev/null
+test.cmi
+test.cmo
+test.cmx
+test.o
+test
+test.opt
+Makefile
+Makefile.in
--- /dev/null
+REQUIRES = gdome2
+OCAMLFIND = @OCAMLFIND@
+OCAMLC = $(OCAMLFIND) @OCAMLC@ -package "$(REQUIRES)"
+OCAMLOPT = $(OCAMLFIND) @OCAMLOPT@ -package "$(REQUIRES)"
+CMA = $(top_builddir)/ocaml/gdome_xslt/mlgdome2-xslt.cma
+CMXA = $(top_builddir)/ocaml/gdome_xslt/mlgdome2-xslt.cmxa
+INIT_CMO = $(top_builddir)/ocaml/gdome_xslt/gdome_xslt_init.cmo
+INIT_CMX = $(top_builddir)/ocaml/gdome_xslt/gdome_xslt_init.cmx
+OCAMLC_FLAGS = -I $(top_builddir)/ocaml/gdome_xslt/
+
+EXTRA_DIST = test.ml
+CLEANFILES = test{,.o,.opt} test.cm[iox]
+
+if HAVE_OCAMLOPT_COND
+noinst_DATA = test.opt test
+else
+noinst_DATA = test
+endif
+
+test: test.ml $(CMA) $(INIT_CMO)
+ $(OCAMLC) -o $@ -linkpkg $(OCAMLC_FLAGS) $(CMA) $(INIT_CMO) $<
+
+test.opt: test.ml $(CMXA) $(INIT_CMX)
+ $(OCAMLOPT) -o $@ -linkpkg $(OCAMLC_FLAGS) $(CMXA) $(INIT_CMX) $<
+
--- /dev/null
+(* This file is part of an ocaml binding of an XSLT engine working on Gdome
+ * documents.
+ *
+ * The code is largely based on the code of T.J. Mather's XML::GDOME::XSLT
+ * Perl module (http://kobesearch.cpan.org/search?dist=XML-GDOME-XSLT)
+ *
+ * Copyright (C) 2002 Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * For more information, please send an email to <sacerdot@cs.unibo.it>
+ *)
+
+let (output_file,
+ correct_output_file,
+ input_file,
+ stylesheet_file) =
+ ("../../test_files/output.xml",
+ "../../test_files/output.xml.correct",
+ "../../test_files/input.xml",
+ "../../test_files/stylesheet.xsl")
+in
+let domImpl = Gdome.domImplementation () in
+ let input =
+ domImpl#createDocumentFromURI ~uri:input_file ()
+ and style =
+ domImpl#createDocumentFromURI ~uri:stylesheet_file ()
+ in
+ (* First of all, let's try the exception handling machinery *)
+ let _ =
+ try
+ ignore (Gdome_xslt.processStylesheet input);
+ assert false (* previous line should rise an exception *)
+ with
+ Gdome_xslt_init.ProcessStylesheetException -> ()
+ in
+ let pstyle = Gdome_xslt.processStylesheet style in
+ let output =
+ Gdome_xslt.applyStylesheet input pstyle
+ ["parameter1","'value1'" ;
+ "parameter2","'value2'" ;
+ "parameter3","'value3'"
+ ]
+ in
+(* (* old version: use gdome serialization functions *)
+ let res =
+ domImpl#saveDocumentToFile ~doc:output ~name:output_file ()
+ in
+ if not res then
+ prerr_endline ("Error saving to document " ^ output_file)
+ else
+ begin
+ Printf.printf
+ "The test was successful iff %s is equal to %s\n"
+ output_file
+ correct_output_file
+ end
+*)
+ (* new version: use libxslt serialization functions *)
+ let outchan = open_out output_file in
+ Gdome_xslt.saveResultToChannel ~outchan ~result:output ~stylesheet:pstyle;
+ close_out outchan;
+ Printf.printf
+ "The test was successful iff %s is equal to %s\n"
+ output_file
+ correct_output_file
+;;
--- /dev/null
+output.xml
+Makefile
+Makefile.in
--- /dev/null
+EXTRA_DIST = input.xml output.xml.correct stylesheet.xsl
--- /dev/null
+<?xml version="1.0"?>
+<input>
+ <msg>It works!</msg>
+</input>
--- /dev/null
+<?xml version="1.0"?>
+<output><parameter>value2</parameter><parameter>value3</parameter><parameter>value1</parameter>
+ <msg>It works!</msg>
+</output>
--- /dev/null
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:param name="parameter1"/>
+<xsl:param name="parameter2"/>
+<xsl:param name="parameter3"/>
+
+<xsl:template match="/">
+ <output>
+ <parameter><xsl:value-of select="$parameter2"/></parameter>
+ <parameter><xsl:value-of select="$parameter3"/></parameter>
+ <parameter><xsl:value-of select="$parameter1"/></parameter>
+ <xsl:apply-templates/>
+ </output>
+</xsl:template>
+
+<xsl:template match="msg">
+ <xsl:copy-of select="."/>
+</xsl:template>
+
+</xsl:stylesheet>