Strip out whitespace for items in a slot

I am using a slot to gather the text of a link to a file…please see code below:

#set($urllink = $sys.item.getProperty(‘rx:vanityurl’).String)
#set($campaignid = $sys.item.getProperty(‘rx:campaignid’).String.toLowerCase().replace(" “, “”))
#define($redirecturl)#slot_simple(‘Redirect_URL’)#end
<redirect url=”${urllink}" to="${redirecturl}?WT.MC_ID=${campaignid}" />

The output of 1 example looks like this:

<redirect url=“joe” to="

http://dev:9992/Rhythmyx/assembler/render?sys_contentid=2130&sys_revision=13&sys_folderid=2058&sys_context=0&sys_siteid=305&sys_variantid=563&sys_authtype=0

?WT.MC_ID=p100" />

I want the link to look like this:

<redirect url=“joe” to=“http://dev:9992/Rhythmyx/assembler/render?sys_contentid=2130&sys_revision=13&sys_folderid=2058&sys_context=0&sys_siteid=305&sys_variantid=563&sys_authtype=0?WT.MC_ID=p100” />

How do you remove the space between the to=" and the beginning of http…also how to you force ?WT to show up on the same line as the url…not the next one.

Joe,

Try putting a “Comment” marker at the end of each line in the velocity template as shown below.:

#set($urllink = $sys.item.getProperty(‘rx:vanityurl’).String)##
#set($campaignid = $sys.item.getProperty(‘rx:campaignid’).String.toLo werCase().replace(" “, “”))##
#define($redirecturl)#slot_simple(‘Redirect_URL’)#end##
<redirect url=”${urllink}" to="${redirecturl}?WT.MC_ID=${campaignid}" />##

Let me know if that helps.

M.

Hi Michael:

Thanks for your response. I ended up doing the following that seemed to work before I read your post:

#set($urllink = $sys.item.getProperty(‘rx:vanityurl’).String)
#set($vanityurl = $rx.string.stripSpaces($urllink))
#set($campaignid = $sys.item.getProperty(‘rx:campaignid’).String.toLowerCase().replace(" “, “”))
#define($redirecturl)#slot(“asa_Redirect_URL” “” “” “” “” “template=asa_Sn_LinkOnly”)#end
<redirect url=”${vanityurl}" to="${redirecturl}?WT.MC_ID=${campaignid}" />

In the LinkOnly template I did this to the bindings:

$pagelink $rx.location.generate($sys.assemblyItem)
$textonly $rx.string.stripSpaces($pagelink)

That fixed it for me. When I view the generated xml file it worked.

I have a similiar issue with a contact slot where it is wrapping the onclick javascript for webtrends to the 2nd line. I will apply your recommendations there.

Thanks,
Joe