diff options
author | Bob Gilligan <gilligan@sydney.vyatta.com> | 2007-12-14 18:07:39 -0800 |
---|---|---|
committer | Bob Gilligan <gilligan@sydney.vyatta.com> | 2007-12-14 18:07:39 -0800 |
commit | b5c72569cb4f0ca97e6c1a43075ac140670f61d9 (patch) | |
tree | fa7b613d301e59d3641a44f54d8f5a0e771e57cc /src/render_xml.cc | |
parent | e049ba70d640035b320ca508a6cfd5de2e22879e (diff) | |
download | vyatta-op-b5c72569cb4f0ca97e6c1a43075ac140670f61d9.tar.gz vyatta-op-b5c72569cb4f0ca97e6c1a43075ac140670f61d9.zip |
Add render_xml to this package. It is used by at least two other
packages.
Diffstat (limited to 'src/render_xml.cc')
-rw-r--r-- | src/render_xml.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/render_xml.cc b/src/render_xml.cc new file mode 100644 index 0000000..a213387 --- /dev/null +++ b/src/render_xml.cc @@ -0,0 +1,31 @@ +#include <stdio.h> +#include <unistd.h> +#include <iostream> +#include <string> + +#include "xsl_processor.hh" + +using namespace std; + +int +main(int argc, char* argv[]) +{ + if (argc < 2) { + printf("usage: %s <xsl_file>\n", argv[0]); + printf(" (takes XML from stdin)\n"); + exit(1); + } + + char buf[2048]; + string xml_str = ""; + while (fgets(buf, 2048, stdin) != NULL) { + xml_str += buf; + } + + string xsl_file(argv[1]); + list<pair<string,string> > listParams; + XSLProcessor xsl_processor(false); + cout << xsl_processor.transform(xml_str, xsl_file, listParams) << endl; + + exit(0); +} |