Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm::xom::XSLTransform Class Reference

#include <elm/xom/XSLTransform.h>

+ Inheritance diagram for elm::xom::XSLTransform:

Public Member Functions

 XSLTransform (Document *stylesheet) throw (XSLException)
 
 XSLTransform (Document *stylesheet, NodeFactory *factory) throw (XSLException)
 
void setParameter (const string &name, const string &value)
 
void setParameter (const string &name, const string &ns, const string &value)
 
DocumenttoDocument (const Nodes &nodes) throw (XMLException)
 
String toString (void)
 
Nodes transform (Document *in) throw (XSLException)
 
Nodes transform (Nodes in) throw (XSLException)
 
DocumenttransformDocument (Document *in) throw (XSLException)
 
- Public Member Functions inherited from elm::ErrorBase
 ErrorBase (ErrorHandler *error_handler=&ErrorHandler::DEFAULT)
 
void setErrorHandler (ErrorHandler *error_handler)
 
ErrorHandlergetErrorHandler (void) const
 

Additional Inherited Members

- Protected Member Functions inherited from elm::ErrorBase
void onError (error_level_t level, const string &message)
 

Detailed Description

Serves as an interface to a XSLT processor. The following example shows how to apply an XSL Transformation to a XOM document and get the transformation result in the form of a XOM Nodes:

public static Nodes transform(Document in)
throws XSLException, ParsingException, IOException {
#include <elm/xom/Builder.h>
#include <elm/xom/XSLTransform.h>
Builder builder = new Builder();
Document *stylesheet = builder.build("mystylesheet.xsl");
XSLTransform transform(stylesheet);
Nodes nodes = transform.transform(doc);
Author
H. Cassé casse.nosp@m.@iri.nosp@m.t.fr

Constructor & Destructor Documentation

elm::xom::XSLTransform::XSLTransform ( Document stylesheet)
throw (XSLException
)

Creates a new XSLTransform by reading the stylesheet from the supplied document.

Parameters
stylesheetdocument containing the stylesheet
Exceptions
XSLExceptionwhen the supplied document is not syntactically correct XSLT
elm::xom::XSLTransform::XSLTransform ( Document stylesheet,
NodeFactory factory 
)
throw (XSLException
)

Creates a new XSLTransform by reading the stylesheet from the supplied document. The supplied factory will be used to create all nodes in the result tree, so that a transform can create instances of subclasses of the standard XOM classes. Because an XSL transformation generates a list of nodes rather than a document, the factory's startMakingDocument and finishMakingDocument methods are not called.

Parameters
stylesheetdocument containing the stylesheet
factorythe factory used to build nodes in the result tree
Exceptions
XSLExceptionwhen the supplied document is not syntactically correct XSLT

Member Function Documentation

void elm::xom::XSLTransform::setParameter ( const string name,
const string value 
)

Supply a parameter to transformations performed by this object.

Parameters
namethe name of the parameter
valuethe value of the parameter
Note
The parameter value must be a valid XPath expression, meaning that,
  • strings must be quoted with "'",
  • boolean value must converted to integer (zero for false, non-zero for true) or using functions true() or false().

References elm::genstruct::AssocList< K, T, C, E, N >::put().

void elm::xom::XSLTransform::setParameter ( const string name,
const string ns,
const string value 
)

Supply a parameter to transformations performed by this object.

Parameters
namethe name of the parameter
namespacethe namespace URI of the parameter
valuethe value of the parameter
Document * elm::xom::XSLTransform::toDocument ( const Nodes nodes)
throw (XMLException
)

Creates a new Nodes object from the input Nodes object by applying this object's stylesheet. The original Nodes object is not changed.

Parameters
indocument to transform
Returns
a Nodes containing the result of the transformation
Exceptions
XSLExceptionif the transformation fails, normally due to an XSLT error all nodes passed in in parameter are cleaned up

References elm::xom::ParentNode::appendChild(), elm::xom::Node::ELEMENT, elm::xom::Node::get(), and elm::xom::Document::setRootElement().

String elm::xom::XSLTransform::toString ( void  )

Returns a string form of this XSLTransform, suitable for debugging.

Returns
debugging string

References elm::xom::Document::toString().

Nodes elm::xom::XSLTransform::transform ( Document in)
throw (XSLException
)

Creates a new Nodes from the input Document by applying this object's stylesheet. The original Document is not changed.

Parameters
indocument to transform
Returns
a Nodes containing the result of the transformation
Exceptions
XSLExceptionif the transformation fails, normally due to an XSLT error
Nodes elm::xom::XSLTransform::transform ( Nodes  in)
throw (XSLException
)

Not currently supported.

Document * elm::xom::XSLTransform::transformDocument ( Document in)
throw (XSLException
)

Transform a document and return it.

Parameters
indocument to transform.
Returns
transformed document.

References elm::io::in.


The documentation for this class was generated from the following files: