Module namespaces from libxslt

# The XSLT C library for GNOME

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

set of function easing the processing and generation of namespace nodes in XSLT.

## Table of Contents

    #define UNDEFINED_DEFAULT_NS

    xmlNsPtr	xsltCopyNamespace	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr elem,
    					 xmlNsPtr ns)

    xmlNsPtr	xsltCopyNamespaceList	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNsPtr cur)

    void	xsltFreeNamespaceAliasHashes	(xsltStylesheetPtr style)

    xmlNsPtr	xsltGetNamespace	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr cur,
    					 xmlNsPtr ns,
    					 xmlNodePtr out)

    xmlNsPtr	xsltGetPlainNamespace	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr cur,
    					 xmlNsPtr ns,
    					 xmlNodePtr out)

    xmlNsPtr	xsltGetSpecialNamespace	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr invocNode,
    					 const xmlChar * nsName,
    					 const xmlChar * nsPrefix,
    					 xmlNodePtr target)

    void	xsltNamespaceAlias		(xsltStylesheetPtr style,
    					 xmlNodePtr node)

## Description

### Macro: UNDEFINED_DEFAULT_NS

    #define UNDEFINED_DEFAULT_NS

Special value for undefined namespace, internal

### Function: xsltCopyNamespace

    xmlNsPtr	xsltCopyNamespace	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr elem,
    					 xmlNsPtr ns)

Copies a namespace node (declaration). If @elem is not NULL, then the new namespace will be declared on @elem.

`ctxt`: | a transformation context
`elem`: | the target element node
`ns`: | the namespace node
`Returns`: | a new xmlNsPtr, or NULL in case of an error.

### Function: xsltCopyNamespaceList

    xmlNsPtr	xsltCopyNamespaceList	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr node,
    					 xmlNsPtr cur)

Do a copy of an namespace list. If @node is non-NULL the new namespaces are added automatically. This handles namespaces aliases. This function is intended only for *internal* use at transformation-time for copying ns-declarations of Literal Result Elements. Called by: xsltCopyTreeInternal() (transform.c) xsltShallowCopyElem() (transform.c) REVISIT: This function won't be used in the refactored code.

`ctxt`: | a transformation context
`node`: | the target node
`cur`: | the first namespace
`Returns`: | a new xmlNsPtr, or NULL in case of error.

### Function: xsltFreeNamespaceAliasHashes

    void	xsltFreeNamespaceAliasHashes	(xsltStylesheetPtr style)

Free up the memory used by namespaces aliases

`style`: | an XSLT stylesheet

### Function: xsltGetNamespace

    xmlNsPtr	xsltGetNamespace	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr cur,
    					 xmlNsPtr ns,
    					 xmlNodePtr out)

Find a matching (prefix and ns-name) ns-declaration for the requested @ns->prefix and @ns->href in the result tree. If none is found then a new ns-declaration will be added to @resultElem. If, in this case, the given prefix is already in use, then a ns-declaration with a modified ns-prefix be we created. Called by: - xsltCopyPropList() (*not* anymore) - xsltShallowCopyElement() - xsltCopyTreeInternal() (*not* anymore) - xsltApplySequenceConstructor() (*not* in the refactored code), - xsltElement() (*not* anymore)

`ctxt`: | a transformation context
`cur`: | the input node
`ns`: | the namespace
`out`: | the output node (or its parent)
`Returns`: | a namespace declaration or NULL in case of namespace fixup failures or API or internal errors.

### Function: xsltGetPlainNamespace

    xmlNsPtr	xsltGetPlainNamespace	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr cur,
    					 xmlNsPtr ns,
    					 xmlNodePtr out)

Obsolete. *Not* called by any Libxslt/Libexslt function. Exaclty the same as xsltGetNamespace().

`ctxt`: | a transformation context
`cur`: | the input node
`ns`: | the namespace
`out`: | the result element
`Returns`: | a namespace declaration or NULL in case of namespace fixup failures or API or internal errors.

### Function: xsltGetSpecialNamespace

    xmlNsPtr	xsltGetSpecialNamespace	(xsltTransformContextPtr ctxt,
    					 xmlNodePtr invocNode,
    					 const xmlChar * nsName,
    					 const xmlChar * nsPrefix,
    					 xmlNodePtr target)

Find a matching (prefix and ns-name) ns-declaration for the requested @nsName and @nsPrefix in the result tree. If none is found then a new ns-declaration will be added to @resultElem. If, in this case, the given prefix is already in use, then a ns-declaration with a modified ns-prefix be we created. Note that this function's priority is to preserve ns-prefixes; it will only change a prefix if there's a namespace clash. If both @nsName and @nsPrefix are NULL, then this will try to "undeclare" a default namespace by declaring an xmlns="".

`ctxt`: | the transformation context
`invocNode`: | the invoking node; e.g. a literal result element/attr; only used for error reports
`nsName`: | the namespace name (or NULL)
`nsPrefix`: | the suggested namespace prefix (or NULL)
`target`: | the result element on which to anchor a namespace
`Returns`: | a namespace declaration or NULL.

### Function: xsltNamespaceAlias

    void	xsltNamespaceAlias		(xsltStylesheetPtr style,
    					 xmlNodePtr node)

Read the stylesheet-prefix and result-prefix attributes, register them as well as the corresponding namespace.

`style`: | the XSLT stylesheet
`node`: | the xsl:namespace-alias node

Daniel Veillard