URL length

Post Reply
dorban
Posts: 31
Joined: Fri Sep 24, 2004 12:39 pm

URL length

Post by dorban »

User avatar
jason112
Site Admin
Posts: 347
Joined: Tue Oct 26, 2004 5:35 pm

URL length

Post by jason112 »

In the XSL stylesheet try changing this line

<FONT SIZE="-1"><xsl:apply-templates select="UrlDisplay/child::node()"/></FONT>

To this

<FONT SIZE="-1"><xsl:value-of select="substring-before(UrlDisplay, '#')"/>/FONT>
User avatar
jason112
Site Admin
Posts: 347
Joined: Tue Oct 26, 2004 5:35 pm

URL length

Post by jason112 »

dorban
Posts: 31
Joined: Fri Sep 24, 2004 12:39 pm

URL length

Post by dorban »

If I run this...

<xsl:value-of select="Url"/>

It shows the full url. If I try...

<xsl:value-of select="UrlDisplay"/>

Nothing displays.

If I run...

<xsl:value-of select="substring-before(Url, '#')"/>

It fixes the issue with the one that has the "#" but doesn't display anything for all the urls that didn't have a "#" in them.

I was trying to see if I could check to see if the URL has a "#" and then optionally use either of the above. I tried this...


<xsl:variable name="Url">
<xsl:if test="contains(Url,'#')">
<xsl:value-of select="substring-before(Url, '#')"/>
</xsl:if>
<xsl:if test="not(contains(Url,'#'))">
<xsl:value-of select="Url"/>
</xsl:if>
</xsl:variable>

But it didn't work as I'd hoped. I know we're running an old version of the software. The HD in the appliance died and we restored from CD. We're outside of our 2 year contract for updates and have been trying to evaluate what we want to do for doc management. I was trying to build this as a POC for our new intranet. Any help is appreciated.

Thanks,
D.
User avatar
jason112
Site Admin
Posts: 347
Joined: Tue Oct 26, 2004 5:35 pm

URL length

Post by jason112 »

You should be able to do it with the logic of the 2nd one, just need some code tweaking.

<xsl:choose>
<xsl:when test="contains(Url,'#')">
<xsl:value-of select="substring-before(Url, '#')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="Url"/>
</xsl:otherwise>
</xsl:choose>
dorban
Posts: 31
Joined: Fri Sep 24, 2004 12:39 pm

URL length

Post by dorban »

Found what I was looking for. Just in case it helps someone else...

<xsl:param name="text" select="Url"/>
<xsl:param name="delim" select="'&#35;'"/>
<xsl:choose>
<xsl:when test="contains($text,$delim)">
URL: <xsl:value-of select="substring-before($text,$delim)"/>
</xsl:when>
<xsl:otherwise>
URL: <xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
Post Reply