# SXP Reference

SXP_query | Functions
#### Syntax
         SXP_query(Q, query, node, position, size)
Name | Type | Description
--- | --- | ---
`Q` | `QueryContext` | The current query context.
`query` | `const SXP_char*` | The text of the query.
`node` | `SXP_Node` | The current node for the query.
`position` | `int` | The position of the current node in the evaluation context. As SXP is a C interface, the position is zero-based (unlike one-based XPath nodesets). Thus, you must set this parameter to 0 if you want the "position()" query to return 1.
`size` | `int` | The size of the evaluation context.
`(RET)` | `int` | The error code.
#### Description Evaluates a query (given as text) based on the current node, the context position (zero-based) and the context size. Any namespaces declared using `SXP_addNamespaceDeclaration` are used for the evaluation, as are the variable bindings made using functions like `SXP_addVariableString`. Upon completion of the query, the pending namespace declarations and variable bindings are cleared.
#### Example
      SXP_query(Q, "node[1]/@att", root, 0, 1);
#### See Also
Groups | [ Functions ]
Entries | [ QueryContext | SXP_Node | SXP_addNamespaceDeclaration | SXP_addVariableString | SXP_getResultString | SXP_getResultType ]

© 2001-2003 Ginger Alliance
revision 03-01-31
This page was generated by APIDOC