blob: 812be52b87ab48538f0d8c18fd9111ad380696a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#include "xobject_value.h"
#include <xalanc/XSLT/XSLTInputSource.hpp>
#include <xalanc/XalanDOM/XalanDocumentFragment.hpp>
#include <boost/algorithm/string.hpp>
#include <string>
#include "support/xalan_string.h"
namespace InputXSLT {
namespace XObjectValue {
template <>
std::string get<std::string>(const xalan::XObjectPtr& ptr) {
return boost::trim_copy(toString(ptr->str()));
}
template <>
xalan::XObjectPtr get<xalan::XObjectPtr>(const xalan::XObjectPtr& ptr) {
return ptr;
}
template <>
xalan::XSLTInputSource get<xalan::XSLTInputSource>(
const xalan::XObjectPtr& ptr) {
switch ( ptr->getType() ) {
case xalan::XObject::eObjectType::eTypeNodeSet: {
return xalan::XSLTInputSource(ptr->nodeset().item(0));
}
case xalan::XObject::eObjectType::eTypeResultTreeFrag: {
return xalan::XSLTInputSource(ptr->rtree().getFirstChild());
}
default: {
return xalan::XSLTInputSource(ptr->str());
}
}
}
}
}
|