This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: ulink and HTML target
- From: Michael Wiedmann <mw at miwie dot in-berlin dot de>
- To: Bob Stayton <bobs at caldera dot com>
- Cc: DocBook-Apps ML <docbook-apps at lists dot oasis-open dot org>
- Date: Fri, 09 Aug 2002 20:32:53 +0200
- Subject: Re: DOCBOOK-APPS: ulink and HTML target
- References: <3D53CA46.6AFC639D@detewe.de> <20020809103346.F25666@caldera.com>
* Bob Stayton <bobs@caldera.com> [020809 10:33]:
> Nothing built in to do this.
> I think you would have to do a customization of
> the ulink template to respond to a target value in the
> role attribute in ulinks.
To share my solution with others, this is what I've done:
<!-- override ulink template (from xref.xsl):
generate HTML attribute target="_blank" if role attribute
of ulink is equal to "newwindow"
-->
<xsl:template match="ulink" name="ulink">
<xsl:variable name="link">
<a>
<xsl:if test="@id">
<xsl:attribute name="name">
<xsl:value-of select="@id"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="href"><xsl:value-of select="@url"/></xsl:attribute>
<!-- Begin Change by MW -->
<xsl:if test="@role = 'newwindow'">
<xsl:attribute name="target">
<xsl:text>_blank</xsl:text>
</xsl:attribute>
</xsl:if>
<!-- End Change -->
<xsl:choose>
<xsl:when test="count(child::node())=0">
<xsl:value-of select="@url"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:variable>
<xsl:copy-of select="$link"/>
</xsl:template>
Michael
--
mw@miwie.in-berlin.de http://www.miwie.org
mw@miwie.org