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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:12:27+00:00 2026-05-23T12:12:27+00:00

I have an XML document that contains items with dashes I’d like to strip

  • 0

I have an XML document that contains items with dashes I’d like to strip

e.g.

<xmlDoc>
   <items>
      <item>a-b-c</item>
      <item>c-d-e</item>
   <items>
</xmlDoc>

I know I can find-replace a single item using this xpath

/xmldoc/items/item[1]/translate(text(),'-','')

Which will return

“abc”

however, how do I do this for the entire set?

This doesn’t work

/xmldoc/items/item/translate(text(),'-','')

Nor this

translate(/xmldoc/items/item/text(),'-','')

Is there a way at all to achieve that?

  • 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-23T12:12:28+00:00Added an answer on May 23, 2026 at 12:12 pm

    I know I can find-replace a single
    item using this xpath

    /xmldoc/items/item[1]/translate(text(),'-','')
    

    Which will return

    "abc"
    

    however, how do I do this for the
    entire set?

    This cannot be done with a single XPath 1.0 expression.

    Use the following XPath 2.0 expression to produce a sequence of strings, each being the result of the application of the translate() function on the string value of the corresponding node:

    /xmlDoc/items/item/translate(.,'-', '')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML document that contains a series of item nodes that look
I have an XML document that contains special characters like '%', Carriage return, line
I have an xml document that contains some Item elements with ids. I want
Situation: I have a simple XML document that contains image information. I need to
I have an xml document that looks like this <?xml version=1.0?> <XML> <VIDEO> <WIDTH>800</WIDTH>
I have an xml document that looks like this. <foo> <bar type=artist/> Bob Marley
I have an XML document that matches our site navigation something like this: <page
Say I have a xml document that looks like this <foo> <bar id=9 />
I have an XML structure that looks like this: <root> <index> <item>item 1</item> <item>item
I have an XML document that contains the following ... <foo>abc</foo> ... If I

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.