Skip to content

Commit

Permalink
Fixes invalid XPath query template
Browse files Browse the repository at this point in the history
Also optimizes result processing.
  • Loading branch information
funkyfuture committed Dec 24, 2024
1 parent c0ea34f commit 73c8d3c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions snakesist/exist_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ class ConnectionProps(NamedTuple):
"""\
for $node in @expression return
<snakesist:result xmlns:snakesist="SNAKESIST_NAMESPACE"
nodeid="{util:node-id($node)}"
absid="{util:absolute-resource-id($node)}"
path="{util:collection-name($node) || "/" || util:document-name($node)}"
snakesist:nodeid="{util:node-id($node)}"
snakesist:absid="{util:absolute-resource-id($node)}"
snakesist:path="{util:collection-name($node) || "/" || util:document-name($node)}"
>{$node}</snakesist:result>
""".replace(
"SNAKESIST_NAMESPACE", SNAKESIST_NAMESPACE
Expand Down Expand Up @@ -469,9 +469,9 @@ def xpath(self, expression: str) -> list[NodeResource]:
content_node = result_node[0]
assert isinstance(content_node, NodeBase)
query_result = QueryResultItem(
absolute_id=str(result_node["absid"]),
node_id=str(result_node["nodeid"]),
document_path=str(result_node["path"]),
absolute_id=result_node["absid"].value,
node_id=result_node["nodeid"].value,
document_path=result_node["path"].value,
node=content_node.detach(),
)
resources.append(NodeResource(exist_client=self, query_result=query_result))
Expand Down

0 comments on commit 73c8d3c

Please sign in to comment.