Use java.net.URLEncoder or something else
Re: http://help.hannonhill.com/discussions/xslt-formats/26-java-url-encoder-allowed-in-cms
I was able to put java.net.URLEncoder into the XSLT, but spaces in URLs are transcribed to pluses (+).
I've search around and I'm not finding much help. One suggestion was using a toURL function on it, but my attempts failed. Another suggestion was to use java.net.URI with toURI and toURL, but I couldn't get that to either.
Is there another way to encode URLs - specifically, encode/transcribe illegal characters to legal characters?
- block.xml.txt 64.2 KB
- format.xsl.txt 4.21 KB
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Ryan Griffith on Jul 11, 2013 @ 09:02 PM
Hi,
Curious, but something you could try is using the JavaScript
encodeURIComponent()
method. Because you are appending the protocol and host information, this should theoretically work.When you have a moment, give the following Xalan component a try and let me know if this produces the expected result:
Note: because you already have the hh prefix defined, I used hh2. Also, two prefixes cannot use the same URL, so I used
xmlns:hh2="http://www.tamu.edu/XSL/Functions"
during testing (the URL doesn't really matter).Please let me know if you have any questions.
Thanks!
2 Posted by Ryan Griffith on Jul 17, 2013 @ 07:10 PM
Hi,
Just wanted to follow up to see if you had a chance to view my recent comment.
Please let us know if you have any questions.
Thanks.
3 Posted by c-siems on Jul 18, 2013 @ 02:01 PM
That did it. Thanks Ryan. This seems like a lot of work to escape 1 or 2 URI - especially when our contributors know better than to put spaces in system names.
For those of you wanting to know how, in the format.xsl.txt file above, I changed the line
to
I also changed the
<guid>
tag to match the (escaped)<link>
tag. This makes the RSS pass the validator.4 Posted by Ryan Griffith on Jul 18, 2013 @ 03:51 PM
Thank you for following up, I am glad to hear that did the trick.
Have you looked into maybe using one of the Asset Factory plugins to generate a system name without spaces? The "Friendly" plugins convert spaces to dashes.
Ryan Griffith closed this discussion on Jul 26, 2013 @ 02:01 PM.