variables: interface for the variable matching and lookup.

## variables

variables - interface for the variable matching and lookup.

interface for the variable matching and lookup.

Author(s): Daniel Veillard

## Synopsis

    #define XSLT_REGISTER_VARIABLE_LOOKUP;
    #define XSLT_RVT_FUNC_RESULT;
    #define XSLT_RVT_GLOBAL;
    #define XSLT_RVT_LOCAL;
    void	xsltFreeGlobalVariables		(xsltTransformContextPtr ctxt);
    int	xsltQuoteUserParams		(xsltTransformContextPtr ctxt,
    					 const char ** params);
    xmlXPathObjectPtr	xsltXPathVariableLookup	(void * ctxt,
    						 const xmlChar * name,
    						 const xmlChar * ns_uri);
    int	xsltEvalUserParams		(xsltTransformContextPtr ctxt,
    					 const char ** params);
    xsltStackElemPtr	xsltParseStylesheetCallerParam	(xsltTransformContextPtr ctxt,
    							 xmlNodePtr inst);
    int	xsltAddStackElemList		(xsltTransformContextPtr ctxt,
    					 xsltStackElemPtr elems);
    void	xsltParseGlobalVariable		(xsltStylesheetPtr style,
    					 xmlNodePtr cur);
    int	xsltQuoteOneUserParam		(xsltTransformContextPtr ctxt,
    					 const xmlChar * name,
    					 const xmlChar * value);
    void	xsltParseGlobalParam		(xsltStylesheetPtr style,
    					 xmlNodePtr cur);
    void	xsltParseStylesheetVariable	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr inst);
    int	xsltEvalGlobalVariables		(xsltTransformContextPtr ctxt);
    int	xsltEvalOneUserParam		(xsltTransformContextPtr ctxt,
    					 const xmlChar * name,
    					 const xmlChar * value);
    void	xsltParseStylesheetParam	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr cur);
    xmlXPathObjectPtr	xsltVariableLookup	(xsltTransformContextPtr ctxt,
    						 const xmlChar * name,
    						 const xmlChar * ns_uri);

## Description

## Details

### Macro XSLT_REGISTER_VARIABLE_LOOKUP

    #define XSLT_REGISTER_VARIABLE_LOOKUP;

Registering macro, not general purpose at all but used in different modules.

### Macro XSLT_RVT_FUNC_RESULT

    #define XSLT_RVT_FUNC_RESULT;

RVT is part of results returned with func:result. The RVT won't be destroyed after exiting a template and will be reset to XSLT_RVT_LOCAL or XSLT_RVT_VARIABLE in the template that receives the return value.

### Macro XSLT_RVT_GLOBAL

    #define XSLT_RVT_GLOBAL;

RVT is part of a global variable.

### Macro XSLT_RVT_LOCAL

    #define XSLT_RVT_LOCAL;

RVT is destroyed after the current instructions ends.

### xsltAddStackElemList ()

    int	xsltAddStackElemList		(xsltTransformContextPtr ctxt,
    					 xsltStackElemPtr elems)

Push an element list onto the stack.

`ctxt`: | xn XSLT transformation context
`elems`: | a stack element list
`Returns`: | 0 in case of success, -1 in case of failure.

### xsltEvalGlobalVariables ()

    int	xsltEvalGlobalVariables		(xsltTransformContextPtr ctxt)

Evaluates all global variables and parameters of a stylesheet. For internal use only. This is called at start of a transformation.

`ctxt`: | the XSLT transformation context
`Returns`: | 0 in case of success, -1 in case of error

### xsltEvalOneUserParam ()

    int	xsltEvalOneUserParam		(xsltTransformContextPtr ctxt,
    					 const xmlChar * name,
    					 const xmlChar * value)

This is normally called from xsltEvalUserParams to process a single parameter from a list of parameters. The @value is evaluated as an XPath expression and the result is stored in the context's global variable/parameter hash table. To have a parameter treated literally (not as an XPath expression) use xsltQuoteUserParams (or xsltQuoteOneUserParam). For more details see description of xsltProcessOneUserParamInternal.

`ctxt`: | the XSLT transformation context
`name`: | a null terminated string giving the name of the parameter
`value`: | a null terminated string giving the XPath expression to be evaluated
`Returns`: | 0 in case of success, -1 in case of error.

### xsltEvalUserParams ()

    int	xsltEvalUserParams		(xsltTransformContextPtr ctxt,
    					 const char ** params)

Evaluate the global variables of a stylesheet. This needs to be done on parsed stylesheets before starting to apply transformations. Each of the parameters is evaluated as an XPath expression and stored in the global variables/parameter hash table. If you want your parameter used literally, use xsltQuoteUserParams.

`ctxt`: | the XSLT transformation context
`params`: | a NULL terminated array of parameters name/value tuples
`Returns`: | 0 in case of success, -1 in case of error

### xsltFreeGlobalVariables ()

    void	xsltFreeGlobalVariables		(xsltTransformContextPtr ctxt)

Free up the data associated to the global variables its value.

`ctxt`: | the XSLT transformation context

### xsltParseGlobalParam ()

    void	xsltParseGlobalParam		(xsltStylesheetPtr style,
    					 xmlNodePtr cur)

parse an XSLT transformation param declaration and record its value.

`style`: | the XSLT stylesheet
`cur`: | the "param" element

### xsltParseGlobalVariable ()

    void	xsltParseGlobalVariable		(xsltStylesheetPtr style,
    					 xmlNodePtr cur)

Parses a global XSLT 'variable' declaration at compilation time and registers it

`style`: | the XSLT stylesheet
`cur`: | the "variable" element

### xsltParseStylesheetCallerParam ()

    xsltStackElemPtr	xsltParseStylesheetCallerParam	(xsltTransformContextPtr ctxt,
    							 xmlNodePtr inst)

Processes an xsl:with-param instruction at transformation time. The value is computed, but not recorded. NOTE that this is also called with an *xsl:param* element from exsltFuncFunctionFunction().

`ctxt`: | the XSLT transformation context
`inst`: | the xsl:with-param instruction element
`Returns`: | the new xsltStackElemPtr or NULL

### xsltParseStylesheetParam ()

    void	xsltParseStylesheetParam	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr cur)

Registers a local XSLT 'param' declaration at transformation time and evaluates its value.

`ctxt`: | the XSLT transformation context
`cur`: | the XSLT 'param' element

### xsltParseStylesheetVariable ()

    void	xsltParseStylesheetVariable	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr inst)

Registers a local XSLT 'variable' instruction at transformation time and evaluates its value.

`ctxt`: | the XSLT transformation context
`inst`: | the xsl:variable instruction element

### xsltQuoteOneUserParam ()

    int	xsltQuoteOneUserParam		(xsltTransformContextPtr ctxt,
    					 const xmlChar * name,
    					 const xmlChar * value)

This is normally called from xsltQuoteUserParams to process a single parameter from a list of parameters. The @value is stored in the context's global variable/parameter hash table.

`ctxt`: | the XSLT transformation context
`name`: | a null terminated string giving the name of the parameter
`value`: | a null terminated string giving the parameter value
`Returns`: | 0 in case of success, -1 in case of error.

### xsltQuoteUserParams ()

    int	xsltQuoteUserParams		(xsltTransformContextPtr ctxt,
    					 const char ** params)

Similar to xsltEvalUserParams, but the values are treated literally and are * *not* evaluated as XPath expressions. This should be done on parsed stylesheets before starting to apply transformations.

`ctxt`: | the XSLT transformation context
`params`: | a NULL terminated arry of parameters names/values tuples
`Returns`: | 0 in case of success, -1 in case of error.

### xsltVariableLookup ()

    xmlXPathObjectPtr	xsltVariableLookup	(xsltTransformContextPtr ctxt,
    						 const xmlChar * name,
    						 const xmlChar * ns_uri)

Search in the Variable array of the context for the given variable value.

`ctxt`: | the XSLT transformation context
`name`: | the variable name
`ns_uri`: | the variable namespace URI
`Returns`: | the value or NULL if not found

### xsltXPathVariableLookup ()

    xmlXPathObjectPtr	xsltXPathVariableLookup	(void * ctxt,
    						 const xmlChar * name,
    						 const xmlChar * ns_uri)

This is the entry point when a varibale is needed by the XPath interpretor.

`ctxt`: | a void * but the the XSLT transformation context actually
`name`: | the variable name
`ns_uri`: | the variable namespace URI
`Returns`: | the value or NULL if not found