开发者

Preserving order when copying elements using Deliverance / XPath

How would I, using Deliverance & XPath (o开发者_高级运维r CSS) selectors, select and copy list items .one and .three from each list below, but display them in the order of their parent list?

<ul id="a-wrapper">
   <li class="one"></li>
   <li class="two"></li>
   <li class="three"></li>
   <li class="four"></li>
</li>

<ul id="b-wrapper">
   <li class="one"></li>
   <li class="two"></li>
   <li class="three"></li>
   <li class="four"></li>
</ul>

    c,d,e,f,g etc....

The catch is it needs to use a href rule, eg: <prepend href="/blah/deblah" content="#x" theme="#y" />

Using the following just lists all the .one elements, then all the .three elements.

<prepend href="/blah/deblah" content=".one" theme="#y" />
<prepend href="/blah/deblah" content=".three" theme="#y" />


Not sure what you mean, but to grab all at once in source order use this XPATH:

//ul[@id='a-wrapper' or @id='b-wrapper']/li[@class='one' or @class='three']
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜