1

I have a display form which has an anchor tag in a table cell somewhere like the following:

    <a href="../../Lists/SomeFilteredListView?FilterField1=field1&FilterValue1={@field1}">
           <xsl:value-of select="@field2"/>
    </a>

I can embed a simple link like this in the form just fine. However, when I started rebuilding the url from left to right, I noticed that it stopped working once I added anything after "FilterField1" which leads me to believe that the "=" character is causing the issue.

What is the proper way of escaping the "=" character in order to add a url with a query string into a form that uses xslt?

edit: I wrapped the string in braces:

href="{'../../Lists/SomeFilteredListView?FilterField1=field1'}"

which worked.. but it stopped working once I added the second part (&FilterValue1=, etc.).

  • 1
    Try %26 to replace the &. = is %2D. – Erin L Apr 1 '16 at 17:23
  • This also works if I encode the entire string (i.e., make the two replacements you suggested). Thank you very much. – Dinerdo Apr 1 '16 at 18:20
4

There is no issue with the equals sign, the issue is with the ampersand, that has to be escaped as &amp;

https://stackoverflow.com/questions/1328538/how-do-i-escape-ampersands-in-xml

There are 5 characters that need to be escaped in XML:

"   &quot;
'   &apos;
<   &lt;
>   &gt;
&   &amp;

https://stackoverflow.com/questions/1091945/what-characters-do-i-need-to-escape-in-xml-documents

  • Thanks! This worked, but I still think there is some sort of issue with the equals sign. If I don't enclose the string in braces and single quotes, the equals sign alone breaks it. – Dinerdo Apr 1 '16 at 18:09
  • You only have to enclose any values you would be referencing like {@field1}. See additional link. – Eric Alexander Apr 1 '16 at 18:14
  • Ah, I understand now. It looks like the equals only caused an issue when it was left at the end of the string. Appreciate your help very much. – Dinerdo Apr 1 '16 at 18:21
-3

Replace & with "& amp;" and = with "& quote;"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.