diff options
author | Adrian Kummerländer | 2014-04-17 21:51:20 +0200 |
---|---|---|
committer | Adrian Kummerländer | 2014-04-17 21:51:20 +0200 |
commit | 9648c804a23278fcdf66e0f78c350e2ddce492ee (patch) | |
tree | 3da73f21148ffaa3773abf5cd7a0d35cba76f8e5 /test.cc | |
download | InputXSLT-9648c804a23278fcdf66e0f78c350e2ddce492ee.tar InputXSLT-9648c804a23278fcdf66e0f78c350e2ddce492ee.tar.gz InputXSLT-9648c804a23278fcdf66e0f78c350e2ddce492ee.tar.bz2 InputXSLT-9648c804a23278fcdf66e0f78c350e2ddce492ee.tar.lz InputXSLT-9648c804a23278fcdf66e0f78c350e2ddce492ee.tar.xz InputXSLT-9648c804a23278fcdf66e0f78c350e2ddce492ee.tar.zst InputXSLT-9648c804a23278fcdf66e0f78c350e2ddce492ee.zip |
First commit of _InputXSLT_
* quick and dirty proof-of-concept for adding plain-file access to XSLT
** based on Apache Xalan XSLT processor
* The idea is to create something like a static counterpart to Symphony CMS
* Adding functions to XSLT for file system, plain file and binary file (read)-access
* This project aims to test how such functionality can be integrated into XSLT
** if it works it could be developed into a nice static content transformation system
* Contrary to the popular opinion I actually like XML and XSLT when used responsibly
Diffstat (limited to 'test.cc')
-rw-r--r-- | test.cc | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -0,0 +1,37 @@ +#include <xalanc/Include/PlatformDefinitions.hpp> +#include <xercesc/util/PlatformUtils.hpp> +#include <xalanc/XalanTransformer/XalanTransformer.hpp> +#include <xalanc/XSLT/XSLTInputSource.hpp> + +#include "src/read_file_command.h" + +int main() { + xercesc::XMLPlatformUtils::Initialize(); + xalanc_1_11::XalanTransformer::initialize(); + + const xalanc_1_11::XalanDOMString customNamespace( + "http://ExternalFunction.xalan-c++.xml.apache.org" + ); + + xalanc_1_11::XalanTransformer transformer; + + transformer.installExternalFunction( + customNamespace, + xalanc_1_11::XalanDOMString("read-file"), + FunctionFileRead() + ); + + xalanc_1_11::XSLTInputSource input("dummy/in.xml"); + xalanc_1_11::XSLTInputSource tranformation("dummy/transform.xsl"); + xalanc_1_11::XSLTResultTarget output("dummy/out.xml"); + + int result(transformer.transform( + input, + tranformation, + output + )); + + xalanc_1_11::XalanTransformer::terminate(); + + return result; +} |