0

How make an XPath that always return a null node list ?

I am not an XPath expert, I could work out *[not(node())]. Is it okay ?

--

I need it because I have two methods : one builds an XPath, and the other is looking for the matches. For some particular cases I want to force a null result depending on the input of the first method.

2 Answers 2

2

The shortest is:

XPath 1.0: /..

XPath 2.0: ()

Sign up to request clarification or add additional context in comments.

Comments

1

How make an XPath that always return a null node list ?

Simple.

/*[false()]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.