     [Answers](https://scrapfly.io/blog)   /  [xpath](https://scrapfly.io/blog/tag/xpath)   /  [How to join values using XPath concat?](https://scrapfly.io/blog/answers/how-to-join-values-in-xpath)   # How to join values using XPath concat?

 by [Bernardas Alisauskas](https://scrapfly.io/blog/author/bernardas) Apr 18, 2026 1 min read [\#xpath](https://scrapfly.io/blog/tag/xpath) 

 [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-join-values-in-xpath "Share on LinkedIn")    

 

 

The `concat()` function is an XPath expression is a string join function for multiple string values. It's useful when parsing an HTML document for a specific string through distributed multiple elements or attributes:

For example, let's see the below interactive XPath expression evaluation:

&lt;html&gt; &lt;div&gt; &lt;h2&gt;Coffee&lt;/h2&gt; &lt;span data-currency="USD"&gt;4.69&lt;/span&gt; &lt;/div&gt; &lt;/html&gt; Above, we contact the name and price elements into a single string. However, we can join any number of elements. Here's an example through two or more arguments:

&lt;html&gt; &lt;div&gt; &lt;h2&gt;Coffee&lt;/h2&gt; &lt;span data-currency="USD"&gt;4.69&lt;/span&gt; &lt;/div&gt;&lt;/html&gt; Note that `concat()` only works with strings so it'll automatically try convert elements to their `text()` values. For further details on XPath selectors, including common tips and tricks, refer to our dedicated guide.

[Parsing HTML with XpathIntroduction to xpath in the context of web-scraping. How to extract data from HTML documents using xpath, best practices and available tools.](https://scrapfly.io/blog/posts/parsing-html-with-xpath)



 

   Table of Contents















 

   Join the Newsletter  Get monthly web scraping insights 

 

  



Scale Your Web Scraping

Anti-bot bypass, browser rendering, and rotating proxies, all in one API. Start with 1,000 free credits.

  No credit card required  1,000 free API credits  Anti-bot bypass included 

 [Start Free](https://scrapfly.io/register) [View Docs](https://scrapfly.io/docs/onboarding) 

 Not ready? Get our newsletter instead. 

 

## Explore this Article with AI

 [ ChatGPT ](https://chat.openai.com/?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-join-values-in-xpath) [ Gemini ](https://www.google.com/search?udm=50&aep=11&q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-join-values-in-xpath) [ Grok ](https://x.com/i/grok?text=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-join-values-in-xpath) [ Perplexity ](https://www.perplexity.ai/search/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-join-values-in-xpath) [ Claude ](https://claude.ai/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-join-values-in-xpath) 



 ## Related Articles

 [  

 python data-parsing 

### How to Parse Datetime Strings with Python and Dateparser

Dateparser is a popular Python package for parsing datetime strings. Here's how it can be used in web scraping and how t...

 

 ](https://scrapfly.io/blog/posts/parsing-datetime-strings-with-python-and-dateparser) [  

 python data-parsing 

### Parsing HTML with Xpath

Introduction to xpath in the context of web-scraping. How to extract data from HTML documents using xpath, best practice...

 

 ](https://scrapfly.io/blog/posts/parsing-html-with-xpath) [  

 data-parsing xpath 

### Ultimate XPath Cheatsheet for HTML Parsing in Web Scraping

Ultimate companion for HTML parsing using XPath selectors. This cheatsheet contains all syntax explanations with interac...

 

 ](https://scrapfly.io/blog/posts/xpath-cheatsheet) 

  ## Related Questions

- [ Q How to count selections in XPath and why? ](https://scrapfly.io/blog/answers/how-to-count-selectors-in-xpath-and-why)
- [ Q How to get the name of an HTML element in XPath? ](https://scrapfly.io/blog/answers/how-to-get-name-of-selected-element-in-xpath)
- [ Q How to reverse expressions in XPath? ](https://scrapfly.io/blog/answers/how-to-reverse-expression-in-xpath)
- [ Q How to select last element in XPath? ](https://scrapfly.io/blog/answers/how-to-select-last-element-in-xpath)
 
  



   



 Scale your web scraping effortlessly, **1,000 free credits** [Start Free](https://scrapfly.io/register)