Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi Peter,

I hope you don't mind that I am forwarding your great work to the
mailing list - so that others can see what is going on :-)

I am just integrating that, fixing few minor things there (we should not
do 'use namespace' in the headers); but looks great overall!  I hope
I'll be able to push later tonight.

Regards,
Kendy
--- Begin Message ---
Hi Michael, 

I'm attaching a couple of patches that provide a simplified
implementation of the flat xml export and aim to fix a minor
configuration bug, as well as an improved version of the patch that
replaces the Java transformation service with a libxslt based one. 

0001-removed-obsolete-flat-xml-export... and
0002-added-missing-newline-before-EOF

just remove the now obsolete xslt scripts for flat xml export from scp2

0001-new-sax-documenthandler-adapter.patch

adds a simple adapter for sax document handlers and is a prerequisite of
the following 

new-flat-xml-export.patch

which is the simplified implementation of the flat xml export. It still
lacks the line-wrapping provided by the xslt script
"split-long-lines.xsl". I'm going to amend this to do some similar
line-wrapping next. 

This patch also moves a header file providing usedful macros for
component registration from config/cache to inc in module filter.

Also attached is an updated patch for the libxslt based xsltfilter
implementation. 

I've changed this to a) use the sax document handler adapter, b) use
libxslt by default and c) try to evaluate the 2nd userdata parameter of
the filter configuration as the name of the transformation service to
use. This should allow extension authors to provide their own
transformer implementation (which then could use the old java based
transformation service which in turn uses saxon and could provide xslt
2.0 for the TEI people for example). 

This last patch is incomplete in the sense that the current filter
configurations for the MS Office 2003 filters needed to be changed to
still use the Java based filter, as long as there's no libxslt based
extension function for the embedded ole export available. I'm going to
work on this after I finished the line-wrapping for the flat xml
export. 

I'd be glad if you or Jan could review and, where applicable, push the
patches so far. I'm mainly unsure about the use of the macros for
component registration in FlatXml.cxx: they look fine, but I just don't
now if this is the right thing to do. There's only place in LibO where
similar macros are beeing used (in module framework). 

Thanks, 

Peter




Am Mittwoch, den 12.01.2011, 09:37 +0000 schrieb Michael Meeks:
Hi Peter,

On Tue, 2011-01-11 at 22:55 +0100, Peter Jentsch wrote:
Hum. I wasn't aware the BSD license would be an issue. Bummer. 

      So - it isn't licensing wise; it is just that if you read it - we have
to append that text to the readmes / documentation - and it contains a
bug too we can't fix (mixed Oracle and Sun ;-).

solver/330/unxlngi6.pro/inc/offuh/com/sun/star/xml/sax/XDocumentHandler.hdl
solver/330/unxlngi6.pro/inc/offuh/com/sun/star/xml/XImportFilter.hdl
solver/330/unxlngi6.pro/inc/offuh/com/sun/star/xml/XExportFilter.hdl

Do you mean, like, literally copy the definitions from the generated
header files there? Not sure if I got this correctly.

      Sure - these are not copyright anyone, and are just auto-generated;
they are also different (wrt. namespaces).

Ok. I believe I've seen some macro for that component_Factory stuff
somewhere. Is it advisable to use such macros? If so, which one?

      Brilliant - if it is a different, and simpler / cleaner way to do it -
please do ! :-)

Anyway, I'll give it a try. I'm not sure about *just how much* needs to
be rewritten to allow for inserting our own copyright header.

      Well; this is a matter of taste and discretion :-)

 It looks like a generic documenthandler adapter class that defaults to
forwarding events unmodified to a parent handler could be useful

      Right !

because that's also used twice in XSLTFilter and maybe in some other
places, so maybe replacing the adapterish code by something the
inherits from such a generic adapter could be a starting point. 

      Sounds like a wonderful idea :-)

Your encouraging feedback is most appreciated :-)

      Ah - not as encouraging as your contribution :-)

I'm still reluctant to remove the complete task from the EasyHacks page
because although now there's a libxslt implementation of XSLTFilter and
a special-cased flat xml filter, the java dependency hasn't completly
vanished because of the office 2003 export filters and the XSLValidation\
service. I'd really like to fix that, too. But maybe just for the sake
of motivation I'll move the task to the done page and add another one
for the remaining stuff :-)

      Oh ! right; that makes sense :-) I had forgotten it included the other
thing too the (XSLT 2.0 stuff).

      Great; anyhow - if we have a native C++ impl. of the XSLT stuff, then
perhaps we can use this more; we have need of this sort of thing for eg.
the wizards documents: where we have some seriously pointless
duplication of whole documents to make tiny changes, that some XSLT
magic might solve rather nicely :-)

      Anyhow - we should discuss the rest of this on-list I think,

      Thanks !

              Michael.


From 382bcd279a56ccdd075a62f71a1d1d034548b25a Mon Sep 17 00:00:00 2001
From: Peter Jentsch <pjotr@guineapics.de>
Date: Tue, 1 Feb 2011 15:18:10 +0100
Subject: [PATCH 1/2] removed obsolete flat xml export xslt scripts from packaging

---
 scp2/source/xsltfilter/file_xsltfilter.scp |   25 +------------------------
 1 files changed, 1 insertions(+), 24 deletions(-)

diff --git a/scp2/source/xsltfilter/file_xsltfilter.scp b/scp2/source/xsltfilter/file_xsltfilter.scp
index 9cabd88..1447238 100644
--- a/scp2/source/xsltfilter/file_xsltfilter.scp
+++ b/scp2/source/xsltfilter/file_xsltfilter.scp
@@ -81,27 +81,4 @@ File gid_File_Xsl_Export_Xhtml_Table
     Styles = (PACKED);
     Dir = gid_Dir_Share_Xslt_Export_Xhtml;
     Name = "/xslt/export/xhtml/table.xsl";
-End
-
-
-File gid_File_Xsl_Export_Odfflatxml
-    TXT_FILE_BODY;
-    Styles = (PACKED, PATCH);
-    Dir = gid_Dir_Share_Xslt_Odfflatxml;
-    Name = "/xslt/odfflatxml/odfflatxmlexport.xsl";
-End
-
-File gid_File_Xsl_Export_Odfflatxml_Split_Long_Lines
-    TXT_FILE_BODY;
-    Styles = (PACKED, PATCH);
-    Dir = gid_Dir_Share_Xslt_Odfflatxml;
-    Name = "/xslt/odfflatxml/split-long-lines.xsl";
-End
-
-File gid_File_Xsl_Import_Odfflatxml
-    TXT_FILE_BODY;
-    Styles = (PACKED, PATCH);
-    Dir = gid_Dir_Share_Xslt_Odfflatxml;
-    Name = "/xslt/odfflatxml/odfflatxmlimport.xsl";
-End
-
+End
\ No newline at end of file
-- 
1.7.1

From 68f9ba9a19af0d9dc1701488796448269294c457 Mon Sep 17 00:00:00 2001
From: Peter Jentsch <pjotr@guineapics.de>
Date: Tue, 1 Feb 2011 17:49:40 +0100
Subject: [PATCH 2/2] added missing newline before EOF

---
 scp2/source/xsltfilter/file_xsltfilter.scp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scp2/source/xsltfilter/file_xsltfilter.scp b/scp2/source/xsltfilter/file_xsltfilter.scp
index 1447238..788a511 100644
--- a/scp2/source/xsltfilter/file_xsltfilter.scp
+++ b/scp2/source/xsltfilter/file_xsltfilter.scp
@@ -81,4 +81,4 @@ File gid_File_Xsl_Export_Xhtml_Table
     Styles = (PACKED);
     Dir = gid_Dir_Share_Xslt_Export_Xhtml;
     Name = "/xslt/export/xhtml/table.xsl";
-End
\ No newline at end of file
+End
-- 
1.7.1

From ad5f8b475361bd5a7534608eb313411157084fd8 Mon Sep 17 00:00:00 2001
From: Peter Jentsch <pjotr@guineapics.de>
Date: Tue, 25 Jan 2011 23:21:22 +0100
Subject: [PATCH] new sax documenthandler adapter

---
 sax/inc/sax/tools/documenthandleradapter.hxx |  261 ++++++++++++++++++++++++++
 sax/prj/d.lst                                |    1 +
 2 files changed, 262 insertions(+), 0 deletions(-)
 create mode 100644 sax/inc/sax/tools/documenthandleradapter.hxx

diff --git a/sax/inc/sax/tools/documenthandleradapter.hxx 
b/sax/inc/sax/tools/documenthandleradapter.hxx
new file mode 100644
index 0000000..0f7c0ba
--- /dev/null
+++ b/sax/inc/sax/tools/documenthandleradapter.hxx
@@ -0,0 +1,261 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ *       [ Peter Jentsch <pjotr@guineapics.de> ]
+ *
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Peter Jentsch <pjotr@guineapics.de>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef DOCUMENTHANDLERADAPTER_H_
+#define DOCUMENTHANDLERADAPTER_H_
+
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+
+using namespace ::rtl;
+using namespace ::std;
+using namespace ::osl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::xml::sax;
+namespace sax
+{
+    /**
+     * DocumentHandlerAdapter provides a base class for simple decorators to XDocumentHandlers.
+     * It forwards all method calls to a delegate. An inheriting class only needs to override the
+     * methods it actually wants to modify.
+     *
+     * See filters/source/odfflatxml/FlatXml.cxx for an example.
+     */
+    class DocumentHandlerAdapter : public XDocumentHandler
+    {
+    public:
+        // XDocumentHandler
+        virtual void SAL_CALL
+        startDocument(void) throw (SAXException, RuntimeException)
+        {
+            m_handler->startDocument();
+        }
+
+        virtual void SAL_CALL
+        endDocument(void) throw (SAXException, RuntimeException)
+        {
+            m_handler->endDocument();
+        }
+
+        virtual void SAL_CALL
+        startElement(const OUString& aName,
+                const Reference<XAttributeList> & xAttribs)
+                throw (SAXException, RuntimeException)
+        {
+            m_handler->startElement(aName, xAttribs);
+        }
+
+        virtual void SAL_CALL
+        endElement(const OUString& aName) throw (SAXException,
+                RuntimeException)
+        {
+            m_handler->endElement(aName);
+        }
+
+        virtual void SAL_CALL
+        characters(const OUString& aChars) throw (SAXException,
+                RuntimeException)
+        {
+            m_handler->characters(aChars);
+        }
+
+        virtual void SAL_CALL
+        ignorableWhitespace(const OUString& aWhitespaces) throw (SAXException,
+                RuntimeException)
+        {
+            m_handler->ignorableWhitespace(aWhitespaces);
+        }
+        virtual void SAL_CALL
+        processingInstruction(const OUString& aTarget, const OUString& aData)
+                throw (SAXException, RuntimeException)
+        {
+            m_handler->processingInstruction(aTarget, aData);
+        }
+        virtual void SAL_CALL
+        setDocumentLocator(const Reference<XLocator> & xLocator)
+                throw (SAXException, RuntimeException)
+        {
+            m_handler->setDocumentLocator(xLocator);
+        }
+        DocumentHandlerAdapter(const Reference<XDocumentHandler>& delegate);
+        DocumentHandlerAdapter() :
+            m_handler(Reference<XDocumentHandler> (0, UNO_QUERY))
+        {
+        }
+        ;
+
+    protected:
+        virtual void SAL_CALL
+        setDelegate(const Reference<XDocumentHandler>& delegate)
+        {
+            m_handler = delegate;
+        }
+        virtual Reference<XDocumentHandler> SAL_CALL
+        getDelegate()
+        {
+            return m_handler;
+        }
+        virtual
+        ~DocumentHandlerAdapter()
+        {
+
+        }
+
+    private:
+        Reference<XDocumentHandler> m_handler;
+
+    };
+
+    /**
+     * ExtendedDocumentHandlerAdapter provides a base class for simple decorators to 
XExtendedDocumentHandlers.
+     * It forwards all method calls to a delegate. An inheriting class only needs to override the
+     * methods it actually wants to modify.
+     */
+    class ExtendedDocumentHandlerAdapter : public XExtendedDocumentHandler
+
+    {
+
+    public:
+        // XDocumentHandler
+        virtual void SAL_CALL
+        startDocument(void) throw (SAXException, RuntimeException)
+        {
+            m_handler->startDocument();
+        }
+
+        virtual void SAL_CALL
+        endDocument(void) throw (SAXException, RuntimeException)
+        {
+            m_handler->endDocument();
+        }
+
+        virtual void SAL_CALL
+        startElement(const OUString& aName,
+                const Reference<XAttributeList> & xAttribs)
+                throw (SAXException, RuntimeException)
+        {
+            m_handler->startElement(aName, xAttribs);
+        }
+
+        virtual void SAL_CALL
+        endElement(const OUString& aName) throw (SAXException,
+                RuntimeException)
+        {
+            m_handler->endElement(aName);
+        }
+
+        virtual void SAL_CALL
+        characters(const OUString& aChars) throw (SAXException,
+                RuntimeException)
+        {
+            m_handler->characters(aChars);
+        }
+
+        virtual void SAL_CALL
+        ignorableWhitespace(const OUString& aWhitespaces) throw (SAXException,
+                RuntimeException)
+        {
+            m_handler->ignorableWhitespace(aWhitespaces);
+        }
+        virtual void SAL_CALL
+        processingInstruction(const OUString& aTarget, const OUString& aData)
+                throw (SAXException, RuntimeException)
+        {
+            m_handler->processingInstruction(aTarget, aData);
+        }
+        virtual void SAL_CALL
+        setDocumentLocator(const Reference<XLocator> & xLocator)
+                throw (SAXException, RuntimeException)
+        {
+            m_handler->setDocumentLocator(xLocator);
+        }
+        // XExtendedDocumentHandler
+        virtual void SAL_CALL
+        startCDATA(void) throw (SAXException, RuntimeException)
+        {
+            m_handler->startCDATA();
+        }
+        virtual void SAL_CALL
+        endCDATA(void) throw (RuntimeException)
+        {
+            m_handler->endCDATA();
+        }
+        virtual void SAL_CALL
+        comment(const OUString& sComment) throw (SAXException,
+                RuntimeException)
+        {
+            m_handler->comment(sComment);
+        }
+        virtual void SAL_CALL
+        unknown(const OUString& sString) throw (SAXException, RuntimeException)
+        {
+            m_handler->unknown(sString);
+        }
+        virtual void SAL_CALL
+        allowLineBreak(void) throw (SAXException, RuntimeException)
+        {
+            m_handler->allowLineBreak();
+        }
+    protected:
+        ExtendedDocumentHandlerAdapter() :
+            m_handler(Reference<XExtendedDocumentHandler> (0, UNO_QUERY))
+        {
+        }
+        ExtendedDocumentHandlerAdapter(
+                const Reference<XExtendedDocumentHandler> delegate) :
+            m_handler(delegate)
+        {
+        }
+
+        virtual void SAL_CALL
+        setDelegate(const Reference<XExtendedDocumentHandler>& delegate)
+        {
+            m_handler = delegate;
+        }
+        virtual Reference<XExtendedDocumentHandler> SAL_CALL
+        getDelegate()
+        {
+            return m_handler;
+        }
+        virtual
+        ~ExtendedDocumentHandlerAdapter()
+        {
+
+        }
+
+    private:
+        Reference<XExtendedDocumentHandler> m_handler;
+    };
+}
+#endif /* DOCUMENTHANDLERADAPTER_H_ */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sax/prj/d.lst b/sax/prj/d.lst
index 87f0134..c9e466d 100644
--- a/sax/prj/d.lst
+++ b/sax/prj/d.lst
@@ -9,5 +9,6 @@ mkdir: %_DEST%\inc%_EXT%\sax\tools
 ..\inc\sax\fshelper.hxx %_DEST%\inc%_EXT%\sax\fshelper.hxx
 ..\inc\sax\fastattribs.hxx %_DEST%\inc%_EXT%\sax\fastattribs.hxx
 ..\inc\sax\tools\converter.hxx %_DEST%\inc%_EXT%\sax\tools\converter.hxx
+..\inc\sax\tools\documenthandleradapter.hxx %_DEST%\inc%_EXT%\sax\tools\documenthandleradapter.hxx
 
 dos: sh -c "if test %OS% = MACOSX; then macosx-create-bundle %_DEST%\lib%_EXT%\*.dylib; fi"
-- 
1.7.1

diff --git a/filter/inc/registration.hxx b/filter/inc/registration.hxx
new file mode 100644
index 0000000..2c1ff3f
--- /dev/null
+++ b/filter/inc/registration.hxx
@@ -0,0 +1,217 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __COMPHELPER_REGISTRATION_HXX_
+#define __COMPHELPER_REGISTRATION_HXX_
+
+//_______________________________________________
+// includes
+
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/registry/InvalidRegistryException.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <cppuhelper/factory.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace comphelper{
+
+//_______________________________________________
+// declaration
+
+//_______________________________________________
+
+/** TODO    doc
+ */
+#define _COMPHELPER_COMPONENT_GETIMPLEMENTATIONENVIRONMENT                                         
                 \
+    extern "C" void SAL_CALL component_getImplementationEnvironment(const sal_Char**        
ppEnvironmentTypeName,  \
+                                                                          uno_Environment** /* 
ppEnvironment */ )   \
+    {                                                                                              
                 \
+        *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;                               
                 \
+    }
+
+//_______________________________________________
+
+/** @short  creates a new key inside component registry.
+
+    @descr  using: a) _COMPHELPER_COMPONENTINFO( MyClass,
+                                                 MyClass::st_getImplName(),
+                                                 MyClass::st_getServNames())
+
+                   b) _COMPHELPER_COMPONENTINFO( MyClass,
+                                                 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"css.MyClass" )),
+                                                 lServiceNames)
+
+    @param  CLASS
+            must be the class name of the implementation
+            of an uno service, which should be registered here.
+
+    @param  IMPLEMENTATIONNAME
+            can be an uno implementation name from type [::rtl::OUString]
+            directly or any possible method call, which returns such
+            name.
+
+    @param  SERVICENAME
+            a list of supported uno service names from type
+            [css::uno::Sequence< ::rtl::OUString >]
+            or any possible method call, which returns such
+            list.
+ */
+#define _COMPHELPER_COMPONENTINFO(CLASS, IMPLEMENTATIONNAME, SERVICENAMES)                         
                 \
+    /*define new scope to prevent multiple using of the same variables ... */                      
                 \
+    {                                                                                              
                 \
+        /* build new key name */                                                                   
                 \
+        ::rtl::OUStringBuffer sKeyBuf(256);                                                        
                 \
+        sKeyBuf.appendAscii("/"               );                                                   
                 \
+        sKeyBuf.append     (IMPLEMENTATIONNAME);                                                   
                 \
+        sKeyBuf.appendAscii("/UNO/SERVICES"   );                                                   
                 \
+        ::rtl::OUString sKey = sKeyBuf.makeStringAndClear();                                       
                 \
+                                                                                                   
                 \
+        /* try to register this service ... thrown exception will be catched by 
COMPONENT_WRITEINFO! */             \
+        css::uno::Reference< css::registry::XRegistryKey > xKey = xRoot->createKey(sKey);          
                 \
+        if (!xKey.is())                                                                            
                 \
+            throw css::registry::InvalidRegistryException(sKey, css::uno::Reference< 
css::uno::XInterface >());     \
+                                                                                                   
                 \
+        /* dont optimize it! it must work for simple types and function calls! */                  
                 \
+        const css::uno::Sequence< ::rtl::OUString > lServiceNames = SERVICENAMES;                  
                 \
+        const ::rtl::OUString*                      pServiceNames = lServiceNames.getConstArray(); 
                 \
+        sal_Int32                                   nCount        = lServiceNames.getLength();     
                 \
+                                                                                                   
                 \
+        for (sal_Int32 i=0; i<nCount; ++i)                                                         
                 \
+            xKey->createKey(pServiceNames[i]);                                                     
                 \
+    }
+
+//_______________________________________________
+
+/** @short  implments extern C function component_writeInfo
+
+    @descr  using: _COMPHELPER_COMPONENT_WRITEINFO
+                        (
+                            _COMPHELPER_COMPONENTINFO(...)
+                            ..
+                            _COMPHELPER_COMPONENTINFO(...)
+                        )
+
+    @param  INFOLIST
+            list of macros of type COMPONENTINFO without(!) any
+            seperator signs between two elements.
+ */
+#define _COMPHELPER_COMPONENT_WRITEINFO(INFOLIST)                                                  
                                 \
+    extern "C" sal_Bool SAL_CALL component_writeInfo(void* pServiceManager,                        
                                 \
+                                                     void* pRegistryKey   )                        
                                 \
+    {                                                                                              
                                 \
+        if (!pServiceManager || !pRegistryKey)                                                     
                                 \
+            return sal_False;                                                                      
                                 \
+                                                                                                   
                                 \
+        css::uno::Reference< css::registry::XRegistryKey > xRoot = reinterpret_cast< 
css::registry::XRegistryKey* >(pRegistryKey);  \
+                                                                                                   
                                 \
+        /*if one of following registration will fail ... an exception is thrown! */                
                                 \
+        try                                                                                        
                                 \
+        {                                                                                          
                                 \
+            /* This parameter will expand to: */                                                   
                                 \
+            /*   _COMPHELPER_COMPONENTINFO(1) */                                                   
                                 \
+            /*   ...                          */                                                   
                                 \
+            /*   _COMPHELPER_COMPONENTINFO(n) */                                                   
                                 \
+            INFOLIST                                                                               
                                 \
+        }                                                                                          
                                 \
+        catch(const css::registry::InvalidRegistryException&)                                      
                                 \
+        {                                                                                          
                                 \
+            return sal_False;                                                                      
                                 \
+        }                                                                                          
                                 \
+        return sal_True;                                                                           
                                 \
+    }
+
+//_______________________________________________
+
+/** TODO    doc
+ */
+#define _COMPHELPER_MULTIINSTANCEFACTORY(IMPLEMENTATIONNAME, SERVICENAMES, FACTORYMETHOD)   \
+    if (IMPLEMENTATIONNAME == sImplName)                                                    \
+        xFactory = ::cppu::createSingleFactory(xSMGR             ,                          \
+                                               IMPLEMENTATIONNAME,                          \
+                                               FACTORYMETHOD     ,                          \
+                                               SERVICENAMES      );
+
+//_______________________________________________
+
+/** TODO    doc
+ */
+#define _COMPHELPER_ONEINSTANCEFACTORY(IMPLEMENTATIONNAME, SERVICENAMES, FACTORYMETHOD)     \
+    if (IMPLEMENTATIONNAME == sImplName)                                                    \
+        xFactory = ::cppu::createOneInstanceFactory(xSMGR             ,                     \
+                                                    IMPLEMENTATIONNAME,                     \
+                                                    FACTORYMETHOD     ,                     \
+                                                    SERVICENAMES      );
+
+//_______________________________________________
+
+/** TODO    doc
+ */
+#define _COMPHELPER_COMPONENT_GETFACTORY(STATIC_INIT,FACTORYLIST)                                  
                                                             \
+    extern "C" void* SAL_CALL component_getFactory(const sal_Char* pImplementationName,            
                                                 \
+                                                         void*     pServiceManager    ,            
                                                 \
+                                                         void*     /* pRegistryKey */ )            
                                                 \
+    {                                                                                              
                                                 \
+        if (                                                                                       
                                                 \
+            (!pImplementationName) ||                                                              
                                                 \
+            (!pServiceManager    )                                                                 
                                                 \
+           )                                                                                       
                                                 \
+        return NULL;                                                                               
                                                 \
+                                                                                                   
                                                 \
+        STATIC_INIT                                                                                
                                                 \
+                                                                                                   
                                                 \
+        css::uno::Reference< css::lang::XMultiServiceFactory >  xSMGR     = reinterpret_cast< 
css::lang::XMultiServiceFactory* >(pServiceManager);  \
+        css::uno::Reference< css::lang::XSingleServiceFactory > xFactory  ;                        
                                                 \
+        rtl::OUString                                           sImplName = 
::rtl::OUString::createFromAscii(pImplementationName);                  \
+                                                                                                   
                                                 \
+        /* This parameter will expand to: */                                                       
                                                 \
+        /*  _COMPHELPER_xxxFACTORY(1)     */                                                       
                                                 \
+        /*  else                          */                                                       
                                                 \
+        /*  ...                           */                                                       
                                                 \
+        /*  else                          */                                                       
                                                 \
+        /*  _COMPHELPER_xxxFACTORY(n)     */                                                       
                                                 \
+        FACTORYLIST                                                                                
                                                 \
+                                                                                                   
                                                 \
+        /* And if one of these checks was successfully => xFactory was set! */                     
                                                 \
+        if (xFactory.is())                                                                         
                                                 \
+        {                                                                                          
                                                 \
+            xFactory->acquire();                                                                   
                                                 \
+            return xFactory.get();                                                                 
                                                 \
+        }                                                                                          
                                                 \
+                                                                                                   
                                                 \
+        return NULL;                                                                               
                                                 \
+    }
+
+} // namespace comphelper
+
+#endif  //  #ifndef __COMPHELPER_REGISTRATION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/config/cache/registration.hxx 
b/filter/source/config/cache/registration.hxx
deleted file mode 100644
index 4f7bf20..0000000
--- a/filter/source/config/cache/registration.hxx
+++ /dev/null
@@ -1,217 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef __COMPHELPER_REGISTRATION_HXX_
-#define __COMPHELPER_REGISTRATION_HXX_
-
-//_______________________________________________
-// includes
-
-#include <com/sun/star/registry/XRegistryKey.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/registry/InvalidRegistryException.hpp>
-#include <rtl/ustrbuf.hxx>
-#include <cppuhelper/factory.hxx>
-
-//_______________________________________________
-// namespace
-
-namespace comphelper{
-
-//_______________________________________________
-// declaration
-
-//_______________________________________________
-
-/** TODO    doc
- */
-#define _COMPHELPER_COMPONENT_GETIMPLEMENTATIONENVIRONMENT                                         
                 \
-    extern "C" void SAL_CALL component_getImplementationEnvironment(const sal_Char**        
ppEnvironmentTypeName,  \
-                                                                          uno_Environment** /* 
ppEnvironment */ )   \
-    {                                                                                              
                 \
-        *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;                               
                 \
-    }
-
-//_______________________________________________
-
-/** @short  creates a new key inside component registry.
-
-    @descr  using: a) _COMPHELPER_COMPONENTINFO( MyClass,
-                                                 MyClass::st_getImplName(),
-                                                 MyClass::st_getServNames())
-
-                   b) _COMPHELPER_COMPONENTINFO( MyClass,
-                                                 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"css.MyClass" )),
-                                                 lServiceNames)
-
-    @param  CLASS
-            must be the class name of the implementation
-            of an uno service, which should be registered here.
-
-    @param  IMPLEMENTATIONNAME
-            can be an uno implementation name from type [::rtl::OUString]
-            directly or any possible method call, which returns such
-            name.
-
-    @param  SERVICENAME
-            a list of supported uno service names from type
-            [css::uno::Sequence< ::rtl::OUString >]
-            or any possible method call, which returns such
-            list.
- */
-#define _COMPHELPER_COMPONENTINFO(CLASS, IMPLEMENTATIONNAME, SERVICENAMES)                         
                 \
-    /*define new scope to prevent multiple using of the same variables ... */                      
                 \
-    {                                                                                              
                 \
-        /* build new key name */                                                                   
                 \
-        ::rtl::OUStringBuffer sKeyBuf(256);                                                        
                 \
-        sKeyBuf.appendAscii("/"               );                                                   
                 \
-        sKeyBuf.append     (IMPLEMENTATIONNAME);                                                   
                 \
-        sKeyBuf.appendAscii("/UNO/SERVICES"   );                                                   
                 \
-        ::rtl::OUString sKey = sKeyBuf.makeStringAndClear();                                       
                 \
-                                                                                                   
                 \
-        /* try to register this service ... thrown exception will be catched by 
COMPONENT_WRITEINFO! */             \
-        css::uno::Reference< css::registry::XRegistryKey > xKey = xRoot->createKey(sKey);          
                 \
-        if (!xKey.is())                                                                            
                 \
-            throw css::registry::InvalidRegistryException(sKey, css::uno::Reference< 
css::uno::XInterface >());     \
-                                                                                                   
                 \
-        /* dont optimize it! it must work for simple types and function calls! */                  
                 \
-        const css::uno::Sequence< ::rtl::OUString > lServiceNames = SERVICENAMES;                  
                 \
-        const ::rtl::OUString*                      pServiceNames = lServiceNames.getConstArray(); 
                 \
-        sal_Int32                                   nCount        = lServiceNames.getLength();     
                 \
-                                                                                                   
                 \
-        for (sal_Int32 i=0; i<nCount; ++i)                                                         
                 \
-            xKey->createKey(pServiceNames[i]);                                                     
                 \
-    }
-
-//_______________________________________________
-
-/** @short  implments extern C function component_writeInfo
-
-    @descr  using: _COMPHELPER_COMPONENT_WRITEINFO
-                        (
-                            _COMPHELPER_COMPONENTINFO(...)
-                            ..
-                            _COMPHELPER_COMPONENTINFO(...)
-                        )
-
-    @param  INFOLIST
-            list of macros of type COMPONENTINFO without(!) any
-            seperator signs between two elements.
- */
-#define _COMPHELPER_COMPONENT_WRITEINFO(INFOLIST)                                                  
                                 \
-    extern "C" sal_Bool SAL_CALL component_writeInfo(void* pServiceManager,                        
                                 \
-                                                     void* pRegistryKey   )                        
                                 \
-    {                                                                                              
                                 \
-        if (!pServiceManager || !pRegistryKey)                                                     
                                 \
-            return sal_False;                                                                      
                                 \
-                                                                                                   
                                 \
-        css::uno::Reference< css::registry::XRegistryKey > xRoot = reinterpret_cast< 
css::registry::XRegistryKey* >(pRegistryKey);  \
-                                                                                                   
                                 \
-        /*if one of following registration will fail ... an exception is thrown! */                
                                 \
-        try                                                                                        
                                 \
-        {                                                                                          
                                 \
-            /* This parameter will expand to: */                                                   
                                 \
-            /*   _COMPHELPER_COMPONENTINFO(1) */                                                   
                                 \
-            /*   ...                          */                                                   
                                 \
-            /*   _COMPHELPER_COMPONENTINFO(n) */                                                   
                                 \
-            INFOLIST                                                                               
                                 \
-        }                                                                                          
                                 \
-        catch(const css::registry::InvalidRegistryException&)                                      
                                 \
-        {                                                                                          
                                 \
-            return sal_False;                                                                      
                                 \
-        }                                                                                          
                                 \
-        return sal_True;                                                                           
                                 \
-    }
-
-//_______________________________________________
-
-/** TODO    doc
- */
-#define _COMPHELPER_MULTIINSTANCEFACTORY(IMPLEMENTATIONNAME, SERVICENAMES, FACTORYMETHOD)   \
-    if (IMPLEMENTATIONNAME == sImplName)                                                    \
-        xFactory = ::cppu::createSingleFactory(xSMGR             ,                          \
-                                               IMPLEMENTATIONNAME,                          \
-                                               FACTORYMETHOD     ,                          \
-                                               SERVICENAMES      );
-
-//_______________________________________________
-
-/** TODO    doc
- */
-#define _COMPHELPER_ONEINSTANCEFACTORY(IMPLEMENTATIONNAME, SERVICENAMES, FACTORYMETHOD)     \
-    if (IMPLEMENTATIONNAME == sImplName)                                                    \
-        xFactory = ::cppu::createOneInstanceFactory(xSMGR             ,                     \
-                                                    IMPLEMENTATIONNAME,                     \
-                                                    FACTORYMETHOD     ,                     \
-                                                    SERVICENAMES      );
-
-//_______________________________________________
-
-/** TODO    doc
- */
-#define _COMPHELPER_COMPONENT_GETFACTORY(STATIC_INIT,FACTORYLIST)                                  
                                                             \
-    extern "C" void* SAL_CALL component_getFactory(const sal_Char* pImplementationName,            
                                                 \
-                                                         void*     pServiceManager    ,            
                                                 \
-                                                         void*     /* pRegistryKey */ )            
                                                 \
-    {                                                                                              
                                                 \
-        if (                                                                                       
                                                 \
-            (!pImplementationName) ||                                                              
                                                 \
-            (!pServiceManager    )                                                                 
                                                 \
-           )                                                                                       
                                                 \
-        return NULL;                                                                               
                                                 \
-                                                                                                   
                                                 \
-        STATIC_INIT                                                                                
                                                 \
-                                                                                                   
                                                 \
-        css::uno::Reference< css::lang::XMultiServiceFactory >  xSMGR     = reinterpret_cast< 
css::lang::XMultiServiceFactory* >(pServiceManager);  \
-        css::uno::Reference< css::lang::XSingleServiceFactory > xFactory  ;                        
                                                 \
-        rtl::OUString                                           sImplName = 
::rtl::OUString::createFromAscii(pImplementationName);                  \
-                                                                                                   
                                                 \
-        /* This parameter will expand to: */                                                       
                                                 \
-        /*  _COMPHELPER_xxxFACTORY(1)     */                                                       
                                                 \
-        /*  else                          */                                                       
                                                 \
-        /*  ...                           */                                                       
                                                 \
-        /*  else                          */                                                       
                                                 \
-        /*  _COMPHELPER_xxxFACTORY(n)     */                                                       
                                                 \
-        FACTORYLIST                                                                                
                                                 \
-                                                                                                   
                                                 \
-        /* And if one of these checks was successfully => xFactory was set! */                     
                                                 \
-        if (xFactory.is())                                                                         
                                                 \
-        {                                                                                          
                                                 \
-            xFactory->acquire();                                                                   
                                                 \
-            return xFactory.get();                                                                 
                                                 \
-        }                                                                                          
                                                 \
-                                                                                                   
                                                 \
-        return NULL;                                                                               
                                                 \
-    }
-
-} // namespace comphelper
-
-#endif  //  #ifndef __COMPHELPER_REGISTRATION_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/odfflatxml/FlatXml.cxx b/filter/source/odfflatxml/FlatXml.cxx
index 6bf7c60..cd40dcb 100644
--- a/filter/source/odfflatxml/FlatXml.cxx
+++ b/filter/source/odfflatxml/FlatXml.cxx
@@ -1,45 +1,39 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
  *
- *  The Contents of this file are made available subject to the terms of
- *  the BSD license.
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
  *
- *  Copyright 2000, 2010 Oracle and/or its affiliates.
- *  All rights reserved.
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
  *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions
- *  are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of Sun Microsystems, Inc. nor the names of its
- *     contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
+ * The Initial Developer of the Original Code is
+ *       Peter Jentsch <pjotr@guineapics.de>
+
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * Initial Developer. All Rights Reserved.
  *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * For minor contributions see the git repository.
  *
- *************************************************************************/
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
 
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/servicefactory.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/implbase2.hxx>
 #include <cppuhelper/implbase3.hxx>
 #include <cppuhelper/implbase.hxx>
 
+#include <sax/tools/documenthandleradapter.hxx>
+
 #include <com/sun/star/lang/XComponent.hpp>
 
 #include <com/sun/star/uno/Any.hxx>
@@ -47,319 +41,218 @@
 
 #include <com/sun/star/beans/PropertyValue.hpp>
 
+#include <com/sun/star/xml/XImportFilter.hpp>
+#include <com/sun/star/xml/XExportFilter.hpp>
 #include <com/sun/star/xml/sax/XParser.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
 #include <com/sun/star/xml/sax/SAXException.hpp>
-#include <com/sun/star/xml/XImportFilter.hpp>
-#include <com/sun/star/xml/XExportFilter.hpp>
 
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/io/XOutputStream.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
 #include <com/sun/star/io/XSeekable.hpp>
-
-#include "FlatXml.hxx"
+#include <registration.hxx>
 
 using namespace ::rtl;
 using namespace ::cppu;
 using namespace ::osl;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
-using namespace ::com::sun::star::xml;
-using namespace ::com::sun::star::xml::sax;
-
-namespace XFlatXml
-{
-
-    sal_Bool
-    XFlatXml::importer(const Sequence<PropertyValue>& aSourceData,
-            const Reference<XDocumentHandler>& xHandler, const Sequence<
-                    OUString>& /* msUserData */) throw (RuntimeException)
-    {
-        // get information from media descriptor
-        // the imput stream that represents the imported file
-        // is most important here since we need to supply it to
-        // the sax parser that drives the supplied document handler
-        sal_Int32 nLength = aSourceData.getLength();
-        OUString aName, aFileName, aURL;
-        Reference<XInputStream> xInputStream;
-        for (sal_Int32 i = 0; i < nLength; i++)
+using namespace ::sax;
+
+namespace css = ::com::sun::star;
+
+using namespace css::beans;
+using namespace css::io;
+using namespace css::uno;
+using namespace css::lang;
+using namespace css::registry;
+using namespace css::xml;
+using namespace css::xml::sax;
+
+namespace filter {
+    namespace odfflatxml {
+        /*
+         * OdfFlatXml export and imports ODF flat XML documents by plugging a pass-through
+         * filter implementation into XmlFilterAdaptor.
+         */
+        class OdfFlatXml : public WeakImplHelper3<XImportFilter,
+                                                  XExportFilter, DocumentHandlerAdapter>
+        {
+        private:
+            Reference< XMultiServiceFactory > m_rServiceFactory;
+
+        public:
+
+            OdfFlatXml(const Reference<css::lang::XMultiServiceFactory> &r) :
+                m_rServiceFactory(r)
             {
-                aName = aSourceData[i].Name;
-                if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("InputStream")))
-                    aSourceData[i].Value >>= xInputStream;
-                else if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("FileName")))
-                    aSourceData[i].Value >>= aFileName;
-                else if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("URL")))
-                    aSourceData[i].Value >>= aURL;
             }
 
-        // we need an input stream
-        OSL_ASSERT(xInputStream.is());
-        if (!xInputStream.is())
-            return sal_False;
-
-        // rewind seekable stream
-        Reference<XSeekable> xSeek(xInputStream, UNO_QUERY);
-        if (xSeek.is())
-            xSeek->seek(0);
-
-        // create SAX parser that will read the document file
-        // and provide events to xHandler passed to this call
-        Reference<XParser>
-                xSaxParser(
-                        m_rServiceFactory->createInstance(
-                                OUString(
-                                        
RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser"))),
-                        UNO_QUERY);
-        OSL_ASSERT(xSaxParser.is());
-        if (!xSaxParser.is())
-            return sal_False;
-
-        // let the parser try to send the sax event to the document handler
-        try
-            {
-                InputSource aInput;
-                aInput.sSystemId = aURL;
-                aInput.sPublicId = aURL;
-                aInput.aInputStream = xInputStream;
-                xSaxParser->setDocumentHandler(xHandler);
-                xSaxParser->parseStream(aInput);
-            }
-        catch (Exception &exc)
-            {
-                // something went wrong
-                OString msg = OUStringToOString(exc.Message,
-                        RTL_TEXTENCODING_ASCII_US);
-                OSL_ENSURE(0, msg);
+            // XImportFilter
+            virtual sal_Bool SAL_CALL
+            importer(const Sequence< css::beans::PropertyValue >& sourceData,
+                     const Reference< css::xml::sax::XDocumentHandler >& docHandler,
+                     const Sequence< OUString >& userData)
+                throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+            // XExportFilter
+            virtual sal_Bool SAL_CALL
+            exporter(
+                     const Sequence< PropertyValue >& sourceData,
+                     const Sequence< OUString >& userData)
+                throw (IllegalArgumentException,
+                       RuntimeException);
+
+            // UNO component helper methods
+
+            static OUString impl_getImplementationName();
+
+            static Sequence< OUString > impl_getSupportedServiceNames();
+
+            static Reference< XInterface > impl_createInstance(const Reference< 
XMultiServiceFactory >& fact);
+        };
+
+        sal_Bool
+        OdfFlatXml::importer(
+                             const Sequence< PropertyValue >& sourceData,
+                             const Reference< XDocumentHandler >& docHandler,
+                             const Sequence< OUString >& /* userData */)
+            throw (IllegalArgumentException, RuntimeException)
+        {
+            // Read InputStream to read from and an URL used for the system id
+            // of the InputSource we create from the given sourceData sequence
+            Reference<XInputStream> inputStream;
+            OUString paramName;
+            OUString url;
+
+            sal_Int32 paramCount = sourceData.getLength();
+            for (sal_Int32 paramIdx = 0; paramIdx < paramCount; paramIdx++)
+                {
+                    paramName = sourceData[paramIdx].Name;
+                    if (paramName.equalsAscii("InputStream"))
+                        sourceData[paramIdx].Value >>= inputStream;
+                    else if (paramName.equalsAscii("URL"))
+                        sourceData[paramIdx].Value >>= url;
+                }
+
+            OSL_ASSERT(inputStream.is());
+            if (!inputStream.is())
                 return sal_False;
-            }
 
-        // done
-        return sal_True;
-    }
+            OUString SAX_PARSER_SERVICE(
+                                        
RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser"));
+            Reference<XParser> saxParser(m_rServiceFactory->createInstance(
+                                                                           SAX_PARSER_SERVICE), 
UNO_QUERY);
 
-    sal_Bool
-    XFlatXml::exporter(const Sequence<PropertyValue>& aSourceData,
-            const Sequence<OUString>& /*msUserData*/) throw (RuntimeException)
-    {
-
-        // read source data
-        // we are especialy interested in the output stream
-        // since that is where our xml-writer will push the data
-        // from it's data-source interface
-        OUString aName, sURL;
-        Reference<XOutputStream> rOutputStream;
-        sal_Int32 nLength = aSourceData.getLength();
-        for (sal_Int32 i = 0; i < nLength; i++)
-            {
-                aName = aSourceData[i].Name;
-                if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OutputStream")))
-                    aSourceData[i].Value >>= rOutputStream;
-                else if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("URL")))
-                    aSourceData[i].Value >>= sURL;
-            }
+            OSL_ASSERT(saxParser.is());
+            if (!saxParser.is())
+                return sal_False;
 
-        if (!m_rDocumentHandler.is())
-            {
-                // get the document writer
-                m_rDocumentHandler
-                        = Reference<XExtendedDocumentHandler> (
-                                m_rServiceFactory->createInstance(
-                                        OUString(
-                                                
RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer"))),
-                                UNO_QUERY);
-                OSL_ASSERT(m_rDocumentHandler.is());
-                if (!m_rDocumentHandler.is())
+            InputSource inputSource;
+            inputSource.sSystemId = url;
+            inputSource.sPublicId = url;
+            inputSource.aInputStream = inputStream;
+            saxParser->setDocumentHandler(docHandler);
+            try
+                {
+                    saxParser->parseStream(inputSource);
+                }
+            catch (Exception &exc)
+                {
+                    OString msg = OUStringToOString(exc.Message,
+                                                    RTL_TEXTENCODING_ASCII_US);
+                    OSL_ENSURE(0, msg);
                     return sal_False;
-            }
-        // get data source interface ...
-        Reference<XActiveDataSource> rDataSource(m_rDocumentHandler, UNO_QUERY);
-        OSL_ASSERT(rDataSource.is());
-        if (!rDataSource.is())
-            return sal_False;
-        OSL_ASSERT(rOutputStream.is());
-        if (!rOutputStream.is())
-            return sal_False;
-        // ... and set output stream
-        rDataSource->setOutputStream(rOutputStream);
-
-        return sal_True;
-    }
-
-    // for the DocumentHandler implementation, we just proxy the the
-    // events to the XML writer that we created upon the output stream
-    // that was provided by the XMLFilterAdapter
-    void
-    XFlatXml::startDocument() throw (SAXException, RuntimeException)
-    {
-        OSL_ASSERT(m_rDocumentHandler.is());
-        m_rDocumentHandler->startDocument();
-    }
-
-    void
-    XFlatXml::endDocument() throw (SAXException, RuntimeException)
-    {
-        OSL_ASSERT(m_rDocumentHandler.is());
-        m_rDocumentHandler->endDocument();
-    }
+                }
+            return sal_True;
+        }
+
+        sal_Bool
+        OdfFlatXml::exporter(const Sequence< PropertyValue >& sourceData,
+                             const Sequence< OUString >& /*msUserData*/)
+            throw (IllegalArgumentException, RuntimeException)
+        {
+            OUString paramName;
+            OUString targetURL;
+            Reference<XOutputStream> outputStream;
+
+            // Read output stream and target URL from the parameters given in sourceData.
+            sal_Int32 paramCount = sourceData.getLength();
+            for (sal_Int32 paramIdx = 0; paramIdx < paramCount; paramIdx++)
+                {
+                    paramName = sourceData[paramIdx].Name;
+                    if (paramName.equalsAscii("OutputStream"))
+                        sourceData[paramIdx].Value >>= outputStream;
+                    else if (paramName.equalsAscii("URL"))
+                        sourceData[paramIdx].Value >>= targetURL;
+                }
+
+            if (!getDelegate().is())
+                {
+                    OUString 
SAX_WRITER_SERVICE(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer"));
+                    Reference< XDocumentHandler > 
saxWriter(m_rServiceFactory->createInstance(SAX_WRITER_SERVICE),
+                                                            UNO_QUERY);
+                    setDelegate(saxWriter);
+                    if (!getDelegate().is())
+                        return sal_False;
+                }
+            // get data source interface ...
+            Reference<XActiveDataSource> dataSource(getDelegate(), UNO_QUERY);
+            OSL_ASSERT(dataSource.is());
+            if (!dataSource.is())
+                return sal_False;
+            OSL_ASSERT(outputStream.is());
+            if (!outputStream.is())
+                return sal_False;
+            dataSource->setOutputStream(outputStream);
 
-    void
-    XFlatXml::startElement(const OUString& str,
-            const Reference<XAttributeList>& attriblist) throw (SAXException,
-            RuntimeException)
-    {
-        OSL_ASSERT(m_rDocumentHandler.is());
-        m_rDocumentHandler->startElement(str, attriblist);
-    }
+            return sal_True;
+        }
 
-    void
-    XFlatXml::endElement(const OUString& str) throw (SAXException,
-            RuntimeException)
-    {
-        OSL_ASSERT(m_rDocumentHandler.is());
-        m_rDocumentHandler->endElement(str);
-    }
 
-    void
-    XFlatXml::characters(const OUString& str) throw (SAXException,
-            RuntimeException)
-    {
-        OSL_ASSERT(m_rDocumentHandler.is());
-        m_rDocumentHandler->characters(str);
-    }
+        OUString OdfFlatXml::impl_getImplementationName()
+        {
+            return ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.filter.OdfFlatXml"));
+        }
 
-    void
-    XFlatXml::ignorableWhitespace(const OUString& str) throw (SAXException,
-            RuntimeException)
-    {
-        OSL_ASSERT(m_rDocumentHandler.is());
-        if (!m_bPrettyPrint)
-            return;
-        m_rDocumentHandler->ignorableWhitespace(str);
-    }
+        Sequence< OUString > OdfFlatXml::impl_getSupportedServiceNames()
+        {
+            css::uno::Sequence< ::rtl::OUString > lServiceNames(2);
+            lServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"com.sun.star.document.ImportFilter" ));
+            lServiceNames[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"com.sun.star.document.ExportFilter" ));
+            return lServiceNames;
+        }
 
-    void
-    XFlatXml::processingInstruction(const OUString& str, const OUString& str2)
-            throw (SAXException, RuntimeException)
-    {
-        OSL_ASSERT(m_rDocumentHandler.is());
-        m_rDocumentHandler->processingInstruction(str, str2);
-    }
+        Reference< XInterface > SAL_CALL OdfFlatXml::impl_createInstance(const Reference< 
XMultiServiceFactory >& fact)
+        {
+            return Reference<XInterface> ((OWeakObject *) new OdfFlatXml(fact));
 
-    void
-    XFlatXml::setDocumentLocator(const Reference<XLocator>& doclocator)
-            throw (SAXException, RuntimeException)
-    {
-        OSL_ASSERT(m_rDocumentHandler.is());
-        m_rDocumentHandler->setDocumentLocator(doclocator);
-    }
+        }
 
-    // --------------------------------------
-    // Component management
-    // --------------------------------------
-    Reference<XInterface> SAL_CALL
-    CreateInstance(const Reference<XMultiServiceFactory> &r)
-    {
-        return Reference<XInterface> ((OWeakObject *) new XFlatXml(r));
-    }
-
-    Sequence<OUString>
-    getSupportedServiceNames()
-    {
-        static Sequence<OUString> *pNames = 0;
-        if (!pNames)
-            {
-                MutexGuard guard(Mutex::getGlobalMutex());
-                if (!pNames)
-                    {
-                        static Sequence<OUString> seqNames(2);
-                        seqNames.getArray()[0] = OUString(
-                                RTL_CONSTASCII_USTRINGPARAM(
-                                        "com.sun.star.document.ImportFilter"));
-                        seqNames.getArray()[1] = OUString(
-                                RTL_CONSTASCII_USTRINGPARAM(
-                                        "com.sun.star.document.ExportFilter"));
-                        pNames = &seqNames;
-                    }
-            }
-        return *pNames;
-    }
+        _COMPHELPER_COMPONENT_GETIMPLEMENTATIONENVIRONMENT
 
-}
+        // extern "C" component_writeInfo()
 
-using namespace XFlatXml;
-#define IMPLEMENTATION_NAME "com.sun.star.comp.filter.FlatXmlCpp"
+        _COMPHELPER_COMPONENT_WRITEINFO
+        (
+         _COMPHELPER_COMPONENTINFO( OdfFlatXml,
+                                    OdfFlatXml::impl_getImplementationName(),
+                                    OdfFlatXml::impl_getSupportedServiceNames())
+         )
+        // extern "C" component_getFactory()
+            _COMPHELPER_COMPONENT_GETFACTORY
+            (
+             {},
+             _COMPHELPER_ONEINSTANCEFACTORY( OdfFlatXml::impl_getImplementationName(),
+                                             OdfFlatXml::impl_getSupportedServiceNames(),
+                                             OdfFlatXml::impl_createInstance)
 
-extern "C"
-{
-    void SAL_CALL
-    component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,
-            uno_Environment ** /* ppEnv */)
-    {
-        *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-    }
+             )
 
-    sal_Bool SAL_CALL
-    component_writeInfo(void * /* pServiceManager */, void * pRegistryKey)
-    {
-        if (pRegistryKey)
-            {
-                try
-                    {
-                        Reference<XRegistryKey>
-                                xNewKey(
-                                        reinterpret_cast<XRegistryKey *> (pRegistryKey)->createKey(
-                                                OUString(
-                                                        RTL_CONSTASCII_USTRINGPARAM( "/" 
IMPLEMENTATION_NAME "/UNO/SERVICES" ))));
-
-                        const Sequence<OUString> & rSNL =
-                                getSupportedServiceNames();
-                        const OUString * pArray = rSNL.getConstArray();
-                        for (sal_Int32 nPos = rSNL.getLength(); nPos--;)
-                            xNewKey->createKey(pArray[nPos]);
-
-                        return sal_True;
-                    }
-                catch (InvalidRegistryException &)
-                    {
-                        OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
-                    }
-            }
-        return sal_False;
     }
+}
 
-    void *
-    SAL_CALL component_getFactory(const sal_Char * pImplName,
-            void * pServiceManager, void * /* pRegistryKey */)
-    {
-        void * pRet = 0;
-
-        if (pServiceManager && rtl_str_compare(pImplName, IMPLEMENTATION_NAME)
-                == 0)
-            {
-                Reference<XSingleServiceFactory>
-                        xFactory(
-                                createSingleFactory(
-                                        reinterpret_cast<XMultiServiceFactory *> (pServiceManager),
-                                        OUString::createFromAscii(pImplName),
-                                        CreateInstance,
-                                        getSupportedServiceNames()));
-
-                if (xFactory.is())
-                    {
-                        xFactory->acquire();
-                        pRet = xFactory.get();
-                    }
-            }
-        return pRet;
-    }
 
-} // extern "C"
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/odfflatxml/FlatXml.hxx b/filter/source/odfflatxml/FlatXml.hxx
deleted file mode 100644
index 8b72f1e..0000000
--- a/filter/source/odfflatxml/FlatXml.hxx
+++ /dev/null
@@ -1,144 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- *  The Contents of this file are made available subject to the terms of
- *  the BSD license.
- *
- *  Copyright 2000, 2010 Oracle and/or its affiliates.
- *  All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions
- *  are met:
- *  1. Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *  2. Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *  3. Neither the name of Sun Microsystems, Inc. nor the names of its
- *     contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *************************************************************************/
-#ifndef __XFLATXML_HXX__
-#define __XFLATXML_HXX__
-
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/servicefactory.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/implbase3.hxx>
-#include <cppuhelper/implbase.hxx>
-
-#include <com/sun/star/lang/XComponent.hpp>
-
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Type.hxx>
-
-#include <com/sun/star/beans/PropertyValue.hpp>
-
-#include <com/sun/star/xml/sax/XParser.hpp>
-#include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/SAXException.hpp>
-#include <com/sun/star/xml/XImportFilter.hpp>
-#include <com/sun/star/xml/XExportFilter.hpp>
-
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-
-using namespace ::rtl;
-using namespace ::cppu;
-using namespace ::osl;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
-using namespace ::com::sun::star::xml;
-using namespace ::com::sun::star::xml::sax;
-
-namespace XFlatXml
-{
-
-    /*
-     * XFlatXml export and imports ODF flat XML documents by plumbing a pass-through
-     * filter implementation to XmlFilterAdaptor.
-     *
-     * XXX: Currently, this code adds nothing to the flat XML filter implementation
-     * provided with the ODK.
-     */
-    class XFlatXml : public WeakImplHelper3<XImportFilter, XExportFilter,
-            XDocumentHandler>
-    {
-    private:
-        // the UNO ServiceFactory
-        Reference<XMultiServiceFactory> m_rServiceFactory;
-
-        // DocumentHandler interface of the css::xml::sax::Writer service
-        Reference<XExtendedDocumentHandler> m_rDocumentHandler;
-
-        // controls pretty-printing
-        sal_Bool m_bPrettyPrint;
-
-    public:
-
-        // ctor...
-        XFlatXml(const Reference<XMultiServiceFactory> &r) :
-            m_rServiceFactory(r), m_bPrettyPrint(sal_True)
-        {
-        }
-
-        // XImportFilter
-        virtual sal_Bool SAL_CALL
-        importer(const Sequence<PropertyValue>& aSourceData, const Reference<
-                XDocumentHandler>& xHandler,
-                const Sequence<OUString>& msUserData) throw (RuntimeException);
-
-        // XExportFilter
-        virtual sal_Bool SAL_CALL
-        exporter(const Sequence<PropertyValue>& aSourceData, const Sequence<
-                OUString>& msUserData) throw (RuntimeException);
-
-        // XDocumentHandler
-        virtual void SAL_CALL
-        startDocument() throw (SAXException, RuntimeException);
-        virtual void SAL_CALL
-        endDocument() throw (SAXException, RuntimeException);
-        virtual void SAL_CALL
-        startElement(const OUString& str,
-                const Reference<XAttributeList>& attriblist)
-                throw (SAXException, RuntimeException);
-        virtual void SAL_CALL
-        endElement(const OUString& str) throw (SAXException, RuntimeException);
-        virtual void SAL_CALL
-        characters(const OUString& str) throw (SAXException, RuntimeException);
-        virtual void SAL_CALL
-        ignorableWhitespace(const OUString& str) throw (SAXException,
-                RuntimeException);
-        virtual void SAL_CALL
-        processingInstruction(const OUString& str, const OUString& str2)
-                throw (com::sun::star::xml::sax::SAXException,
-                RuntimeException);
-        virtual void SAL_CALL
-        setDocumentLocator(const Reference<XLocator>& doclocator)
-                throw (SAXException, RuntimeException);
-    };
-}
-#endif // __XFLATXML_HXX__
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/odfflatxml/odfflatxmlexport.xsl 
b/filter/source/odfflatxml/odfflatxmlexport.xsl
deleted file mode 100644
index 2c1ea97..0000000
--- a/filter/source/odfflatxml/odfflatxmlexport.xsl
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0">
-    <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
-
-  <xsl:template match="@*|node()">
-    <xsl:copy>
-      <xsl:apply-templates select="@*|node()"/>
-    </xsl:copy>
-  </xsl:template>
-
-  <xsl:template match="@office:mimetype[string(.)='application/vnd.oasis.opendocument.drawing']">
-      <xsl:attribute 
name="office:mimetype">application/vnd.oasis.opendocument.graphics</xsl:attribute>
-  </xsl:template>
-
-  <xsl:include href="split-long-lines.xsl"/>
-</xsl:stylesheet>
diff --git a/filter/source/odfflatxml/odfflatxmlimport.xsl 
b/filter/source/odfflatxml/odfflatxmlimport.xsl
deleted file mode 100644
index 802ff53..0000000
--- a/filter/source/odfflatxml/odfflatxmlimport.xsl
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
-    <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
-
-    <xsl:template match="@*|node()">
-        <xsl:copy>
-            <xsl:apply-templates select="@*|node()"/>
-        </xsl:copy>
-    </xsl:template>
-</xsl:stylesheet>
diff --git a/filter/source/odfflatxml/split-long-lines.xsl 
b/filter/source/odfflatxml/split-long-lines.xsl
deleted file mode 100644
index 0e9d310..0000000
--- a/filter/source/odfflatxml/split-long-lines.xsl
+++ /dev/null
@@ -1,98 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Version: MPL 1.1 / GPLv3+ / LGPLv3+
-
-The contents of this file are subject to the Mozilla Public License Version
-1.1 (the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-http://www.mozilla.org/MPL/
-
-Software distributed under the License is distributed on an "AS IS" basis,
-WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-for the specific language governing rights and limitations under the
-License.
-
-The Initial Developer of the Original Code is
-       Gioele Barabucci <gioele@svario.it>
-Portions created by the Initial Developer are Copyright (C) 2010 the
-Initial Developer. All Rights Reserved.
-
-Contributor(s): Gioele Barabucci <gioele@svario.it>
-
-Alternatively, the contents of this file may be used under the terms of
-either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-instead of those above.
--->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
-                xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
-                version="1.0">
-       <xsl:param name="num-max-spaces">5</xsl:param>
-       <xsl:param name="sep"><xsl:text xml:space="preserve">&#32;</xsl:text></xsl:param>
-       <xsl:param name="newline"><xsl:text xml:space="preserve">&#10;</xsl:text></xsl:param>
-
-       <xsl:template match="text:p/text()">
-               <xsl:call-template name="split-current-text-node"/>
-       </xsl:template>
-
-       <xsl:template match="text:p/text:span/text()">
-               <xsl:call-template name="split-current-text-node"/>
-       </xsl:template>
-
-       <xsl:template name="split-current-text-node">
-               <xsl:call-template name="split-text">
-                       <xsl:with-param name="num-prec-spaces">0</xsl:with-param>
-                       <xsl:with-param name="text" select="."/>
-               </xsl:call-template>
-       </xsl:template>
-
-       <xsl:template name="split-text">
-               <xsl:param name="num-prec-spaces"/>
-               <xsl:param name="text"/>
-
-               <xsl:variable name="contains-space" select="contains($text, $sep)"/>
-               <xsl:variable name="text-before">
-                       <xsl:choose>
-                               <xsl:when test="$contains-space"><xsl:value-of 
select="substring-before($text, $sep)"/></xsl:when>
-                               <xsl:when test="$text = $sep"><xsl:value-of 
select="$text"/></xsl:when>
-                               <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
-                       </xsl:choose>
-               </xsl:variable>
-               <xsl:variable name="text-after">
-                       <xsl:choose>
-                               <xsl:when test="$contains-space"><xsl:value-of 
select="substring-after($text, $sep)"/></xsl:when>
-                               <xsl:otherwise></xsl:otherwise>
-                       </xsl:choose>
-               </xsl:variable>
-               <xsl:variable name="finished" select="string-length($text-after) = 0"/>
-               <xsl:variable name="is-empty" select="string-length($text-before) = 0"/>
-
-               <xsl:value-of select="$text-before"/>
-
-               <xsl:choose>
-                       <xsl:when test="$num-prec-spaces = $num-max-spaces">
-                               <xsl:value-of select="$newline"/>
-                               <xsl:call-template name="split-text">
-                                       <xsl:with-param name="text" select="$text-after"/>
-                                       <xsl:with-param name="num-prec-spaces">0</xsl:with-param>
-                               </xsl:call-template>
-                       </xsl:when>
-
-                       <xsl:otherwise>
-                               <xsl:if test="$contains-space">
-                                       <xsl:value-of select="$sep"/>
-                               </xsl:if>
-
-                               <xsl:if test="not($finished)">
-                                       <xsl:variable name="incr" select="number(not($is-empty))"/>
-
-                                       <xsl:call-template name="split-text">
-                                               <xsl:with-param name="text" select="$text-after"/>
-                                               <xsl:with-param name="num-prec-spaces" 
select="$num-prec-spaces + $incr"/>
-                                       </xsl:call-template>
-                               </xsl:if>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </xsl:template>
-</xsl:stylesheet>
diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx 
b/filter/source/xsltfilter/LibXSLTTransformer.cxx
new file mode 100644
index 0000000..08fff37
--- /dev/null
+++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx
@@ -0,0 +1,441 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ *       [ Peter Jentsch <pjotr@guineapics.de> ]
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Peter Jentsch <pjotr@guineapics.de>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <stdio.h>
+#include <list>
+#include <map>
+#include <iostream>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xmlIO.h>
+#include <libxslt/transform.h>
+#include <libxslt/xsltutils.h>
+#include <libxslt/variables.h>
+
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/servicefactory.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <osl/module.h>
+#include <osl/file.hxx>
+#include <osl/process.h>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#include <com/sun/star/io/XActiveDataControl.hpp>
+#include <com/sun/star/io/XStreamListener.hpp>
+
+#include <LibXSLTTransformer.hxx>
+
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::osl;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+using ::std::list;
+using ::std::map;
+using ::std::pair;
+
+#define _INPUT_BUFFER_SIZE 4096
+#define _OUTPUT_BUFFER_SIZE 4096
+
+namespace XSLT
+{
+    const char* const LibXSLTTransformer::PARAM_SOURCE_URL = "sourceURL";
+    const char* const LibXSLTTransformer::PARAM_SOURCE_BASE_URL =
+            "sourceBaseURL";
+    const char* const LibXSLTTransformer::PARAM_TARGET_URL = "targetURL";
+    const char* const LibXSLTTransformer::PARAM_TARGET_BASE_URL =
+            "targetBaseURL";
+    const char* const LibXSLTTransformer::PARAM_DOCTYPE_SYSTEM = "sytemType";
+    const char* const LibXSLTTransformer::PARAM_DOCTYPE_PUBLIC = "publicType";
+
+    const sal_Int32 Reader::OUTPUT_BUFFER_SIZE = _OUTPUT_BUFFER_SIZE;
+
+    const sal_Int32 Reader::INPUT_BUFFER_SIZE = _INPUT_BUFFER_SIZE;
+
+    struct ParserInputBufferCallback
+    {
+        static int
+        on_read(void * context, char * buffer, int len)
+        {
+            Reader * tmp = static_cast<Reader*> (context);
+            return tmp->read(buffer, len);
+        }
+        static int
+        on_close(void * context)
+        {
+            Reader * tmp = static_cast<Reader*> (context);
+            return tmp->closeInput();
+        }
+    };
+    struct ParserOutputBufferCallback
+    {
+        static int
+        on_write(void * context, const char * buffer, int len)
+        {
+            Reader * tmp = static_cast<Reader*> (context);
+            return tmp->write(buffer, len);
+        }
+        static int
+        on_close(void * context)
+        {
+            Reader * tmp = static_cast<Reader*> (context);
+            return tmp->closeOutput();
+        }
+    };
+
+    Reader::Reader(LibXSLTTransformer* transformer) :
+        m_transformer(transformer), m_terminated(false), m_readBuf(
+                INPUT_BUFFER_SIZE), m_writeBuf(OUTPUT_BUFFER_SIZE)
+    {
+        LIBXML_TEST_VERSION;
+    }
+    ;
+
+    int
+    Reader::read(char * buffer, int len)
+    {
+        //        const char *ptr = (const char *) context;
+        if (buffer == NULL || len < 0)
+            return (-1);
+        sal_Int32 n;
+        Reference<XInputStream> xis = this->m_transformer->getInputStream();
+        n = xis.get()->readBytes(m_readBuf, len);
+        if (n > 0)
+            {
+                memcpy(buffer, m_readBuf.getArray(), n);
+            }
+        return n;
+    }
+
+    int
+    Reader::write(const char * buffer, int len)
+    {
+        if (buffer == NULL || len < 0)
+            return -1;
+        if (len > 0)
+            {
+                Reference<XOutputStream> xos = m_transformer->getOutputStream();
+                sal_Int32 writeLen = len;
+                sal_Int32 bufLen = ::std::min(writeLen,
+                        this->OUTPUT_BUFFER_SIZE);
+                const sal_uInt8* memPtr =
+                        reinterpret_cast<const sal_uInt8*> (buffer);
+                while (writeLen > 0)
+                    {
+                        sal_Int32 n = ::std::min(writeLen, bufLen);
+                        m_writeBuf.realloc(n);
+                        memcpy(m_writeBuf.getArray(), memPtr,
+                                static_cast<size_t> (n));
+                        xos.get()->writeBytes(m_writeBuf);
+                        memPtr += n;
+                        writeLen -= n;
+                    }
+            }
+        return len;
+    }
+
+    int
+    Reader::closeInput()
+    {
+        return 0;
+    }
+
+    int
+    Reader::closeOutput()
+    {
+        Reference<XOutputStream> xos = m_transformer->getOutputStream();
+        if (xos.is())
+            {
+                xos.get()->flush();
+                xos.get()->closeOutput();
+            }
+        m_transformer->done();
+        return 0;
+    }
+
+    void
+    Reader::run()
+    {
+        OSL_ASSERT(m_transformer != NULL);
+        OSL_ASSERT(m_transformer->getInputStream().is());
+        OSL_ASSERT(m_transformer->getOutputStream().is());
+        OSL_ASSERT(m_transformer->getStyleSheetURL());
+        ::std::map<const char*, OString>::iterator pit;
+        ::std::map<const char*, OString> pmap = m_transformer->getParameters();
+        const char* params[pmap.size() * 2 + 1]; // build parameters
+        int paramIndex = 0;
+        for (pit = pmap.begin(); pit != pmap.end(); pit++)
+            {
+                params[paramIndex++] = (*pit).first;
+                params[paramIndex++] = (*pit).second.getStr();
+            }
+        params[paramIndex] = NULL;
+        xmlDocPtr doc = xmlReadIO(&ParserInputBufferCallback::on_read,
+                &ParserInputBufferCallback::on_close,
+                static_cast<void*> (this), NULL, NULL, 0);
+        xsltStylesheetPtr styleSheet = xsltParseStylesheetFile(
+                (const xmlChar *) m_transformer->getStyleSheetURL().getStr());
+        xmlDocPtr result = NULL;
+        xsltTransformContextPtr tcontext = NULL;
+        if (styleSheet)
+            {
+                tcontext = xsltNewTransformContext(styleSheet, doc);
+                xsltQuoteUserParams(tcontext, params);
+                result = xsltApplyStylesheetUser(styleSheet, doc, 0, 0, 0,
+                        tcontext);
+            }
+
+        if (result)
+            {
+                xmlCharEncodingHandlerPtr encoder = xmlGetCharEncodingHandler(
+                        XML_CHAR_ENCODING_UTF8);
+                xmlOutputBufferPtr outBuf = xmlAllocOutputBuffer(encoder);
+                outBuf->context = static_cast<void *> (this);
+                outBuf->writecallback = &ParserOutputBufferCallback::on_write;
+                outBuf->closecallback = &ParserOutputBufferCallback::on_close;
+                xsltSaveResultTo(outBuf, result, styleSheet);
+            }
+        else
+            {
+                xmlErrorPtr lastErr = xmlGetLastError();
+                OUString msg;
+                if (lastErr)
+                    msg = OUString::createFromAscii(lastErr->message);
+                else
+                    msg = OUString::createFromAscii(
+                            "Unknown XSLT transformation error");
+
+                m_transformer->error(msg);
+            }
+        closeOutput();
+        xsltFreeStylesheet(styleSheet);
+        xsltFreeTransformContext(tcontext);
+        xmlFreeDoc(doc);
+        xmlFreeDoc(result);
+    }
+    ;
+
+    void
+    Reader::onTerminated()
+    {
+        m_terminated = true;
+    }
+    ;
+
+    Reader::~Reader()
+    {
+    }
+
+    LibXSLTTransformer::LibXSLTTransformer(
+            const Reference<XMultiServiceFactory> &r) :
+        m_rServiceFactory(r)
+    {
+    }
+
+    void
+    LibXSLTTransformer::setInputStream(
+            const Reference<XInputStream>& inputStream)
+            throw (RuntimeException)
+    {
+        m_rInputStream = inputStream;
+    }
+
+    Reference<XInputStream>
+    LibXSLTTransformer::getInputStream() throw (RuntimeException)
+    {
+        return m_rInputStream;
+    }
+
+    void
+    LibXSLTTransformer::setOutputStream(
+            const Reference<XOutputStream>& outputStream)
+            throw (RuntimeException)
+    {
+        m_rOutputStream = outputStream;
+    }
+
+    Reference<XOutputStream>
+    LibXSLTTransformer::getOutputStream() throw (RuntimeException)
+    {
+        return m_rOutputStream;
+    }
+
+    void
+    LibXSLTTransformer::addListener(const Reference<XStreamListener>& listener)
+            throw (RuntimeException)
+    {
+        m_listeners.insert(m_listeners.begin(), listener);
+    }
+
+    void
+    LibXSLTTransformer::removeListener(
+            const Reference<XStreamListener>& listener)
+            throw (RuntimeException)
+    {
+        m_listeners.remove(listener);
+    }
+
+    void
+    LibXSLTTransformer::start() throw (RuntimeException)
+    {
+        ListenerList::iterator it;
+        ListenerList* l = &m_listeners;
+        for (it = l->begin(); it != l->end(); it++)
+            {
+                Reference<XStreamListener> xl = *it;
+                xl.get()->started();
+            }
+        Reader* r = new Reader(this);
+        r->create();
+    }
+
+    void
+    LibXSLTTransformer::error(const OUString& msg)
+    {
+        ListenerList* l = &m_listeners;
+        Any arg;
+        arg <<= Exception(msg, *this);
+        for (ListenerList::iterator it = l->begin(); it != l->end(); it++)
+            {
+                Reference<XStreamListener> xl = *it;
+                if (xl.is())
+                    {
+                        xl.get()->error(arg);
+                    }
+            }
+    }
+
+    void
+    LibXSLTTransformer::done()
+    {
+        ListenerList* l = &m_listeners;
+        for (ListenerList::iterator it = l->begin(); it != l->end(); it++)
+            {
+                Reference<XStreamListener> xl = *it;
+                if (xl.is())
+                    {
+                        xl.get()->closed();
+                    }
+            }
+    }
+
+    void
+    LibXSLTTransformer::terminate() throw (RuntimeException)
+    {
+        m_parameters.clear();
+    }
+
+    void
+    LibXSLTTransformer::initialize(const Sequence<Any>& params)
+            throw (RuntimeException)
+    {
+        xmlSubstituteEntitiesDefault(0);
+        m_parameters.clear();
+        for (int i = 0; i < params.getLength(); i++)
+            {
+                NamedValue nv;
+                params[i] >>= nv;
+                OString nameUTF8 = OUStringToOString(nv.Name,
+                        RTL_TEXTENCODING_UTF8);
+                OUString value;
+                OString valueUTF8;
+                if (nv.Value >>= value)
+                    {
+                        valueUTF8 = OUStringToOString(value,
+                                RTL_TEXTENCODING_UTF8);
+                    }
+                else
+                    {
+                        // ignore non-string parameters
+                        continue;
+                    }
+                if (nameUTF8.equals("StylesheetURL"))
+                    {
+                        m_styleSheetURL = valueUTF8;
+                    }
+                else if (nameUTF8.equals("SourceURL"))
+                    {
+                        m_parameters.insert(pair<const char*, OString> (
+                                PARAM_SOURCE_URL, valueUTF8));
+                    }
+                else if (nameUTF8.equals("SourceBaseURL"))
+                    {
+                        m_parameters.insert(pair<const char*, OString> (
+                                PARAM_SOURCE_BASE_URL, valueUTF8));
+                    }
+                else if (nameUTF8.equals("TargetURL"))
+                    {
+                        m_parameters.insert(pair<const char*, OString> (
+                                PARAM_TARGET_URL, valueUTF8));
+                    }
+                else if (nameUTF8.equals("TargetBaseURL"))
+                    {
+                        m_parameters.insert(pair<const char*, OString> (
+                                PARAM_TARGET_BASE_URL, valueUTF8));
+                    }
+                else if (nameUTF8.equals("DoctypeSystem"))
+                    {
+                        m_parameters.insert(pair<const char*, OString> (
+                                PARAM_DOCTYPE_SYSTEM, valueUTF8));
+                    }
+                else if (nameUTF8.equals("DoctypePublic"))
+                    {
+                        m_parameters.insert(pair<const char*, OString> (
+                                PARAM_DOCTYPE_PUBLIC, valueUTF8));
+                    }
+            }
+    }
+
+    const OString
+    LibXSLTTransformer::getStyleSheetURL()
+    {
+        return m_styleSheetURL;
+    }
+
+    ::std::map<const char*, OString>
+    LibXSLTTransformer::getParameters()
+    {
+        return m_parameters;
+    }
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
diff --git a/filter/source/xsltfilter/LibXSLTTransformer.hxx 
b/filter/source/xsltfilter/LibXSLTTransformer.hxx
new file mode 100644
index 0000000..c6c644e
--- /dev/null
+++ b/filter/source/xsltfilter/LibXSLTTransformer.hxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ *       [ Peter Jentsch <pjotr@guineapics.de> ]
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Peter Jentsch <pjotr@guineapics.de>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#ifndef __LIBXSLTTRANSFORMER_HXX__
+#define __LIBXSLTTRANSFORMER_HXX__
+#include "precompiled_filter.hxx"
+
+#include <stdio.h>
+
+#include <list>
+#include <map>
+
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xmlIO.h>
+#include <libxslt/transform.h>
+
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/servicefactory.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase.hxx>
+
+#include <osl/thread.hxx>
+
+#include <com/sun/star/uno/Any.hxx>
+
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#include <com/sun/star/io/XActiveDataControl.hpp>
+#include <com/sun/star/io/XStreamListener.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::osl;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+
+using ::std::list;
+using ::std::map;
+
+namespace XSLT
+{
+
+    /*
+     * LibXSLTTransformer provides an transforming pipe service to XSLTFilter.
+     *
+     * It implements XActiveDataSource, XActiveDataSink and XActiveDataControl
+     * to consume data. It also notifies upstream of important events such as
+     * begin and end of the transformation and of any errors that occur during
+     * transformation.
+     *
+     * TODO: Error reporting leaves room for improvement, currently.
+     *
+     * The actual transformation is done by a worker thread.
+     *
+     * See Reader below.
+     */
+    class LibXSLTTransformer : public WeakImplHelper4<XActiveDataSink,
+            XActiveDataSource, XActiveDataControl, XInitialization>
+    {
+    private:
+        static const char* const PARAM_SOURCE_URL;
+        static const char* const PARAM_SOURCE_BASE_URL;
+        static const char* const PARAM_TARGET_URL;
+        static const char* const PARAM_TARGET_BASE_URL;
+        static const char* const PARAM_DOCTYPE_SYSTEM;
+        static const char* const PARAM_DOCTYPE_PUBLIC;
+
+        // the UNO ServiceFactory
+        Reference<XMultiServiceFactory> m_rServiceFactory;
+
+        Reference<XInputStream> m_rInputStream;
+
+        Reference<XOutputStream> m_rOutputStream;
+
+        typedef ::std::list<Reference<XStreamListener> > ListenerList;
+
+        ListenerList m_listeners;
+
+        OString m_styleSheetURL;
+
+        ::std::map<const char *, OString> m_parameters;
+
+    public:
+
+        // ctor...
+        LibXSLTTransformer(const Reference<XMultiServiceFactory> &r);
+
+        // XActiveDataSink
+        virtual void SAL_CALL
+        setInputStream(const Reference<XInputStream>& inputStream)
+                throw (RuntimeException);
+        virtual Reference<XInputStream> SAL_CALL
+        getInputStream() throw (RuntimeException);
+        // XActiveDataSource
+        virtual void SAL_CALL
+        setOutputStream(const Reference<XOutputStream>& outputStream)
+                throw (RuntimeException);
+        virtual Reference<XOutputStream> SAL_CALL
+        getOutputStream() throw (RuntimeException);
+        // XActiveDataControl
+        virtual void SAL_CALL
+        addListener(const Reference<XStreamListener>& listener)
+                throw (RuntimeException);
+        virtual void SAL_CALL
+        removeListener(const Reference<XStreamListener>& listener)
+                throw (RuntimeException);
+        virtual void SAL_CALL
+        start() throw (RuntimeException);
+        virtual void SAL_CALL
+        terminate() throw (RuntimeException);
+        virtual void SAL_CALL
+        initialize(const Sequence<Any>& params) throw (RuntimeException);
+
+        void SAL_CALL
+        done();
+
+        void SAL_CALL
+        error(const OUString& msg);
+
+        const OString SAL_CALL
+        getStyleSheetURL();
+
+        ::std::map<const char*, OString> SAL_CALL
+        getParameters();
+
+    };
+
+    /*
+     * Reader provides a worker thread to perform the actual transformation.
+     * It pipes the streams provided by a LibXSLTTransformer
+     * instance through libxslt.
+     */
+    class Reader : public osl::Thread
+    {
+    public:
+        Reader(LibXSLTTransformer* transformer);
+        int SAL_CALL
+        read(char * buffer, int len);
+        int SAL_CALL
+        write(const char * buffer, int len);
+        int SAL_CALL
+        closeInput();
+        int SAL_CALL
+        closeOutput();
+
+    protected:
+        virtual
+        ~Reader();
+
+    private:
+        static const sal_Int32 OUTPUT_BUFFER_SIZE;
+        static const sal_Int32 INPUT_BUFFER_SIZE;
+        LibXSLTTransformer* m_transformer;
+        sal_Bool m_terminated;
+        Sequence<sal_Int8> m_readBuf;
+        Sequence<sal_Int8> m_writeBuf;
+        virtual void SAL_CALL
+        run();
+        virtual void SAL_CALL
+        onTerminated();
+    };
+
+}
+;
+
+#endif // __LIBXSLTTRANSFORMER_HXX__
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx
index 21983a1..a1545fa 100644
--- a/filter/source/xsltfilter/XSLTFilter.cxx
+++ b/filter/source/xsltfilter/XSLTFilter.cxx
@@ -39,6 +39,8 @@
 #include <cppuhelper/implbase4.hxx>
 #include <cppuhelper/implbase.hxx>
 
+#include <sax/tools/documenthandleradapter.hxx>
+
 #include <osl/time.h>
 #include <osl/conditn.h>
 #include <tools/urlobj.hxx>
@@ -76,10 +78,12 @@
 
 #include <xmloff/attrlist.hxx>
 #include <fla.hxx>
+#include <LibXSLTTransformer.hxx>
 
 using namespace ::rtl;
 using namespace ::cppu;
 using namespace ::osl;
+using namespace ::sax;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::io;
 using namespace ::com::sun::star::uno;
@@ -89,587 +93,550 @@ using namespace ::com::sun::star::xml;
 using namespace ::com::sun::star::xml::sax;
 using namespace ::com::sun::star::util;
 
-namespace XSLT {
-
-
-class FLABridge : public WeakImplHelper1< XDocumentHandler>
+namespace XSLT
 {
-private:
-    const Reference<XDocumentHandler>& m_rDocumentHandler;
-    const sal_Unicode *eval(const sal_Unicode *expr, sal_Int32 exprLen);
-    FLA::Evaluator ev;
-    bool active;
-
-public:
-    FLABridge(const Reference<XDocumentHandler>& m_rDocumentHandler);
-
-    // XDocumentHandler
-    virtual void SAL_CALL startDocument()
-        throw (SAXException,RuntimeException);
-    virtual void SAL_CALL endDocument()
-        throw (SAXException, RuntimeException);
-    virtual void SAL_CALL startElement(const OUString& str, const Reference<XAttributeList>& 
attriblist)
-        throw (SAXException,RuntimeException);
-    virtual void SAL_CALL endElement(const OUString& str)
-        throw (SAXException, RuntimeException);
-    virtual void SAL_CALL characters(const OUString& str)
-        throw (SAXException, RuntimeException);
-    virtual void SAL_CALL ignorableWhitespace(const OUString& str)
-        throw (SAXException, RuntimeException);
-    virtual void SAL_CALL processingInstruction(const OUString& str, const OUString& str2)
-        throw (com::sun::star::xml::sax::SAXException,RuntimeException);
-    virtual void SAL_CALL setDocumentLocator(const Reference<XLocator>& doclocator)
-        throw (SAXException,RuntimeException);
-
-};
-
-FLABridge::FLABridge(const Reference<XDocumentHandler>& _rDocumentHandler) : 
m_rDocumentHandler(_rDocumentHandler), active(false)
-{
-}
 
-void FLABridge::startDocument() throw (SAXException,RuntimeException){
-    OSL_ASSERT(m_rDocumentHandler.is());
-    m_rDocumentHandler->startDocument();
-}
+    /*
+     * FLABridge provides some obscure attribute mangling to wordml2000 import/export filters.
+     * In the long run, you might want to replace this with an XSLT extension function.
+     */
+    class FLABridge : public WeakImplHelper1< DocumentHandlerAdapter >
+    {
+    private:
+        const sal_Unicode *
+        eval(const sal_Unicode *expr, sal_Int32 exprLen);
+        FLA::Evaluator ev;
+        bool active;
 
-void FLABridge::endDocument() throw (SAXException,RuntimeException){
-    OSL_ASSERT(m_rDocumentHandler.is());
-    m_rDocumentHandler->endDocument();
+    public:
+        FLABridge(const Reference<XDocumentHandler>& m_rDocumentHandler);
 
-}
+        virtual void SAL_CALL
+        startElement(const OUString& str,
+                const Reference<XAttributeList>& attriblist)
+                throw (SAXException, RuntimeException);
 
+    };
 
-void FLABridge::startElement(const OUString& str, const Reference<XAttributeList>& attriblist)
-    throw (SAXException, RuntimeException)
-{
-    OSL_ASSERT(m_rDocumentHandler.is());
-    if (active)
+    FLABridge::FLABridge(const Reference<XDocumentHandler>& _rDocumentHandler) : active(false)
     {
-//             SvXMLAttributeList* _attriblist=SvXMLAttributeList::getImplementation(attriblist);
-        const int len=attriblist->getLength();
-        SvXMLAttributeList *_newattriblist= new SvXMLAttributeList();
-        for(int i=0;i<len;i++)
-        {
-            const OUString& name=attriblist->getNameByIndex( sal::static_int_cast<sal_Int16>( i ) 
);
-            sal_Int32 pos;
-            static const OUString _value_(".value", 6, RTL_TEXTENCODING_ASCII_US);
-            if ((pos=name.lastIndexOf(L'.'))!=-1 && name.match(_value_, pos))
+        DocumentHandlerAdapter::setDelegate(_rDocumentHandler);
+    }
+
+    void
+    FLABridge::startElement(const OUString& str,
+            const Reference<XAttributeList>& attriblist) throw (SAXException,
+            RuntimeException)
+    {
+        if (active)
             {
-                const OUString newName(name, pos);
-                const OUString& value=attriblist->getValueByIndex( 
sal::static_int_cast<sal_Int16>( i ) );
-                const OUString newValue(ev.eval(value.getStr(), value.getLength()));
-                if (newValue.getLength()>0)
-                {
-                    _newattriblist->AddAttribute(newName, newValue);
-                }
+                //             SvXMLAttributeList* 
_attriblist=SvXMLAttributeList::getImplementation(attriblist);
+                const int len = attriblist->getLength();
+                SvXMLAttributeList *_newattriblist = new SvXMLAttributeList();
+                for (int i = 0; i < len; i++)
+                    {
+                        const OUString& name = attriblist->getNameByIndex(
+                                sal::static_int_cast<sal_Int16>(i));
+                        sal_Int32 pos;
+                        static const OUString _value_(".value", 6,
+                                RTL_TEXTENCODING_ASCII_US);
+                        if ((pos = name.lastIndexOf(L'.')) != -1 && name.match(
+                                _value_, pos))
+                            {
+                                const OUString newName(name, pos);
+                                const OUString
+                                        & value =
+                                                attriblist->getValueByIndex(
+                                                        sal::static_int_cast<
+                                                                sal_Int16>(i));
+                                const OUString newValue(ev.eval(value.getStr(),
+                                        value.getLength()));
+                                if (newValue.getLength() > 0)
+                                    {
+                                        _newattriblist->AddAttribute(newName,
+                                                newValue);
+                                    }
+                            }
+                        else
+                            {
+                                _newattriblist->AddAttribute(
+                                        name,
+                                        attriblist->getValueByIndex(
+                                                sal::static_int_cast<sal_Int16>(
+                                                        i)));
+                            }
+                    };
+                const Reference<XAttributeList> newattriblist(_newattriblist);
+                DocumentHandlerAdapter::startElement(str, newattriblist);
             }
-            else
+        else
             {
-                _newattriblist->AddAttribute(name, attriblist->getValueByIndex( 
sal::static_int_cast<sal_Int16>( i )));
+                if (str.compareToAscii("fla:fla.activate") == 0)
+                    {
+                        active = 1;
+                    }
+                DocumentHandlerAdapter::startElement(str, attriblist);
             }
-        };
-        const Reference<XAttributeList> newattriblist(_newattriblist);
-        m_rDocumentHandler->startElement(str, newattriblist);
     }
-    else
+
+    /*
+     * XSLTFilter reads flat xml streams from the XML filter framework and passes
+     * them to an XSLT transformation service. XSLT transformation errors are
+     * reported to XSLTFilter.
+     *
+     * Currently, two implemations for the XSLT transformation service exist:
+     * a java based service (see XSLTransformer.java) and  a libxslt based
+     * service (LibXSLTTransformer.cxx).
+     *
+     * The libxslt implementation will be used, if the value of the 2nd "UserData"
+     * parameter of the filter configuration is "libxslt"
+     */
+    class XSLTFilter : public WeakImplHelper4<XImportFilter, XExportFilter,
+            XStreamListener, ExtendedDocumentHandlerAdapter>
     {
-        if (str.compareToAscii("fla:fla.activate")==0) 
-        {
-            active=1;
-        }
-        m_rDocumentHandler->startElement(str, attriblist);
+    private:
+        static const OUString LIBXSLT_HELPER_SERVICE_IMPL;
+
+        // the UNO ServiceFactory
+        Reference<XMultiServiceFactory> m_rServiceFactory;
+
+        // DocumentHandler interface of the css::xml::sax::Writer service
+        Reference<XOutputStream> m_rOutputStream;
+
+        Reference<XActiveDataControl> m_tcontrol;
+
+        oslCondition m_cTransformed;
+        sal_Bool m_bTerminated;
+        sal_Bool m_bError;
+
+        OUString m_aExportBaseUrl;
+
+        OUString
+        rel2abs(const OUString&);
+        OUString
+        expandUrl(const OUString&);
+
+    public:
+
+        // ctor...
+        XSLTFilter(const Reference<XMultiServiceFactory> &r);
+
+        // XStreamListener
+        virtual void SAL_CALL
+        error(const Any& a) throw (RuntimeException);
+        virtual void SAL_CALL
+        closed() throw (RuntimeException);
+        virtual void SAL_CALL
+        terminated() throw (RuntimeException);
+        virtual void SAL_CALL
+        started() throw (RuntimeException);
+        virtual void SAL_CALL
+        disposing(const EventObject& e) throw (RuntimeException);
+
+        // XImportFilter
+        virtual sal_Bool SAL_CALL
+        importer(const Sequence<PropertyValue>& aSourceData, const Reference<
+                XDocumentHandler>& xHandler,
+                const Sequence<OUString>& msUserData) throw (RuntimeException);
+
+        // XExportFilter
+        virtual sal_Bool SAL_CALL
+        exporter(const Sequence<PropertyValue>& aSourceData, const Sequence<
+                OUString>& msUserData) throw (RuntimeException);
+
+        // XDocumentHandler
+        virtual void SAL_CALL
+        startDocument() throw (SAXException, RuntimeException);
+        virtual void SAL_CALL
+        endDocument() throw (SAXException, RuntimeException);
+    };
+
+    XSLTFilter::XSLTFilter(const Reference<XMultiServiceFactory> &r):
+m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False)
+    {
+        m_cTransformed = osl_createCondition();
     }
-}
-
-void FLABridge::endElement(const OUString& str)
-    throw (SAXException, RuntimeException)
-{
-    OSL_ASSERT(m_rDocumentHandler.is());
-    m_rDocumentHandler->endElement(str);
-}
-
-void FLABridge::characters(const OUString& str)
-    throw (SAXException, RuntimeException)
-{
-    OSL_ASSERT(m_rDocumentHandler.is());
-    m_rDocumentHandler->characters(str);
-}
-
-void FLABridge::ignorableWhitespace(const OUString& str)
-    throw (SAXException, RuntimeException)
-{
-    OSL_ASSERT(m_rDocumentHandler.is());
-    m_rDocumentHandler->ignorableWhitespace(str);
-}
 
-void  FLABridge::processingInstruction(const OUString& str, const OUString& str2)
-    throw (SAXException, RuntimeException)
-{
-    OSL_ASSERT(m_rDocumentHandler.is());
-    m_rDocumentHandler->processingInstruction(str, str2);
-}
-
-void FLABridge::setDocumentLocator(const Reference<XLocator>& doclocator)
-    throw (SAXException, RuntimeException)
-{
-    OSL_ASSERT(m_rDocumentHandler.is());
-    m_rDocumentHandler->setDocumentLocator(doclocator);
-}
-
-
-
-class XSLTFilter : public WeakImplHelper4< XImportFilter, XExportFilter, XDocumentHandler, 
XStreamListener>
-{
-private:
-    // the UNO ServiceFactory
-    Reference< XMultiServiceFactory > m_rServiceFactory;
-
-    // DocumentHandler interface of the css::xml::sax::Writer service
-    Reference < XExtendedDocumentHandler > m_rDocumentHandler;
-    Reference < XOutputStream > m_rOutputStream;
-
-    // controls pretty-printing
-    sal_Bool m_bPrettyPrint;
-
-    Reference< XActiveDataControl > m_tcontrol;
-    oslCondition  m_cTransformed;
-    sal_Bool m_bTerminated;
-    sal_Bool m_bError;
-
-    OUString m_aExportBaseUrl;
-    OUString m_aOldBaseUrl;
-
-    OUString rel2abs(const OUString&);
-    OUString expandUrl(const OUString&);
-
-public:
-
-    // ctor...
-    XSLTFilter( const Reference< XMultiServiceFactory > &r );
-
-    // XStreamListener
-    virtual void SAL_CALL error(const Any& a) throw (RuntimeException);
-    virtual void SAL_CALL closed() throw (RuntimeException);
-    virtual void SAL_CALL terminated() throw (RuntimeException);
-    virtual void SAL_CALL started() throw (RuntimeException);
-    virtual void SAL_CALL disposing(const EventObject& e) throw (RuntimeException);
-
-
-    // XImportFilter
-    virtual sal_Bool SAL_CALL importer(
-            const Sequence<PropertyValue>& aSourceData,
-            const Reference<XDocumentHandler>& xHandler,
-            const Sequence<OUString>& msUserData)
-        throw(RuntimeException);
-
-    // XExportFilter
-    virtual sal_Bool SAL_CALL exporter(
-            const Sequence<PropertyValue>& aSourceData,
-            const Sequence<OUString>& msUserData)
-        throw(RuntimeException);
-
-    // XDocumentHandler
-    virtual void SAL_CALL startDocument()
-        throw (SAXException,RuntimeException);
-    virtual void SAL_CALL endDocument()
-        throw (SAXException, RuntimeException);
-    virtual void SAL_CALL startElement(const OUString& str, const Reference<XAttributeList>& 
attriblist)
-        throw (SAXException,RuntimeException);
-    virtual void SAL_CALL endElement(const OUString& str)
-        throw (SAXException, RuntimeException);
-    virtual void SAL_CALL characters(const OUString& str)
-        throw (SAXException, RuntimeException);
-    virtual void SAL_CALL ignorableWhitespace(const OUString& str)
-        throw (SAXException, RuntimeException);
-    virtual void SAL_CALL processingInstruction(const OUString& str, const OUString& str2)
-        throw (com::sun::star::xml::sax::SAXException,RuntimeException);
-    virtual void SAL_CALL setDocumentLocator(const Reference<XLocator>& doclocator)
-        throw (SAXException,RuntimeException);
-};
-
-XSLTFilter::XSLTFilter( const Reference< XMultiServiceFactory > &r )
-    : m_rServiceFactory(r)
-    , m_bPrettyPrint(sal_True)
-    , m_bTerminated(sal_False)
-    , m_bError(sal_False)
-{
-    m_cTransformed = osl_createCondition();
-}
-
-void XSLTFilter::disposing(const EventObject& ) throw (RuntimeException)
-{
-}
-
-::rtl::OUString XSLTFilter::expandUrl( const ::rtl::OUString& sUrl )
-{
-    ::rtl::OUString sExpandedUrl;
-    try
+    void
+    XSLTFilter::disposing(const EventObject&) throw (RuntimeException)
     {
-        Reference< XComponentContext > xContext;
-        Reference< XPropertySet > xProps( m_rServiceFactory, UNO_QUERY_THROW );
-        xContext.set( xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"DefaultContext" )) ), UNO_QUERY_THROW );
-        Reference< XMacroExpander > xMacroExpander( xContext->getValueByName( ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander" )) ), UNO_QUERY_THROW 
);
-        sExpandedUrl = xMacroExpander->expandMacros(sUrl);
-        sal_Int32 nPos = sExpandedUrl.indexOf(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"vnd.sun.star.expand:" )));
-        if ( nPos != -1 )
-            sExpandedUrl = sExpandedUrl.copy(nPos+20);
     }
-    catch (Exception&) {}
-    return sExpandedUrl;
-}
 
-void XSLTFilter::started() throw (RuntimeException)
-{
-    osl_resetCondition(m_cTransformed);
-}
-void XSLTFilter::error(const Any& a) throw (RuntimeException)
-{
-    Exception e;
-    if ( a >>= e)
+    ::rtl::OUString
+    XSLTFilter::expandUrl(const ::rtl::OUString& sUrl)
     {
-        OString aMessage("XSLTFilter::error was called: ");
-        aMessage += OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US);
-        OSL_ENSURE(sal_False, aMessage);
+        ::rtl::OUString sExpandedUrl;
+        try
+            {
+                Reference<XComponentContext> xContext;
+                Reference<XPropertySet> xProps(m_rServiceFactory,
+                        UNO_QUERY_THROW);
+                xContext.set(xProps->getPropertyValue(::rtl::OUString(
+                        RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))),
+                        UNO_QUERY_THROW);
+                Reference<XMacroExpander>
+                        xMacroExpander(
+                                xContext->getValueByName(
+                                        ::rtl::OUString(
+                                                RTL_CONSTASCII_USTRINGPARAM( 
"/singletons/com.sun.star.util.theMacroExpander" ))),
+                                UNO_QUERY_THROW);
+                sExpandedUrl = xMacroExpander->expandMacros(sUrl);
+                sal_Int32 nPos = sExpandedUrl.indexOf(::rtl::OUString(
+                        RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.expand:" )));
+                if (nPos != -1)
+                    sExpandedUrl = sExpandedUrl.copy(nPos + 20);
+            }
+        catch (Exception&)
+            {
+            }
+        return sExpandedUrl;
     }
-    m_bError = sal_True;
-    osl_setCondition(m_cTransformed);
-}
-void XSLTFilter::closed() throw (RuntimeException)
-{
-    osl_setCondition(m_cTransformed);
-}
-void XSLTFilter::terminated() throw (RuntimeException)
-{
-    m_bTerminated = sal_True;
-    osl_setCondition(m_cTransformed);
-}
-
-OUString XSLTFilter::rel2abs(const OUString& s)
-{
 
-    Reference< XStringSubstitution > subs(m_rServiceFactory->createInstance(
-        OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.PathSubstitution" ))), 
UNO_QUERY);
-    OUString 
aWorkingDir(subs->getSubstituteVariableValue(OUString(RTL_CONSTASCII_USTRINGPARAM("$(progurl)"))));
-    INetURLObject aObj( aWorkingDir );
-    aObj.setFinalSlash();
-    bool bWasAbsolute;
-    INetURLObject aURL = aObj.smartRel2Abs(
-        s, bWasAbsolute, false, INetURLObject::WAS_ENCODED, RTL_TEXTENCODING_UTF8, true );
-    return aURL.GetMainURL(INetURLObject::NO_DECODE);
-}
-
-
-
-sal_Bool XSLTFilter::importer(
-        const Sequence<PropertyValue>& aSourceData,
-        const Reference<XDocumentHandler>& xHandler,
-        const Sequence<OUString>& msUserData)
-    throw (RuntimeException)
-{
-    if ( msUserData.getLength() < 5 )
-        return sal_False;
-
-    OUString udImport = msUserData[2];
-    OUString udStyleSheet = rel2abs(msUserData[4]);
-
-    // get information from media descriptor
-    // the imput stream that represents the imported file
-    // is most important here since we need to supply it to
-    // the sax parser that drives the supplied document handler
-    sal_Int32 nLength = aSourceData.getLength();
-    OUString aName, aFileName, aURL;
-    Reference< XInputStream > xInputStream;
-    for ( sal_Int32 i = 0 ; i < nLength; i++)
+    void
+    XSLTFilter::started() throw (RuntimeException)
     {
-        aName = aSourceData[i].Name;
-        if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("InputStream")))
-            aSourceData[i].Value >>= xInputStream;
-        else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("FileName")))
-            aSourceData[i].Value >>= aFileName;
-        else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("URL")))
-            aSourceData[i].Value >>= aURL;
+        osl_resetCondition(m_cTransformed);
     }
-    OSL_ASSERT(xInputStream.is());
-    if (!xInputStream.is()) return sal_False;
-
-    // create SAX parser that will read the document file
-    // and provide events to xHandler passed to this call
-    Reference < XParser > xSaxParser( m_rServiceFactory->createInstance(
-        OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" ))), UNO_QUERY );
-    OSL_ASSERT(xSaxParser.is());
-    if(!xSaxParser.is())return sal_False;
-
-    // create transformer
-    Sequence< Any > args(3);
-    NamedValue nv;
-
-    nv.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "StylesheetURL" ));
-    nv.Value <<= expandUrl(udStyleSheet); args[0] <<= nv;
-    nv.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "SourceURL" ));
-    nv.Value <<= aURL; args[1] <<= nv;
-    nv.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "SourceBaseURL" ));
-    nv.Value <<= OUString(INetURLObject(aURL).getBase());
-    args[2] <<= nv;
-
-    m_tcontrol = Reference< XActiveDataControl >(m_rServiceFactory->createInstanceWithArguments(
-        OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.JAXTHelper" )), args), 
UNO_QUERY);
-
-    OSL_ASSERT(xHandler.is());
-    OSL_ASSERT(xInputStream.is());
-    OSL_ASSERT(m_tcontrol.is());
-    if (xHandler.is() && xInputStream.is() && m_tcontrol.is())
+    void
+    XSLTFilter::error(const Any& a) throw (RuntimeException)
     {
-        try
-        {
-            // we want to be notfied when the processing is done...
-            m_tcontrol->addListener(Reference< XStreamListener >(this));
-
-            // connect input to transformer
-            Reference< XActiveDataSink > tsink(m_tcontrol, UNO_QUERY);
-            tsink->setInputStream(xInputStream);
-
-            // create pipe
-            Reference< XOutputStream > pipeout(m_rServiceFactory->createInstance(
-                OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.Pipe" ))), UNO_QUERY);
-            Reference< XInputStream > pipein(pipeout, UNO_QUERY);
-
-            //connect transformer to pipe
-            Reference< XActiveDataSource > tsource(m_tcontrol, UNO_QUERY);
-            tsource->setOutputStream(pipeout);
-
-            // connect pipe to sax parser
-            InputSource aInput;
-            aInput.sSystemId = aURL;
-            aInput.sPublicId = aURL;
-            aInput.aInputStream = pipein;
-
-            // set doc handler
-            xSaxParser->setDocumentHandler(new FLABridge(xHandler));
-
-            // transform
-            m_tcontrol->start();
-            // osl_waitCondition(m_cTransformed, 0);
-            if (!m_bError && !m_bTerminated)
+        Exception e;
+        if (a >>= e)
             {
-                // parse the transformed XML buffered in the pipe
-                xSaxParser->parseStream(aInput);
-                osl_waitCondition(m_cTransformed, 0);
-                return sal_True;
-            } else {
-                return sal_False;
+                OString aMessage("XSLTFilter::error was called: ");
+                aMessage += OUStringToOString(e.Message,
+                        RTL_TEXTENCODING_ASCII_US);
+                OSL_ENSURE(sal_False, aMessage);
             }
-        }
-#if OSL_DEBUG_LEVEL > 0
-        catch( Exception& exc)
-#else
-        catch( Exception& )
-#endif
-        {
-            // something went wrong
-            OSL_ENSURE(0, OUStringToOString(exc.Message, RTL_TEXTENCODING_ASCII_US).getStr());
-            return sal_False;
-        }
-    } else
-    {
-        return sal_False;
+        m_bError = sal_True;
+        osl_setCondition(m_cTransformed);
     }
-}
-
-sal_Bool XSLTFilter::exporter(
-        const Sequence<PropertyValue>& aSourceData,
-        const Sequence<OUString>& msUserData)
-    throw (RuntimeException)
-{
-    if ( msUserData.getLength() < 6 )
-        return sal_False;
-
-    // get interesting values from user data
-    OUString udImport = msUserData[2];
-    OUString udStyleSheet = rel2abs(msUserData[5]);
-
-    // read source data
-    // we are especialy interested in the output stream
-    // since that is where our xml-writer will push the data
-    // from it's data-source interface
-    OUString aName, sURL;
-    sal_Bool bIndent = sal_False;
-    OUString aDoctypePublic;
-    OUString aDoctypeSystem;
-    // Reference<XOutputStream> rOutputStream;
-    sal_Int32 nLength = aSourceData.getLength();
-    for ( sal_Int32 i = 0 ; i < nLength; i++)
+    void
+    XSLTFilter::closed() throw (RuntimeException)
     {
-        aName = aSourceData[i].Name;
-        if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Indent")))
-            aSourceData[i].Value >>= bIndent;
-        if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("DocType_Public")))
-            aSourceData[i].Value >>= aDoctypePublic;
-        if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("DocType_System")))
-            aSourceData[i].Value >>= aDoctypeSystem;
-        if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OutputStream")))
-            aSourceData[i].Value >>= m_rOutputStream;
-        else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("URL" ) ))
-            aSourceData[i].Value >>= sURL;
+        osl_setCondition(m_cTransformed);
     }
-
-    if (!m_rDocumentHandler.is()) {
-        // get the document writer
-        m_rDocumentHandler = Reference<XExtendedDocumentHandler>(
-            m_rServiceFactory->createInstance(
-            OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ))),
-                UNO_QUERY);
+    void
+    XSLTFilter::terminated() throw (RuntimeException)
+    {
+        m_bTerminated = sal_True;
+        osl_setCondition(m_cTransformed);
     }
 
-    // create transformer
-    Sequence< Any > args(4);
-    NamedValue nv;
-    nv.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "StylesheetURL" ));
-    nv.Value <<= expandUrl(udStyleSheet); args[0] <<= nv;
-    nv.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" ));
-    nv.Value <<= sURL; args[1] <<= nv;
-    nv.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DoctypeSystem" ));
-    nv.Value <<= aDoctypeSystem; args[2] <<= nv;
-    nv.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "DoctypePublic" ));
-    nv.Value <<= aDoctypePublic; args[3] <<= nv;
-    nv.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetBaseURL" ));
-    INetURLObject ineturl(sURL);
-    ineturl.removeSegment();
-    m_aExportBaseUrl = ineturl.GetMainURL(INetURLObject::NO_DECODE);
-    nv.Value <<= m_aExportBaseUrl;
-    args[3] <<= nv;
-
-    m_tcontrol = Reference< XActiveDataControl >(m_rServiceFactory->createInstanceWithArguments(
-        OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.JAXTHelper" )), args), 
UNO_QUERY);
-
-    OSL_ASSERT(m_rDocumentHandler.is());
-    OSL_ASSERT(m_rOutputStream.is());
-    OSL_ASSERT(m_tcontrol.is());
-    if (m_tcontrol.is() && m_rOutputStream.is() && m_rDocumentHandler.is())
+    OUString
+    XSLTFilter::rel2abs(const OUString& s)
     {
-        // we want to be notfied when the processing is done...
-        m_tcontrol->addListener(Reference< XStreamListener >(this));
-
-        // create pipe
-        Reference< XOutputStream > pipeout(m_rServiceFactory->createInstance(
-            OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.Pipe" ))), UNO_QUERY);
-        Reference< XInputStream > pipein(pipeout, UNO_QUERY);
-
-        // connect sax writer to pipe
-        Reference< XActiveDataSource > xmlsource(m_rDocumentHandler, UNO_QUERY);
-        xmlsource->setOutputStream(pipeout);
-
-        // connect pipe to transformer
-        Reference< XActiveDataSink > tsink(m_tcontrol, UNO_QUERY);
-        tsink->setInputStream(pipein);
-
-        // connect transformer to output
-        Reference< XActiveDataSource > tsource(m_tcontrol, UNO_QUERY);
-        tsource->setOutputStream(m_rOutputStream);
-
-        // we will start receiving events after returning 'true'.
-        // we will start the transformation as soon as we receive the startDocument 
-        // event.
-        return sal_True;
+
+        Reference<XStringSubstitution>
+                subs(
+                        m_rServiceFactory->createInstance(
+                                OUString(
+                                        RTL_CONSTASCII_USTRINGPARAM( 
"com.sun.star.util.PathSubstitution" ))),
+                        UNO_QUERY);
+        OUString aWorkingDir(subs->getSubstituteVariableValue(OUString(
+                RTL_CONSTASCII_USTRINGPARAM("$(progurl)"))));
+        INetURLObject aObj(aWorkingDir);
+        aObj.setFinalSlash();
+        bool bWasAbsolute;
+        INetURLObject aURL = aObj.smartRel2Abs(s, bWasAbsolute, false,
+                INetURLObject::WAS_ENCODED, RTL_TEXTENCODING_UTF8, true);
+        return aURL.GetMainURL(INetURLObject::NO_DECODE);
     }
-    else
+
+    sal_Bool
+    XSLTFilter::importer(const Sequence<PropertyValue>& aSourceData,
+            const Reference<XDocumentHandler>& xHandler, const Sequence<
+                    OUString>& msUserData) throw (RuntimeException)
     {
-        return sal_False;
-    }
-}
+        if (msUserData.getLength() < 5)
+            return sal_False;
 
-// for the DocumentHandler implementation, we just proxy the the
-// events to the XML writer that we created upon the output stream
-// that was provided by the XMLFilterAdapter
-void XSLTFilter::startDocument() throw (SAXException,RuntimeException){
-    OSL_ASSERT(m_rDocumentHandler.is());
-    m_rDocumentHandler->startDocument();
-    m_tcontrol->start();
-}
+        OUString udImport = msUserData[2];
+        OUString udStyleSheet = rel2abs(msUserData[4]);
+
+        // get information from media descriptor
+        // the imput stream that represents the imported file
+        // is most important here since we need to supply it to
+        // the sax parser that drives the supplied document handler
+        sal_Int32 nLength = aSourceData.getLength();
+        OUString aName, aFileName, aURL;
+        Reference<XInputStream> xInputStream;
+        for (sal_Int32 i = 0; i < nLength; i++)
+            {
+                aName = aSourceData[i].Name;
+                if (aName.equalsAscii("InputStream"))
+                    aSourceData[i].Value >>= xInputStream;
+                else if (aName.equalsAscii("FileName"))
+                    aSourceData[i].Value >>= aFileName;
+                else if (aName.equalsAscii("URL"))
+                    aSourceData[i].Value >>= aURL;
+            }
+        OSL_ASSERT(xInputStream.is());
+        if (!xInputStream.is())
+            return sal_False;
 
-void XSLTFilter::endDocument() throw (SAXException, RuntimeException){
-    OSL_ASSERT(m_rDocumentHandler.is());
-    m_rDocumentHandler->endDocument();
-    // wait for the transformer to finish
-    osl_waitCondition(m_cTransformed, 0);
-    if (!m_bError && !m_bTerminated)
-    {
-        return;
-    } else {        
-        throw RuntimeException();
+        // create SAX parser that will read the document file
+        // and provide events to xHandler passed to this call
+        Reference<XParser>
+                xSaxParser(
+                        m_rServiceFactory->createInstance(
+                                OUString(
+                                        RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" 
))),
+                        UNO_QUERY);
+        OSL_ASSERT(xSaxParser.is());
+        if (!xSaxParser.is())
+            return sal_False;
+
+        // create transformer
+        Sequence<Any> args(3);
+        NamedValue nv;
+
+        nv.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "StylesheetURL" ));
+        nv.Value <<= expandUrl(udStyleSheet);
+        args[0] <<= nv;
+        nv.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "SourceURL" ));
+        nv.Value <<= aURL;
+        args[1] <<= nv;
+        nv.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "SourceBaseURL" ));
+        nv.Value <<= OUString(INetURLObject(aURL).getBase());
+        args[2] <<= nv;
+
+        OUString 
serviceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.documentconversion.LibXSLTTransformer"));
+        if (msUserData[1].getLength() != 0)
+            serviceName = msUserData[1];
+
+        m_tcontrol = Reference<XActiveDataControl> 
(m_rServiceFactory->createInstanceWithArguments(serviceName, args), UNO_QUERY);
+
+        OSL_ASSERT(xHandler.is());
+        OSL_ASSERT(xInputStream.is());
+        OSL_ASSERT(m_tcontrol.is());
+        if (xHandler.is() && xInputStream.is() && m_tcontrol.is())
+            {
+                try
+                    {
+                        // we want to be notfied when the processing is done...
+                        m_tcontrol->addListener(Reference<XStreamListener> (
+                                this));
+
+                        // connect input to transformer
+                        Reference<XActiveDataSink> tsink(m_tcontrol, UNO_QUERY);
+                        tsink->setInputStream(xInputStream);
+
+                        // create pipe
+                        Reference<XOutputStream>
+                                pipeout(
+                                        m_rServiceFactory->createInstance(
+                                                OUString(
+                                                        RTL_CONSTASCII_USTRINGPARAM( 
"com.sun.star.io.Pipe" ))),
+                                        UNO_QUERY);
+                        Reference<XInputStream> pipein(pipeout, UNO_QUERY);
+
+                        //connect transformer to pipe
+                        Reference<XActiveDataSource> tsource(m_tcontrol,
+                                UNO_QUERY);
+                        tsource->setOutputStream(pipeout);
+
+                        // connect pipe to sax parser
+                        InputSource aInput;
+                        aInput.sSystemId = aURL;
+                        aInput.sPublicId = aURL;
+                        aInput.aInputStream = pipein;
+
+                        // set doc handler
+                        xSaxParser->setDocumentHandler(new FLABridge(xHandler));
+
+                        // transform
+                        m_tcontrol->start();
+                        // osl_waitCondition(m_cTransformed, 0);
+                        if (!m_bError && !m_bTerminated)
+                            {
+                                // parse the transformed XML buffered in the pipe
+                                xSaxParser->parseStream(aInput);
+                                osl_waitCondition(m_cTransformed, 0);
+                                return sal_True;
+                            }
+                        else
+                            {
+                                return sal_False;
+                            }
+                    }
+#if OSL_DEBUG_LEVEL > 0
+                catch( Exception& exc)
+#else
+                catch (Exception&)
+#endif
+                    {
+                        // something went wrong
+                        OSL_ENSURE(0, OUStringToOString(exc.Message, 
RTL_TEXTENCODING_ASCII_US).getStr());
+                        return sal_False;
+                    }
+            }
+        else
+            {
+                return sal_False;
+            }
     }
 
-}
+    sal_Bool
+    XSLTFilter::exporter(const Sequence<PropertyValue>& aSourceData,
+            const Sequence<OUString>& msUserData) throw (RuntimeException)
+    {
+        if (msUserData.getLength() < 6)
+            return sal_False;
 
-void XSLTFilter::startElement(const OUString& str, const Reference<XAttributeList>& attriblist)
-    throw (SAXException, RuntimeException)
-{
-    OSL_ASSERT(m_rDocumentHandler.is());
-//     SvXMLAttributeList* _attriblist=SvXMLAttributeList::getImplementation(attriblist);
-    m_rDocumentHandler->startElement(str, attriblist);
-}
+        // get interesting values from user data
+        OUString udImport = msUserData[2];
+        OUString udStyleSheet = rel2abs(msUserData[5]);
+
+        // read source data
+        // we are especialy interested in the output stream
+        // since that is where our xml-writer will push the data
+        // from it's data-source interface
+        OUString aName, sURL;
+        sal_Bool bIndent = sal_False;
+        OUString aDoctypePublic;
+        OUString aDoctypeSystem;
+        // Reference<XOutputStream> rOutputStream;
+        sal_Int32 nLength = aSourceData.getLength();
+        for (sal_Int32 i = 0; i < nLength; i++)
+            {
+                aName = aSourceData[i].Name;
+                if (aName.equalsAscii("Indent"))
+                    aSourceData[i].Value >>= bIndent;
+                if (aName.equalsAscii("DocType_Public"))
+                    aSourceData[i].Value >>= aDoctypePublic;
+                if (aName.equalsAscii("DocType_System"))
+                    aSourceData[i].Value >>= aDoctypeSystem;
+                if (aName.equalsAscii("OutputStream"))
+                    aSourceData[i].Value >>= m_rOutputStream;
+                else if (aName.equalsAscii("URL"))
+                    aSourceData[i].Value >>= sURL;
+            }
 
-void XSLTFilter::endElement(const OUString& str)
-    throw (SAXException, RuntimeException)
-{
-    OSL_ASSERT(m_rDocumentHandler.is());
-    m_rDocumentHandler->endElement(str);
-}
+        if (!getDelegate().is())
+            {
+                // get the document writer
+                setDelegate(Reference<XExtendedDocumentHandler> (
+                                m_rServiceFactory->createInstance(
+                                        OUString(
+                                                RTL_CONSTASCII_USTRINGPARAM( 
"com.sun.star.xml.sax.Writer" ))),
+                                UNO_QUERY));
+            }
 
-void XSLTFilter::characters(const OUString& str)
-    throw (SAXException, RuntimeException)
-{
-    OSL_ASSERT(m_rDocumentHandler.is());
-    m_rDocumentHandler->characters(str);
-}
+        // create transformer
+        Sequence<Any> args(4);
+        NamedValue nv;
+        nv.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "StylesheetURL" ));
+        nv.Value <<= expandUrl(udStyleSheet);
+        args[0] <<= nv;
+        nv.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "TargetURL" ));
+        nv.Value <<= sURL;
+        args[1] <<= nv;
+        nv.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "DoctypeSystem" ));
+        nv.Value <<= aDoctypeSystem;
+        args[2] <<= nv;
+        nv.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "DoctypePublic" ));
+        nv.Value <<= aDoctypePublic;
+        args[3] <<= nv;
+        nv.Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "TargetBaseURL" ));
+        INetURLObject ineturl(sURL);
+        ineturl.removeSegment();
+        m_aExportBaseUrl = ineturl.GetMainURL(INetURLObject::NO_DECODE);
+        nv.Value <<= m_aExportBaseUrl;
+        args[3] <<= nv;
+
+        OUString 
serviceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.documentconversion.LibXSLTTransformer"));
+        if (msUserData[1].getLength() != 0)
+            serviceName = msUserData[1];
+
+        m_tcontrol = Reference<XActiveDataControl> 
(m_rServiceFactory->createInstanceWithArguments(serviceName, args), UNO_QUERY);
+
+        OSL_ASSERT(m_rOutputStream.is());
+        OSL_ASSERT(m_tcontrol.is());
+        if (m_tcontrol.is() && m_rOutputStream.is())
+            {
+                // we want to be notfied when the processing is done...
+                m_tcontrol->addListener(Reference<XStreamListener> (this));
+
+                // create pipe
+                Reference<XOutputStream>
+                        pipeout(
+                                m_rServiceFactory->createInstance(
+                                        OUString(
+                                                RTL_CONSTASCII_USTRINGPARAM( 
"com.sun.star.io.Pipe" ))),
+                                UNO_QUERY);
+                Reference<XInputStream> pipein(pipeout, UNO_QUERY);
+
+                // connect sax writer to pipe
+                Reference<XActiveDataSource> xmlsource(getDelegate(),
+                        UNO_QUERY);
+                xmlsource->setOutputStream(pipeout);
+
+                // connect pipe to transformer
+                Reference<XActiveDataSink> tsink(m_tcontrol, UNO_QUERY);
+                tsink->setInputStream(pipein);
+
+                // connect transformer to output
+                Reference<XActiveDataSource> tsource(m_tcontrol, UNO_QUERY);
+                tsource->setOutputStream(m_rOutputStream);
+
+                // we will start receiving events after returning 'true'.
+                // we will start the transformation as soon as we receive the startDocument
+                // event.
+                return sal_True;
+            }
+        else
+            {
+                return sal_False;
+            }
+    }
 
-void XSLTFilter::ignorableWhitespace(const OUString& str)
-    throw (SAXException, RuntimeException)
-{
-    OSL_ASSERT(m_rDocumentHandler.is());
-    if (!m_bPrettyPrint) return;
-    m_rDocumentHandler->ignorableWhitespace(str);
-}
+    // for the DocumentHandler implementation, we just proxy the the
+    // events to the XML writer that we created upon the output stream
+    // that was provided by the XMLFilterAdapter
+    void
+    XSLTFilter::startDocument() throw (SAXException, RuntimeException)
+    {
+        ExtendedDocumentHandlerAdapter::startDocument();
+        m_tcontrol->start();
+    }
 
-void  XSLTFilter::processingInstruction(const OUString& str, const OUString& str2)
-    throw (SAXException, RuntimeException)
-{
-    OSL_ASSERT(m_rDocumentHandler.is());
-    m_rDocumentHandler->processingInstruction(str, str2);
-}
+    void
+    XSLTFilter::endDocument() throw (SAXException, RuntimeException)
+    {
+        ExtendedDocumentHandlerAdapter::endDocument();
+        // wait for the transformer to finish
+        osl_waitCondition(m_cTransformed, 0);
+        if (!m_bError && !m_bTerminated)
+            {
+                return;
+            }
+        else
+            {
+                throw RuntimeException();
+            }
 
-void XSLTFilter::setDocumentLocator(const Reference<XLocator>& doclocator)
-    throw (SAXException, RuntimeException)
-{
-    OSL_ASSERT(m_rDocumentHandler.is());
-    m_rDocumentHandler->setDocumentLocator(doclocator);
-}
+    }
 
-// --------------------------------------
-// Component management
-// --------------------------------------
-#define SERVICE_NAME "com.sun.star.documentconversion.XSLTFilter"
-#define IMPLEMENTATION_NAME "com.sun.star.comp.documentconversion.XSLTFilter"
+    // --------------------------------------
+    // Component management
+    // --------------------------------------
+#define FILTER_SERVICE_NAME "com.sun.star.documentconversion.XSLTFilter"
+#define FILTER_IMPL_NAME "com.sun.star.comp.documentconversion.XSLTFilter"
+#define TRANSFORMER_SERVICE_NAME "com.sun.star.documentconversion.LibXSLTTransformer"
+#define TRANSFORMER_IMPL_NAME "com.sun.star.comp.documentconversion.LibXSLTTransformer"
 
-static Reference< XInterface > SAL_CALL CreateInstance( const Reference< XMultiServiceFactory > &r)
-{
-    return Reference< XInterface >(( OWeakObject *)new XSLTFilter(r));
-}
+    static Reference<XInterface> SAL_CALL
+    CreateTransformerInstance(const Reference<XMultiServiceFactory> &r)
+    {
+        return Reference<XInterface> ((OWeakObject *) new LibXSLTTransformer(r));
+    }
 
-static Sequence< OUString > getSupportedServiceNames()
-{
-    static Sequence < OUString > *pNames = 0;
-    if( ! pNames )
+    static Reference<XInterface> SAL_CALL
+    CreateFilterInstance(const Reference<XMultiServiceFactory> &r)
     {
-        MutexGuard guard( Mutex::getGlobalMutex() );
-        if( !pNames )
-        {
-            static Sequence< OUString > seqNames(1);
-                seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICE_NAME));
-            pNames = &seqNames;
-        }
+        return Reference<XInterface> ((OWeakObject *) new XSLTFilter(r));
     }
-    return *pNames;
-}
 
 }
 
@@ -677,57 +644,98 @@ using namespace XSLT;
 
 extern "C"
 {
-void SAL_CALL component_getImplementationEnvironment(
-    const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
-{
-    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-}
-
-sal_Bool SAL_CALL component_writeInfo(void * /* pServiceManager */, void * pRegistryKey )
-{
-    if (pRegistryKey)
+    void SAL_CALL
+    component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,
+            uno_Environment ** /* ppEnv */)
     {
-        try
-        {
-            Reference< XRegistryKey > xNewKey(
-                reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey(
-                    OUString( RTL_CONSTASCII_USTRINGPARAM( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" 
)) ) );
-
-            const Sequence< OUString > & rSNL = getSupportedServiceNames();
-            const OUString * pArray = rSNL.getConstArray();
-            for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
-                xNewKey->createKey( pArray[nPos] );
-
-            return sal_True;
-        }
-        catch (InvalidRegistryException &)
-        {
-            OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
-        }
+        *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
     }
-    return sal_False;
-}
 
-void * SAL_CALL component_getFactory(
-    const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
-{
-    void * pRet = 0;
+    sal_Bool SAL_CALL
+    component_writeInfo(void * /* pServiceManager */, void * pRegistryKey)
+    {
+        sal_Bool bRetVal = sal_False;
+        if (pRegistryKey)
+            {
+                try
+                    {
+                        Reference<XRegistryKey> pXNewKey(
+                                static_cast<XRegistryKey*> (pRegistryKey));
+                        pXNewKey->createKey(
+                                OUString(
+                                        RTL_CONSTASCII_USTRINGPARAM( "/" FILTER_IMPL_NAME 
"/UNO/SERVICES/" FILTER_SERVICE_NAME )));
+                        bRetVal = sal_True;
+
+                        pXNewKey = static_cast<XRegistryKey*> (pRegistryKey);
+                        pXNewKey->createKey(
+                                OUString(
+                                        RTL_CONSTASCII_USTRINGPARAM( "/" TRANSFORMER_IMPL_NAME 
"/UNO/SERVICES/" TRANSFORMER_SERVICE_NAME )));
+                        bRetVal = sal_True;
+                    }
+                catch (InvalidRegistryException&)
+                    {
+                        OSL_ENSURE(sal_False, "InvalidRegistryException caught");
+                        bRetVal = sal_False;
+                    }
+            }
+        return bRetVal;
+    }
 
-    if (pServiceManager && rtl_str_compare( pImplName, IMPLEMENTATION_NAME ) == 0)
+    void *
+    SAL_CALL component_getFactory(const sal_Char * pImplName,
+            void * pServiceManager, void * /* pRegistryKey */)
     {
-        Reference< XSingleServiceFactory > xFactory( createSingleFactory(
-            reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
-            OUString::createFromAscii( pImplName ),
-            CreateInstance, getSupportedServiceNames() ) );
-
-        if (xFactory.is())
-        {
-            xFactory->acquire();
-            pRet = xFactory.get();
-        }
+        void * pRet = 0;
+
+        if (pServiceManager)
+            {
+                if (rtl_str_compare(pImplName, FILTER_IMPL_NAME) == 0)
+                    {
+                        Sequence<OUString> serviceNames(1);
+                        serviceNames.getArray()[0]
+                                = OUString(
+                                        RTL_CONSTASCII_USTRINGPARAM( FILTER_SERVICE_NAME ));
+
+                        Reference<XSingleServiceFactory>
+                                xFactory(
+                                        createSingleFactory(
+                                                reinterpret_cast<XMultiServiceFactory *> 
(pServiceManager),
+                                                OUString::createFromAscii(
+                                                        pImplName),
+                                                CreateFilterInstance,
+                                                serviceNames));
+
+                        if (xFactory.is())
+                            {
+                                xFactory->acquire();
+                                pRet = xFactory.get();
+                            }
+                    }
+                else if (rtl_str_compare(pImplName, TRANSFORMER_IMPL_NAME) == 0)
+                    {
+                        Sequence<OUString> serviceNames(1);
+                        serviceNames.getArray()[0]
+                                = OUString(
+                                        RTL_CONSTASCII_USTRINGPARAM( TRANSFORMER_SERVICE_NAME ));
+                        Reference<XSingleServiceFactory>
+                                xFactory(
+                                        createSingleFactory(
+                                                reinterpret_cast<XMultiServiceFactory *> 
(pServiceManager),
+                                                OUString::createFromAscii(
+                                                        pImplName),
+                                                CreateTransformerInstance,
+                                                serviceNames));
+
+                        if (xFactory.is())
+                            {
+                                xFactory->acquire();
+                                pRet = xFactory.get();
+                            }
+
+                    }
+            }
+        return pRet;
     }
-    return pRet;
-}
 
 } // extern "C"
 
diff --git a/filter/source/xsltfilter/makefile.mk b/filter/source/xsltfilter/makefile.mk
index a5e2713..ee23cfd 100644
--- a/filter/source/xsltfilter/makefile.mk
+++ b/filter/source/xsltfilter/makefile.mk
@@ -33,9 +33,19 @@ LIBTARGET=NO
 
 # --- Settings -----------------------------------------------------
 CLASSDIR!:=$(CLASSDIR)$/$(TARGET)
+
 .INCLUDE: settings.mk
 
-SLOFILES=$(SLO)$/XSLTFilter.obj $(SLO)$/fla.obj
+.IF "$(SYSTEM_LIBXSLT)" == "YES"
+CFLAGS+= $(LIBXSLT_CFLAGS)
+.ELSE
+LIBXSLTINCDIR=external$/libxslt
+CFLAGS+= -I$(SOLARINCDIR)$/$(LIBXSLTINCDIR)
+.ENDIF
+
+
+
+SLOFILES=$(SLO)$/XSLTFilter.obj $(SLO)$/LibXSLTTransformer.obj $(SLO)$/fla.obj
 LIBNAME=xsltfilter
 SHL1TARGETDEPN=makefile.mk
 SHL1OBJS=$(SLOFILES)
@@ -50,7 +60,9 @@ SHL1STDLIBS= \
     $(CPPUHELPERLIB)    \
     $(CPPULIB)          \
     $(XMLOFFLIB) \
-    $(SALLIB)
+    $(SALLIB) \
+    $(LIBXML2LIB) \
+    $(XSLTLIB)
 
 .IF "$(SOLAR_JAVA)"!=""
 

--- End Message ---
--- Begin Message ---
Hi, 

there was one bit missing from my last mail: the changed implementation
name of the flat xml import/export also needs to be changed in the
filter config files . See attached patch.

Bye, 

Peter
From 7bb0d9765900c3397125c87e5cedabeec0c0bc6e Mon Sep 17 00:00:00 2001
From: Peter Jentsch <pjotr@guineapics.de>
Date: Wed, 2 Feb 2011 01:22:45 +0100
Subject: [PATCH 15/15] fixed flat xml export service name in configuration files

---
 .../config/fragments/filters/ODG_FlatXML.xcu       |    2 +-
 .../config/fragments/filters/ODP_FlatXML.xcu       |    2 +-
 .../config/fragments/filters/ODS_FlatXML.xcu       |    2 +-
 .../config/fragments/filters/ODT_FlatXML.xcu       |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/filter/source/config/fragments/filters/ODG_FlatXML.xcu 
b/filter/source/config/fragments/filters/ODG_FlatXML.xcu
index f528248..0e386ad 100644
--- a/filter/source/config/fragments/filters/ODG_FlatXML.xcu
+++ b/filter/source/config/fragments/filters/ODG_FlatXML.xcu
@@ -3,7 +3,7 @@
         <prop oor:name="Type"><value>draw_ODG_FlatXML</value></prop>
         <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
         <prop oor:name="UIComponent"/>
-        <prop oor:name="UserData"><value 
oor:separator=",">com.sun.star.comp.filter.FlatXmlCpp,,com.sun.star.comp.Draw.XMLOasisImporter,com.sun.star.comp.Draw.XMLOasisExporter,,,true</value></prop>
+        <prop oor:name="UserData"><value 
oor:separator=",">com.sun.star.comp.filter.OdfFlatXml,,com.sun.star.comp.Draw.XMLOasisImporter,com.sun.star.comp.Draw.XMLOasisExporter,,,true</value></prop>
         <prop 
oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
         <prop oor:name="TemplateName"/>
         <prop oor:name="UIName">
diff --git a/filter/source/config/fragments/filters/ODP_FlatXML.xcu 
b/filter/source/config/fragments/filters/ODP_FlatXML.xcu
index 8f15d7c..121cb2d 100644
--- a/filter/source/config/fragments/filters/ODP_FlatXML.xcu
+++ b/filter/source/config/fragments/filters/ODP_FlatXML.xcu
@@ -3,7 +3,7 @@
         <prop oor:name="Type"><value>impress_ODP_FlatXML</value></prop>
         <prop 
oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
         <prop oor:name="UIComponent"/>
-        <prop oor:name="UserData"><value 
oor:separator=",">com.sun.star.comp.filter.FlatXmlCpp,,com.sun.star.comp.Impress.XMLOasisImporter,com.sun.star.comp.Impress.XMLOasisExporter,,,true</value></prop>
+        <prop oor:name="UserData"><value 
oor:separator=",">com.sun.star.comp.filter.OdfFlatXml,,com.sun.star.comp.Impress.XMLOasisImporter,com.sun.star.comp.Impress.XMLOasisExporter,,,true</value></prop>
         <prop 
oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
         <prop oor:name="TemplateName"/>
         <prop oor:name="UIName">
diff --git a/filter/source/config/fragments/filters/ODS_FlatXML.xcu 
b/filter/source/config/fragments/filters/ODS_FlatXML.xcu
index df8e856..7ae34aa 100644
--- a/filter/source/config/fragments/filters/ODS_FlatXML.xcu
+++ b/filter/source/config/fragments/filters/ODS_FlatXML.xcu
@@ -3,7 +3,7 @@
         <prop oor:name="Type"><value>calc_ODS_FlatXML</value></prop>
         <prop 
oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
         <prop oor:name="UIComponent"/>
-        <prop oor:name="UserData"><value 
oor:separator=",">com.sun.star.comp.filter.FlatXmlCpp,,com.sun.star.comp.Calc.XMLOasisImporter,com.sun.star.comp.Calc.XMLOasisExporter,,,true</value></prop>
+        <prop oor:name="UserData"><value 
oor:separator=",">com.sun.star.comp.filter.OdfFlatXml,,com.sun.star.comp.Calc.XMLOasisImporter,com.sun.star.comp.Calc.XMLOasisExporter,,,true</value></prop>
         <prop 
oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
         <prop oor:name="TemplateName"/>
         <prop oor:name="UIName">
diff --git a/filter/source/config/fragments/filters/ODT_FlatXML.xcu 
b/filter/source/config/fragments/filters/ODT_FlatXML.xcu
index cf764ec..e08d39d 100644
--- a/filter/source/config/fragments/filters/ODT_FlatXML.xcu
+++ b/filter/source/config/fragments/filters/ODT_FlatXML.xcu
@@ -3,7 +3,7 @@
         <prop oor:name="Type"><value>writer_ODT_FlatXML</value></prop>
         <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
         <prop oor:name="UIComponent"/>
-        <prop oor:name="UserData"><value 
oor:separator=",">com.sun.star.comp.filter.FlatXmlCpp,,com.sun.star.comp.Writer.XMLOasisImporter,com.sun.star.comp.Writer.XMLOasisExporter,,,true</value></prop>
+        <prop oor:name="UserData"><value 
oor:separator=",">com.sun.star.comp.filter.OdfFlatXml,,com.sun.star.comp.Writer.XMLOasisImporter,com.sun.star.comp.Writer.XMLOasisExporter,,,true</value></prop>
         <prop 
oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
         <prop oor:name="TemplateName"/>
         <prop oor:name="UIName">
-- 
1.7.1


--- End Message ---

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.