Main Page | Class Hierarchy | Class List | File List | Class Members

xslt::stylesheet Class Reference

The xslt::stylesheet class is used to hold information about an XSLT stylesheet. More...

#include <stylesheet.h>

List of all members.

Public Types

typedef std::map< std::string,
std::string > 
param_type
 Type for passing parameters to the stylesheet.


Public Member Functions

 stylesheet (const char *filename)
 Create a new xslt::stylesheet object and load and parse the stylesheet in the given filename.

 stylesheet (xml::document doc)
 Create a new xslt::stylesheet object from an xml::document object that contains the parsed stylesheet.

 ~stylesheet (void)
 Clean up after an xslt::stylesheet.

bool apply (xml::document &doc, xml::document &result)
 Apply this stylesheet to the given XML document.

bool apply (xml::document &doc, xml::document &result, const param_type &with_params)
 Apply this stylesheet to the given XML document.

xml::documentapply (xml::document &doc)
 Apply this stylesheet to the given XML document.

xml::documentapply (xml::document &doc, const param_type &with_params)
 Apply this stylesheet to the given XML document.

const std::string & get_error_message (void) const
 If you used one of the xslt::stylesheet::apply member functions that return a bool, you can use this function to get the text message for the transformation error.


Detailed Description

The xslt::stylesheet class is used to hold information about an XSLT stylesheet.

You can use it to load in a stylesheet and then use that stylesheet to transform an XML document to something else.


Member Typedef Documentation

typedef std::map<std::string, std::string> xslt::stylesheet::param_type
 

Type for passing parameters to the stylesheet.


Constructor & Destructor Documentation

xslt::stylesheet::stylesheet const char *  filename  )  [explicit]
 

Create a new xslt::stylesheet object and load and parse the stylesheet in the given filename.

Parameters:
filename The name of the file that contains the stylesheet.
Author:
Peter Jones

xslt::stylesheet::stylesheet xml::document  doc  )  [explicit]
 

Create a new xslt::stylesheet object from an xml::document object that contains the parsed stylesheet.

The given xml::document is passed by value. This is needed because the stylesheet will own the document and free it.

Parameters:
doc The parsed stylesheet.
Author:
Peter Jones

xslt::stylesheet::~stylesheet void   ) 
 

Clean up after an xslt::stylesheet.

Author:
Peter Jones


Member Function Documentation

xml::document& xslt::stylesheet::apply xml::document doc,
const param_type with_params
 

Apply this stylesheet to the given XML document.

The results document is returned. If there is an error during transformation, this function will throw a std::runtime_error exception.

Each time you call this member function, the xml::document object that was returned from the last call becomes invalid. That is, of course, unless you copied it first.

Parameters:
doc The XML document to transform.
with_params Override xsl:param elements using the given key/value map
Returns:
A reference to the result tree.
Author:
Peter Jones

xml::document& xslt::stylesheet::apply xml::document doc  ) 
 

Apply this stylesheet to the given XML document.

The results document is returned. If there is an error during transformation, this function will throw a std::runtime_error exception.

Each time you call this member function, the xml::document object that was returned from the last call becomes invalid. That is, of course, unless you copied it first.

Parameters:
doc The XML document to transform.
Returns:
A reference to the result tree.
Author:
Peter Jones

bool xslt::stylesheet::apply xml::document doc,
xml::document result,
const param_type with_params
 

Apply this stylesheet to the given XML document.

The result document is placed in the second document parameter.

Parameters:
doc The XML document to transform.
result The result tree after applying this stylesheet.
with_params Override xsl:param elements using the given key/value map
Returns:
True if the transformation was successful and the results placed in result.

False if there was an error, result is not modified.

Author:
Peter Jones

bool xslt::stylesheet::apply xml::document doc,
xml::document result
 

Apply this stylesheet to the given XML document.

The result document is placed in the second document parameter.

Parameters:
doc The XML document to transform.
result The result tree after applying this stylesheet.
Returns:
True if the transformation was successful and the results placed in result.

False if there was an error, result is not modified.

Author:
Peter Jones

const std::string& xslt::stylesheet::get_error_message void   )  const
 

If you used one of the xslt::stylesheet::apply member functions that return a bool, you can use this function to get the text message for the transformation error.

If you are using one of the apply member functions that throws exceptions, this function should not be used. The text message for the transformation error will be given to the std::runtime_error constructor.

Returns:
The last error message.
Author:
Peter Jones


The documentation for this class was generated from the following file:
Generated on Tue Oct 19 12:26:03 2004 for xmlwrapp by doxygen 1.3.6