Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsShort answer: XPath concat() joins values in the order you provide them. It does not add spaces, commas, or any other separator automatically, so include each separator as its own argument: concat('Ada', ' ', 'Lovelace') returns Ada Lovelace.
What XPath concat() does
The function appends its arguments from left to right and returns one string. XPath 1.0 defines the form concat(string, string, string*): you must supply at least two arguments, and you may supply more.
concat('North', 'South')
This returns NorthSouth. To insert punctuation or whitespace, add a literal argument:
concat('North', ', ', 'South')
The result is North, South. The function performs direct concatenation; it does not infer a delimiter from the values.
#1 Best Overall
Basic syntax
concat(value1, value2, value3, ...)
- Arguments are evaluated from left to right.
- Every argument contributes its string value.
- There must be at least two arguments in XPath 1.0.
- A separator such as
' ',', ',' - ', or':'must be written explicitly.
Joining XML attributes and elements
In an XML document such as:
<person given="Ada" family="Lovelace" />
you can build a display name with:
concat(@given, ' ', @family)
In XPath 1.0, an attribute or element node selected as an argument is converted to a string. If a node-set contains several nodes, its first node in document order supplies the string value. Therefore, this expression is appropriate when each context node has one @given and one @family attribute. It does not produce one concatenated result for every node in a multi-node selection; select or process those nodes separately.
For element content, the equivalent expression is:
concat(given, ' ', family)
A predicate can compare the constructed string with a target value:
//person[concat(given, ' ', family) = 'Ada Lovelace']
This pattern first obtains the string value of given, inserts one literal space, obtains the value of family, and then performs the comparison.
Separators, punctuation, and formatting
Because separators are ordinary arguments, you can choose the exact output format:
Recommended Free Tools
| Expression | Result | Use |
|---|---|---|
concat('Ada', ' ', 'Lovelace') |
Ada Lovelace |
Human-readable name |
concat('Ada', ', ', 'Lovelace') |
Ada, Lovelace |
Comma-separated display |
concat('2026', '-', '09', '-', '29') |
2026-09-29 |
ISO-style date text |
concat('ID:', ' ', @id) |
ID: 123 when @id is 123 |
Label plus value |
Whitespace is significant. ' ' is one space, while ' ' is two. If a source value already contains leading or trailing whitespace, concat() preserves it; use a separate normalization step when your host supports one and the data requires it.
concat() versus string-join()
Use concat() when the number and position of values are fixed. Use string-join() when you have a sequence and want one separator inserted between adjacent items.
Rank #2
- Used Book in Good Condition
| Question | concat() |
string-join() |
|---|---|---|
| Input shape | Separate, explicitly positioned arguments | A sequence of items |
| Delimiter behavior | No automatic delimiter; write it as an argument | The supplied separator is placed between sequence members |
| Version consideration | Defined in XPath 1.0 and later versions | Use the XPath 2.0-and-later style; XPath 3.1 specifies sequence and separator behavior |
For a fixed pair:
concat('Ada', ' ', 'Lovelace')
For a sequence:
string-join(('Ada', 'Lovelace'), ' ')
The second expression places one space between the two sequence items. XPath 3.1 also defines a one-argument form, string-join(('Ada', 'Lovelace')), whose separator is the empty string.
Check the XPath version implemented by your XSLT processor, XML database, browser API, or other host before using string-join(). A host that only implements XPath 1.0 will accept concat() but not the XPath 2.0+ sequence functions.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteHandling missing and empty values
XPath 1.0 node selections
If an attribute or element is absent, its node-set converts to an empty string in a string context. The literal separators you supplied still appear:
concat(@given, ' ', @family)
If only @family exists, the result contains a leading space followed by the family name. That behavior is predictable but may not be the desired presentation. Handle optional fields with a conditional expression or choose separate branches in the surrounding XSLT or application code.
XPath 3.1 atomic values
The XPath 3.1 function specification describes concat() as accepting two or more atomic arguments and casting each one to xs:string. An empty-sequence argument behaves as an empty string. Separators you wrote explicitly are still retained, so an empty value does not remove a neighboring literal space or comma.
Do not expect trimming or filtering
concat() neither trims whitespace nor skips empty arguments. If your output must avoid doubled spaces, dangling punctuation, or optional labels, decide that logic before calling concat() or use a sequence-and-filter approach available in your XPath version.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Practical recipes
Build a full name
concat(@first, ' ', @last)
This is the simplest fixed-field pattern. It assumes both attributes are intended to be present.
Add a label
concat('Order ', @number, ': ', @status)
With @number="42" and @status="shipped", the result is Order 42: shipped.
Create a path-like value
concat('/products/', @sku)
The slash is part of the output, not a delimiter supplied by XPath.
Match a formatted value
//product[concat(@brand, ' ', @model) = 'Acme 1000']
Use this when the comparison format is fixed and known. If many records must be joined with the same delimiter, string-join() is usually the clearer expression in XPath 2.0+.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Testing an expression in your host
XPath is an expression language, so the exact way to run it depends on the host. In an XSLT stylesheet, place the expression in a value-of instruction:
<xsl:value-of select="concat(@given, ' ', @family)" />
In an XPath-capable XML editor or database console, evaluate the expression with an appropriate context node. The context matters: @given means “the given attribute of the current node,” while //person/@given selects attributes from the document root. If the context is wrong, the expression may be valid but return an empty string.
Troubleshooting concat() expressions
There is no space between words
Cause: the expression contains only the values.
concat('Ada', 'Lovelace')
Fix: add a literal space argument:
concat('Ada', ' ', 'Lovelace')
The output has an unexpected leading or trailing space
Cause: a separator is emitted even though one neighboring node is missing or already contains whitespace.
Fix: inspect the source values, remove unintended whitespace in the source or surrounding expression, and add conditional handling for optional fields.
The expression fails with a function or arity error
Cause: fewer than two arguments were supplied, or the host does not support the function syntax you used.
Fix: provide at least two arguments for concat() and verify the host’s XPath version and function library. For sequence joining, use string-join() only where XPath 2.0 or later is available.
Only one value appears from a multi-node selection
Cause: XPath 1.0 converts a node-set used as a string to the string value of its first node in document order.
Fix: iterate over the selected nodes, evaluate concat() with each node as the context, or use a sequence-oriented expression in a newer XPath version.
Best Value
A valid expression returns an empty string
Cause: the context node does not contain the referenced attributes or elements, or the path selected no node.
Fix: test each path independently, confirm the current context, and distinguish an absent node from a node whose value is genuinely empty.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Performance and maintainability
No general benchmark establishes a universal speed advantage for one joining function. In practice, choose the expression that matches your data shape. A short, fixed concat() call is explicit and portable to XPath 1.0. For a variable-length sequence, string-join() communicates the delimiter rule without writing a separate argument for every item.
Keep formatting decisions visible in the expression. A reviewer can immediately see whether the output uses a space, comma, slash, or no separator. When the format is reused in several templates or queries, centralize it according to the facilities of your host rather than copying subtly different literal separators.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Or skip the browser setup
If you need a screenshot of a page that demonstrates an XPath result, you can capture the rendered page through ScreenshotNeo instead of configuring a local browser script. It is a website screenshot API; it does not evaluate XPath for you, so the expression still needs to run in your page or application first.
The one-call example below captures Stripe’s page as a WebP response. See the ScreenshotNeo API documentation for the available options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The same request in Python:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
And in Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
- Cookie and consent banners are accepted and removed before capture, along with more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off.
- Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed. Response headers identify the page verdict and whether the shot was billed.
- An MCP server provides
take_screenshot,get_page_info, andcapture_pdftools for Claude, Cursor, and other MCP clients. - The Free plan includes 1,000 screenshots per month without a card. Paid plans start at $5 for 3,000 screenshots; yearly billing gives two months free.
Create your free ScreenshotNeo account to try it without a card.
Choosing the right expression
- Use
concat()for a small, fixed list of values whose positions are known. - Write every required separator explicitly and verify whether source values already contain whitespace.
- Check how your host converts nodes, especially when a path can select more than one node.
- Use
string-join()for a sequence when the host supports XPath 2.0 or later. - Test missing-value cases, not only the fully populated example.
Frequently Asked Questions
How can I determine which XPath version my application supports?
Check the XPath or XSLT version listed in the host application’s documentation and confirm which function library it exposes. This determines whether sequence functions such as string-join() are available.
Does concat() change the XML document?
No. It computes and returns a string value; changing an XML document requires a separate transformation or update operation provided by the host.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

