Xpath10 string
xpath10-string · version 1.0.0 · Structured formats · free, no key needed
Evaluate an XPath 1.0 expression that yields a string, including concat, substring, translate, and string conversion.
Use when you need to: xpath 1.0 string result · xpath concat substring and translate · xpath normalize-space value.
Decide before calling
Read the versioned contract and the supported scope below. Reuse xpath10-string@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use xpath10-string@1.0.0 for xpath 1.0 string result. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- xpath 1.0 string result
- xpath concat substring and translate
- xpath normalize-space value
- xpath substring-before and substring-after
- convert an xpath 1.0 value with the string function
- xpath string literal result
- compute an xpath 1.0 string expression
- מחרוזת xpath string
Not supported
- query an XML document with a location path
- XPath 2.0 functions such as replace, matches, tokenize, and lower-case
- format-number display formatting
Behavior
- Returns the XPath 1.0 string value of the expression. A number or boolean result is unsupported_input reason result_type, after evaluation.
- Keyword operators and, or, div, and mod match only token kind name. Symbolic operators and delimiters match only kind op. Quoted spellings such as 'div', 'and', '=', ')', and '*' are strings and are syntax errors.
- Characters are Unicode scalar values. concat, substring, substring-before, substring-after, translate, normalize-space, and string-length count code points and do not normalize. Whitespace is XML S only.
- translate keeps the first mapping for a repeated from-character and deletes a character with no to-character. substring is 1-based and rounds its numbers with the XPath round function.
- Numbers inside a string conversion use section 4.2: NaN, Infinity, -Infinity, and plain decimal. Negative zero's XPath string is 0. No scientific notation.
- and/or short-circuit only at evaluation, after the whole expression is parsed. Zero-argument string() and normalize-space() throw unsupported_input reason context_node when evaluated.
- Check order: UTF-8 input bytes, then parse limits and unsupported syntax, then the 96-character string cap, then the result type, then the JSON output byte cap. Output is exactly {"result": string}.
- Parentheses do not count as nodes. Depth 0 is a bare literal; each parenthesis and each function argument adds one. Eight nested parentheses are the maximum.
Input
expression(string, required): min length 1; max length 512; XPath 1.0 value expression. maxLength counts Unicode code points. The UTF-8 cap is limits.max_input_bytes.
Output
result(string, required): max length 96; XPath string value. Empty is allowed. maxLength counts code points.
Limits
- max input bytes: 512
- max string codepoints: 96
- max depth: 8
- max nodes: 21
- max arguments: 4
- max output bytes: 100
Example
Request input:
{
"expression": "substring(\"12345\",2,3)"
}
Response:
{
"result": {
"result": "234"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "xpath10-string",
"version": "1.0.0",
"input": {
"expression": "substring(\"12345\",2,3)"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/xpath10-string/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"expression":"substring(\"12345\",2,3)"}'
The machine-readable contract is at /v1/tools/xpath10-string/versions/1.0.0.
CLI
node cli.mjs run xpath10-string 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Xpath10 boolean: Evaluate an XPath 1.0 boolean expression: comparisons, and, or, not, starts-with, contains, and boolean conversion.
- Xpath10 evaluate: Evaluate an XPath 1.0 value expression and return its type with an exact string, number, or boolean token.
- Xpath10 number: Evaluate an XPath 1.0 numeric expression: arithmetic, div, mod, floor, ceiling, round, and number conversion.
- Xpath10 count: Count the nodes in an XPath 1.0 node-set from location paths, axes, predicates, namespaces and union.
- Xpath10 select: Select an XPath 1.0 node-set from location paths, axes, predicates, namespaces and union, in document order.
- Xpath10 paths: List the canonical XPath 1.0 path of each node in a location-path node-set, in document order.