Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Our XSL is set up so that when search results come up a user can click on an icon to go to that exact document in our library. The problem is when a document has an ampersand (&) in the metadata column "Title" and the icon is clicked the document isn't found in the library. Just as a side note the document does show up in the search results. A sample of the icon's URL is below.

If I replace the ampersand (&) in the URL with %26 the document is found in the library.

My question: What can I do to the URL to replace the ampersand (&) with "%26" for the Title metadata column only (This is my preferred method)? Or will I have to go through the 300+ documents with ampersand (&) in the titles and replace with the word "and" instead (help with a PowerShell command?).

This is what the URL of the icon used to go to the document in the library looks like before I reaplace the & with %26

http://myportal.domain.com/My%20Library/Forms/AllItems.aspx?InitialTabId=Ribbon.Document&VisibilityContext=WSSTabPersistence&View={FF43BG1F-4F18-4040-9C52-G49G1GGE9F2Q}&FilterField1=Title&FilterValue1=Care Management Solution Features & Benefits video

share|improve this question
add comment

1 Answer 1

Store the URL as a variable in XSL and then show the output with disabling output escaping.

<xsl:variable name="test" select="http://www.mysite.com/mypage.aspx?param1=1&amp;param2=2" />

<xsl:value-of select="$test" disable-output-escaping="yes" />
share|improve this answer
    
I'm not that familiar with XSL is this correct? <xsl:variable name="titleamp" select="http://myportal.domain.com/My%20Library/Forms/AllItems.aspx?InitialTabId‌​=Ribbon.Document&VisibilityContext=WSSTabPersistence&View={FF43BG1F-4F18-4040-9C5‌​2-G49G1GGE9F2Q}&FilterField1=Title&FilterValue1=Care Management Solution Features & Benefits video " /> <xsl:value-of select="$test" disable-output-escaping="yes" /> Will adding this variable do anything to the ampersands (&) in all of the other places in my sample? –  SMFH Jun 29 '12 at 20:23
    
This should do the trick, maybe you can encounter some problems with the space ( ' ' ). But you should first try this one. Good luck –  BenCes Jul 2 '12 at 6:39
    
Thank you very much BenCes. I will give this a try once I set up a test environment. –  SMFH Jul 2 '12 at 16:38
    
Don't forget to mark this as an answer –  BenCes Jul 6 '12 at 7:10
    
Did this work out for you? Mark this as an answer please. –  BenCes Jul 25 '12 at 15:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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