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 8385197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:36:31+00:00 2026-06-09T17:36:31+00:00

How do I select a specific attribute value from a series of values using

  • 0

How do I select a specific attribute value from a series of values using XQuery?

My XML file looks like this:

<unit id="01" xref="entry01 entry02">

How do I select a specific value — such as entry01 — from the xref attribute and assign it to a variable?

I need to select the individual values from the attribute xref, because additional features for these values are defined later in the file:

<features xref="entry01" font-size="2">
<features xref="entry02" font-size="3">

I would like to organize the entries into a table such as one exemplified below. The columns defined by the attributes as follows: unit id, xref, font-size.

<tbody>
<tr>
<td>01</td>
<td>entry01</td>
<td>2</td>
</tr>
<tr>
<td>01</td>
<td>entry02</td>
<td>3</td>
</tr>
</tbody>
  • 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-06-09T17:36:32+00:00Added an answer on June 9, 2026 at 5:36 pm

    Use fn:tokenize to split at space (or all whitespace) characters, depending on you needs:

    Split at a single space:

    tokenize(<unit id="01" xref="entry01 entry02"/>/@xref, " ")[1]
    

    Allow multiple spaces directly following each other:

    tokenize(<unit id="01" xref="entry01  entry02"/>/@xref, " +")[2
    

    Split at a single whitespace (I changed the attribute value to contain a tab character):

    tokenize(<unit id="01" xref="entry01    entry02"/>/@xref, "\s")[2]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I select a specific value in the combobox column in the datagridView
How can one select a specific sibling of a context node using jQuery? Specifically,
I'd like to be able to select a specific option within a dropdown list
I am using the .eq() method to select a specific child element of a
Hi can anyone help me how to select a specific div from the content
I'm trying to use LINQ to SQL to select a few specific columns from
I need to select node which has a specific value: <td class='formlabel'>Name:</td> So I
Suppose that I have a database query which looks like below - select name,
This code can't read a specific attribute - the name attribute more specifically. Instead
I have XML exactly like this format: <?xml version=1.0 encoding=utf-8?> <book> <chapter> <verse>This is

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.