File: XSLTProc.cpp

package info (click to toggle)
sp-gxmlcpp 1.0.20040603-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,592 kB
  • ctags: 267
  • sloc: sh: 7,360; cpp: 1,626; makefile: 120
file content (36 lines) | stat: -rw-r--r-- 813 bytes parent folder | download | duplicates (6)
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
// $Id: XSLTProc.cpp,v 1.4 2003/01/30 12:38:31 spabsurd Exp $

// STDC++
#include <iostream>
#include <cassert>

// C libraries
#include <libexslt/exslt.h>  // Needed to enable exslt

// Local
#include <sp-gxmlcpp/XMLTree.hpp>
#include <sp-gxmlcpp/XMLDump.hpp>
#include <sp-gxmlcpp/XSLTrans.hpp>

int main(int argc, char** argv)
{
	// Support for exslt
	exsltRegisterAll();

	if (argc < 3)
	{
		std::cerr << "Usage: " << argv[0] << " XSL-FILE XML-FILE" << std::endl;
		exit(1);
	}

	std::ifstream xslFile(argv[1], std::ios::in);
	assert(xslFile.is_open());
	std::ifstream xmlFile(argv[2], std::ios::in);
	assert(xmlFile.is_open());

	SP::GXML::XSLTrans trans(xslFile);
	SP::GXML::XMLTree tree(xmlFile);

	std::auto_ptr<SP::GXML::XMLDump> dump(trans.trans(&tree));
	std::cout << dump.get()->get() << std::flush;
}