You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Philippe Vijghen <Ph...@forem.be> on 2000/02/16 14:20:06 UTC

XSLT and URL escaping in or in

Dear all,

[This question might be a bit too generic for this mailing list
but I like very much the quality of the posts over here.]

I am wondering how peoples are actually producing HTML output
with correctely escaped URLs in HREF or SRC attributes.
This is particularely the case when those URLs are computed 
using element content or attribute value (described using 
X-path expressions).

Exemple: I have an attribute @theme containing "On the road"
	   and I would like to use that value to select the corresponding
	   logo 

		<IMG SRC="/Images/{@theme}.gif"/>
		
		...is unfortunately producing

		<IMG SRC="/Images/On the road.gif"/>

		...which is not acceptable for Netscape Communicator
		whereby the following is expected

		<IMG SRC="/Images/On%20the%20road.gif"/>
	
I tried anyway to used the java.net.URLEncoder.encode
through the Xalan java extension mecanism.
It works fine on Xalan side but then I get 
<IMG SRC="/Images/On+the+road.gif"/>
...which is not valid neither.
So in the worse case, I'll have to rewrite my own 
java encoder, which is a bit strange for such a 
common need.	

However, I would prefer not having to use XSLT extensions
as I hate to become too much product-dependant and as we 
consider using the "same" stylesheets on client-side.

	Philippe