setContextNodeIdToFirstMatchingNodeFromContextNode

How to get setContextNodeIdToFirstMatchingNodeFromContextNode

Depend on fontoxml-base-flow to make this transform available.

Set contextNodeId to the nodeId of the first match of the XPath evaluated from the original context node.

"contextual-remove-title": {
  "label": "Remove title",
  "steps": [
    {
      "type": "transform/setContextNodeIdToFirstMatchingNodeFromContextNode",
      "data": {
        "contextNodeId": "{{contextNodeId}}",
        "xPathQuery": "./title"
      }
    },
    {
      "type": "operation/delete-node",
      "data": {
        "contextNodeId": "{{contextNodeId}}"
      }
    }
  ]
}

Note that the inline-xpath-in-operations syntax can also be used to achieve the same goal:

"contextual-remove-title": {
  "label": "Remove title",
  "steps": [
    {
      "type": "operation/delete-node",
      "data": {
        "contextNodeId": "x__$data('contextNode')/title"
      }
    }
  ]
}

Imported operation data

Name Type Description
contextNodeId NodeId

The nodeId of the node to start the query from

xPathQuery Stencil

Stencil containing one or more gaps representing the locations from which to set the values of the model.

Exported operation data

Name Type Description
contextNodeId NodeId
Was this page helpful?