Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6099653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:17:51+00:00 2026-05-23T13:17:51+00:00

I have this xpath pattern: tags = doc.xpath(‘/html/body//a[text() = ‘ + name.encode(‘utf8’) + ‘]/@href’

  • 0

I have this xpath pattern:

tags = doc.xpath('/html/body//a[text() = "' + name.encode('utf8') + '"]/@href'

This returns the url of every -tag with name name as text in it. Is it possible to get a case insensitiv matching of name?

Edit

When trying @Shelhamer solution I get:

>>> a_tag_list = html_string.xpath('/html/body//a[lower-case(text()) = "' + author_name.lower() + '"]/@href')
  File "lxml.etree.pyx", line 1459, in lxml.etree._Element.xpath (src/lxml/lxml.etree.c:40530)
  File "xpath.pxi", line 324, in lxml.etree.XPathElementEvaluator.__call__ (src/lxml/lxml.etree.c:113864)
  File "xpath.pxi", line 242, in lxml.etree._XPathEvaluatorBase._handle_result (src/lxml/lxml.etree.c:113063)
  File "xpath.pxi", line 227, in lxml.etree._XPathEvaluatorBase._raise_eval_error (src/lxml/lxml.etree.c:112894)
lxml.etree.XPathEvalError: Unregistered function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:17:51+00:00Added an answer on May 23, 2026 at 1:17 pm

    This can be done by using the lower-case function:

    tags = doc.xpath('/html/body//a[lower-case(text()) = "' + name.encode('utf8') + '"]/@href'
    

    A helpful list of functions is here:
    http://www.w3schools.com/xpath/xpath_functions.asp

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this xpath expression that does not work //div[child[0]::h4[text()[contains(.,'Dir')]]]/a To parse this html:
I have this xpath query: descendant-or-self::link and this html code: <html xmlns=http://www.w3.org/1999/xhtml> <head> <meta
I have this code: $reader = new DOMDocument(); $reader->loadHTML($shell); $xpath = new DomXPath($reader); $xpath->registerNamespace('html','http://www.w3.org/1999/xhtml');
I have this HTML/XML: \t\t\t\t\t \r\n\t\t <a href=/test.aspx> <span class=test> <b>blabla</b> </span> </a> <br/>
I have this RewriteRule that works too well :-) RewriteRule ^([^/]*)/$ /script.html?id=$1 [L] The
I want to search div id in an html doc with certain pattern. I
for example we have this xml: <body> <a> <b> <c>hello</c> <c>world</c> </b> </a> <a>
Is there some kind of split() function in XPath? Say I have this XML:
I have an XPath with which I'm trying to match meta tags that have
I have this div: <div class=product-name>Product1</div> I also have this div: <div class=product-name gold>Product2</div>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.