[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: url rewriting
We solve this in our applications via a named template:
<a> <xsl:attribute name="href"> <xsl:call-template name="url-rewriting"> <xsl:with-param name="url" select="'http://www.foo.bar'"/> </xsl:call-template> </xsl:attribute> </a> --- <xsl:template name="url-rewriting"> <xsl:param name="url" select="''"/> <xsl:choose> <xsl:when test="contains($url, '?')"> <xsl:value-of select="substring-before($url, '?')"/> <xsl:text>;jsessionid=</xsl:text> <xsl:value-of select="$sessionid"/> <xsl:value-of select="substring-after($url, '?')"/> </xsl:when> <xsl:when test="contains($url, '#')"> <xsl:value-of select="substring-before($url, '#')"/> <xsl:text>;jsessionid=</xsl:text> <xsl:value-of select="$sessionid"/> <xsl:value-of select="substring-after($url, '#')"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$url"/> <xsl:text>;jsessionid=</xsl:text> <xsl:value-of select="$sessionid"/> </xsl:otherwise> </xsl:choose> </xsl:template> This template adds the sessionid, which is passed as global parameter to the stylesheet, to the url. It's simple and reusable code and you can catch such things like links in javascript. Another solution is a two step process. We set the attributes in a different namespace and in a second transformation step the sessionid is added: <a url:href="http://www.foo.bar"/> ---- <xsl:template match="url:href"> <!-- similar to the above one --> </xsl:template> Regards, Joerg Madhavi Thottempudi wrote: Hi there! 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
|