New: [feature request: support xpath functions for strings](https://github.com/clicon/clixon/issues/556)

Added: re-match, substring, string, string-length, translate, substring-before, substring-after, starts-with
This commit is contained in:
Olof hagsand 2024-11-01 15:11:28 +01:00
parent 3188e3cc59
commit 515d30bdd7
7 changed files with 741 additions and 45 deletions

View file

@ -120,7 +120,7 @@
#include "clixon_queue.h"
#include "clixon_hash.h"
#include "clixon_handle.h"
#include "clixon_handle.h"
#include "clixon_yang.h"
#include "clixon_xml.h"
#include "clixon_err.h"
@ -251,21 +251,13 @@ xp_primary_function(clixon_xpath_yacc *xpy,
}
fn = ret;
switch (fn){
case XPATHFN_RE_MATCH: /* Group of NOT IMPLEMENTED xpath functions */
case XPATHFN_ENUM_VALUE:
case XPATHFN_ENUM_VALUE: /* Group of NOT IMPLEMENTED xpath functions */
case XPATHFN_LAST:
case XPATHFN_ID:
case XPATHFN_LOCAL_NAME:
case XPATHFN_NAMESPACE_URI:
case XPATHFN_STRING:
case XPATHFN_CONCAT:
case XPATHFN_STARTS_WITH:
case XPATHFN_SUBSTRING_BEFORE:
case XPATHFN_SUBSTRING_AFTER:
case XPATHFN_SUBSTRING:
case XPATHFN_STRING_LENGTH:
case XPATHFN_NORMALIZE_SPACE:
case XPATHFN_TRANSLATE:
case XPATHFN_LANG:
case XPATHFN_NUMBER:
case XPATHFN_SUM:
@ -280,7 +272,8 @@ xp_primary_function(clixon_xpath_yacc *xpy,
clixon_xpath_parseerror(xpy, cbuf_get(cb));
goto done;
break;
case XPATHFN_CURRENT: /* Group of implemented xpath functions */
case XPATHFN_RE_MATCH: /* Group of implemented xpath functions */
case XPATHFN_CURRENT:
case XPATHFN_DEREF:
case XPATHFN_DERIVED_FROM:
case XPATHFN_BIT_IS_SET:
@ -288,7 +281,14 @@ xp_primary_function(clixon_xpath_yacc *xpy,
case XPATHFN_POSITION:
case XPATHFN_COUNT:
case XPATHFN_NAME:
case XPATHFN_STRING:
case XPATHFN_STARTS_WITH:
case XPATHFN_CONTAINS:
case XPATHFN_SUBSTRING_BEFORE:
case XPATHFN_SUBSTRING_AFTER:
case XPATHFN_SUBSTRING:
case XPATHFN_STRING_LENGTH:
case XPATHFN_TRANSLATE:
case XPATHFN_BOOLEAN:
case XPATHFN_NOT:
case XPATHFN_TRUE: