Page 1 of 1

Differentiating between internal and outgoing links

Posted: Wed Feb 10, 2010 5:07 pm
by slaterino
Hi,
Does anyone know a quick way that I can differentiate between internal and outgoing links? Basically I want all outgoing links to have target=_blank and the internal ones to open in the same window. In my XML all my internal links are written as 'internal_link.php' and all outgoing as 'http://www.outgoing.com.'

I was thinking I could use xsl:attribute and have a xsl:when statement to find all links that begin with http or something like that. Is that possible? Does anyone know what criteria I could use to differentiate them?

My code will look something like this:

<a>
<xsl:attribute name="target">
<xsl:choose>
<xsl:when test="LINK BEGINS WITH HTTP">_blank</xsl:when>
<xsl:otherwise>_self</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</a>

Does anyone know what I could write for the criteria to make this work??

Many thanks,
Russ