# The XSLT C library for GNOME

## Module transform 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 module implements the bulk of the actual

## Table of Contents

    void	xslHandleDebugger		(xmlNodePtr cur,
    					 xmlNodePtr node,
    					 xsltTemplatePtr templ,
    					 xsltTransformContextPtr ctxt)

    void	xsltApplyImports		(xsltTransformContextPtr ctxt,
    					 xmlNodePtr contextNode,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr comp)

    void	xsltApplyOneTemplate		(xsltTransformContextPtr ctxt,
    					 xmlNodePtr contextNode,
    					 xmlNodePtr list,
    					 xsltTemplatePtr templ,
    					 xsltStackElemPtr params)

    void	xsltApplyStripSpaces		(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node)

    xmlDocPtr	xsltApplyStylesheet	(xsltStylesheetPtr style,
    					 xmlDocPtr doc,
    					 const char ** params)

    xmlDocPtr	xsltApplyStylesheetUser	(xsltStylesheetPtr style,
    					 xmlDocPtr doc,
    					 const char ** params,
    					 const char * output,
    					 FILE * profile,
    					 xsltTransformContextPtr userCtxt)

    void	xsltApplyTemplates		(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

    void	xsltAttribute			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr comp)

    void	xsltCallTemplate		(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

    void	xsltChoose			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr contextNode,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr comp)

    void	xsltComment			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr comp)

    void	xsltCopy			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

    void	xsltCopyOf			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

    xmlNodePtr	xsltCopyTextString	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr target,
    					 const xmlChar * string,
    					 int noescape)

    void	xsltDocumentElem		(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

    void	xsltElement			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

    void	xsltForEach			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr contextNode,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

    void	xsltFreeTransformContext	(xsltTransformContextPtr ctxt)

    int	xsltGetXIncludeDefault		(void)

    void	xsltIf			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr contextNode,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

    void	xsltLocalVariablePop		(xsltTransformContextPtr ctxt,
    					 int limitNr,
    					 int level)

    int	xsltLocalVariablePush		(xsltTransformContextPtr ctxt,
    					 xsltStackElemPtr variable,
    					 int level)

    xsltTransformContextPtr	xsltNewTransformContext	(xsltStylesheetPtr style,
    						 xmlDocPtr doc)

    void	xsltNumber			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

    void	xsltProcessOneNode		(xsltTransformContextPtr ctxt,
    					 xmlNodePtr contextNode,
    					 xsltStackElemPtr withParams)

    void	xsltProcessingInstruction	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

    xmlDocPtr	xsltProfileStylesheet	(xsltStylesheetPtr style,
    					 xmlDocPtr doc,
    					 const char ** params,
    					 FILE * output)

    void	xsltRegisterAllElement		(xsltTransformContextPtr ctxt)

    int	xsltRunStylesheet		(xsltStylesheetPtr style,
    					 xmlDocPtr doc,
    					 const char ** params,
    					 const char * output,
    					 xmlSAXHandlerPtr SAX,
    					 xmlOutputBufferPtr IObuf)

    int	xsltRunStylesheetUser		(xsltStylesheetPtr style,
    					 xmlDocPtr doc,
    					 const char ** params,
    					 const char * output,
    					 xmlSAXHandlerPtr SAX,
    					 xmlOutputBufferPtr IObuf,
    					 FILE * profile,
    					 xsltTransformContextPtr userCtxt)

    void	xsltSetXIncludeDefault		(int xinclude)

    void	xsltSort			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr comp)

    void	xsltText			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr comp)

    void	xsltValueOf			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

## Description

### Function: xslHandleDebugger

    void	xslHandleDebugger		(xmlNodePtr cur,
    					 xmlNodePtr node,
    					 xsltTemplatePtr templ,
    					 xsltTransformContextPtr ctxt)

If either cur or node are a breakpoint, or xslDebugStatus in state where debugging must occcur at this time then transfer control to the xslDebugBreak function

`cur`: | source node being executed
`node`: | data node being processed
`templ`: | temlate that applies to node
`ctxt`: | the xslt transform context

### Function: xsltApplyImports

    void	xsltApplyImports		(xsltTransformContextPtr ctxt,
    					 xmlNodePtr contextNode,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr comp)

Process the XSLT apply-imports element.

`ctxt`: | an XSLT transformation context
`contextNode`: | the current node in the source tree.
`inst`: | the element node of the XSLT 'apply-imports' instruction
`comp`: | the compiled instruction

### Function: xsltApplyOneTemplate

    void	xsltApplyOneTemplate		(xsltTransformContextPtr ctxt,
    					 xmlNodePtr contextNode,
    					 xmlNodePtr list,
    					 xsltTemplatePtr templ,
    					 xsltStackElemPtr params)

Processes a sequence constructor on the current node in the source tree. @params are the already computed variable stack items; this function pushes them on the variable stack, and pops them before exiting; it's left to the caller to free or reuse @params afterwards. The initial states of the variable stack will always be restored before this function exits. NOTE that this does *not* initiate a new distinct variable scope; i.e. variables already on the stack are visible to the process. The caller's side needs to start a new variable scope if needed (e.g. in exsl:function). @templ is obsolete and not used anymore (e.g. <exslt:function> does not provide a @templ); a non-NULL @templ might raise an error in the future. BIG NOTE: This function is not intended to process the content of an xsl:template; it does not expect xsl:param instructions in @list and will report errors if found. Called by: - xsltEvalVariable() (variables.c) - exsltFuncFunctionFunction() (libexsl/functions.c)

`ctxt`: | a XSLT process context
`contextNode`: | the node in the source tree.
`list`: | the nodes of a sequence constructor
`templ`: | not used
`params`: | a set of parameters (xsl:param) or NULL

### Function: xsltApplyStripSpaces

    void	xsltApplyStripSpaces		(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node)

Strip the unwanted ignorable spaces from the input tree

`ctxt`: | a XSLT process context
`node`: | the root of the XML tree

### Function: xsltApplyStylesheet

    xmlDocPtr	xsltApplyStylesheet	(xsltStylesheetPtr style,
    					 xmlDocPtr doc,
    					 const char ** params)

Apply the stylesheet to the document NOTE: This may lead to a non-wellformed output XML wise !

`style`: | a parsed XSLT stylesheet
`doc`: | a parsed XML document
`params`: | a NULL terminated arry of parameters names/values tuples
`Returns`: | the result document or NULL in case of error

### Function: xsltApplyStylesheetUser

    xmlDocPtr	xsltApplyStylesheetUser	(xsltStylesheetPtr style,
    					 xmlDocPtr doc,
    					 const char ** params,
    					 const char * output,
    					 FILE * profile,
    					 xsltTransformContextPtr userCtxt)

Apply the stylesheet to the document and allow the user to provide its own transformation context.

`style`: | a parsed XSLT stylesheet
`doc`: | a parsed XML document
`params`: | a NULL terminated array of parameters names/values tuples
`output`: | the targetted output
`profile`: | profile FILE * output or NULL
`userCtxt`: | user provided transform context
`Returns`: | the result document or NULL in case of error

### Function: xsltApplyTemplates

    void	xsltApplyTemplates		(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

Processes the XSLT 'apply-templates' instruction on the current node.

`ctxt`: | a XSLT transformation context
`node`: | the 'current node' in the source tree
`inst`: | the element node of an XSLT 'apply-templates' instruction
`castedComp`: | the compiled instruction

### Function: xsltAttribute

    void	xsltAttribute			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr comp)

Process the xslt attribute node on the source node

`ctxt`: | a XSLT process context
`node`: | the node in the source tree.
`inst`: | the xslt attribute node
`comp`: | precomputed information

### Function: xsltCallTemplate

    void	xsltCallTemplate		(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

Processes the XSLT call-template instruction on the source node.

`ctxt`: | a XSLT transformation context
`node`: | the "current node" in the source tree
`inst`: | the XSLT 'call-template' instruction
`castedComp`: | the compiled information of the instruction

### Function: xsltChoose

    void	xsltChoose			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr contextNode,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr comp)

Processes the xsl:choose instruction on the source node.

`ctxt`: | a XSLT process context
`contextNode`: | the current node in the source tree
`inst`: | the xsl:choose instruction
`comp`: | compiled information of the instruction

### Function: xsltComment

    void	xsltComment			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr comp)

Process the xslt comment node on the source node

`ctxt`: | a XSLT process context
`node`: | the node in the source tree.
`inst`: | the xslt comment node
`comp`: | precomputed information

### Function: xsltCopy

    void	xsltCopy			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

Execute the XSLT-copy instruction on the source node.

`ctxt`: | an XSLT process context
`node`: | the node in the source tree
`inst`: | the element node of the XSLT-copy instruction
`castedComp`: | computed information of the XSLT-copy instruction

### Function: xsltCopyOf

    void	xsltCopyOf			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

Process the XSLT copy-of instruction.

`ctxt`: | an XSLT transformation context
`node`: | the current node in the source tree
`inst`: | the element node of the XSLT copy-of instruction
`castedComp`: | precomputed information of the XSLT copy-of instruction

### Function: xsltCopyTextString

    xmlNodePtr	xsltCopyTextString	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr target,
    					 const xmlChar * string,
    					 int noescape)

Adds @string to a newly created or an existent text node child of @target.

`ctxt`: | a XSLT process context
`target`: | the element where the text will be attached
`string`: | the text string
`noescape`: | should disable-escaping be activated for this text node.
`Returns`: | the text node, where the text content of @cur is copied to. NULL in case of API or internal errors.

### Function: xsltDocumentElem

    void	xsltDocumentElem		(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

Process an EXSLT/XSLT-1.1 document element

`ctxt`: | an XSLT processing context
`node`: | The current node
`inst`: | the instruction in the stylesheet
`castedComp`: | precomputed information

### Function: xsltElement

    void	xsltElement			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

Process the xslt element node on the source node

`ctxt`: | a XSLT process context
`node`: | the node in the source tree.
`inst`: | the xslt element node
`castedComp`: | precomputed information

### Function: xsltForEach

    void	xsltForEach			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr contextNode,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

Process the xslt for-each node on the source node

`ctxt`: | an XSLT transformation context
`contextNode`: | the "current node" in the source tree
`inst`: | the element node of the xsl:for-each instruction
`castedComp`: | the compiled information of the instruction

### Function: xsltFreeTransformContext

    void	xsltFreeTransformContext	(xsltTransformContextPtr ctxt)

Free up the memory allocated by @ctxt

`ctxt`: | an XSLT parser context

### Function: xsltGetXIncludeDefault

    int	xsltGetXIncludeDefault		(void)

Provides the default state for XInclude processing

`Returns`: | 0 if there is no processing 1 otherwise

### Function: xsltIf

    void	xsltIf			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr contextNode,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

Processes the xsl:if instruction on the source node.

`ctxt`: | a XSLT process context
`contextNode`: | the current node in the source tree
`inst`: | the xsl:if instruction
`castedComp`: | compiled information of the instruction

### Function: xsltLocalVariablePop

    void	xsltLocalVariablePop		(xsltTransformContextPtr ctxt,
    					 int limitNr,
    					 int level)

Pops all variable values at the given @depth from the stack.

`ctxt`: | the transformation context
`limitNr`: | number of variables which should remain
`level`: | the depth in the xsl:template's tree

### Function: xsltLocalVariablePush

    int	xsltLocalVariablePush		(xsltTransformContextPtr ctxt,
    					 xsltStackElemPtr variable,
    					 int level)

Places the variable onto the local variable stack

`ctxt`: | the transformation context
`variable`: | variable to be pushed to the variable stack
`level`: | new value for variable's level
`Returns`: | 0 for success, -1 for any error **NOTE:** This is an internal routine and should not be called by users!

### Function: xsltNewTransformContext

    xsltTransformContextPtr	xsltNewTransformContext	(xsltStylesheetPtr style,
    						 xmlDocPtr doc)

Create a new XSLT TransformContext

`style`: | a parsed XSLT stylesheet
`doc`: | the input document
`Returns`: | the newly allocated xsltTransformContextPtr or NULL in case of error

### Function: xsltNumber

    void	xsltNumber			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

Process the xslt number node on the source node

`ctxt`: | a XSLT process context
`node`: | the node in the source tree.
`inst`: | the xslt number node
`castedComp`: | precomputed information

### Function: xsltProcessOneNode

    void	xsltProcessOneNode		(xsltTransformContextPtr ctxt,
    					 xmlNodePtr contextNode,
    					 xsltStackElemPtr withParams)

Process the source node.

`ctxt`: | a XSLT process context
`contextNode`: | the "current node" in the source tree
`withParams`: | extra parameters (e.g. xsl:with-param) passed to the template if any

### Function: xsltProcessingInstruction

    void	xsltProcessingInstruction	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

Process the xslt processing-instruction node on the source node

`ctxt`: | a XSLT process context
`node`: | the node in the source tree.
`inst`: | the xslt processing-instruction node
`castedComp`: | precomputed information

### Function: xsltProfileStylesheet

    xmlDocPtr	xsltProfileStylesheet	(xsltStylesheetPtr style,
    					 xmlDocPtr doc,
    					 const char ** params,
    					 FILE * output)

Apply the stylesheet to the document and dump the profiling to the given output.

`style`: | a parsed XSLT stylesheet
`doc`: | a parsed XML document
`params`: | a NULL terminated arry of parameters names/values tuples
`output`: | a FILE * for the profiling output
`Returns`: | the result document or NULL in case of error

### Function: xsltRegisterAllElement

    void	xsltRegisterAllElement		(xsltTransformContextPtr ctxt)

Registers all default XSLT elements in this context

`ctxt`: | the XPath context

### Function: xsltRunStylesheet

    int	xsltRunStylesheet		(xsltStylesheetPtr style,
    					 xmlDocPtr doc,
    					 const char ** params,
    					 const char * output,
    					 xmlSAXHandlerPtr SAX,
    					 xmlOutputBufferPtr IObuf)

Apply the stylesheet to the document and generate the output according to @output @SAX and @IObuf. It's an error to specify both @SAX and @IObuf. NOTE: This may lead to a non-wellformed output XML wise ! NOTE: This may also result in multiple files being generated NOTE: using IObuf, the result encoding used will be the one used for creating the output buffer, use the following macro to read it from the stylesheet XSLT_GET_IMPORT_PTR(encoding, style, encoding) NOTE: using SAX, any encoding specified in the stylesheet will be lost since the interface uses only UTF8

`style`: | a parsed XSLT stylesheet
`doc`: | a parsed XML document
`params`: | a NULL terminated array of parameters names/values tuples
`output`: | the URL/filename ot the generated resource if available
`SAX`: | a SAX handler for progressive callback output (not implemented yet)
`IObuf`: | an output buffer for progressive output (not implemented yet)
`Returns`: | the number of bytes written to the main resource or -1 in case of error.

### Function: xsltRunStylesheetUser

    int	xsltRunStylesheetUser		(xsltStylesheetPtr style,
    					 xmlDocPtr doc,
    					 const char ** params,
    					 const char * output,
    					 xmlSAXHandlerPtr SAX,
    					 xmlOutputBufferPtr IObuf,
    					 FILE * profile,
    					 xsltTransformContextPtr userCtxt)

Apply the stylesheet to the document and generate the output according to @output @SAX and @IObuf. It's an error to specify both @SAX and @IObuf. NOTE: This may lead to a non-wellformed output XML wise ! NOTE: This may also result in multiple files being generated NOTE: using IObuf, the result encoding used will be the one used for creating the output buffer, use the following macro to read it from the stylesheet XSLT_GET_IMPORT_PTR(encoding, style, encoding) NOTE: using SAX, any encoding specified in the stylesheet will be lost since the interface uses only UTF8

`style`: | a parsed XSLT stylesheet
`doc`: | a parsed XML document
`params`: | a NULL terminated array of parameters names/values tuples
`output`: | the URL/filename ot the generated resource if available
`SAX`: | a SAX handler for progressive callback output (not implemented yet)
`IObuf`: | an output buffer for progressive output (not implemented yet)
`profile`: | profile FILE * output or NULL
`userCtxt`: | user provided transform context
`Returns`: | the number of by written to the main resource or -1 in case of error.

### Function: xsltSetXIncludeDefault

    void	xsltSetXIncludeDefault		(int xinclude)

Set whether XInclude should be processed on document being loaded by default

`xinclude`: | whether to do XInclude processing

### Function: xsltSort

    void	xsltSort			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr comp)

function attached to xsl:sort nodes, but this should not be called directly

`ctxt`: | a XSLT process context
`node`: | the node in the source tree.
`inst`: | the xslt sort node
`comp`: | precomputed information

### Function: xsltText

    void	xsltText			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr comp)

Process the xslt text node on the source node

`ctxt`: | a XSLT process context
`node`: | the node in the source tree.
`inst`: | the xslt text node
`comp`: | precomputed information

### Function: xsltValueOf

    void	xsltValueOf			(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNodePtr inst,
    					 xsltStylePreCompPtr castedComp)

Process the xslt value-of node on the source node

`ctxt`: | a XSLT process context
`node`: | the node in the source tree.
`inst`: | the xslt value-of node
`castedComp`: | precomputed information

Daniel Veillard