标题: W3C对xpath的阐述
yorsal
管理员
Rank: 9Rank: 9Rank: 9


UID 6
精华 0
积分 0
帖子 205
阅读权限 200
注册 2007-1-29
状态 离线
发表于 2007-1-31 10:00  资料  个人空间  短消息  加为好友  添加 yorsal 为MSN好友 通过MSN和 yorsal 交谈 QQ
W3C对xpath的阐述

Here are some examples of location paths using the unabbreviated syntax:
  • child::para selects the para element children of the context node
  • child::* selects all element children of the context node
  • child::text() selects all text node children of the context node
  • child::node() selects all the children of the context node, whatever their node type
  • attribute::name selects the name attribute of the context node
  • attribute::* selects all the attributes of the context node
  • descendant::para selects the para element descendants of the context node
  • ancestor::div selects all div ancestors of the context node
  • ancestor-or-self::div selects the div ancestors of the context node and, if the context node is a div element, the context node as well
  • descendant-or-self::para selects the para element descendants of the context node and, if the context node is a para element, the context node as well
  • self::para selects the context node if it is a para element, and otherwise selects nothing
  • child::chapter/descendant::para selects the para element descendants of the chapter element children of the context node
  • child::*/child::para selects all para grandchildren of the context node
  • / selects the document root (which is always the parent of the document element)
  • /descendant::para selects all the para elements in the same document as the context node
  • /descendant::list/child::item selects all the item elements that have an olist parent and that are in the same document as the context node
  • child::para[position()=1] selects the first para child of the context node
  • child::para[position()=last()] selects the last para child of the context node
  • child::para[position()=last()-1] selects the last but one para child of the context node
  • child::para[position()>1] selects all the para children of the context node other than the first para child of the context node
  • following-sibling::chapter[position()=1] selects the next chapter sibling of the context node
  • preceding-sibling::chapter[position()=1] selects the previous chapter sibling of the context node
  • /descendant::figure[position()=42] selects the forty-second figure element in the document
  • /child::doc/child::chapter[position()=5]/child::section[position()=2] selects the second section of the fifth chapter of the doc document element
  • child::para[attribute::type="warning"] selects all para children of the context node that have a type attribute with value warning
  • child::para[attribute::type='warning'][position()=5] selects the fifth para child of the context node that has a type attribute with value warning
  • child::para[position()=5][attribute::type="warning"] selects the fifth para child of the context node if that child has a type attribute with value warning
  • child::chapter[child::title='Introduction'] selects the chapter children of the context node that have one or more title children with string-value equal to Introduction
  • child::chapter[child::title] selects the chapter children of the context node that have one or more title children
  • child::*[self::chapter or self::appendix] selects the chapter and appendix children of the context node
  • child::*[self::chapter or self::appendix][position()=last()] selects the last chapter or appendix child of the context node

详细参考
地址:http://www.w3.org/TR/xpath





i love jQuery
顶部
技术幻想
新手上路
Rank: 1



UID 38
精华 0
积分 0
帖子 7
阅读权限 10
注册 2007-1-31
状态 离线
发表于 2007-1-31 12:30  资料  个人空间  短消息  加为好友 
少发英文资料,翻译了再发嘛!
毕竟像我这样读不懂的人还是很多的

顶部
yorsal
管理员
Rank: 9Rank: 9Rank: 9


UID 6
精华 0
积分 0
帖子 205
阅读权限 200
注册 2007-1-29
状态 离线
发表于 2007-2-1 09:43  资料  个人空间  短消息  加为好友  添加 yorsal 为MSN好友 通过MSN和 yorsal 交谈 QQ
我觉得我们是不是应该开个<英文学习>板块呢~





i love jQuery
顶部
yolio2003
新手上路
Rank: 1


UID 70
精华 0
积分 0
帖子 36
阅读权限 10
注册 2007-2-5
状态 离线
发表于 2007-2-5 16:40  资料  个人空间  短消息  加为好友 

应该是有人支持滴

顶部
purifieron
新手上路
Rank: 1



UID 117
精华 0
积分 0
帖子 5
阅读权限 10
注册 2007-2-21
状态 离线
发表于 2007-2-21 10:16  资料  个人空间  主页 短消息  加为好友 
我支持,这个专业的,也只是英文的,不行,你要看多英文的资料。





顶部
yzm
新手上路
Rank: 1



UID 414
精华 0
积分 0
帖子 6
阅读权限 10
注册 2007-4-10
状态 离线
发表于 2007-4-10 23:07  资料  个人空间  短消息  加为好友 

同意
开一个英文学习

顶部
analyzer
新手上路
Rank: 1


UID 1221
精华 0
积分 0
帖子 42
阅读权限 10
注册 2007-7-5
来自 西安
状态 离线
发表于 2007-7-5 14:43  资料  个人空间  主页 短消息  加为好友  添加 analyzer 为MSN好友 通过MSN和 analyzer 交谈 QQ ICQ 状态 Yahoo!
支持,学习,顶上去啊

顶部
 



当前时区 GMT+8, 现在时间是 2008-11-21 06:48
鲁ICP备05039777号

    本论坛支付平台由支付宝提供
携手打造安全诚信的交易社区 Powered by Discuz! 5.5.0  © 2001-2007 Comsenz Inc.
Processed in 0.019392 second(s), 6 queries , Gzip enabled

清除 Cookies - 联系我们 - jQuery中文社区 - Archiver - WAP