Gnome XSLT Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# pattern

## Name

pattern --

## Synopsis

    struct      xsltCompMatch;
    typedef     xsltCompMatchPtr;
    xsltCompMatchPtr xsltCompilePattern         (const xmlChar *pattern,
                                                 xmlDocPtr doc,
                                                 xmlNodePtr node);
    void        xsltFreeCompMatchList           (xsltCompMatchPtr comp);
    int         xsltTestCompMatchList           (xsltTransformContextPtr ctxt,
                                                 xmlNodePtr node,
                                                 xsltCompMatchPtr comp);
    int         xsltAddTemplate                 (xsltStylesheetPtr style,
                                                 xsltTemplatePtr cur,
                                                 const xmlChar *mode,
                                                 const xmlChar *modeURI);
    xsltTemplatePtr xsltGetTemplate             (xsltTransformContextPtr ctxt,
                                                 xmlNodePtr node,
                                                 xsltStylesheetPtr style);
    void        xsltFreeTemplateHashes          (xsltStylesheetPtr style);
    void        xsltCleanupTemplates            (xsltStylesheetPtr style);
    int         xsltMatchPattern                (xsltTransformContextPtr ctxt,
                                                 xmlNodePtr node,
                                                 const xmlChar *pattern);

## Description

## Details

### struct xsltCompMatch

    struct xsltCompMatch;

### xsltCompMatchPtr

    typedef xsltCompMatch *xsltCompMatchPtr;

### xsltCompilePattern ()

    xsltCompMatchPtr xsltCompilePattern         (const xmlChar *pattern,
                                                 xmlDocPtr doc,
                                                 xmlNodePtr node);

Compile the XSLT pattern and generates a list of precompiled form suitable for fast matching.

[1] Pattern ::= LocationPathPattern | Pattern '|' LocationPathPattern

`pattern` : |
`doc` : | the containing document
`node` : | the containing element
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

### xsltTestCompMatchList ()

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

Test wether 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

### 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

### xsltGetTemplate ()

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

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

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

### xsltFreeTemplateHashes ()

    void        xsltFreeTemplateHashes          (xsltStylesheetPtr style);

Free up the memory used by xsltAddTemplate/xsltGetTemplate mechanism

`style` : | an XSLT stylesheet

### xsltCleanupTemplates ()

    void        xsltCleanupTemplates            (xsltStylesheetPtr style);

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

`style` : | an XSLT stylesheet

### xsltMatchPattern ()

    int         xsltMatchPattern                (xsltTransformContextPtr ctxt,
                                                 xmlNodePtr node,
                                                 const xmlChar *pattern);

Determine if a node matches a pattern.

`ctxt` : |
`node` : | a node in the source tree
`pattern` : | an XSLT pattern
Returns : |

<<< Previous Page | Home | Up | Next Page >>>
functions | templates