2 * xsltInternals.h: internal data structures, constants and functions used
5 * See Copyright for the status of this software.
7 * Daniel.Veillard@imag.fr
10 #ifndef __XML_XSLT_INTERNALS_H__
11 #define __XML_XSLT_INTERNALS_H__
13 #include <libxml/tree.h>
14 #include <libxml/hash.h>
15 #include <libxml/xpath.h>
16 #include <libxslt/xslt.h>
24 * The in-memory structure corresponding to an XSLT Variable
33 typedef struct _xsltStackElem xsltStackElem;
34 typedef xsltStackElem *xsltStackElemPtr;
35 struct _xsltStackElem {
36 struct _xsltStackElem *next;/* chained list */
37 xsltElem type; /* type of the element */
38 int computed; /* was the evaluation done */
39 xmlChar *name; /* the local part of the name QName */
40 xmlChar *nameURI; /* the URI part of the name QName */
41 xmlChar *select; /* the eval string */
42 xmlNodePtr tree; /* the tree if no eval string */
43 xmlXPathObjectPtr value; /* The value if computed */
47 * The in-memory structure corresponding to an XSLT Template
49 #define XSLT_PAT_NO_PRIORITY -12345789
51 typedef struct _xsltTemplate xsltTemplate;
52 typedef xsltTemplate *xsltTemplatePtr;
53 struct _xsltTemplate {
54 struct _xsltTemplate *next;/* chained list sorted by priority */
55 xmlChar *match; /* the matching string */
56 int priority; /* as given from the stylesheet, not computed */
57 xmlChar *name; /* the local part of the name QName */
58 xmlChar *nameURI; /* the URI part of the name QName */
59 xmlChar *mode; /* the local part of the mode QName */
60 xmlChar *modeURI; /* the URI part of the mode QName */
61 xmlNodePtr content; /* the template replacement value */
65 * Data structure of decimal-format
67 typedef struct _xsltDecimalFormat {
68 struct _xsltDecimalFormat *next; /* chained list */
70 /* Used for interpretation of pattern */
72 xmlChar *patternSeparator;
73 /* May appear in result */
76 xmlChar *noNumber; /* Not-a-number */
77 /* Used for interpretation of pattern and may appear in result */
78 xmlChar *decimalPoint;
83 } xsltDecimalFormat, *xsltDecimalFormatPtr;
86 * The in-memory structure corresponding to an XSLT Stylesheet
87 * NOTE: most of the content is simply linked from the doc tree
88 * structure, no specific allocation is made.
90 typedef struct _xsltStylesheet xsltStylesheet;
91 typedef xsltStylesheet *xsltStylesheetPtr;
92 struct _xsltStylesheet {
94 * The stylesheet import relation is kept as a tree
96 struct _xsltStylesheet *parent;
97 struct _xsltStylesheet *next;
98 struct _xsltStylesheet *imports;
101 * General data on the style sheet document
103 xmlDocPtr doc; /* the parsed XML stylesheet */
104 xmlHashTablePtr stripSpaces;/* the hash table of the strip-space
105 preserve space and cdata-section elements */
108 * Global variable or parameters
110 xsltStackElemPtr variables; /* linked list of param and variables */
113 * Template descriptions
115 xsltTemplatePtr templates; /* the ordered list of templates */
116 void *templatesHash; /* hash table or wherever compiled templates
117 informations are stored */
118 void *rootMatch; /* template based on / */
119 void *elemMatch; /* template based on * */
120 void *attrMatch; /* template based on @* */
121 void *parentMatch; /* template based on .. */
122 void *textMatch; /* template based on text() */
123 void *piMatch; /* template based on processing-instruction() */
124 void *commentMatch; /* template based on comment() */
129 xmlHashTablePtr nsAliases; /* the namespace alias hash tables */
134 xmlHashTablePtr attributeSets;/* the attribute sets hash tables */
137 * Output related stuff.
139 xmlChar *method; /* the output method */
140 xmlChar *methodURI; /* associated namespace if any */
141 xmlChar *version; /* version string */
142 xmlChar *encoding; /* encoding string */
143 int omitXmlDeclaration; /* omit-xml-declaration = "yes" | "no" */
145 /* Number formatting */
146 xsltDecimalFormatPtr decimalFormat;
147 int standalone; /* standalone = "yes" | "no" */
148 xmlChar *doctypePublic; /* doctype-public string */
149 xmlChar *doctypeSystem; /* doctype-system string */
150 int indent; /* should output being indented */
151 xmlChar *mediaType; /* media-type string */
156 * The in-memory structure corresponding to an XSLT Transformation
168 } xsltTransformState;
170 typedef struct _xsltTransformContext xsltTransformContext;
171 typedef xsltTransformContext *xsltTransformContextPtr;
172 struct _xsltTransformContext {
173 xsltStylesheetPtr style; /* the stylesheet used */
174 xsltOutputType type; /* the type of output */
176 xmlDocPtr doc; /* the current doc */
177 xmlNodePtr node; /* the current node */
178 xmlNodeSetPtr nodeList; /* the current node list */
180 xmlDocPtr output; /* the resulting document */
181 xmlNodePtr insert; /* the insertion node */
183 xmlXPathContextPtr xpathCtxt; /* the XPath context */
184 void *variablesHash; /* hash table or wherever variables
185 informations are stored */
186 xmlDocPtr extraDocs; /* extra docs parsed by document() */
187 xsltTransformState state; /* the current state */
190 #define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return;
191 #define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error;
192 #define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0);
195 * Functions associated to the internal types
196 xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet,
199 xsltStylesheetPtr xsltParseStylesheetFile (const xmlChar* filename);
200 void xsltFreeStylesheet (xsltStylesheetPtr sheet);
201 int xsltIsBlank (xmlChar *str);
202 void xsltFreeStackElemList (xsltStackElemPtr elem);
204 xsltStylesheetPtr xsltParseStylesheetProcess(xsltStylesheetPtr ret,
206 xsltStylesheetPtr xsltParseStylesheetDoc (xmlDocPtr doc);
211 #endif /* __XML_XSLT_H__ */