开发者

xpath help substring expression

开发者 https://www.devze.com 2022-12-28 14:31 出处:网络
Hi i have a document from which i am trying to extract a date. But the problem is within 开发者_如何学编程the node along with the date their is some text too. Something like

Hi i have a document from which i am trying to extract a date. But the problem is within 开发者_如何学编程the node along with the date their is some text too. Something like

 <div class="postHeader">  
 Posted on   
   July 20, 2009  9:22 PM PDT  

   </div>  

From this tag i just want the date item not the Posted on text. something like

./xhtml:div[@class = 'postHeader'] is getting everything. and to be precise, the document i have is basically a nodelist of this elements for eg i will get 10 nodes of these elements with different date values but to be worse the problem is sometime inside these tags some random other tags also pops us like anchors etc. Can i write a universal expath which will just get the date out of the div tag?


With XSLT 2.0 you have the xpath function matches() and replace(). Do you have XPATH 2.0 available?

0

精彩评论

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