XPATHS and Default Namespaces

后端 未结 5 2080
囚心锁ツ
囚心锁ツ 2020-11-28 12:34

What is the story behind XPath and support for namespaces? Did XPath as a specification precede namespaces? If I have a document where elements have been given a default na

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-28 13:22

    You need local-name():

    http://www.w3.org/TR/xpath#function-local-name

    To crib from http://web.archive.org/web/20100810142303/http://jcooney.net:80/archive/2005/08/09/6517.aspx:

    
      
        
                  
    
    

    This expression will match the “bar” element:

      //*[local-name()='bar'] 
    

    This one won't:

     //bar
    

提交回复
热议问题