[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Resolving Netscape 4.7, and IE 5 issues with XSL
Niranjan Perera wrote: > In my demo.xsl, I have the following fragment > > <xsl:attribute > name="href">getDemo.xml?Id=<xsl:value-of > select="@Account"/></xsl:attribute> > > where @Account is holding onto 'Hello World' Not sure if you need to do more complex calculations to get your attribute values, but a simpler syntax in this case would be: <a href="getDemo.xml?Id={@Account}">click</a> In any case, your output HTML contains href="getDemo.xml?Id=Hello World" And you should note that the attribute value here is not a legal URI. Raw space characters are not allowed in URIs. > When I use IE 5, Netscape 6, or Opera 5 this is what > is sent via the http call: > > http://localhost/demo/getDemo.xml?Id=Hello%20World Then IE 5, Netscape 6 and Opera 5 are being very nice to translate your unescaped space for you. They are under no obligation to do that. > When I use Netscape 4.7 this is what is sent via the http call > > http://localhost/demo/getDemo.xml?Id=Hello World Netscape 4.7 is not doing anything wrong, although one could argue that since an href value must be a URI, any disallowed characters in the value should be considered part of the URI and should be escaped so as not to have this situation. But there is no requirement that this actually happen. You should just translate the spaces in the first place. If you are sure that your server will accept '+' instead of ' ', you might try using the translate() function: <a href="getDemo.xml?Id={translate(@Account,' ','+')}">click</a> or, the way I would do it, would be to do a string replacement of ' ' with '%20': <a> <xsl:attribute name="href"> <xsl:text>getDemo.xml?Id=</xsl:text> <xsl:call-template name="replace"> <xsl:with-param name="stringIn" select="@Account"/> <xsl:with-param name="charsIn" select="' '"/> <xsl:with-param name="charsOut" select="'%20'"/> </xsl:call-template> </xsl:attribute> <xsl:text>click</xsl:text> </a> The named template is below. <xsl:template name="replace"> <xsl:param name="stringIn"/> <xsl:param name="charsIn"/> <xsl:param name="charsOut"/> <xsl:choose> <xsl:when test="contains($stringIn,$charsIn)"> <xsl:value-of select="concat(substring-before($stringIn,$charsIn),$charsOut)"/> <xsl:call-template name="replaceCharsInString"> <xsl:with-param name="stringIn" select="substring-after($stringIn,$charsIn)"/> <xsl:with-param name="charsIn" select="$charsIn"/> <xsl:with-param name="charsOut" select="$charsOut"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$stringIn"/> </xsl:otherwise> </xsl:choose> </xsl:template> Also please note that you are asking an HTML question, not an XSL question, really. - Mike _____________________________________________________________________________ mike j. brown, software engineer at | xml/xslt: http://skew.org/xml/ webb.net in denver, colorado, USA | personal: http://hyperreal.org/~mike/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|