--- xmlhelp/util/makefile.mk.xslt~	2006-01-05 18:18:15.000000000 +0000
+++ xmlhelp/util/makefile.mk	2006-02-16 16:05:55.000000000 +0000
@@ -62,6 +62,11 @@
 .ENDIF # wnt
 .ENDIF # sablot3rdlib
 
+.IF "$(SYSTEM_LIBXSLT)" == "YES"
+PKGCONFIG_MODULES=libxslt
+.INCLUDE: pkg_config.mk
+.ENDIF
+
 # --- Shared-Library ---------------------------------------------------
 
 SHL1TARGET=$(TARGET)$(UCP_VERSION)
@@ -75,12 +80,16 @@
 	$(CPPULIB)               \
 	$(SALLIB)                \
 	$(VOSLIB)                \
-	$(SABLOT3RDLIB)          \
 	$(EXPATASCII3RDLIB)      \
 	$(UCBHELPERLIB)          \
 	$(SVLLIB)             \
 	$(BERKELEYLIB)
-#	$(BERKELEYCPPLIB)
+
+.IF "$(SYSTEM_LIBXSLT)" == "YES"
+	SHL1STDLIBS+=$(PKGCONFIG_LIBS)
+.ELSE
+	SHL1STDLIBS+=$(SABLOT3RDLIB)
+.ENDIF
 
 SHL1LIBS =                       \
 	$(SLB)$/jaqe.lib         \
--- xmlhelp/source/cxxhelp/provider/makefile.mk.xslt~	2005-09-09 12:19:42.000000000 +0000
+++ xmlhelp/source/cxxhelp/provider/makefile.mk	2006-02-16 16:05:55.000000000 +0000
@@ -52,6 +52,12 @@
 CFLAGS+=-DSYSTEM_DB -I$(DB_INCLUDES)
 .ENDIF
 
+.IF "$(SYSTEM_LIBXSLT)" == "YES"
+PKGCONFIG_MODULES=libxslt
+.INCLUDE: pkg_config.mk
+CFLAGS+=-DSYSTEM_LIBXSLT
+.ENDIF
+
 .IF "$(SYSTEM_SABLOT)" == "YES"
 CFLAGS+=-DSYSTEM_SABLOT
 .ENDIF
--- xmlhelp/source/cxxhelp/provider/urlparameter.cxx.xslt~	2006-02-16 15:59:10.000000000 +0000
+++ xmlhelp/source/cxxhelp/provider/urlparameter.cxx	2006-02-16 16:05:55.000000000 +0000
@@ -61,6 +61,11 @@
 #ifndef _RTL_URI_HXX_
 #include <rtl/uri.hxx>
 #endif
+#ifdef SYSTEM_LIBXSLT
+#include <libxslt/xslt.h>
+#include <libxslt/transform.h>
+#include <libxslt/xsltutils.h>
+#else
 #ifdef SYSTEM_SABLOT
 #include <sablot.h>
 #include <shandler.h>
@@ -72,6 +77,7 @@
 #include <sablot/shandler.h>
 #endif
 #endif
+#endif
 #ifndef BERKELEYDBPROXY_DB_HXX_
 #include "db.hxx"
 #endif
@@ -727,8 +733,7 @@
 	return ret;
 }
 
-
-
+#ifndef SYSTEM_LIBXSLT
 
 ////////////////////////////////////////////////////////////////////////////////
 //                           InutStreamTransformerImpl                        //
@@ -762,6 +767,7 @@
 						SablotHandle processor_,
 						int handle );
 
+#endif
 
 struct UserData {
 	
@@ -779,7 +785,124 @@
 	URLParameter*                       m_pInitial;
 };
 
+#ifdef SYSTEM_LIBXSLT
+UserData *ugblData = 0;
+
+static int
+pkgMatch(const char * URI) {
+    if ((URI != NULL) && !strncmp(URI, "vnd.sun.star.pkg", 16))
+        return 1;
+    return 0;
+}
+
+static int
+helpMatch(const char * URI) {
+    if ((URI != NULL) && !strncmp(URI, "vnd.sun.star.help", 17))
+        return 1;
+    return 0;
+}
+
+static void *
+pkgOpen(const char * URI) {
+	rtl::OUString language,jar,path;
+
+	if( ugblData->m_pInitial->get_eid().getLength() )
+		return (void*)(new Reference< XHierarchicalNameAccess >);
+	else
+	{
+		jar = ugblData->m_pInitial->get_jar();
+		language = ugblData->m_pInitial->get_language();
+		path = ugblData->m_pInitial->get_path();
+	}
+            
+	Reference< XHierarchicalNameAccess > xNA(ugblData->m_pDatabases->jarFile( jar,language ));
+
+    Reference< XInputStream > xInputStream;
+
+	if( xNA.is() )
+	{
+		try
+		{
+			Any aEntry = xNA->getByHierarchicalName( path );
+			Reference< XActiveDataSink > xSink;
+			if( ( aEntry >>= xSink ) && xSink.is() )
+				xInputStream = xSink->getInputStream();
+		}
+		catch ( NoSuchElementException & )
+		{
+		}
+	}
+	
+	if( xInputStream.is() )
+	{
+		return new Reference<XInputStream>(xInputStream);
+	}
+	return 0;
+}
+
+static void *
+helpOpen(const char * URI) {
+	rtl::OUString language,jar,path;
 
+	URLParameter urlpar( rtl::OUString::createFromAscii( URI ),
+						 ugblData->m_pDatabases );
+		
+	jar = urlpar.get_jar();
+	language = urlpar.get_language();
+	path = urlpar.get_path();
+
+	Reference< XHierarchicalNameAccess > xNA(ugblData->m_pDatabases->jarFile( jar,language ));
+
+    Reference< XInputStream > xInputStream;
+
+	if( xNA.is() )
+	{
+		try
+		{
+			Any aEntry = xNA->getByHierarchicalName( path );
+			Reference< XActiveDataSink > xSink;
+			if( ( aEntry >>= xSink ) && xSink.is() )
+				xInputStream = xSink->getInputStream();
+		}
+		catch ( NoSuchElementException & )
+		{
+		}
+	}
+	
+	if( xInputStream.is() )
+		return new Reference<XInputStream>(xInputStream);
+	return 0;
+}
+
+static int
+helpRead(void * context, char * buffer, int len) {
+	Reference< XInputStream > *pRef = (Reference< XInputStream >*)context;
+
+	Sequence< sal_Int8 > aSeq;
+	len = (*pRef)->readBytes( aSeq,len);
+	memcpy(buffer, aSeq.getConstArray(), len);
+
+	return len;
+}
+
+static int
+pkgRead(void * context, char * buffer, int len) {
+	if( ugblData->m_pInitial->get_eid().getLength() )
+	{
+		ugblData->m_pDatabases->popupDocument( ugblData->m_pInitial,&buffer,&len);
+		return len;
+	}
+	else
+		return helpRead(context, buffer, len);
+}
+
+static int
+uriClose(void * context) {
+	Reference< XInputStream > *pRef = (Reference< XInputStream >*)context;
+	delete pRef;
+    return 0;
+}
+#endif
 
 InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam,
 												Databases*    pDatabases,
@@ -806,6 +929,7 @@
 	}
 	else
 	{
+#ifndef SYSTEM_LIBXSLT
 		SchemeHandler schemeHandler;
 		schemeHandler.getAll = schemehandlergetall;
 		schemeHandler.freeMemory = schemehandlerfreememory;
@@ -813,6 +937,7 @@
 		schemeHandler.get = schemehandlerget;
 		schemeHandler.put = schemehandlerput;
 		schemeHandler.close = schemehandlerclose;
+#endif
 	
 		UserData userData( this,urlParam,pDatabases );
 	
@@ -823,77 +948,78 @@
         int last = 0;
         
 		parString[last++] = "Program";
-		parString[last++] = urlParam->getByName( "Program" );
+		parString[last++] = rtl::OString('\'') + urlParam->getByName( "Program" ) + rtl::OString('\'');
 		parString[last++] = "Database";
-		parString[last++] = urlParam->getByName( "DatabasePar" );
+		parString[last++] = rtl::OString('\'') + urlParam->getByName( "DatabasePar" ) + rtl::OString('\'');
 		parString[last++] = "Id";
-		parString[last++] = urlParam->getByName( "Id" );
+		parString[last++] = rtl::OString('\'') + urlParam->getByName( "Id" ) + rtl::OString('\'');
 		parString[last++] = "Path";
-		parString[last++] = urlParam->getByName( "Path" );
+		parString[last++] = rtl::OString('\'') + urlParam->getByName( "Path" ) + rtl::OString('\'');
 		parString[last++] = "Language";
-		parString[last++] = urlParam->getByName( "Language" );
+		parString[last++] = rtl::OString('\'') + urlParam->getByName( "Language" ) + rtl::OString('\'');
 		parString[last++] = "System";
-		parString[last++] = urlParam->getByName( "System" );
+		parString[last++] = rtl::OString('\'') + urlParam->getByName( "System" ) + rtl::OString('\'');
 		parString[last++] = "productname";
-		parString[last++] = rtl::OString(
+		parString[last++] = rtl::OString('\'') + rtl::OString(
             pDatabases->getProductName().getStr(),
             pDatabases->getProductName().getLength(),
-            RTL_TEXTENCODING_UTF8 );
+            RTL_TEXTENCODING_UTF8 ) + rtl::OString('\'');
 		parString[last++] = "productversion";
-		parString[last++] = 
-            rtl::OString( pDatabases->getProductVersion().getStr(),
+		parString[last++] = rtl::OString('\'') + 
+            rtl::OString(  pDatabases->getProductVersion().getStr(),
                           pDatabases->getProductVersion().getLength(),
-                          RTL_TEXTENCODING_UTF8 );
+                          RTL_TEXTENCODING_UTF8 ) + rtl::OString('\'');
 
         parString[last++] = "imgrepos";
-        parString[last++] = pDatabases->getImagesZipFileURL();
+        parString[last++] = rtl::OString('\'') + pDatabases->getImagesZipFileURL() + rtl::OString('\'');
         parString[last++] = "hp";
-        parString[last++] = urlParam->getByName( "HelpPrefix" );
+        parString[last++] = rtl::OString('\'') + urlParam->getByName( "HelpPrefix" ) + rtl::OString('\'');
         
         if( parString[last-1].getLength() )
         {
             parString[last++] = "sm";
-            parString[last++] = "vnd.sun.star.help%3A%2F%2F";
+            parString[last++] = "'vnd.sun.star.help%3A%2F%2F'";
             parString[last++] = "qm";
-            parString[last++] = "%3F";
+            parString[last++] = "'%3F'";
             parString[last++] = "es";
-            parString[last++] = "%3D";
+            parString[last++] = "'%3D'";
             parString[last++] = "am";
-            parString[last++] = "%26";
+            parString[last++] = "'%26'";
             parString[last++] = "cl";
-            parString[last++] = "%3A";
+            parString[last++] = "'%3A'";
             parString[last++] = "sl";
-            parString[last++] = "%2F";
+            parString[last++] = "'%2F'";
             parString[last++] = "hm";
-            parString[last++] = "%23";
+            parString[last++] = "'%23'";
             parString[last++] = "cs";
-            parString[last++] = "css";
+            parString[last++] = "'css'";
 
             parString[last++] = "vendorname";
-            parString[last++] = 
+            parString[last++] = rtl::OString('\'') + 
                 rtl::OString( pDatabases->getVendorName().getStr(),
                               pDatabases->getVendorName().getLength(),
-                              RTL_TEXTENCODING_UTF8 );
+                              RTL_TEXTENCODING_UTF8 ) + rtl::OString('\'');
             parString[last++] = "vendorversion";
-            parString[last++] = 
+            parString[last++] = rtl::OString('\'') + 
                 rtl::OString( pDatabases->getVendorVersion().getStr(),
                               pDatabases->getVendorVersion().getLength(),
-                              RTL_TEXTENCODING_UTF8 );
+                              RTL_TEXTENCODING_UTF8 ) + rtl::OString('\'');
             parString[last++] = "vendorshort";
-            parString[last++] = 
+            parString[last++] = rtl::OString('\'') + 
                 rtl::OString( pDatabases->getVendorShort().getStr(),
                               pDatabases->getVendorShort().getLength(),
-                              RTL_TEXTENCODING_UTF8 );
+                              RTL_TEXTENCODING_UTF8 ) + rtl::OString('\'');
         }
         
 		for( int i = 0; i < last; ++i )
 			parameter[i] = parString[i].getStr();
 		parameter[last] = 0;
 		
-	
+#ifndef SYSTEM_LIBXSLT	
 		SablotHandle p;
 		SablotCreateProcessor(&p);
 		SablotRegHandler( p,HLR_SCHEME,&schemeHandler,(void*)(&userData) );
+#endif
 		rtl::OUString xslURL = pDatabases->getInstallPathAsURL/*WithOutEncoding*/();
 		
 		rtl::OString xslURLascii( 
@@ -902,6 +1028,31 @@
 			RTL_TEXTENCODING_ASCII_US/*osl_getThreadTextEncoding()*/);
 		xslURLascii += "main_transform.xsl";
 
+#ifdef SYSTEM_LIBXSLT
+		ugblData = &userData;
+
+		xmlRegisterInputCallbacks(pkgMatch, pkgOpen, pkgRead, uriClose);
+		xmlRegisterInputCallbacks(helpMatch, helpOpen, helpRead, uriClose);
+
+		xsltStylesheetPtr cur = 
+			xsltParseStylesheetFile((const xmlChar *)xslURLascii.getStr());
+
+		xmlDocPtr doc = xmlParseFile("vnd.sun.star.pkg:/");
+
+		xmlDocPtr res = xsltApplyStylesheet(cur, doc, parameter);
+	if (res) {
+		xmlChar *doc_txt_ptr=0;
+		int doc_txt_len;
+		int nResult = xsltSaveResultToString(&doc_txt_ptr, &doc_txt_len, res, cur);
+		addToBuffer((const char*)doc_txt_ptr, doc_txt_len);
+		xmlFree(doc_txt_ptr);
+	}
+		xmlPopInputCallbacks();
+		xmlPopInputCallbacks();
+		xmlFreeDoc(res);
+		xmlFreeDoc(doc);
+		xsltFreeStylesheet(cur);
+#else
 		const char aVndPkgConstStr[] = "vnd.sun.star.pkg:/";
 		const char aVndResConstStr[] = "vnd.sun.star.resultat:/";
 		char aVndPkgStr[ sizeof( aVndPkgConstStr ) ];
@@ -919,6 +1070,7 @@
 #endif
 		 
 		SablotDestroyProcessor( p );
+#endif
 	}
 }
 	
@@ -1064,8 +1216,7 @@
 }
 
 
-
-
+#ifndef SYSTEM_LIBXSLT
 
 /**
  *    getAll: open the URI and return the whole string
@@ -1238,7 +1389,4 @@
 	return 0;
 }
 
-
-
-
-
+#endif
--- config_office/set_soenv.in.xslt~	2006-02-16 15:59:18.000000000 +0000
+++ config_office/set_soenv.in	2006-02-16 16:06:18.000000000 +0000
@@ -1802,6 +1802,7 @@
 ToFile( "DB_INCLUDES",       "@DB_INCLUDES@",      "e" );
 ToFile( "DB_JAR",            "@DB_JAR@",           "e" );
 ToFile( "DB_JAR_SO",         "@DB_JAR_SO@",        "e" );
+ToFile( "SYSTEM_LIBXSLT",    "@SYSTEM_LIBXSLT@",   "e" );
 ToFile( "SYSTEM_HSQLDB",     "@SYSTEM_HSQLDB@",    "e" );
 ToFile( "HSQLDB_JAR",        "@HSQLDB_JAR@",       "e" );
 ToFile( "SYSTEM_BSH",        "@SYSTEM_BSH@",       "e" );
--- config_office/configure.in.xslt~	2006-02-16 15:59:18.000000000 +0000
+++ config_office/configure.in	2006-02-16 16:05:55.000000000 +0000
@@ -319,6 +319,9 @@
 AC_ARG_WITH(system-sablot,
 [  --with-system-sablot    Use sablot already on system
 ],,)
+AC_ARG_WITH(system-libxslt,
+[  --with-system-libxslt   Use libxslt already on system
+],,)
 AC_ARG_WITH(system-odbc,
 [  --with-system-odbc-headers     Use the odbc headers already on system
 ],,)
@@ -3089,6 +3092,22 @@
 AC_SUBST(XT_JAR)
 
 dnl ===================================================================
+dnl Check for system libxslt
+dnl ===================================================================
+AC_MSG_CHECKING([which libxslt to use])
+if test -n "$with_system_libxslt" && test "$with_system_libxslt" != "no"; then
+   AC_MSG_RESULT([external])
+   SYSTEM_LIBXSLT=YES
+
+   PKG_CHECK_MODULES( LIBXSLT, libxslt )
+else
+   AC_MSG_RESULT([none])
+   SYSTEM_LIBXSLT=NO
+fi
+AC_SUBST(SYSTEM_LIBXSLT)
+
+if test "$SYSTEM_LIBXSLT" == "NO"; then
+dnl ===================================================================
 dnl Check for system sablot
 dnl ===================================================================
 AC_MSG_CHECKING([which sablot to use])
@@ -3111,6 +3130,7 @@
 fi
 AC_SUBST(SYSTEM_SABLOT)
 AC_SUBST(SABLOT_LIBS)
+fi
 
 dnl ===================================================================
 dnl Check for system curl
