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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:50:18+00:00 2026-05-23T18:50:18+00:00

The relevant parts of the code: <xsl:variable name=apos>'</xsl:variable> <xsl:variable name=and select=’&#039;’ /> <xsl:value-of select=translate(products_name/node(),$and,$apos)/>

  • 0

The relevant parts of the code:

<xsl:variable name="apos">'</xsl:variable>
<xsl:variable name="and" select='"&#039;"' />

<xsl:value-of select="translate(products_name/node(),$and,$apos)"/>

I’m thinking this should be a simple thing and that the above code should work but it doesn’t effect the output at all.

(I used variables because names cannot begin within an ampersand and using just an apostrophe brings up a compile error.)

I’ve tested the code to make sure the translate is working using strings and there are no errors there.

Any help would be greatly appreciated.

  • 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-23T18:50:19+00:00Added an answer on May 23, 2026 at 6:50 pm

    You are on the right track, but not yet there: Your problem is, that XSL is a language that itself is written using XML. For all XML languages, the parser automatically decodes XML entities. The XSLT engine only comes afterwards.

    As a result, the XSLT engine neither does nor can distinguish whether you wrote ' or &#039; – it’s the same. For your problem, this has two effects:

    1. You have to use a variable containing the apostrope – this is because the apostrophe itself is reserved for string literals in expressions that may contain functions. Even for <xsl:value-of select="translate(products_name/node(),$and,'&#039;')"/>, the XML parser transforms the entity into an apostrophe, i.e. <xsl:value-of select="translate(products_name/node(),$and,''')"/>

    2. You have to escape the ampersand used in the string you search for: for the XSL engine, the variable “and” contains the value ', i.e. you are replacing an apostrophe with an apostrophe.

    Working solution:

    <xsl:variable name="apos">'</xsl:variable>
    <xsl:value-of select='translate(text(), "&amp;#039;", $apos)'/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The relevant snippet of HTML: <span class=a> <div class=fieldname>Question 1</div> <input type=text value= name=q1
Here's the relevant code: <div data-bind=foreach: chats, visible: chats().length > 0> <input data-bind='value: $parent.newCommentText'
Here are the relevant parts of the XAML file: xmlns:local=clr-namespace:BindingTest <ListBox x:Name=myList ItemsSource={Binding Source={x:Static
My problem is related to Android. I have the following code (non-relevant parts omitted):
Relevant Code Snippet: public class MyPreference extends Preference { public MyPreference(Context context, AttributeSet attrs)
Here is the code relevant to my question: http://jsfiddle.net/mkerny45/V23NK/ As you can see there
Here's the relevant code snippet. public static Territory[] assignTerri (Territory[] board, String[] colors) {
Here's the relevant code: public static void printBoarders (Territory x) { int t =
In a Linq Statement like the following (narrowed down to relevant parts for the
I'm having a bit of difficulty setting a variable from the code behind and

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.