This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[docbook-apps] Improving ulink fo rendering


hello,

These are two modifications I suggest: in FO XSL stylesheets:

1) make the url text an actual link
It is frustrating not to be able to click on a URL but only on the ulink text.
This can be done simply by moving down the fo:basic-link closing tag down in 
the <xsl:template match="ulink" name="ulink">

2) allow URL hyphenation on a custom list of characters.
This relies on adding of a new param:
  <xsl:param name="ulink.hyphenate.chars" select="':/@&amp;?.'"/>

and modification of the hyphenate-url template as follows:

  <xsl:template name="hyphenate-url">
    <xsl:param name="url" select="''"/>
    <xsl:choose>
      <xsl:when test="$ulink.hyphenate = ''">
        <xsl:value-of select="$url"/>
      </xsl:when>
      <xsl:when test="not(string-length($url) = 1)">
        <xsl:variable name="char" select="substring($url, 0, 2)"/>
        <xsl:value-of select="$char"/>
        <xsl:if test="contains($ulink.hyphenate.chars,$char)">
          <xsl:copy-of select="$ulink.hyphenate"/>
        </xsl:if>
        <xsl:call-template name="hyphenate-url">
          <xsl:with-param name="url" select="substring($url, 2, 1 div 0)"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$url"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


-- 
Camille Bégnis
NeoDoc Co-Founder
http://neodoc.biz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]