OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Subject: Re: DOCBOOK-APPS: ulink and HTML target


* 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



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]


Powered by eList eXpress LLC