Hello Mario,
> We would like to have external links in a Wiki page
> (http://...whatever...) open in a new browser window by default, instead
> of the current window. Has anyone managed to set this up?
>
> We're using Daisy 1.5.
I am using the following code fragment within document-to-html.xsl, which inherits from and overloads the default skin:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
[...] >
<xsl:import href="daisyskin:/(default)(webapp)xslt/document-to-html.xsl"/>
[...]
<xsl:template match="a" mode="PartContent">
<xsl:variable name="neLinkInfo" select="p:linkInfo"/>
<!-- <xsl:variable name="bIsLinkEmail" select="starts-with( @href, 'mailto:')"/> -->
<xsl:variable name="bIsLinkExternal" select="not( $bIsLinkEmail) and( starts-with( @href, 'http:')
or starts-with( @href, 'ftp:') or starts-with( @href, 'news:'))"/>
<xsl:variable name="bIsLinkPDF" select="contains( @href, '.pdf')"/>
<xsl:variable name="bIsLinkRSS" select="contains( @href, '.rss')"/>
<a>
<xsl:copy-of select="@*"/>
<xsl:choose>
<xsl:when test="$bIsLinkExternal">
<xsl:attribute name="class">external</xsl:attribute>
<xsl:attribute name="target">_blank</xsl:attribute>
</xsl:when>
<xsl:when test="$bIsLinkPDF"><xsl:attribute name="class">pdf</xsl:attribute></xsl:when>
<xsl:when test="$bIsLinkRSS"><xsl:attribute name="class">rss</xsl:attribute></xsl:when>
<xsl:otherwise/>
</xsl:choose>
<xsl:if test="$neLinkInfo/@documentName">
<xsl:attribute name="title"><xsl:value-of select="$neLinkInfo/@documentName"/></xsl:attribute>
</xsl:if>
<xsl:apply-templates mode="PartContent"/>
</a>
</xsl:template>
HTH,
--
Olivier
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3909 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.cocoondev.org/pipermail/daisy/attachments/20080602/f683265e/smime.bin