Output-escaping in XSLT

I write a xml file as following:
<?xml version="1.0" encoding="GB2312"?>
<?xml-stylesheet href="xsl/order_edit.xsl" type="text/xsl"?>
<Order>
     <Sales>&#24352;&#19977;</Sales>
     <Value>&#24352;&#19977;</Value>
</Order>
and the order_edit.xsl is as follwing:
<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" encoding="GB2312"/>
<xsl:template match="/">
     <html>
          <body>
          <input type="text" name="test1">
          <xsl:attribute name="value">
               <xsl:value-of select="Order/Sales"
disable-output-escaping="yes">
               </xsl:value-of>
          </xsl:attribute>
          </input>
          <br></br>
          <xsl:value-of select="Order/Value" disable-
output-escaping="yes">
          </xsl:value-of>
          </body>
     </html>
</xsl:template>
</xsl:stylesheet>
when I run the xml file in OC4J,the source code in IE is as
following:
<html>
<body>
<input name="test1" type="text" value="&amp;#24352;&amp;#19977;">
<br>&#24352;&#19977;</body>
</html>
test1.value now is "&amp;#24352;&amp;#19977;",but I hope it be
"&#24352;&#19977;" to be displayed correctly.("&#24352;&#19977;"
is two chinese characters).
What can I do?

Acora IT Limited is a consultancy specialising in Oracle and XML
applications, working on these XML Conundrums and found that
posting this sort of question very difficult, as writing the
code down to be displayed in the forums correctly often leads
other missleading questions/answers. If you would like to e-
mail the question in Plain Text to the address below I will have
a look and try and answer your question to my best ability.
[email protected]
Acora IT Limited

Similar Messages

  • Error with output escaping in xslt

    (using c-xml parser v2 2.0.1.0.0 for Sun Solaris)
    Hi all,
    when using the following in a XSL file:
    <xsl:text disable-output-escaping="yes">
    <&;>&quote;&apos;
    </xsl:text>
    the result in the output is:
    &#60;&#38;>"'
    My question: why are the lt and the amp not change into < and & correctly???
    And by the way, rsults are the same when using disable-output-escaping="no".
    null

    Hi Harmen,
    I also encounting the problem( I am using the C++ version), could you tell me if you have got the answer for it?
    Many thanks in advance.
    Sean
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Harmen:
    Sorry text got mingled, hope this won't:
    <xsl:text disable-output-escaping="yes">
    <&>"e;&apos;
    <&;>&quote;&apos;
    </xsl:text>
    And I forgot to mention I'm using the XSLSample program.<HR></BLOCKQUOTE>
    null

  • XSLT HTML output escaping problem

    I am having problems with JAXP XSLT output escaping in HTML. I have an XML document which correctly escapes &, <, > etc (eg: &amp). However, when I transform the document the XSLT processor is escaping these values again. This means that the HTML output contains &amp; where the XML document contains & (for example). Surely correctly escaped characters in the XML should be left alone? Or should the XML document not contain escaped characters? In my understanding special characters in text nodes of XML documents should be escaped. Obviously a work around is to disable output escaping on these nodes but that is a real pain to have to do each time you pull a value through from the XML document. I'm confused as to what format the XSLT processor expects the XML to be in in relation to escaping of elements. Any information gratefully accepted!
    Thanks.

    Sorry! I was getting confused - the special characters were being escaped twice before they reached the XSLT processor. It looks like the processor will leave alone escape sequences that are already in the XML when it transforms to HTML.

  • Uri-escaping in XSLT-Processor when using html-method in xsl:output

    I've a problem with the XSLT-Processor:
    He tries to escape non-ASCII Characters in the href-Attribute when I use the output method "html". This is correct according to XSLT 1.0 and HTML4, but the processor doesn't really escape the characters, he just gives me a %3F ('?'-character) instead of %HH (where HH corresponds to the hex value of the char).
    I searched the forums and found a thread with the same problem, but there was no solution to this issue. The thread was started in 2002 so maybe someone came up with a solution.

    Add the non-ascii character to <xsl:text disable-output-escaping="yes"></xsl:text>

  • 9iR2 XSLT: disable-output-escaping bug if  input is escaped

    If my interpretation of XSLT standards is correct, the "disable-output-escaping" attribute in the following example should output <table width="100%"> before the first attribute of the current element, and </table> after the last one. The overall result will be a valid HTML table. This is what happens if my browser (IE 5.5 SP2) or XMLSpy does the transform.
    In 9iR2 (and also in 9iR1), however, the actual output is &lt;table width="100%"&gt; and &lt;/table&gt;.
    Is this a (known) bug ??
    Age Jan
    <xsl:template match="@*">
         <!-- xsl:if test="position()=1">
              <xsl:text disable-output-escaping="yes">&lt;table width="100%"&gt;</xsl:text>
         </xsl:if -->
         <tr class="attribute">
              <td width="40"><xsl:value-of select="name(.)"/></td>
              <td><xsl:value-of select="."/></td>
         </tr>
         <!-- xsl:if test="position()=last()">
              <xsl:text disable-output-escaping="yes">&lt;/table&gt;</xsl:text>
         </xsl:if -->
    </xsl:template>

    Bug 2289449

  • XSLT : Problem using xsl:value-of disable-output-escaping="yes"

    Hello,
    I have some problem using "disable-output-escaping" attribute of xsl:value-of() function.
    I have a table SONGS with two columns XML and XSL filled with :
    <song>
      <title>Isn't she lovely?</title>
    </song>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output method="xml" encoding="UTF-8"></xsl:output>
      <xsl:template match="//song">
        <out>
          <xsl:value-of select="title" disable-output-escaping="yes"></xsl:value-of>
        </out>
      </xsl:template>
    </xsl:stylesheet>The query to transform XML with XSL :
    SELECT XMLTRANSFORM (xml, xsl)  FROM songs;I get this XML :
    <out>Isn&apos;t she lovely?</out>but I want that (without the '&amp;' special character) :
    <out>Isn't she lovely?</out>How can I procees to succeed ?
    Thanks,
    Dominique

    What DB version?
    The following SQL
    select xmltransform(XMLTYPE('<song>
      <title>Isn''t she lovely?</title>
    </song>'), XMLTYPE('<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output method="xml" encoding="UTF-8"></xsl:output>
      <xsl:template match="//song">
        <out>
          <xsl:value-of select="title" disable-output-escaping="yes"></xsl:value-of>
        </out>
      </xsl:template>
    </xsl:stylesheet>'))
      from dual;produces this on 11.1.0.6
    <?xml version="1.0" encoding="UTF-8"?>
    <out>Isn't she lovely?</out>and this on 10.2.0.4
    <out>Isn&apos;t she lovely?</out>I found a couple of previous discussions regarding this at
    {thread:id=679397}
    {thread:id=879301}
    The last discussion provides a workaround if you need it.

  • XSL's disable-output-escaping in Java

    Hi,
    I have a question about the disable-output-escaping attribute in a XSLT-Stylesheet.
    I need to have a string in my output that describes a numeric entity like "& # x 0030;" (the inserted spaces are only to avoid the forumsoftware to interpret this sign). This should not be interpreted as the sign "0" but rather be literally copied in the result document.
    In XSLT Stylesheet I achieve this by writing:
    <xsl:value-of disable-output-escaping="yes" select="'&#x0026;#x0030;'" />Now I've tried to create a such Node object in a DOM tree. But thats harder than I thought.
    Text n = currentNode.getOwnerDocument().createTextNode((char)38 + "#x0030;");
    Text n = currentNode.getOwnerDocument().createTextNode("\u0026#x0030;");I tried to create a Text object (see above) but the ampersand sign is always interpreted as '& amp;', so that my resultstring is '& amp;#x0048;'.
    Now my question is if there is a posibility to set a property like "disable-output-escaping" for a specific Text/Node object?
    I would be grateful for an answer.
    Best Wishes
    esprimo

    Hi DrClap,
    thank you for your answer. Thats too bad that this doesn't work.
    But allow me a further question. I don't quite understand why it is malformed XML what I want to generate.
    <?xml version="1.0" encoding="UTF-8"?>
    <test>Hello & #x0042;en!</test>[again the space within the entity is to avoid the forum software to interpret this as the sign 'B']
    If I create a file like the above, both my XML editor tells me that this is wellformed and the Firefox browser can parse it properly (which I guess indicates that it is wellformed).
    So why is it malformed XML to represent a numeric entity?
    Best Wishes
    esprimo

  • Not escaping '&' in XSLT

    I have a XSL stylesheet with the following code:
    <xsl:param name="link"/>
    <xsl:template match="mystuff">
             <a href="{$link}">                    
                 <xsl:value-of select="anchor"/>
             </a>
    </xsl:template>
    (...)'link' is a parameter whose value is passed from the java code, and normally contains the '&' character (as in URL query parameters).
    i.e.: http://www.myserver.net/servlet?p=a&m=b
    The problem is that when doing the XSL transformation, the '&' is escaped into '& amp;'.
    So instead of: <a href="http://www.myserver.net/servlet?p=a[b&[/bm=b">my link</a>
    I'm getting: <a href="http://www.myserver.net/servlet?p=a& amp;m=b">my link</a>
    That would be ok with most browsers (that I know) but the browser that I'm using doesn't have that support, so I really need to output the unescaped '&' in the link.
    I've tried <xsl:text disable-output-escaping="yes"> as well as setting the output to text, but neither worked (the former generated an exception during the transformation, and the latter didn't output the HTML tag).
    Any ideas?

    I understand DrClap's view on this. I've found that view on every thread out there, where someone asks for the same 'incorrect' behaviour.
    Still, even though I understand the correctness of XSLT, there should always be a way of bending the rules for cases when it's justified.
    The problem is that the browser is a J2ME app that's being developed here at work, and since they're trying to reduce its footprint I'm guessing making it handle the '& amp;' won't be a priority. The idea is that the server should make it easy on the client, so that we can have a really slim client.
    ajeru's tips didn't work either, but I did format my <a> tag that way (separate the href attribute) because it looks neater. Thanks.
    I ended up adding one line of Java code after the XSL transformation that just replaces all the '& amp' with '&'. It's an ugly hack, but it will keep things running, and that's what matters when deadlines approach ;)

  • XSL disable-output-escaping problem

    When using the Java xslsample example to perform an XSLT transformation, we are trying to generate characters such as '<' in the output stream. However the following code fragment taken from the XSLT working draft:
    <xsl:text disable-output-escaping="yes"><</xsl:text>
    generates &#60; to the output stream.
    Any ideas?
    David
    null

    Never mind! I found the overloaded ProcessXSL member functions that output rather than transform.
    All cool now!

  • Is xsl:value-of disable-output-escaping="yes"/ Supported in 2.0.2.6?

    I can't seem to display HTML from XML.
    In my XML file I store the HTML snippet in an XML tag:
    <PRE>
    <body.htmlcontent>
    <&#60;table width="540" border="0" cellpadding="0" cellspacing="0">
    &#60;tr>&#60;td>
    &#60;font face="Helvetica, Arial" size="2">
    &#60;!-- STILL IMAGE GOES HERE -->
    &#60;img src="graphics/imagegoeshere.jpg" width="200" height="175" align="right" vspace="0" hspace="7">
    &#60;!-- END STILL IMAGE TAG -->
    &#60;!-- CITY OR TOWN NAME GOES FIRST FOLLOWED BY TWO LETTER STATE ABBREVIATION -->
    &#60;b>City, state abbreviation&#60;/b> -
    &#60;!-- CITY OR TOWN NAME ENDS HERE -->
    &#60;!-- STORY TEXT STARTS HERE -->
    Story text goes here..
    &#60;!-- STORY TEXT ENDS HERE -->
    &#60;/font>
    &#60;/td>&#60;/tr>&#60;/table>
    </body.htmlcontent>
    </PRE>
    I use the following in my xsl:
    <xsl:value-of select="body.HTMLcontent" disable-output-escaping="yes"/>
    However, the HTML output <PRE>&#60;</PRE>is still outputted and all of the HTML tags
    are displayed in the browser. How do I display the HTML properly?
    Bob Hewett
    [email protected]

    This makes sense. Here's why.
    oraxsl internally uses the:
    void XSLProcessor.processXSL(style,source,printwriter);
    XSLSample.java uses:
    DocumentFragment XSLProcessor.processXSL(style,source);
    The former supports <xsl:output> and all
    options related to writing out output
    that might not be valid XML (including the disable output escaping)
    The latter is pure XML-to-XML tree returned,
    so no <xsl:output> or disabled escaping
    can be used since nothing's being output,
    just a DOM tree fragment of the result is
    being returned.
    null

  • Disable-output-escaping and named templates

    I am trying to combine two parts of Steve book, the "features" example that requires disable-output-escaping because the text in the db contains html, and the titledboxes xsl which is called a s a named template.
    Problem is that when I call a template passing the text from the db as a content param the html gets escaped regardless of the output escaping.
    I know why but I need to know a workaround that allows me to use templates and lets me keep html embeded in the db column.
    Rob

    This is Bug 1285505, "Disable-Output-Escaping Is Lost When Copying A Text Node" which has been fixed for the 9.0.1 release that will be posted to OTN in about the May timeframe.
    In the meantime, the workaround is to build two versions of your titled-box template, one which explicitly does disable-output-escaping when it writes the content to the output, and the other one that's like what you have now.

  • URI escaping in XSLT

    I have following xml file:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Any string with russian symbols in utf-8 encoding -->
    <href>/cgi-bin/search.cgi?q=&#9576;&#9619;&#9576;&#9563;&#9576;&#9488;&#9576;&#9617;&#9576;&#9563;&#9576;&#9618;</href>
    And I have following xsl file:
    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" encoding="koi8-r"/>
    <xsl:template match="/href">
    Click me
    </xsl:template>
    </xsl:stylesheet>
    Result of transformation is:
    Click me
    %E2%EE%EF%E0%EE%E1 - same string but in windows-1251 encoding. Although, I set koi8-r output encoding.
    What's wrong?
    I use XDK 9.2.0.1.0 on Windows NT 2000.

    Add the non-ascii character to <xsl:text disable-output-escaping="yes"></xsl:text>

  • Output Escaping in Oracle

    Hi Forum,
    a simple question, but as I learned from strolling through the forum, it may be a complicated answer:
    How can I control output escaping?
    I'm struggling with a set of scenarios where output escaping can't be avoided obviously, so my question is whether there's a method available to "un-escape" entities after having automatically escaped them.
    Does anybody have a solution for that?
    Thanks,
    Jürgen

    There is no Oracle version numbered 10.1.3.0.
    Perhaps you have 10.1.0.3 in which case you've quite a few patches you could and should install. Check the metalink docs and see if the issue is addressed.

  • XSL disable-output-escaping

    Hi,
    I have the next part of an XML file:
    <?xml version="1.0" encoding="UTF-8"?>
    <idiomas>
         <element>
              <titol><![CDATA[Angl�s]]></titol>
              <url>/google.com</url>
              <alt><![CDATA[Change to Angl�s]]></alt>
              <language>en</language>
         </element>
    </idiomas>
    I want to obtain the next html code transforming the XML with an XSL to HTML code:
    <a title="Canviar a Castell�">Castellano </a>
    <a title="Change to Angl�s">Angl�s </a>
    but I obtain the next one:
    <a title="Canviar a Castell�">Castellano</a>
    <a title="Change to Angl�s">Angl�s</a>
    because I don't know HOW CAN I MAKE THE "disable-output-escaping" in elements like href, title, lang or xml:lang
    It seems that the "disable-output-escaping" only is available for xsl:value-of and xsl:text
    This is part of my XSL file:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:output method="html" version="4.0" encoding="UTF-8" indent="yes"/>
    <a href="{url" title="{alt" tabindex="80" lang="{language}" xml:lang="{language}">
         <xsl:value-of select="titol" disable-output-escaping="yes"/>
    </a>
    Anyone know how can I "disable-output-escaping" in elements accessed as {url}, {alt} ...
    Thanks in advance.
    Xavi
    Message was edited by:
    ffelipei_
    Message was edited by:
    ffelipei_

    First of all thanks for answer the question.
    You are right, the forum software has changed the text I wrote.
    I don't know how can explain what I want to said, but I will try.
    In my question I wrote:
    I want to obtain the next html code transforming the XML with an XSL to HTML code:
    <a title="Canviar a Castell�">Castellano </a>
    <a title="Change to Angl�s">Angl�s </a>
    but I obtain the next one:
    <a title="Canviar a Castell�">Castellano</a>
    <a title="Change to Angl�s">Angl�s</a>
    This text is partially ok.
    The two first lines of HTML are ok. The other two are ok partially, because the title attribute has been escaped.
    I will use the next symbol "_" following the ampersand "&" to prevent escaping of forum software.
    The last lines would be:
    <a title="Canviar a Castell&_amp;agrave;">Castellano</a>
    <a title="Canviar a Angl&_amp;egrave;s">Angl&_egrave;s</a>
    In the title I obtain after xsl transformation a "double encoding of entities".
    Thanks

  • XSL "disable-output-escaping" Directive  Support post - 9i R2

    Hello there,
    I've recently discovered that the XSL directive, disable-output-escaping="yes", does not work in Oracle 9i R2 when applying a Stylesheet to an XML document via the XMLTYPE.TRANSFORM function.
    I can accept that this wasn't supported in this version of the Database (as I have no choice in the matter ;-)). My question is, is this directive supported in XMLTYPE.TRANSFORM in either 10g R1/R2, or 11g R1?
    Thanks in advance.
    James

    Be adviced, regarding the "I have no choice in the matter", that maybe it is an idea to push your management into a new era, while being aware of the folllowing information (Metalink Note:392222.1):
    PURPOSE
    Reminder to Oracle Database customers of the end of Premier Support for version 9.2
    SCOPE & APPLICATION
    All Oracle9i Database Release 9.2 customers
    REMINDER: Premier Support for Oracle9i Database Release 9.2 Ends July 2007
    Oracle would like to remind our customers that the last day of 5-year Premier
    Support period for all editions of Oracle9i Database Release 9.2 is 31-July-2007.  
    Customers who plan on continuing to use Oracle9i Database Release 9.2 may choose
    from one of two options
    1. Continue with full error correction support by contracting for Extended
       Support, which will be offered for three years (to end of July 2010), or
    2. Continue with Sustaining Support which provides access to Global Customer
       Support and all pre-existing patches and Metalink notes (offered indefinitely).
    Customers wishing to upgrade to a release covered under Premier Support may
    choose Oracle Database Release 10.2 (Premier Support through end of July 2010)
    or Oracle Database Release 10.1 (Premier Support through end of January 2009).
    Oracle9i Database Release 9.2 Extended Support details:
    • Extended Support fee waived for the period August 1, 2007 to July 31, 2008.
    • Access to Fixes and Critical Patch Updates (CPUs) during the first year of
      Extended Support at no additional cost.
    • Patch set 9.2.0.8 will be the last patch set available for Oracle9i Database
      Release 9.2.
    • Effective August 1, 2007 all Fixes and CPUs will be created against the
      9.2.0.8 code line. 
    Please see the headline article on Metalink News and Notes entitled
    "First Year Extended Support Fee Waived for Oracle9i Database Release 2"
    for more details. 
    NOTES and EXCEPTIONS:
    • This end of Premier Support applies to all Oracle E-Business Suite,Peoplesoft,
      and Siebel customers using Database Version 9.2 where a later version of the
      Database is certified.  For example, E-Business Suite version 11.5.8 customers
      will be supported through the end of Premier Support for that E-Business Suite
      version because 9.2 was the last Database version certified.
    • Extended Support (ES) for the Oracle Database 9.2 will not include the
      Oracle HTTP Server 1.0.2.2 that is included with the Oracle Database 9.2.
    SUMMARY of Lifetime Support Dates for Oracle Database Release 9.2:
    Support Phase             Begins             Ends
    Premier Support             1-June-2003     31-July-2007
    Extended Support     1-August-2007     31-July-2010
    Sustaining Support     1-August-2010     Indefinite
    Please see http://www.oracle.com/support/premier/lifetime-support-policy.html for
    more information on the Lifetime Support Policy.

Maybe you are looking for

  • Motion crashes when attempting to start a project

    I've got a mac pro in which motion crashes every time the user tries to open a project, be it a new blank one or an old project. The mac itself is a single CPU quad 2.8 with 6 gig ddr3 and an ati 5770 I've already tried uninstalling and re-installing

  • I am VERY  disappointed with apple chat!

    The chat intro says they will be with me in about 2 minutes, well I've waited over 22 minutes, with now response!!!!! Anyway;   I can't receive my e-mail on my iPhone.   I CAN  send e-mail but cannot receive/pick up  I had e-mail issues with my pc an

  • HT3472 does apple iphone 5 earphone will support apple ipod 3 generation? my 3 gen ipod is not supporting

    does apple iphone 5 earphone will support apple ipod shuffle 3 generation? my 3 gen ipod is not supporting. please help me out to solve the issue.if any third party earphones support please let me know

  • Photo Stream - How do I change the order the photos are in

    I have several Photo Streams and I would like to change the order the photos are displayed on the subscribed Streams. I have tried on Mac, and iPad3, iPhone4S and there does not seem to be an option. Any help would be greatful. Thanks, Mark. iPhoto 1

  • Various Following v6 Upgrade...

    Hi All, Previously, I was using RH v4 and recently upgraded to v6. I started working on one of my existing projects (all appeared to be fine!!!) and set up the RS version control system. I have added several new topics and updated a number of the exi