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 ;)

Similar Messages

  • Essbase 11.1.1 not escaping ampersand in XMLA

    We are using Microsoft SQL Server Reporting Services (SSRS 2008 SP1 CU3) to report against Hyperion Essbase 11.1.1 using the XMLA interface. When reporting against specific cubes with "&" (ampersands) in the name of measures (such as "Services & Support"), we are running into problems where SSRS will reject the message as being "unrecognized".
    Troubleshooting have shown that Essbase is not correctly escaping the ampersand characters in the messages being send by Essbase to SSRS. I'll include an example of the XML being sent by Essbase:
    <EXPRESSION>"EBITDA" - "Depreciation & Amortization"-"Goodwill & Intangibles"-"Other Income & Expense"-"806140";</EXPRESSION> <---- Ampersand not escaped
    <MEASURE_NAME>Customization &-a-m-p-; Implementation</MEASURE_NAME> <--- Ampersand escaped, note: this forum interprets the escaping of ampersand's and I added dashes to illustrate the point
    Can somebody please confirm if there is a way to work around this problem in Essbase (setting?) or if this is a bug in the interface.

    Hi,
    I can only comment that &---> is reserved for substitution variable in Essbase. It may be creating this kind of error.
    Elsewhere we use " " to use &.
    Thanks
    Focusthread Hyperion Trainer
    [http://focusthread.com/training]

  • Import from Excel not escaping quote (')

    Hi,
    I'm having problems with text fields in an Excel spreadsheet that contain single quotes (') not being escaped when the insert commands are built using the Import from Excel wizard.
    It's pretty much the same problem as that described in the post below (but for importing Excel spreadsheets):
    <Re: DDL in the SQL tab does not escape apostrophes
    SQLDev 1.2.1.32.00
    WinXP SP2
    Excel 2003
    Any chance of getting this fixed?
    Thanks,
    Simon

    OK, so have updated to
    SQLDev 1.2.1.32.13
    and still see problem when importing from Excel.
    The generated SQL looks like this:
    insert into INV_CONTAINERS (CONTAINER_NAME) VALUES('Tetramethylethylenediamine, N,N,N',N'-');
    That's supposed to be just one item in the VALUES term.
    Is there another way to do this? If not, how do I lodge this as a bug?
    Simon

  • Url Not Escaped in Podcast Content

    I am using ITunes v. 6.0.1.3 on WinXp and when subscribing to a podcast you must manually escape the url if it contains a space. Also if the content URL contains spaces iTunes will not escape that URL either and will error out while trying to download content.
    How can I submit an official bug report?
    Try and subscribe to this podcast: http://channel9.msdn.com/rss.aspx?ForumID=34&Mode=0&sortby=0&sortorder=1&format= mp3
    All the content except the very oldest podcasts will fail to download because most of the new content is using spaces in the url for the content.
    Thanks,
    Adam
    ... sorry for the cross post my op should have been to this forum first.

    Hi
    I have some workaround for you.
    You can open the URL in the Portal Content Area.
    1. you have to create a portal component project to create a par file.
    use the below code in jsp:
    <table>
    <tr width="100%" height="100%">
    <td width="70%" border="1"><div style="background-color: rgb(194, 220, 255);font-family: Tahoma; font-size: 12px; display: block;">
    Please click <a  href="http://google.com" target='_blank'> here  </a>to open google..<BR>
    <BR>
    <BR>
    </td>
    <td width="30%"><div style="background-color: rgb(194, 220, 255);font-family: Tahoma; font-size: 12px; display: block;"></td>
    </div>
    </tr>
    </table>
    2. export par to your portal from system admin  -> support -> portal runtime - admin console
    3. create a iview with the portal component.
    4.  change the  iview properties to show in new window = false etc..
    hope this will help

  • Diff tool - Bug with comments not escaped

    Diff tool in version 3.1.07
    I have a new table that includes comments on the columns. Some of those comments have single quotes in them like in the words "don't" or "user's". The diff script is not escaping those quotes in the CREATE TABLE DDL so the DDL fails.
    Another issue is that semicolons are not placed at the end of CREATE OR REPLACE FORCE VIEW statements.
    Edited by: EdInWisconsin on Feb 13, 2012 8:39 AM

    Found another issue:
    Forward slashes not placed at end of statements to create/replace packages or procedures. This caused several of my procs to run together and was pretty obvious once it happened but easy to miss when reviewing the script and obviously caused problems.

  • CF8 - XmlFormat not escaping High ASCII characters

    In CF8, we have a problem where XmlFormat is not escaping
    High ASCII characters. This was working just fine on our CF7
    instance, but in CF8, it is not escaping all characters. I am aware
    of the long-standing problem with escaping Windows-1252 characters,
    but now we are experiencing an issue with basic high ASCII
    characters, like chr(233) and chr(244). Is anyone else experiencing
    this issue? We have not installed Update 1 to CF8 yet. I don't see
    a fix for this in the release note, but any word on if this is
    fixed by the updater?
    Here is a test to demonstrate the issue:
    <cfset myString = "The Islamic Republic of Mauritania's
    (République Islamique de Mauritanie) 2007 estimated population
    is 3,270,000. Cote d'Ivoire and Côte d'Ivoire">
    <cfset myNewString = XmlFormat(myString)>
    <cfoutput>#myNewString#</cfoutput>

    BKBK,
    Thanks for the info. Adding the processingdirective does help
    show that these characters are being escaped, however, the behavior
    has changed somewhat between CF7 and CF8, as we were not using a
    processingdirective in CF7, and this was working as advertised.
    Where this is giving us a problem is after we create an XML
    document using CFXML, (ensuring that we XmlFormat any strings), we
    then validate that document against a schema, and we are all of a
    sudden getting errors during validation for invalid characters
    within the XML. We are using ToString() after creating the XML
    document with CFXML, and our process is the same as we were using
    in CF7. That is why I was curious if anyone else was having this
    same issue... because something definitely changed between CF7 and
    CF8 with XML processing.

  • 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

  • Created by column value is not showing in XSLT List View After Migration To 2013

    Hello All,
    In my XSLT Created By Column value is not showing. Please help me with this problem. My code is simple I have custom column in XSLT name as 'Reported By' in which I want to show 'Created By' column value. but it is not showing. please help me with that.
    Thanks in advance

    hi
    is anyone has answer for this question.
    thanks...!!!!

  • Dynamic Directory not reliable with XSLT

    Dear experts,
    I have set up an XSLT mapping that dynamically sets the Directory:
    <xsl:param name="inputparam"/>
    <xsl:param name="TargetFolder">
            <xsl:choose>
                <xsl:when test="$storeCode='1234'">
                    <xsl:value-of select="'BDX'"/>
                </xsl:when>
                <xsl:when test="$storeCode='4998'">
                    <xsl:value-of select="'CRB'"/>
                </xsl:when>
                <xsl:when test="$storeCode='1326'">
                    <xsl:value-of select="'OLR'"/>
                </xsl:when>
                <xsl:when test="$storeCode='88746'">
                    <xsl:value-of select="'ROM'"/>
                </xsl:when>
                <xsl:when test="$storeCode='16781'">
                    <xsl:value-of select="'TRY'"/>
                </xsl:when>
            </xsl:choose>
    </xsl:param>
    <xsl:variable name="__function"  select="dyncfg:init($inputparam)" />
    <xsl:variable name="__function"  select="dyncfg:putValue('http://sap.com/xi/XI/System/File', 'Directory', $TargetFolder)" />
    In receiver FTP channel I use:
    - AF_Modules/DynamicConfigurationBean
    key.0 "write http://sap.com/xi/XI/System/File Directory"
    value.0 "message.interface"
    - Variable replacement
    targetfolder "message:interface_namespace"
    - ASMA
    Directory
    - Target Directory
    %targetfolder%
    So everything is set up correctly and it also works fine. But sometimes the FTP receiver channel does not get the Directory (I do not know why) and RWB gives the error:
    com.sap.aii.af.ra.ms.api.RecoverableException: The Adapter Message Property 'Directory' was configured as mandatory element, but was not supplied in the XI Message header: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: The Adapter Message Property 'Directory' was configured as mandatory element, but was not supplied in the XI Message header
    Is there a safer way to accomplish what I am doing? Should I go for a Java mapping?
    Thank you for your ideas and best regards,
    Peter
    Edited by: Peter Wallner on Jul 4, 2011 8:53 AM

    Hello Sarvesh,
    Thank you again. I did go for a JAVA mapping now because I can't use graphical mapping in this scenario.
    Now I created it and when I look in SXMB_MONI in the "DynamicConfiguration" it tells me "Directory" and "FileName" which is good.
    But when I check in RWB the messages get stuck and it says "write property message.interface from key (http://sap.com/xi/XI/System/File)Directory with value null;"
    Does the order in the DynamicConfiguration matter? In MONI it looks like this:
    - <SAP:DynamicConfiguration xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Record namespace="http://sap.com/xi/XI/System/Directory" name="Directory">CRB</SAP:Record>
      <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">EXPORT_1401_2011-07-03.xml.zip</SAP:Record>
      </SAP:DynamicConfiguration>
    But normally the "FileName" is always first, isn't it?
    Thanks again and best regards,
    Peter

  • 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>

  • UIX 2.1.7: Howto NOT escape HTML

    Hi all,
    we are using UIX 2.1.7 together with BC4J 9.0.3. We have a bc4j:table that displays data from a view object. One of the VO attributes contains HTML (just tags for formatting bold, italics, ...). When the UIX page is displayed, the HTML is not rendered but printed as-is, i.e. with tags, because UIX seems to escape the brackets to entities.
    Is there a way to prevent this? If not, which would be the preferred way to display formatted HTML coming from a database?
    Thanks for any help,
    Markus.

    Markus -
    Try using the <formattedText> element to display your text. <formattedText> passes through a variety of (but not all) HTML tags - see the entry in the UIX Element Reference for the details...
    Andy

  • Regular Expression Redirects in Web Server 7 not escaping special chars

    we are trying to add following rule in config file
    <If $uri =~ "^/ViewCourse\.action\?(.*)">
    NameTrans fn="redirect" url="https://$urlhost/learning/viewCourse.action?$query"
    </If>
    we get following error when we try to escape "." as "\." Anythought?
    onfig (24578): CONF2260: Error parsing file rp-prod-obj.conf, line 45: Unable to parse expression: \. is an invalid escape sequence
    config (24578): CORE3235: File server.xml line 136: Error processing element: Error processing file rp-prod-obj.conf
    rp-zn-tstick2-dat: ADMIN3606: Error while reconfiguring the server.
    config ( 5514): CONF2260: Error parsing file rp-prod-obj.conf, line 45: Unable to parse expression: \. is an invalid escape sequence
    config ( 5514): CORE3235: File server.xml line 136: Error processing element: Error processing file rp-prod-obj.conf

    Works for me as:
    <If $uri =~ '^/ViewCourse\.action\?(.*)'>
    NameTrans fn="redirect" url="https://$urlhost/learning/viewCourse.action?$query"
    </If>It boils down to the difference between a ' and a ". The docs , frankly, are a bit byzantine on the difference, but it's a question of how much escaping you need to do. Single quote ('), as above, works. Your original can also work (well, I think it can ... I know the server will reconfig and/or start at least) with more escaping:
    {code}<If $uri =~ "^/ViewCourse\\.action\\?(.*)">
    NameTrans fn="redirect" url="https://$urlhost/learning/viewCourse.action?$query"
    </If>{code}
    I'm not positive the extra escaping is needed on the question mark. Your mileage may vary. Warranty void in most states. Etc.

  • Escape character " is not escaped

    I have an application that posts information to a browser. I have the same problem with all the HTML tags.
    The problem arises when I escape " (quote). For example, this function:
    protected String formatAnswerHTML( String answerText ){
    StringBuffer returnString = new StringBuffer("<font class=\"agentName\">");
    returnString.append(agentName);
    returnString.append(": </font><font class=\"agentMssg\">");
    returnString.append(super.insertHyperlinksAtOptions(answerText));
    returnString.append("</font>");
    return returnString.toString();
    generates the following output:
    <FONT class=\"agentName\">Alex: </FONT><FONT class=\"agentMssg\">Hello and welcome to Ericsson Customer service. Please enter your question in plain English or select from the menu below.<BR></FONT>
    Does someone has a clue as to why the \" doesn't work?

    If you need to fix it quickly, and if it works for your browser, you can use single quotes instead of double quotes, so you don't have to escape them. Like:
    print("<img src='image.gif'>");
    That should work, since most browsers let you use single quotes. But if you are strict on consistancy, you might not like having single quotes in some places and double quotes in others...but that's only if you are worried about it.

  • Paging is not working in xslt dataview webpart

    Hi,
        Problem: Paging is not working in combined views, created by using linked data source
        Decription: Created a combined view using 3 different lists with merge option and enabled paging and grouping. Paging is not working and I have set display sets up to 30 items. Kindly provide any possible scenarious which causes this issue
    and any solutions.
    Thanks
    Razvi444

    Hi Razvi444,
    I assume you created the view web part as the link below:
    http://sp2013.blogspot.com/2013/11/two-sharepoint-lists-in-dataview-linked.html
    After that, we could add web part on our site page by insert > web part > miscellaneous > data source name. By default, the data source is set to display sets of 10 items in Paging.
    If you would like to switch it to 30 items, please save it and save the web part to Site Gallery as well. Then give it a new name and re-add the web part to our page.
    Regards,
    Rebecca Tu
    TechNet Community Support

  • 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>

Maybe you are looking for

  • Adobe Acrobat 9 Standard for the Mac?

    Okay, I apologize for what may appear to be a frightfully stupid question, but is there an Acrobat 9 Standard for the Macintosh? There appears to be support files and such for Adobe 9 Pro for the Mac available, but whenever I search for the Adobe 9 S

  • Can't Add Files to iPod

    I just got a 20 GB iPod this week. I was able to add about 1.5 GB of songs to it so far. Today, I am connecting to the Mac, trying to drag some new MP3 files from iTunes into the iPod folder, and it gets stuck. ITunes says it is transferring "1 of 10

  • OS Upgrade on Content Server

    Hi, We are using Content Server 6.30 Installed on Linux 3EL, DMS Installed on ECC6 system. We are using StorageType=FSS(File System Storage) on Content Server. Now We are planning to Upgrade OS on Content Server. Now Issue is I searched in PAM for su

  • MaxL script saved on the server

    Hi There, I have MaxL script created and save at Administration Server from EAS. I have users who can launch EAS from web, however he seems not being able to see my MaxL script. Do I need to grant him any specific right so he can see and run the MaxL

  • Asant   cannot find package, javac can??

    Hi All, I am working through the J2EE training disc CDJ-310A. I am trying to build the bankproject with asant and build.xml. Compiling with asant. Classpath set and works (javac finds it and set looks okay). Javac finds junit fine. Is there some othe