# The XSLT C library for GNOME

## Module templates from libxslt

API Menu

- Main Menu
- Developer Menu
- API Menu
- ChangeLog

Related links

- Mail archive
- XML libxml2
- FTP
- Windows binaries
- Solaris binaries
- MacOsX binaries
- Bug Tracker
- lxml Python bindings
- Perl XSLT bindings
- XSLT with PHP
- Apache module
- Pascal bindings
- Xsldbg Debugger

API Indexes

- Alphabetic
- Constructors
- Functions/Types
- Modules
- Symbols

This set of routine encapsulates XPath calls and Attribute Value Templates evaluation.

## Table of Contents

    xmlAttrPtr	xsltAttrListTemplateProcess	(xsltTransformContextPtr ctxt,
    						 xmlNodePtr target,
    						 xmlAttrPtr attrs)

    xmlAttrPtr	xsltAttrTemplateProcess	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr target,
    					 xmlAttrPtr attr)

    xmlChar *	xsltAttrTemplateValueProcess	(xsltTransformContextPtr ctxt,
    						 const xmlChar * str)

    xmlChar *	xsltAttrTemplateValueProcessNode	(xsltTransformContextPtr ctxt,
    							 const xmlChar * str,
    							 xmlNodePtr inst)

    xmlChar *	xsltEvalAttrValueTemplate	(xsltTransformContextPtr ctxt,
    						 xmlNodePtr inst,
    						 const xmlChar * name,
    						 const xmlChar * ns)

    const xmlChar *	xsltEvalStaticAttrValueTemplate	(xsltStylesheetPtr style,
    						 xmlNodePtr inst,
    						 const xmlChar * name,
    						 const xmlChar * ns,
    						 int * found)

    xmlChar *	xsltEvalTemplateString	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr contextNode,
    					 xmlNodePtr inst)

    int	xsltEvalXPathPredicate		(xsltTransformContextPtr ctxt,
    					 xmlXPathCompExprPtr comp,
    					 xmlNsPtr * nsList,
    					 int nsNr)

    xmlChar *	xsltEvalXPathString	(xsltTransformContextPtr ctxt,
    					 xmlXPathCompExprPtr comp)

    xmlChar *	xsltEvalXPathStringNs	(xsltTransformContextPtr ctxt,
    					 xmlXPathCompExprPtr comp,
    					 int nsNr,
    					 xmlNsPtr * nsList)

    xmlNodePtr *	xsltTemplateProcess	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node)

## Description

### Function: xsltAttrListTemplateProcess

    xmlAttrPtr	xsltAttrListTemplateProcess	(xsltTransformContextPtr ctxt,
    						 xmlNodePtr target,
    						 xmlAttrPtr attrs)

Processes all attributes of a Literal Result Element. Attribute references are applied via xsl:use-attribute-set attributes. Copies all non XSLT-attributes over to the @target element and evaluates Attribute Value Templates. Called by xsltApplySequenceConstructor() (transform.c).

`ctxt`: | the XSLT transformation context
`target`: | the element where the attributes will be grafted
`attrs`: | the first attribute
`Returns`: | a new list of attribute nodes, or NULL in case of error. (Don't assign the result to @target->properties; if the result is NULL, you'll get memory leaks, since the attributes will be disattached.)

### Function: xsltAttrTemplateProcess

    xmlAttrPtr	xsltAttrTemplateProcess	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr target,
    					 xmlAttrPtr attr)

Process one attribute of a Literal Result Element (in the stylesheet). Evaluates Attribute Value Templates and copies the attribute over to the result element. This does *not* process attribute sets (xsl:use-attribute-set).

`ctxt`: | the XSLT transformation context
`target`: | the element where the attribute will be grafted
`attr`: | the attribute node of a literal result element
`Returns`: | the generated attribute node.

### Function: xsltAttrTemplateValueProcess

    xmlChar *	xsltAttrTemplateValueProcess	(xsltTransformContextPtr ctxt,
    						 const xmlChar * str)

Process the given node and return the new string value.

`ctxt`: | the XSLT transformation context
`str`: | the attribute template node value
`Returns`: | the computed string value or NULL, must be deallocated by the caller.

### Function: xsltAttrTemplateValueProcessNode

    xmlChar *	xsltAttrTemplateValueProcessNode	(xsltTransformContextPtr ctxt,
    							 const xmlChar * str,
    							 xmlNodePtr inst)

Process the given string, allowing to pass a namespace mapping context and return the new string value. Called by: - xsltAttrTemplateValueProcess() (templates.c) - xsltEvalAttrValueTemplate() (templates.c) QUESTION: Why is this function public? It is not used outside of templates.c.

`ctxt`: | the XSLT transformation context
`str`: | the attribute template node value
`inst`: | the instruction (or LRE) in the stylesheet holding the attribute with an AVT
`Returns`: | the computed string value or NULL, must be deallocated by the caller.

### Function: xsltEvalAttrValueTemplate

    xmlChar *	xsltEvalAttrValueTemplate	(xsltTransformContextPtr ctxt,
    						 xmlNodePtr inst,
    						 const xmlChar * name,
    						 const xmlChar * ns)

Evaluate a attribute value template, i.e. the attribute value can contain expressions contained in curly braces ({}) and those are substituted by they computed value.

`ctxt`: | the XSLT transformation context
`inst`: | the instruction (or LRE) in the stylesheet holding the attribute with an AVT
`name`: | the attribute QName
`ns`: | the attribute namespace URI
`Returns`: | the computed string value or NULL, must be deallocated by the caller.

### Function: xsltEvalStaticAttrValueTemplate

    const xmlChar *	xsltEvalStaticAttrValueTemplate	(xsltStylesheetPtr style,
    						 xmlNodePtr inst,
    						 const xmlChar * name,
    						 const xmlChar * ns,
    						 int * found)

Check if an attribute value template has a static value, i.e. the attribute value does not contain expressions contained in curly braces ({})

`style`: | the XSLT stylesheet
`inst`: | the instruction (or LRE) in the stylesheet holding the attribute with an AVT
`name`: | the attribute Name
`ns`: | the attribute namespace URI
`found`: | indicator whether the attribute is present
`Returns`: | the static string value or NULL, must be deallocated by the caller.

### Function: xsltEvalTemplateString

    xmlChar *	xsltEvalTemplateString	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr contextNode,
    					 xmlNodePtr inst)

Processes the sequence constructor of the given instruction on @contextNode and converts the resulting tree to a string. This is needed by e.g. xsl:comment and xsl:processing-instruction.

`ctxt`: | the XSLT transformation context
`contextNode`: | the current node in the source tree
`inst`: | the XSLT instruction (xsl:comment, xsl:processing-instruction)
`Returns`: | the computed string value or NULL; it's up to the caller to free the result.

### Function: xsltEvalXPathPredicate

    int	xsltEvalXPathPredicate		(xsltTransformContextPtr ctxt,
    					 xmlXPathCompExprPtr comp,
    					 xmlNsPtr * nsList,
    					 int nsNr)

Process the expression using XPath and evaluate the result as an XPath predicate

`ctxt`: | the XSLT transformation context
`comp`: | the XPath compiled expression
`nsList`: | the namespaces in scope
`nsNr`: | the number of namespaces in scope
`Returns`: | 1 is the predicate was true, 0 otherwise

### Function: xsltEvalXPathString

    xmlChar *	xsltEvalXPathString	(xsltTransformContextPtr ctxt,
    					 xmlXPathCompExprPtr comp)

Process the expression using XPath and get a string

`ctxt`: | the XSLT transformation context
`comp`: | the compiled XPath expression
`Returns`: | the computed string value or NULL, must be deallocated by the caller.

### Function: xsltEvalXPathStringNs

    xmlChar *	xsltEvalXPathStringNs	(xsltTransformContextPtr ctxt,
    					 xmlXPathCompExprPtr comp,
    					 int nsNr,
    					 xmlNsPtr * nsList)

Process the expression using XPath, allowing to pass a namespace mapping context and get a string

`ctxt`: | the XSLT transformation context
`comp`: | the compiled XPath expression
`nsNr`: | the number of namespaces in the list
`nsList`: | the list of in-scope namespaces to use
`Returns`: | the computed string value or NULL, must be deallocated by the caller.

### Function: xsltTemplateProcess

    xmlNodePtr *	xsltTemplateProcess	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node)

Obsolete. Don't use it.

`ctxt`: | the XSLT transformation context
`node`: | the attribute template node
`Returns`: | NULL.

Daniel Veillard