John
John

Reputation: 1

Xpath multiple attributes from different nodes

What's wrong with this xpath line added below:

/holiday[starts-with(@code,'A')/holidaytype[1]/duration[@period=(15)]

I'm trying to filter by holiday code and then by the number of day(period).

Upvotes: 0

Views: 75

Answers (1)

acdcjunior
acdcjunior

Reputation: 135862

You are missing a / and a ]. Look:

/holiday[starts-with(@code,'A')/holidaytype[1]/duration[@period=(15)]
 ^                             ^
 ^-- missing here              ^-- and "]" here

In the first case, it can be a // or //*/. So, try:

//holiday[starts-with(@code,'A')]/holidaytype[1]/duration[@period=(15)]

Upvotes: 3

Related Questions