#ifndef xslt_processorimpl_h_
#define xslt_processorimpl_h_
#ifdef KHTML_XSLT
#include "StringHash.h"
#include "XSLStyleSheet.h"
#include <wtf/HashMap.h>
#include <libxml/parserInternals.h>
#include <libxslt/documents.h>
namespace WebCore {
class FrameView;
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, FrameView *view = 0);
void importStylesheet(Node *style) { m_stylesheetRootNode = style; }
RefPtr<DocumentFragment> transformToFragment(Node *source, Document *ouputDoc);
RefPtr<Document> transformToDocument(Node *source);
void setParameter(StringImpl *namespaceURI, StringImpl *localName, StringImpl *value);
RefPtr<StringImpl> getParameter(StringImpl *namespaceURI, StringImpl *localName) const;
void removeParameter(StringImpl *namespaceURI, StringImpl *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<RefPtr<StringImpl>, RefPtr<StringImpl> > 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