pattern

pattern - interface for the pattern matching used in template matches.

the implementation of the lookup of the right template for a given node must be really fast in order to keep decent performances.

Author(s): Daniel Veillard

Synopsis

typedef struct _xsltCompMatch xsltCompMatch;
typedef xsltCompMatch * xsltCompMatchPtr;
void	xsltNormalizeCompSteps		(void * payload, 
void * data,
const xmlChar * name); int xsltAddTemplate (xsltStylesheetPtr style,
xsltTemplatePtr cur,
const xmlChar * mode,
const xmlChar * modeURI); xsltCompMatchPtr xsltCompilePattern (const xmlChar * pattern,
xmlDocPtr doc,
xmlNodePtr node,
xsltStylesheetPtr style,
xsltTransformContextPtr runtime); int xsltMatchPattern (xsltTransformContextPtr ctxt,
xmlNodePtr node,
const xmlChar * pattern,
xmlDocPtr ctxtdoc,
xmlNodePtr ctxtnode); xsltTemplatePtr xsltGetTemplate (xsltTransformContextPtr ctxt,
xmlNodePtr node,
xsltStylesheetPtr style); void xsltCompMatchClearCache (xsltTransformContextPtr ctxt,
xsltCompMatchPtr comp); int xsltTestCompMatchList (xsltTransformContextPtr ctxt,
xmlNodePtr node,
xsltCompMatchPtr comp); void xsltFreeCompMatchList (xsltCompMatchPtr comp); void xsltFreeTemplateHashes (xsltStylesheetPtr style); void xsltCleanupTemplates (xsltStylesheetPtr style);

Description

Details

Structure xsltCompMatch

struct _xsltCompMatch {
The content of this structure is not made public by the API.
} xsltCompMatch;


Typedef xsltCompMatchPtr

xsltCompMatch * xsltCompMatchPtr;


xsltAddTemplate ()

int	xsltAddTemplate			(xsltStylesheetPtr style, 
xsltTemplatePtr cur,
const xmlChar * mode,
const xmlChar * modeURI)

Register the XSLT pattern associated to @cur

style:an XSLT stylesheet
cur:an XSLT template
mode:the mode name or NULL
modeURI:the mode URI or NULL
Returns:-1 in case of error, 0 otherwise

xsltCleanupTemplates ()

void	xsltCleanupTemplates		(xsltStylesheetPtr style)

Cleanup the state of the templates used by the stylesheet and the ones it imports.

style:an XSLT stylesheet

xsltCompMatchClearCache ()

void	xsltCompMatchClearCache		(xsltTransformContextPtr ctxt, 
xsltCompMatchPtr comp)

Clear pattern match cache.

ctxt:a XSLT process context
comp:the precompiled pattern list

xsltCompilePattern ()

xsltCompMatchPtr	xsltCompilePattern	(const xmlChar * pattern, 
xmlDocPtr doc,
xmlNodePtr node,
xsltStylesheetPtr style,
xsltTransformContextPtr runtime)

Compile the XSLT pattern and generates a list of precompiled form suitable for fast matching. [1] Pattern ::= LocationPathPattern | Pattern '|' LocationPathPattern

pattern:an XSLT pattern
doc:the containing document
node:the containing element
style:the stylesheet
runtime:the transformation context, if done at run-time
Returns:the generated pattern list or NULL in case of failure

xsltFreeCompMatchList ()

void	xsltFreeCompMatchList		(xsltCompMatchPtr comp)

Free up the memory allocated by all the elements of @comp

comp:an XSLT comp list

xsltFreeTemplateHashes ()

void	xsltFreeTemplateHashes		(xsltStylesheetPtr style)

Free up the memory used by xsltAddTemplate/xsltGetTemplate mechanism

style:an XSLT stylesheet

xsltGetTemplate ()

xsltTemplatePtr	xsltGetTemplate		(xsltTransformContextPtr ctxt, 
xmlNodePtr node,
xsltStylesheetPtr style)

Finds the template applying to this node, if @style is non-NULL it means one needs to look for the next imported template in scope.

ctxt:a XSLT process context
node:the node being processed
style:the current style
Returns:the xsltTemplatePtr or NULL if not found

xsltMatchPattern ()

int	xsltMatchPattern		(xsltTransformContextPtr ctxt, 
xmlNodePtr node,
const xmlChar * pattern,
xmlDocPtr ctxtdoc,
xmlNodePtr ctxtnode)

ctxt:
node:
pattern:
ctxtdoc:
ctxtnode:
Returns:


xsltTestCompMatchList ()

int	xsltTestCompMatchList		(xsltTransformContextPtr ctxt, 
xmlNodePtr node,
xsltCompMatchPtr comp)

Test whether the node matches one of the patterns in the list

ctxt:a XSLT process context
node:a node
comp:the precompiled pattern list
Returns:1 if it matches, 0 if it doesn't and -1 in case of failure