From bd39d49464dbd17eb3d4cdbb5784431e43e56fbf Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 29 Jun 2014 20:36:28 +0200 Subject: Switched FunctionWriteFile content parameter to xalan::XalanNode pointer * i.e. "write-file" now supports the serialization of given DOM structures ** this will be needed e.g. if FunctionTransform returns the result as a DOM tree instead of as a plain string ** enables the creation of multiple XML documents from within a single transformation *** i.e. backports the functionality provided in XSLT 2.0 by "xsl:result-document" to xalan's XSLT 1.0 * changed test cases accordingly --- src/support/type/xobject_value.cc | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'src/support/type') diff --git a/src/support/type/xobject_value.cc b/src/support/type/xobject_value.cc index 46ce53c..a788e8e 100644 --- a/src/support/type/xobject_value.cc +++ b/src/support/type/xobject_value.cc @@ -46,25 +46,35 @@ xalan::XObjectPtr XObjectValue::get( } template <> -xalan::XSLTInputSource XObjectValue::get( +xalan::XalanNode* XObjectValue::get( const xalan::XObjectPtr& ptr) const { switch ( ptr->getType() ) { case xalan::XObject::eObjectType::eTypeNodeSet: { - return xalan::XSLTInputSource( - ptr->nodeset().item(0) - ); + return ptr->nodeset().item(0); } case xalan::XObject::eObjectType::eTypeResultTreeFrag: { - return xalan::XSLTInputSource( - ptr->rtree().getFirstChild() - ); + return ptr->rtree().getFirstChild(); } default: { - return xalan::XSLTInputSource( - this->get(ptr).string().data() - ); + return nullptr; } } } +template <> +xalan::XSLTInputSource XObjectValue::get( + const xalan::XObjectPtr& ptr) const { + xalan::XalanNode* const node( + this->get(ptr) + ); + + if ( node == nullptr ) { + return xalan::XSLTInputSource( + this->get(ptr).string().data() + ); + } else { + return xalan::XSLTInputSource(node); + } +} + } -- cgit v1.2.3