Phase 4 ยท Reference Material

XPath Library

Phase 4 extends the XPath Library with XPath 1.0 navigation, filtering, duplicate detection, and text functions.

DuplicatesFilteringLogicMath and CountsNavigationText Functions
Redacted samples: Sensitive names, URLs, IDs, customer values, infrastructure details, and project-specific values have been replaced with generic placeholders.

Absolute Path

Starts selection at the XML document root.

/Report/<NodeCollection>/<Node>

When to use

Use when the target location is fixed regardless of current context.

Notes

Absolute paths break if the root structure changes.

Relative Path

Starts from the current context node.

Detail/<FieldName>

When to use

Use inside Transformer actions where the current node is already selected.

Notes

Know your current node before writing the expression.

Parent Node

Selects the parent of the current node.

..

When to use

Use when a field-level match needs to act on the parent record.

Notes

Avoid climbing too far without confirming the XML structure.

Previous Sibling

Selects prior sibling Detail nodes.

preceding-sibling::Detail

When to use

Useful for duplicate detection and comparing current row to earlier rows.

Notes

Only checks siblings at the same level.

Next Sibling

Selects following sibling Detail nodes.

following-sibling::Detail

When to use

Useful when comparing a current line to later lines.

Notes

Can be expensive on large XML if overused.

First Node

Selects the first matching node.

[position() = 1]

When to use

Use when only the first occurrence should remain or be processed.

Notes

[1] is shorter but context can matter.

Not First Node

Selects every matching node except the first.

[position() > 1]

When to use

Use for removing repeated nodes when position is enough.

Notes

Do not write position()=!1; that is invalid XPath syntax.

Last Node

Selects the last matching node.

[last()]

When to use

Use when totals or final records should be processed.

Notes

last() is based on the current node set.

Duplicate Based on Previous Sibling Field

Finds rows where the current field value already appeared earlier.

Detail[FIELD_ID = preceding-sibling::Detail/FIELD_ID]

When to use

Use for deleting duplicate Detail records while keeping the first occurrence.

Notes

Only works for duplicates under the same parent.

Normalize Space

Trims and collapses internal whitespace.

normalize-space(FIELD_NAME)

When to use

Use before comparing values that may contain extra spaces.

Notes

normalize-space() returns a string, not a node.

Contains

Checks whether a field contains text.

contains(FIELD_NAME, "ABC")

When to use

Use for partial text matching.

Notes

Case-sensitive in XPath 1.0.

Starts With

Checks whether a field starts with text.

starts-with(FIELD_NAME, "ABC")

When to use

Use for prefix checks such as account, item, or document patterns.

Notes

Case-sensitive in XPath 1.0.

Ends With Workaround

XPath 1.0 workaround for suffix matching.

substring(FIELD_NAME, string-length(FIELD_NAME) - string-length("ABC") + 1) = "ABC"

When to use

Use because XPath 1.0 has no ends-with() function.

Notes

Fails if you forget the + 1 offset.

String Length

Returns the number of characters in a string.

string-length(FIELD_NAME)

When to use

Use for testing blank values or fixed-length fields.

Notes

Whitespace counts unless normalized first.

Count Nodes

Counts matching child nodes.

count(Detail)

When to use

Use in conditions that depend on number of records.

Notes

Make sure the path is relative to the right node.

Not Empty

Checks that a field has content.

normalize-space(FIELD_NAME) != ""

When to use

Use instead of FIELD_NAME != "" when spaces are possible.

Notes

Avoid treating whitespace as meaningful data.

AND Condition

Requires both conditions to be true.

FIELD_A != "" and FIELD_B = "Yes"

When to use

Use for precise filtering.

Notes

Use lowercase and/or in XPath.

OR Condition

Allows either condition to be true.

FIELD_A = "A" or FIELD_A = "B"

When to use

Use for multiple accepted values.

Notes

Parentheses help readability for complex logic.

Related Topics

Phase 5 adds related-topic guidance to reduce duplicate entries and make reusable patterns easier to find.

RedactedReviewedCanonical