| Paul's profileAutoSpongePhotosBlogLists | Help |
|
|
February 26 Building Anchors With Multiple URL ParametersFor some reason, this was hard for me to figure out today. In the past (like here), I used XSL to parse and concatenate bits of text with data to make a useful anchor tag on my page. And when I've done work for redirects (like here) and pre-population (like here) I always used the javascript method to parse the URL into a query string and value.
For some reason, today I needed to do the same thing but also use the "Source" parameter to land the user on a top-level site page instead of the survey summary page and it baffled me.
I kept reviewing my notes, looking for the answer: "Why does SPD always throw an error on this string, it's quoted?" Every time I added '&Source...' to the concat function, my page blew up. Without the & the page would load but the URL that came out was wrong. This was good, because I already knew how to put something offensive in a variable and call it again with XSL code from my experience with substring and the mailto tag. I tried putting the & into this: <xsl:variable name="amp1">&</xsl:variable>
But that blew up too. After some googling, some cussing, and finally some good ole fashioned trial and error I stumbled upon the answer (and have I mentioned how much I love zvon.org?): <xsl:variable name="amp1">&</xsl:variable>
Even though apostrophe is offensive and is often carried as a variable, ampersand is offensive even to the variable definition, so you have to use the entity reference.
So my URL looks like this: <a href="{concat('https://domain/site/Lists/Course%20Evaluation/NewForm2.aspx?CourseID=',@ID,$amp1,'Source=...where I want the user to land...')}">Evaluation Survey</a> Comments (3)
Trackbacks (12)The trackback URL for this entry is: http://autosponge.spaces.live.com/blog/cns!D7F85948C20F0293!285.trak Weblogs that reference this entry
|
|
|