web analytics

Learning XPath Expressions By Examples

Options
@2016-01-15 20:53:50

Select chapter 3 only

//chapter[3]
//chapter[position() = 3]
//chapter[@id=3]
/book/chapter[3]/self::*

 

@2016-01-15 21:20:27

Select chapter 2 and chapter 4 only

//chapter[position() = 2 or position() = 4]

 

 

@2016-01-15 21:57:51

Select all chapters except for chapter 3

//chapter[position() != 3]
//chapter[not(position() = 3)]

 

@2016-01-15 23:20:58

Select all chapters except for chapter 3 and chapter 6

//chapter[position() != 3 and position() != 6]

 

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com