#ifndef XSLTProcessor_h
#define XSLTProcessor_h
#if ENABLE(XSLT)
#include "StringHash.h"
#include "XSLStyleSheet.h"
#include <wtf/HashMap.h>
#include <libxml/parserInternals.h>
#include <libxslt/documents.h>
namespace WebCore {
class Frame;
class Node;
class Document;
class DocumentFragment;
class XSLTProcessor : public Shared<XSLTProcessor>
{
public:
void setXSLStylesheet(XSLStyleSheet *styleSheet) { m_stylesheet = styleSheet; }
bool transformToString(Node *source, DeprecatedString &resultMIMEType, DeprecatedString &resultString, DeprecatedString &resultEncoding);
RefPtr<Document> createDocumentFromSource(const DeprecatedString& source, const DeprecatedString& sourceEncoding, const DeprecatedString& sourceMIMEType, Node* sourceNode, Frame* frame);
void importStylesheet(Node *style) { m_stylesheetRootNode = style; }
RefPtr<DocumentFragment> transformToFragment(Node *source, Document *ouputDoc);
RefPtr<Document> transformToDocument(Node *source);
void setParameter(const String& namespaceURI, const String& localName, const String& value);
String getParameter(const String& namespaceURI, const String& localName) const;
void removeParameter(const String& namespaceURI, const String& localName);
void clearParameters() { m_parameters.clear(); }
void reset() { m_stylesheet = NULL; m_stylesheetRootNode = NULL; m_parameters.clear(); }
public:
XSLStyleSheet *xslStylesheet() const { return m_stylesheet.get(); }
typedef HashMap<String, String> ParameterMap;
private:
RefPtr<Document> documentFromXMLDocPtr(xmlDocPtr resultDoc, xsltStylesheetPtr sheet, Document *ownerDocument, bool sourceIsDocument);
RefPtr<XSLStyleSheet> m_stylesheet;
RefPtr<Node> m_stylesheetRootNode;
ParameterMap m_parameters;
};
}
#endif
#endif