Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Up One Level With returned URL [Thread Next] Re: Up One Level With returned URLTo: NULL Date: 3/3/2007 7:00:00 PM
XSLer wrote:
> If I add:
>
> <a href="/..{url}">
>
> It returns:
>
> http://myservername/..<the url>
>
> Am I doing what you suggest wrong? I could very well be.
I think the suggestion is to either write a (recursive) template that
returns the substring after the last slash or to try whether
<a href="{url}/..">
works for whatever application consumes the link URL.
A template could look like
<xsl:template name="substring-after-last">
<xsl:param name="str"/>
<xsl:param name="separator" select="'/'"/>
<xsl:choose>
<xsl:when test="contains($str, $separator)">
<xsl:call-template name="substring-after-last">
<xsl:with-param name="str" select="substring-after($str,
$separator)"/>
<xsl:with-param name="separator" select="$separator"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$str"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
and be called as e.g.
<xsl:call-template name="substring-after-last">
<xsl:with-param name="str" select="url"/>
</xsl:call-template>
Not tested but you should get the idea.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
