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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:56:15+00:00 2026-06-17T04:56:15+00:00

Hi i have applied CDATA to a sectio of nodes in a xml all

  • 0

Hi i have applied CDATA to a sectio of nodes in a xml all the < and > are replaced by &lt; and &gt;. I want to replace " with &quot; in addition.

what changes do i need to make to the CDATA part to replace " with &quot;

  • 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-17T04:56:16+00:00Added an answer on June 17, 2026 at 4:56 am

    You don’t say clearly what you are doing, so it’s hard to answer simply.

    If what you mean is that

    • you have added a CDATA marked section in an XML document you are feeding to an XSLT stylesheet;
    • the portion of the stylesheet’s output which corresponds to the CDATA section in the input has references to the entities lt and gt where the input has angle brackets (so <p class="greeting">Hello, world</p> becomes &lt;p class="greeting"&gt;Hello, world!&lt;/p&gt;, and this is what you desire; and
    • you would like ” not to appear literally in the output either, but be replaced by a reference to the entity quot

    then one way to achieve your aim is to write a template to handle text nodes, which tests for the presence of “, splits the text node into left-part and right-part on the first “, writes out the left part, writes out an ampersand, writes out quot;, and then calls itself recursively with the right part of the string.

    The following stylesheet illustrates the pattern:

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    version="1.0">
    
      <xsl:template match="doc">
        <xsl:element name="doc">
          <xsl:apply-templates/>
        </xsl:element>
      </xsl:template>
    
      <xsl:template match="text()" name="escape-quot">
        <xsl:param name="s" select="."/>
        <xsl:choose>
          <xsl:when test="contains($s,'&quot;')">
            <xsl:variable name="sL" 
              select="substring-before($s,'&quot;')"/>
            <xsl:variable name="sR" 
              select="substring-after($s,'&quot;')"/>
            <xsl:value-of select="$sL"/>
            <xsl:text>&amp;quot;</xsl:text>
            <xsl:call-template name="escape-quot">
              <xsl:with-param name="s" select="$sR"/>
            </xsl:call-template>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="$s"/>
          </xsl:otherwise>
        </xsl:choose>    
      </xsl:template>
    </xsl:stylesheet>
    

    We can apply it to the following input to see the result:

    <doc>Hi. This is a test.
    <![CDATA[<p class="greeting">Hello, 
    world!</p>]]>
    </doc>
    

    The result I get is, I conjecture, what you are looking for.

    <?xml version="1.0"?>
    <doc><p>Hi. This is a test.</p>
    <p>&lt;p class=&amp;quot;greeting&amp;quot;&gt;Hello, 
    world!&lt;/p&gt;</p>
    </doc>
    

    If that wasn’t what you wanted, you might try explaining your question in more detail. It’s always a good idea in cases like this to provide (a) the key bits of your current code, (b) sample input, (c) a sample of the output you’re currently getting, with a description of what’s wrong with it, and (d) a sample of what you would like the output to look like. (Keep both the samples and the code short — you want to provide the smallest possible complete working example so readers can recreate your problem.)

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

Sidebar

Related Questions

I have a style applied to my whole application: AndroidManifest.xml: <application android:theme=@style/ApplicationStyle android:icon=@drawable/icon android:label=@string/app_name>
I have applied the follwoing selector to all my buttons by specifying it in
We have a farm with 2 servers. I have applied some changes to the
I have applied bxslider on ul element. But i want to have different pause
I have applied gesture on whole view and I want to interact with table
I have some div's and have applied resizable & draggable methods to it. But
I have a upload field. I want to upload only images. I have applied
I have applied this code for iframe id. <iframe id='<?php echo 'fraDisabled'.$i.$post->ID; ?>' src='<?php
I have applied a CABasicAnimation to a layer. The animation modifies the position.y layer
I have applied Two different Image Enhancement Algorithm on a particular Image and got

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.