Replacing Ampersand character - &

Hi All,
I am working on the PO Layout for Oracle Applications. I have managed to get the program to show long text notes associated with the purchase order lines. However some notes include ampersand characters.
I have no control over the generation of the data (as it is Oracle standard PO data definition) so I cannot replace it in the pl/sql.
I have tried using the replace function, but am struggling.
the following code contains my latest attempt, and also a commented out line which simply shows the text (works fine if the text has no & character) and another attempt I have made.
<!-- for long text -->
                    <xsl:for-each select="$LINE_LONG_ATTACHMENTS_ROOT_OBJ">
                    <!-- fo:block><fo:inline><xsl:value-of select ="TEXT"/> </fo:inline></fo:block-->
                         SHOW LINE LONG MSGS
                         <xsl:if test="$lineID = .">
                              <xsl:variable name="line" select="position()" />
                              <!-- fo:block><fo:inline xdofo:use-attribute-sets="i_61"><xsl:value-of select="../TEXT[$line]"/></fo:inline>     </fo:block><fo:block/ -->      
                              <fo:block><fo:inline xdofo:use-attribute-sets="i_61"><xsl:value-of select="replace(string(../TEXT[$line]), string('L'), string('M')) "/></fo:inline>     </fo:block><fo:block/>      
                              <!-- xsl:variable name="note_text" select="replace(string(xdoxslt:normalize_string($_XDOCTX, ../TEXT[$line])), string('L'), string('M'))"/>
<fo:block><fo:inline xdofo:use-attribute-sets="i_61">
                              <xsl:value-of select="$note_text"/ >
                              </fo:inline>     </fo:block><fo:block/-->
                         </xsl:if>
                    </xsl:for-each>
Currently my example tries to replace L with M as a test. Ideally I would like to replace & with &amps;
Thanks,
Will

Hi Will:
Unfortunately replacing & in XML is already too late - you don't have valid XML so you can't apply a stylesheet. If you could wrap a cdata section around your & you would be fine:
<![CDATA[" text "]]>
, but it seems that you can't modify the XML - so you are between a rock and a hard place.
Klaus

Similar Messages

  • Replacing a character in a string to another character

    hi,
    i need to write a function or procedure to replace the character of a string value suppose:
    l_error:= 'abcdefghijklmnop' is a string
    i need write a function or procedure to replace the character "c" to "z"
    that data in l_error is not in any table.
    thanks,
    AJ

    I want to Replace all the Existence of the word - "Test" in a string with "Test1" whereever a space exits before the word Test and someother alphabet after "Test" i.e. Test will be replaced with Test1 if a word starts with Test and contains more alphabets also. For example - TestName should be replaced with Test1Name while MyTest should not be updated to MyTest1.
    I have tried to use below query which uses oracle regular expressions -
    SELECT REGEXP_REPLACE('MYCOMPANY TEST TESTGEET INDIA PVT LTD TEST','\s(TEST)\w',' TEST1') FROM DUAL
    Output -
    "MYCOMPANY TEST *TEST1EET* INDIA PVT LTD TEST"
    Here, it has also replaced the G also from TESTGEET and resulted in TEST1EET while i want TEST1GEET.
    Can someone please suggest how can i do this..... may b m doing some silly mistake but sorry m a newbie to regular expression...
    Thanks in advance..

  • How to replace the '&' character with '&' in xi

    Hi,
    i need to replace the '&' character with ' &amp;'.but i f i am converting it is displaying as '&' because internally '&amp;' = '&'.
    beacuse of this it is not converting.
    is there any possiblity to change the  standard conversion in xi.

    Graphical mapping does not support special character like & , <,> to be mapped.
    You can encode & as and in UTF-8 only.
    if you want the special character to be used, Opt XSLT mapping with ISO-8859-1 encoding
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="ISO-8859-1"/>
    <xsl:template match="/">
    <xsl:copy-of select="*" />
    </xsl:template>
    </xsl:stylesheet>
    How to Work with Character Encodings in Process Integration (NW7.0)
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42

  • How to replace a character in a string with blank space.

    Hi,
    How to replace a character in a string with blank space.
    Note:
    I have to change string  CL_DS_1===========CM01 to CL_DS_1               CM01.
    i.e) I have to replace '=' with ' '.
    I have already tried with <b>REPLACE ALL OCCURRENCES OF '=' IN temp_fill_string WITH ' '</b>
    Its not working.

    Hi,
    Try with this..
    call method textedit- >replace_all
      exporting
        case_sensitive_mode = case_sensitive_mode
        replace_string = replace_string
        search_string = search_string
        whole_word_mode = whole_word_mode
      changing
        counter = counter
      exceptions
        error_cntl_call_method = 1
        invalid_parameter = 2.
    <b>Parameters</b>      <b> Description</b>    <b> Possible values</b>
    case_sensitive_mode    Upper-/lowercase       false Do not observe (default value)
                                                                       true  Observe
    replace_string                Text to replace the 
                                         occurrences of
                                         SEARCH_STRING
    search_string                 Text to be replaced
    whole_word_mode          Only replace whole words   false Find whole words and                                                                               
    parts of words (default                                                                               
    value)
                                                                               true  Only find whole words
    counter                         Return value specifying how
                                        many times the search string
                                        was replaced
    Regards,
      Jayaram...

  • Cannot produce the ampersand character in an output ile

    We are using DBMS_XMLQuery to select some stuff from thedatabase (8.1.7) and output as XML in a CLOB.
    We pass transform this CLOB to a text output file (not html) by passing the above result to the xmlparser package.
    Our stylesheet looks like
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/" >
    testing
    </xsl:template>
    </xsl:stylesheet>
    OK, we're just trying to get anything to appear!!!
    Obviously this fails. Replacing ampersand with 'ampersand amp;' causes hash number tobe output (38 I think).
    I'd really like to get an ampersand out the end of this.
    I have tried enclosing the ampersand amp; in <xsl:text> - no good
    <xsl:text disable-output-beffering> - no good
    I've tried CDATA, using <xsl:output type="text" /> at the start of the stylesheet, all to no avail.
    I've searched this forum, lots of similar questions but no relevant answer (I'm new to this stuff).
    Help!!!!!!!!!!!!!!

    Apologies for replying to my own posting (although I would greatly appreciate someones elses reply), I decided to try out oraxsl from the unix command line. Sure enough, it output the ampersand as an ampersand and not a code. Therefore, I must have something wrong in the plsql code that sets up the parser.
    Heres the code - I think we got it from the online docs. I've chopped out the comments and debug, hopefully I didnt chop out any code :)
    PROCEDURE gen_file(dir varchar2, p_clob clob, xslfile varchar2, resfile varchar2, errfile varchar2) is
    p xmlparser.Parser;
    xmldoc xmldom.DOMDocument;
    xmldocnode xmldom.DOMNode;
    proc xslprocessor.Processor;
    ss xslprocessor.Stylesheet;
    xsldoc xmldom.DOMDocument;
    docfrag xmldom.DOMDocumentFragment;
    docfragnode xmldom.DOMNode;
    xslelem xmldom.DOMElement;
    nspace varchar2(50);
    xslcmds xmldom.DOMNodeList;
    begin
    -- new parser
    p := xmlparser.newParser;
    xmlparser.setValidationMode(p, FALSE);
    xmlparser.setErrorLog(p, dir &#0124; &#0124; '/' &#0124; &#0124; errfile);
    xmlparser.setPreserveWhiteSpace(p, TRUE);
    xmlparser.setBaseDir(p, dir);
    xmlparser.parseclob(p, p_clob);
    xmldoc := xmlparser.getDocument(p);
    xmlparser.parse(p, dir &#0124; &#0124; '/' &#0124; &#0124; xslfile);
    xsldoc := xmlparser.getDocument(p);
    xslelem := xmldom.getDocumentElement(xsldoc);
    nspace := xmldom.getNamespace(xslelem);
    xmldom.getExpandedName(xslelem));
    xslcmds := xmldom.getChildrenByTagName(xslelem, '*', nspace);
    ss := xslprocessor.newStylesheet(xsldoc, dir &#0124; &#0124; '/' &#0124; &#0124; xslfile);
    proc := xslprocessor.newProcessor;
    xslprocessor.showWarnings(proc, true);
    xslprocessor.setErrorLog(proc, dir &#0124; &#0124; '/' &#0124; &#0124; errfile);
    docfrag := xslprocessor.processXSL(proc, ss, xmldoc);
    docfragnode := xmldom.makeNode(docfrag);
    xmldom.writeToFile(docfragnode, dir &#0124; &#0124; '/' &#0124; &#0124; resfile);
    -- deal with exceptions
    exception
    when xmldom.INDEX_SIZE_ERR then
    raise_application_error(-20120, 'Index Size error');
    when xmldom.DOMSTRING_SIZE_ERR then
    raise_application_error(-20120, 'String Size error');
    when xmldom.HIERARCHY_REQUEST_ERR then
    raise_application_error(-20120, 'Hierarchy request error');
    when xmldom.WRONG_DOCUMENT_ERR then
    raise_application_error(-20120, 'Wrong doc error');
    when xmldom.INVALID_CHARACTER_ERR then
    raise_application_error(-20120, 'Invalid Char error');
    when xmldom.NO_DATA_ALLOWED_ERR then
    raise_application_error(-20120, 'Nod data allowed error');
    when xmldom.NO_MODIFICATION_ALLOWED_ERR then
    raise_application_error(-20120, 'No mod allowed error');
    when xmldom.NOT_FOUND_ERR then
    raise_application_error(-20120, 'Not found error');
    when xmldom.NOT_SUPPORTED_ERR then
    raise_application_error(-20120, 'Not supported error');
    when xmldom.INUSE_ATTRIBUTE_ERR then
    raise_application_error(-20120, 'In use attr error');
    end gen_file;
    null

  • Adobe Javascript in PDF Form for replacing special character

    How to replace special character "/"  in to "\" in the text field of PDF Form by using Adobe Javascript.

    In PDF Form java script,  returns the file path with "/" forward slash, but need to get default in "\" backward slash in the file path.

  • Replace a character in a String array

    I have an array of strings and am trying to replace the ' character with a space. I keep getting either a cannot be applied or cannot resolve symbol error. Can anyone help?
    String arrayList = request.getParameter("field");
    String newList = arrayList.replace("\'", " ");

    the replace method of the String class takes two parameters and both of them are characters not strings use it like this
    arrayList.replace('\'', ' ');that should fix it

  • Replacing a character in a String

    Hi All,
    How can I replace a character ' which appears in a String into \'

    There is a method in String that replaces all
    occurrences of one character with anothercharacter.
    It's called, hold your breath now, "replace".But tho OP wants to replace one character with two
    characters :)You're right, I missed that. Well, serves me right for being sarcastic. :-)

  • Find/Replace Extended Character Set characters in filenames in one pipeline

    Hello all,
    I have to work with some very bored people. Instead of putting a dash (hex 2d) into a filename, they opt for something from this
    set of extended characters, which makes my regular expressions fail.  IS there a way I can efficiently find & replace anything outside the standard character set
    in one pipelinewithout finding and replacing a character at a time?
    So,I'd like something like:
    get-childitem * | where-object $_.name -match '\x99' | rename-item -newname { $_.name -replace '\x99','='}
    from hex 80 to hex FF rather than a for-each.
    Thanks.

    Answer would depend on the way you want to replace... Easier if you want replace any char in set with selected char:
    $Name = -join (180..190|%{[char]$_})
    New-Item -ItemType File -Name $Name
    Get-ChildItem * | Rename-Item -NewName {
    [regex]::Replace(
    $_.Name,
    '[\xB4-\xBE]',
    } -WhatIf
    But if you want it more complicated, you may do that too. E.g. defining hashtable that can be used to replace individual elements:
    $Replacer = @{}
    foreach ($Char in (180..190 | % { [char]$_ })) {
    $Replacer.Add(
    [string]$Char,
    (echo _, -, =, . | Get-Random)
    $Replacer
    Get-ChildItem * | Rename-Item -NewName {
    [regex]::Replace(
    $_.Name,
    '[\xB4-\xBE]',
    $Replacer[$args[0].Value]
    } -WhatIf
    Using this syntax make it possible to include some logic in replace. E.g. you could easily use switch to decide what to do with given string:
    Get-ChildItem * | Rename-Item -NewName {
    [regex]::Replace(
    $_.Name,
    '[\xB4-\xBE]',
    switch ($args[0].Value) {
    º { "0" }
    µ { "u" }
    ¹ { "1" }
    ¸ { "," }
    Default { "_" }
    } -WhatIf

  • Replace a character

    Hi all
    I have a ascii file should I replace a character with another. How can I do with form?
    regards
    Silvia

    Open the file with a text editor would be the simplest solution:
    client_host('cmd /c start myfile.txt');
    The start command will cause the default application that is associated with the txt extension to open the file.

  • Replacing u25A1 character

    Hi,
    How to replace this □ character in routine while loading data from source system.
    Regards,
    Pravender

    I had face a same problem in ABAP programming, try to use this statement... and check its removing junk character.
    Data : A(35) type C,
              B(35) type C,
       CLASS cl_abap_char_utilities DEFINITION LOAD.
       clear : A,B.
       A = your_field.
       concatenate A cl_abap_char_utilities=>cr_lf INTO B.
       REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>cr_lf In B WITH
       space.
       your_field = B.
    Best Regards,

  • How to replace a character in a file using awk

    Hello,
    Does anyone has a sample script to replace a character in a file using awk?
    Regards,
    Edited by: slsam01 on Jul 15, 2012 12:56 PM

    Hi
    awk it's not best for this job.
    For replace charecter - generaly use tr or sed
    Example on awk:
    awk -F<old_char> ' { for (i=1; i<NF ;i++ ) printf ( "%s<new_char>", $i ); print $NF }' <file>
    #Replace "e" on "a" in /etc/hosts
    awk -Fe ' { for (i=1; i<NF ;i++ ) printf ( "%sa", $i ); print $NF }' /etc/hosts
    Regards.
    PS. Same on *tr"
    cat file | tr "e" "a"

  • Replace single character and leave the ones in expressions

    Hi,
    I'm looking for nice and elegant solution to my problem. Let's say I have a string "e+exp(e)". I want to replace all "e" with "1", excepts the one in "exp". I was trying to use regular expressions but I've failed after an hour... The solution should be able to solve things like replace "a" in "rand(a)" without changing rand. Basically I need to replace single character without replacing the ones in words/expressions.
    Any ideas?  
    Certified LabVIEW Developer, Certified TestStand Developer
    Solved!
    Go to Solution.

    No time for elegance right now, just brute force.  I would pad the string with spaces on each end to remove end cases and then search for the character surrounded by non-word characters. 
    Message Edited by Darin.K on 04-14-2010 04:06 PM
    Attachments:
    VariableParsingRegex.png ‏18 KB

  • Using html in cf report builder and escaping the & ampersand character

    Some of the data we collect is entered via a WYSIWYG editor.  Therefore formatting such as bold, italic etc is translated into HTML.
    The text could also contain special characters/accented characters, again these are translated into their html equivalents.
    In CF Report Builder, I have set the XHTML Text formatting to TRUE.  However the report won't render the text in these boxes.  From what I can see it doesn't like the '&' character (ampersand).
    I have read elsewhere that report builder is limited in the characters etc that it can read and that I should translate the values.  I ended up doing this in the database to try and save some time.
    CREATE  OR REPLACE FUNCTION translatexhtmltoasci(var_text IN appendix3%TYPE)
      RETURN clob
    ISvar_translated_text clob;BEGIN
     select  replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(re place(replace(
      replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(re place(replace
      (replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(r eplace(replace
      (replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(r eplace(replace
      (replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(r eplace(replace
      (replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(r eplace(replace
      (replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(r eplace(replace
      (replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(r eplace(replace
      (replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(r eplace(replace
      (replace(replace(replace(replace(replace(replace(replace(replace(replace(
    var_text , chr(38) || 'lt;', chr(60))
      , chr(38) || 'gt;', chr(62))
      , chr(38) || 'euro;', chr(49792))
      , chr(38) || 'iexcl;', chr(49825))
      , chr(38) || 'cent;', chr(49826))
      , chr(38) || 'pound;', chr(49827))
      , chr(38) || 'curren;', chr(49828))
      , chr(38) || 'yen;', chr(49829))
      , chr(38) || 'brvbar;', chr(49830))
      , chr(38) || 'uml;', chr(49832))
      , chr(38) || 'copy;', chr(49833))
      , chr(38) || 'ordf;', chr(49834))
      , chr(38) || 'laquo;', chr(49835))
      , chr(38) || 'not;', chr(49836))
      , chr(38) || 'shy;', chr(49837))
      , chr(38) || 'reg;', chr(49838))
      , chr(38) || 'macr;', chr(49839))
      , chr(38) || 'deg;', chr(49840))
      , chr(38) || 'plusmn;', chr(49841))
      , chr(38) || 'sup2;', chr(49842))
      , chr(38) || 'sup3;', chr(49843))
      , chr(38) || 'acute;', chr(49844))
      , chr(38) || 'micro;', chr(49845))
      , chr(38) || 'para;', chr(49846))
      , chr(38) || 'middot;', chr(49847))
      , chr(38) || 'cedil;', chr(49848))
      , chr(38) || 'sup1;', chr(49849))
      , chr(38) || 'ordm;', chr(49850))
      , chr(38) || 'raquo;', chr(49851))
      , chr(38) || 'frac14;', chr(49852))
      , chr(38) || 'frac12;', chr(49853))
      , chr(38) || 'frac34;', chr(49854))
      , chr(38) || 'iquest;', chr(49855))
      , chr(38) || 'Agrave;', chr(50048))
      , chr(38) || 'Aacute;', chr(50049))
      , chr(38) || 'Acirc;', chr(50050))
      , chr(38) || 'Atilde;', chr(50051))
      , chr(38) || 'Auml;', chr(50052))
      , chr(38) || 'Aring;', chr(50053))
      , chr(38) || 'AElig;', chr(50054))
      , chr(38) || 'Ccedil;', chr(50055))
      , chr(38) || 'Egrave;', chr(50056))
      , chr(38) || 'Eacute;', chr(50057))
      , chr(38) || 'Ecirc;', chr(50058))
      , chr(38) || 'Euml;', chr(50059))
      , chr(38) || 'Igrave;', chr(50060))
      , chr(38) || 'Iacute;', chr(50061))
      , chr(38) || 'Icirc;', chr(50062))
      , chr(38) || 'Iuml;', chr(50063))
      , chr(38) || 'ETH;',

    I also stuck with this . Still no answer, no solution

  • Trying to tweak RegEx used to replace ampersands

    I Googled the Web and found a RegEx (regular expression) to find ampersands on my Web pages (that were not already part of HTML entities) and replace them with the correct HTML entity for an ampersand. It worked well except in one situation: It will find an ampersand that begins an HTML entity if that ampersand is immediately preceded by a comma. I'm not good enough with RegEx to know how to tweak it and solve the comma problem. Can someone make a suggestion? Here it is ...
    &(?!#?[a-z0-9]+;)

    Hi,
    what I would like to know was quite simply the original character string you wont search and replace. Unfortunately, this statement "and solve the comma problem" did confuse me a bit.
    By not stand here with empty hands, I would to give this little hint I remember from an earlier thread (maybe it's wellknown already): If the caption contains an ampersand, the character following the ampersand is underlined to indicate a keyboard mnemonic, use two ampersands: "&&".
    Hans-G.

Maybe you are looking for