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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:47:17+00:00 2026-05-28T00:47:17+00:00

I tried different ways and also looked around but can’t get this running. I

  • 0

I tried different ways and also looked around but can’t get this running.
I need to concat the following:

"concat( 
    'this is; \"a sample',
    //XML_NODE,
    '\"; \"using an apostrophe',
    ''',
    'in text\"'
)"

one line version:

"concat( 'this is; \"a sample', //XML_NODE, '\"; \"using an apostrophe', ''', 'in text\"' )"

The output should be:

this is "a sample XML_NODE_VALUE"; "using an apostrophe ' in text"

The problem is the ‘ in the text. concat use it to end a string and expect an following ; or the end of concat. Escaping or HTML entities all seems to not work.

Any help is really appreciated.

Thanks!

  • 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-28T00:47:17+00:00Added an answer on May 28, 2026 at 12:47 am

    In XML/XSLT you do not escape characters with a backslash.

    • In XML you can use entity references.
    • In XSLT you can use entity references and variables.

    The problem with the apostrophe inside of your concat strings is that the XML parser loading the XSLT will expand it before the concat gets evaluated by the XSLT engine; so you can’t use an entity reference for the apostrophe character unless it is wrapped in double quotes (or entity references for double quotes, as Dimitre Novatchev’s answer demonstrates).

    • Use the entity reference " for the double quote ".
    • Create a variable for the apostrophe character and reference the variable as one of the components of the concat()

    Applied in the context of an XSLT:

    <xsl:variable name="apostrophe">'</xsl:variable>
    
    <xsl:value-of select="concat( 
                'this is; &quot;a sample',
                //XML_NODE,
                '&quot;; &quot;using an apostrophe ',
                $apostrophe,
                ' in text&quot;'
                )" />
    

    If you need a 100% XPath solution that avoids the use of XSLT variables, then Dimitre’s answer would be best.

    If you are concerned with how easy it is to read, understand, and maintain, then Michael Kay’s suggestion to use XSLT variables for the quote and apostrophe might be best.

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

Sidebar

Related Questions

I've searched and searched and tried many different ways, but I can't seem to
Having tried this query a million different ways, I can't seem to SELECT 'count_lonely_vehicles'
I have tried this a few different ways but none of them seem to
Okay, I've tried about 8 different ways to get a key event into my
I have tried this a few different ways and it always seems to fail.
This seems really dumb. I've tried a bunch of different ways and it's just
Hello I have tried this many different ways and have followed the tutorial at
I need to monitor console output in Java, I have tried several different ways
I've tried many different ways to phrase this question to google et al with
I tried 3 different ways of displaying Page numbers, OnCloseDocument content is not displaying

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.