2013-03-28 91 views
0

我嘗試從下面的div標記中提取每個文本(),但沒有在標記之間的文本()。從XPATH結果中排除節點

我用這個沒有成功:

//div[@class="availability"]/*[not(self::a)]/text() 

這是HTML

<div class="availability"> 
    Available. Delivered from UK <br><a href="test.com">Click for more</a> 
</div> 

<div class="availability"> 
    Available. Delivered from HK <br><a href="test.com">Click for more</a> 
</div> 

<div class="availability"> 
    Available. Delivered from USA <br><a href="test.com">Click for more</a> 
</div> 

<div class="availability"> 
    Available. Delivered from DE <br><a href="test.com">Click for more</a> 
</div> 

感謝指導我到正確的方向!

回答

1

//div[@class="availability"]/text()

+0

thx .. so simple .. – Jabb