![]() | ![]() | ![]() | Gnome XSLT Library Reference Manual | ![]() |
---|
xsltutils —
#define XSLT_TODO #define XSLT_STRANGE #define IS_XSLT_ELEM (n) #define IS_XSLT_NAME (n, val) #define IS_XSLT_REAL_NODE (n)xmlChar * xsltGetNsProp (xmlNodePtr node, constxmlChar *name, constxmlChar *nameSpace); int xsltGetUTF8Char (unsigned char *utf, int *len); void xsltPrintErrorContext (xsltTransformContextPtr ctxt, xsltStylesheetPtr style,xmlNodePtr node); void xsltMessage (xsltTransformContextPtr ctxt,xmlNodePtr node,xmlNodePtr inst); void xsltSetGenericErrorFunc (void *ctx,xmlGenericErrorFunc handler); void xsltSetGenericDebugFunc (void *ctx,xmlGenericErrorFunc handler); void xsltSetTransformErrorFunc (xsltTransformContextPtr ctxt, void *ctx,xmlGenericErrorFunc handler); void xsltTransformError (xsltTransformContextPtr ctxt, xsltStylesheetPtr style,xmlNodePtr node, const char *msg, ...); void xsltDocumentSortFunction (xmlNodeSetPtr list); void xsltSetSortFunc (xsltSortFunc handler); void xsltSetCtxtSortFunc (xsltTransformContextPtr ctxt, xsltSortFunc handler); void xsltDefaultSortFunction (xsltTransformContextPtr ctxt,xmlNodePtr *sorts, int nbsorts); void xsltDoSortFunction (xsltTransformContextPtr ctxt,xmlNodePtr *sorts, int nbsorts);xmlXPathObjectPtr * xsltComputeSortResult (xsltTransformContextPtr ctxt,xmlNodePtr sort); constxmlChar * xsltGetQNameURI (xmlNodePtr node,xmlChar **name); int xsltSaveResultTo (xmlOutputBufferPtr buf,xmlDocPtr result, xsltStylesheetPtr style); int xsltSaveResultToFilename (const char *URI,xmlDocPtr result, xsltStylesheetPtr style, int compression); int xsltSaveResultToFile (FILE *file,xmlDocPtr result, xsltStylesheetPtr style); int xsltSaveResultToFd (int fd,xmlDocPtr result, xsltStylesheetPtr style); int xsltSaveResultToString (xmlChar **doc_txt_ptr, int *doc_txt_len,xmlDocPtr result, xsltStylesheetPtr style); void xsltSaveProfiling (xsltTransformContextPtr ctxt,FILE *output);xmlDocPtr xsltGetProfileInformation (xsltTransformContextPtr ctxt);long xsltTimestamp (void); void xsltCalibrateAdjust (long delta ); #define XSLT_TIMESTAMP_TICS_PER_SEC enum xsltDebugStatusCodes; void (*xsltHandleDebuggerCallback) (xmlNodePtr cur,xmlNodePtr node, xsltTemplatePtr templ, xsltTransformContextPtr ctxt); int (*xsltAddCallCallback) (xsltTemplatePtr templ,xmlNodePtr source); void (*xsltDropCallCallback) (void); int xsltSetDebuggerCallbacks (int no, void *block); int xslAddCall (xsltTemplatePtr templ,xmlNodePtr source); void xslDropCall (void);
#define IS_XSLT_NAME(n, val)
Checks the value of an element in XSLT namespace.
n : | |
val : |
#define IS_XSLT_REAL_NODE(n)
Check that a node is a 'real' one: document, element, text or attribute.
n : |
xmlChar * xsltGetNsProp (xmlNodePtr node, constxmlChar *name, constxmlChar *nameSpace);
Similar to
Search and get the value of an attribute associated to a node This attribute has to be anchored in the namespace specified, or has no namespace and the element is in that namespace.
This does the entity substitution.
This function looks in DTD attribute declaration for
node : | the node |
name : | the attribute name |
nameSpace : | the URI of the namespace |
Returns : | the attribute value or NULL if not found. It's up to the caller to free the memory. |
int xsltGetUTF8Char (unsigned char *utf, int *len);
Read one UTF8 Char from utf
Function copied from libxml2
utf : | a sequence of UTF-8 encoded bytes |
len : | a pointer to bytes len |
Returns : | the char value or -1 in case of error and update len with the number of bytes used |
void xsltPrintErrorContext (xsltTransformContextPtr ctxt, xsltStylesheetPtr style,xmlNodePtr node);
Display the context of an error.
ctxt : | the transformation context |
style : | the stylesheet |
node : | the current node being processed |
void xsltMessage (xsltTransformContextPtr ctxt,xmlNodePtr node,xmlNodePtr inst);
Process and xsl:message construct
ctxt : | an XSLT processing context |
node : | The current node |
inst : | The node containing the message instruction |
void xsltSetGenericErrorFunc (void *ctx,xmlGenericErrorFunc handler);
Function to reset the handler and the error context for out of context error messages. This simply means that handler will be called for subsequent error messages while not parsing nor validating. And ctx will be passed as first argument to handler One can simply force messages to be emitted to another FILE * than stderr by setting ctx to this file handle and handler to NULL.
ctx : | the new error handling context |
handler : | the new handler function |
void xsltSetGenericDebugFunc (void *ctx,xmlGenericErrorFunc handler);
Function to reset the handler and the error context for out of context error messages. This simply means that handler will be called for subsequent error messages while not parsing or validating. And ctx will be passed as first argument to handler One can simply force messages to be emitted to another FILE * than stderr by setting ctx to this file handle and handler to NULL.
ctx : | the new error handling context |
handler : | the new handler function |
void xsltSetTransformErrorFunc (xsltTransformContextPtr ctxt, void *ctx,xmlGenericErrorFunc handler);
Function to reset the handler and the error context for out of context error messages specific to a given XSLT transromation.
This simply means that handler will be called for subsequent error messages while running the transformation.
ctxt : | the XSLT transformation context |
ctx : | the new error handling context |
handler : | the new handler function |
void xsltTransformError (xsltTransformContextPtr ctxt, xsltStylesheetPtr style,xmlNodePtr node, const char *msg, ...);
Display and format an error messages, gives file, line, position and extra parameters, will use the specific transformation context if available
ctxt : | an XSLT transformation context |
style : | the XSLT stylesheet used |
node : | the current node in the stylesheet |
msg : | the message to display/transmit |
... : | extra parameters for the message display |
void xsltDocumentSortFunction (xmlNodeSetPtr list);
reorder the current node list list accordingly to the document order
list : | the node set |
void xsltSetSortFunc (xsltSortFunc handler);
Function to reset the global handler for XSLT sorting. If the handler is NULL, the default sort function will be used.
handler : | the new handler function |
void xsltSetCtxtSortFunc (xsltTransformContextPtr ctxt, xsltSortFunc handler);
Function to set the handler for XSLT sorting for the specified context. If the handler is NULL, then the global sort function will be called
ctxt : | a XSLT process context |
handler : | the new handler function |
void xsltDefaultSortFunction (xsltTransformContextPtr ctxt,xmlNodePtr *sorts, int nbsorts);
reorder the current node list accordingly to the set of sorting requirement provided by the arry of nodes.
ctxt : | a XSLT process context |
sorts : | array of sort nodes |
nbsorts : | the number of sorts in the array |
void xsltDoSortFunction (xsltTransformContextPtr ctxt,xmlNodePtr *sorts, int nbsorts);
reorder the current node list accordingly to the set of sorting requirement provided by the arry of nodes. This is a wrapper function, the actual function used is specified using xsltSetCtxtSortFunc() to set the context specific sort function, or xsltSetSortFunc() to set the global sort function. If a sort function is set on the context, this will get called. Otherwise the global sort function is called.
ctxt : | a XSLT process context |
sorts : | array of sort nodes |
nbsorts : | the number of sorts in the array |
xmlXPathObjectPtr * xsltComputeSortResult (xsltTransformContextPtr ctxt,xmlNodePtr sort);
reorder the current node list accordingly to the set of sorting requirement provided by the array of nodes.
ctxt : | a XSLT process context |
sort : | node list |
Returns : | a ordered XPath nodeset or NULL in case of error. |
constxmlChar * xsltGetQNameURI (xmlNodePtr node,xmlChar **name);
This function analyzes name, if the name contains a prefix, the function seaches the associated namespace in scope for it. It will also replace name value with the NCName, the old value being freed. Errors in the prefix lookup are signalled by setting name to NULL.
NOTE: the namespace returned is a pointer to the place where it is defined and hence has the same lifespan as the document holding it.
node : | the node holding the QName |
name : | pointer to the initial QName value |
Returns : | the namespace URI if there is a prefix, or NULL if name is not prefixed. |
int xsltSaveResultTo (xmlOutputBufferPtr buf,xmlDocPtr result, xsltStylesheetPtr style);
Save the result result obtained by applying the style stylesheet to an I/O output channel buf
buf : | an output buffer |
result : | the result xmlDocPtr |
style : | the stylesheet |
Returns : | the number of byte written or -1 in case of failure. |
int xsltSaveResultToFilename (const char *URI,xmlDocPtr result, xsltStylesheetPtr style, int compression);
Save the result result obtained by applying the style stylesheet to a file or URL
URI : | |
result : | the result xmlDocPtr |
style : | the stylesheet |
compression : | the compression factor (0 - 9 included) |
Returns : | the number of byte written or -1 in case of failure. |
int xsltSaveResultToFile (FILE *file,xmlDocPtr result, xsltStylesheetPtr style);
Save the result result obtained by applying the style stylesheet to an open FILE * I/O. This does not close the FILE file
file : | a FILE * I/O |
result : | the result xmlDocPtr |
style : | the stylesheet |
Returns : | the number of bytes written or -1 in case of failure. |
int xsltSaveResultToFd (int fd,xmlDocPtr result, xsltStylesheetPtr style);
Save the result result obtained by applying the style stylesheet to an open file descriptor This does not close the descriptor.
fd : | a file descriptor |
result : | the result xmlDocPtr |
style : | the stylesheet |
Returns : | the number of bytes written or -1 in case of failure. |
int xsltSaveResultToString (xmlChar **doc_txt_ptr, int *doc_txt_len,xmlDocPtr result, xsltStylesheetPtr style);
Save the result result obtained by applying the style stylesheet to a file or URL
doc_txt_ptr : | Memory pointer for allocated XML text |
doc_txt_len : | Length of the generated XML text |
result : | the result xmlDocPtr |
style : | the stylesheet |
Returns : | the number of byte written or -1 in case of failure. |
void xsltSaveProfiling (xsltTransformContextPtr ctxt,FILE *output);
Save the profiling informations on output
ctxt : | an XSLT context |
output : | a FILE * for saving the informations |
xmlDocPtr xsltGetProfileInformation (xsltTransformContextPtr ctxt);
This function should be called after the transformation completed
to extract template processing profiling informations if availble.
The informations are returned as an XML document tree like
<?xml version="1.0"?>
<profile>
<template rank="1" match="*" name=""
mode="" calls="6" time="48" average="8"/>
<template rank="2" match="item2|item3" name=""
mode="" calls="10" time="30" average="3"/>
<template rank="3" match="item1" name=""
mode="" calls="5" time="17" average="3"/>
</profile>
The caller will need to free up the returned tree with
ctxt : | a transformation context |
Returns : | the xmlDocPtr corresponding to the result or NULL if not available. |
long xsltTimestamp (void);
Used for gathering profiling data
Returns : | the number of tenth of milliseconds since the beginning of the profiling |
void xsltCalibrateAdjust (long delta );
Used for to correct the calibration for xsltTimestamp()
Param1 : |
#define XSLT_TIMESTAMP_TICS_PER_SEC 100000l
Sampling precision for profiling
typedef enum { XSLT_DEBUG_NONE = 0, /* no debugging allowed */ XSLT_DEBUG_INIT, XSLT_DEBUG_STEP, XSLT_DEBUG_STEPOUT, XSLT_DEBUG_NEXT, XSLT_DEBUG_STOP, XSLT_DEBUG_CONT, XSLT_DEBUG_RUN, XSLT_DEBUG_RUN_RESTART, XSLT_DEBUG_QUIT } xsltDebugStatusCodes;
void (*xsltHandleDebuggerCallback) (xmlNodePtr cur,xmlNodePtr node, xsltTemplatePtr templ, xsltTransformContextPtr ctxt);
cur : | |
node : | |
templ : | |
ctxt : |
int (*xsltAddCallCallback) (xsltTemplatePtr templ,xmlNodePtr source);
templ : | |
source : | |
Returns : |
int xsltSetDebuggerCallbacks (int no, void *block);
This function allow to plug a debugger into the XSLT library block points to a block of memory containing the address of no callback routines.
no : | number of callbacks |
block : | the block of callbacks |
Returns : | 0 in case of success and -1 in case of error |
int xslAddCall (xsltTemplatePtr templ,xmlNodePtr source);
Add template "call" to call stack
templ : | current template being applied |
source : | the source node being processed |
Returns : | : 1 on sucess 0 otherwise an error may be printed if WITH_XSLT_DEBUG_BREAKPOINTS is defined |
<< transform | attributes >> |