aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-08-18 20:11:18 +0200
committerAdrian Kummerlaender2014-08-18 20:11:18 +0200
commitb31f9170c2bc2330442070968d3cb334cadb5faa (patch)
treeeb5eef97afdf5d5f4066743ec2b8ed05241a71e4
parent8ed33c3e9e2648a5a0150c05e06c228336e9e9d6 (diff)
downloadInputXSLT-b31f9170c2bc2330442070968d3cb334cadb5faa.tar
InputXSLT-b31f9170c2bc2330442070968d3cb334cadb5faa.tar.gz
InputXSLT-b31f9170c2bc2330442070968d3cb334cadb5faa.tar.bz2
InputXSLT-b31f9170c2bc2330442070968d3cb334cadb5faa.tar.lz
InputXSLT-b31f9170c2bc2330442070968d3cb334cadb5faa.tar.xz
InputXSLT-b31f9170c2bc2330442070968d3cb334cadb5faa.tar.zst
InputXSLT-b31f9170c2bc2330442070968d3cb334cadb5faa.zip
Renamed FunctionExternalCommand result root node
* this change was implemented to match the naming scheme of all other external functions * updated external text formatter test case accordingly
-rw-r--r--src/function/external_command.cc12
-rw-r--r--test/external_text_formatter/transformation.xsl14
2 files changed, 11 insertions, 15 deletions
diff --git a/src/function/external_command.cc b/src/function/external_command.cc
index bd2bf84..7d91a9a 100644
--- a/src/function/external_command.cc
+++ b/src/function/external_command.cc
@@ -41,7 +41,7 @@ namespace InputXSLT {
DomDocumentCache::document_ptr FunctionExternalCommand::constructDocument(
std::string command,
- boost::optional<std::string> stdinText
+ boost::optional<std::string> input
) const {
DomDocumentCache::document_ptr domDocument(
DomDocumentCache::createDocument("content")
@@ -56,18 +56,18 @@ DomDocumentCache::document_ptr FunctionExternalCommand::constructDocument(
boost::process::launch_shell(command, context)
);
- if ( stdinText ) {
+ if ( input ) {
boost::process::postream& inputStream = commandProcess.get_stdin();
- inputStream << *stdinText;
+ inputStream << *input;
inputStream.close();
}
boost::process::pistream& outputStream = commandProcess.get_stdout();
boost::process::status status = commandProcess.wait();
- ResultNodeFacade result(domDocument.get(), "output");
- result.setAttribute("command", command);
- result.setAttribute("code", std::to_string(status.exit_status()));
+ ResultNodeFacade result(domDocument.get(), "command");
+ result.setAttribute("executed", command);
+ result.setAttribute("code", std::to_string(status.exit_status()));
if ( status.exited() ) {
try {
diff --git a/test/external_text_formatter/transformation.xsl b/test/external_text_formatter/transformation.xsl
index c6f11fc..eb92c46 100644
--- a/test/external_text_formatter/transformation.xsl
+++ b/test/external_text_formatter/transformation.xsl
@@ -11,15 +11,11 @@
<xsl:import href="[testcase.xsl]"/>
<xsl:template name="formatter">
- <xsl:param name="format"/>
- <xsl:param name="file"/>
-
+ <xsl:param name="format"/>
+ <xsl:param name="file"/>
<xsl:variable name="content" select="InputXSLT:read-file($file)/text()"/>
- <xsl:copy-of select="InputXSLT:external-command(
- $format,
- $content
- )"/>
+ <xsl:copy-of select="InputXSLT:external-command($format, $content)"/>
</xsl:template>
<xsl:template name="implementation">
@@ -31,8 +27,8 @@
</xsl:variable>
<xsl:choose>
- <xsl:when test="xalan:nodeset($result)/output/@result = 'success'">
- <xsl:copy-of select="xalan:nodeset($result)/output/*"/>
+ <xsl:when test="xalan:nodeset($result)/command/@result = 'success'">
+ <xsl:copy-of select="xalan:nodeset($result)/command/node()"/>
</xsl:when>
<xsl:otherwise>
Failure during external text formatting