preceding-sibling::*[1]

来源:互联网 发布:未来软件4.8 编辑:程序博客网 时间:2024/06/16 08:41

还是有点不太明白




search the relative information about xpath axis 'preceding-sibling', find there are the same question from otherssee[1]. The output display document order when apply preceding-sibling::*[1] to the context node in xpath1.0, and reversed in xpath2.0. It's annoyingly to have one output with xmlspy2006 but another display in Office software. It's questional what version its used internally. 

Just like the diagram (using 'X' to presented the current location, that is to say the context )described as [2], i think it's true for xpath2.0.

preceding-sibling

 current() 

following-sibling

last()

...

2

1

X

1

2

...

last()

 

The reversed order which works with xpath1.0 should be like this:

preceding-sibling

 current() 

following-sibling

1

2

...

last()

X

1

2

...

last()

 Is that right?

[1]http://mail.gnome.org/archives/xml/2005-August/msg00045.html

[2]http://www.infopathdev.com/blogs/greg/archive/2005/06/13/Using-XPath_2700_s-_2700_preceding_2D00_sibling_2700_-Axis-Correctly.aspx                               





原创粉丝点击