<!ENTITY toc.section.depth SYSTEM "../params/toc.section.depth.xml">
<!ENTITY use.extensions SYSTEM "../params/use.extensions.xml">
<!ENTITY ulink.footnotes SYSTEM "../params/ulink.footnotes.xml">
+<!ENTITY ulink.hyphenate SYSTEM "../params/ulink.hyphenate.xml">
<!ENTITY ulink.show SYSTEM "../params/ulink.show.xml">
<!ENTITY variablelist.as.blocks SYSTEM "../params/variablelist.as.blocks.xml">
<!ENTITY verbatim.properties SYSTEM "../params/verbatim.properties.xml">
&blockquote.properties;
&ulink.show;
&ulink.footnotes;
+&ulink.hyphenate;
</reference>
<reference><title>FO</title>
<src:fragref linkend="toc.section.depth.frag"/>
<src:fragref linkend="use.extensions.frag"/>
<src:fragref linkend="ulink.footnotes.frag"/>
+<src:fragref linkend="ulink.hyphenate.frag"/>
<src:fragref linkend="ulink.show.frag"/>
<src:fragref linkend="variablelist.as.blocks.frag"/>
<src:fragref linkend="verbatim.properties.frag"/>
xsl:use-attribute-sets="xref.properties">
<xsl:choose>
<xsl:when test="count(child::node())=0">
- <xsl:value-of select="@url"/>
+ <xsl:call-template name="hyphenate-url">
+ <xsl:with-param name="url" select="@url"/>
+ </xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
and $ulink.show != 0">
<fo:inline hyphenate="false">
<xsl:text> [</xsl:text>
- <xsl:value-of select="@url"/>
+ <xsl:call-template name="hyphenate-url">
+ <xsl:with-param name="url" select="@url"/>
+ </xsl:call-template>
<xsl:text>]</xsl:text>
</fo:inline>
</xsl:if>
</xsl:template>
+<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="contains($url, '/')">
+ <xsl:value-of select="substring-before($url, '/')"/>
+ <xsl:text>/</xsl:text>
+ <xsl:copy-of select="$ulink.hyphenate"/>
+ <xsl:call-template name="hyphenate-url">
+ <xsl:with-param name="url" select="substring-after($url, '/')"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$url"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
<xsl:template match="olink" name="olink">
<xsl:apply-templates/>
</xsl:template>
--- /dev/null
+<refentry id="ulink.hyphenate">
+<refmeta>
+<refentrytitle>ulink.hyphenate</refentrytitle>
+<refmiscinfo role="type">string</refmiscinfo>
+</refmeta>
+<refnamediv>
+<refname>ulink.hyphenate</refname>
+<refpurpose>Allow URLs to be automatically hyphenated</refpurpose>
+</refnamediv>
+
+<refsynopsisdiv>
+<src:fragment id='ulink.hyphenate.frag'>
+<xsl:param name="ulink.hyphenate" select="'­'"/>
+</src:fragment>
+</refsynopsisdiv>
+
+<refsect1><title>Description</title>
+
+<para>If not empty, the specified character (or more generally, content) is
+added to URLs after every <quote>/</quote>. If the character specified is a
+Unicode soft hyphen (0x00AD) or Unicode zero-width space (0x200B), some FO
+processors will be able to reasonably hyphenate long URLs.</para>
+
+<para>As of 28 Jan 2002, discretionary hyphens are more widely and correctly
+supported than zero-width spaces for this purpose.</para>
+
+</refsect1>
+</refentry>