DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Feb 2005

    Problem with double quotes in xsl

    Hi, I am a web developer for a company in Greece and I came across with a problem with NO solution ( well no easy solution)

    The problem is:

    I have a text box in HTML and I am getting its contents from an XML document Eg.
    <input type="text" name="myText">
    <xsl:attrinbute name="value"><xsl:value-of select="Document/text"/></xsl:attribute>
    The XML that is used is this:
    -- A simple sentence "with" double quotes --

    When I produce this output to my browser, within the textbox I get this value:
    -- A simple sentence
    Instead of -- A simple sentence "with" double quotes --

    The truth is that I can solve this problem with javascript but I donít have the time to start parsing the string for finding double quotes Is there any solution to this?

  2. #2
    Join Date
    Dec 2004
    Have you tried using disable-output-escaping="yes" on your value-of ?

  3. #3
    Join Date
    Feb 2005
    Hi alantin

    Yes i have tried that and nothing happened

    I have got the same output even when my XML is like this:
    -- A simple sentence &quot;with&quot; double quotes --

    or this:

    <![CDATA[-- A simple sentence &quot;with&quot; double quotes --]]>

    I think that the problem arise at the moment that the XSLT translates the contents of the <text> element.
    In other words when the XSLT converts the &quot; to " then this value is being strored in HTML like this:
    <input type="text" name="myText" value="-- A simple sentence "with" double quotes --"/>

    this line of code will produce a text box with this value:-- A simple sentence

  4. #4
    Nigel McFarlane is offline Former moderator, account closed
    Join Date
    Nov 2003
    I live on the 'net
    The only legal option for your XML document is to use &quot; so that's a start.
    Nigel McFarlane, Author: "Firefox Hacks", "Rapid Application Development with Mozilla"

  5. #5
    Join Date
    Feb 2005
    I found the problem.
    I am working for a company and i didnt realised that there were a piece of code that transform all the &amp; to & and all the &quot; to "
    Since these are being transformed then the generated HTML is the following:

    <input type="text" name="myText" value="-- A simple sentence "with" double quotes --"/>
    which is wrong

    Thanks guys for you replies

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.