[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] How to show URL after link text for PDF outputfrom Docbook 5.0?
As for the ulink:show "dilemma", i am partly on your side that you should keep this parameter, as many existing custom layers may depend on it. I also agree with you on the way it should work. On the other hand, if you say goodbye to ulink:show for a new more fitting parameter, i think that would be a better solution in the long run, as editing a custom layer to make it work again is a one time step and not too painful. All that with the assumtion that the transformations need not be backward compatible to older Docbook versions. I had a few minor issues to solve with your customizable solution but now it works as intended. The first issue was a missing declaration of the xlink namespace in my custom.xsl. The second problem was an existing custom template for 'inline.linkseq' which was now overruled by your code. I had all my links displayed in blue color, but the new modified links with xrefstyle='ulink' did not show up in blue anymore. So i modified your code a little and added an fo:inline to have my blue color back. This is how the relevant part of my customization file now looks like. I am not too firm with XSLT, but i hope i did it right. At least it works as intended now. <?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:d="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:import href="file://localhost/i:/docbook/tools/docbook-xsl/fo/docbook.xsl"/> <xsl:include href="file://localhost/i:/docbook/cfg/custom_titlepage.xsl"/> <!-- Show URL after link text for links with attribute xrefstyle='ulink' --> <!-- Display all these links in blue <xsl:template match="d:link[@xrefstyle = 'ulink']"> <xsl:param name="content"> <xsl:call-template name="simple.xlink"> <xsl:with-param name="content"> <xsl:apply-templates/> <xsl:text> (</xsl:text> <xsl:value-of select="@xlink:href"/> <xsl:text>)</xsl:text> </xsl:with-param> </xsl:call-template> </xsl:param> <fo:inline color="blue"> <xsl:call-template name="anchor"/> <xsl:if test="@dir"> <xsl:attribute name="direction"> <xsl:choose> <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when> <xsl:otherwise>rtl</xsl:otherwise> </xsl:choose> </xsl:attribute> </xsl:if> <xsl:copy-of select="$content"/> </fo:inline> </xsl:template> <!-- display all links in blue --> <xsl:template name="inline.linkseq"> <xsl:param name="content"> <xsl:call-template name="simple.xlink"> <xsl:with-param name="content"> <xsl:apply-templates/> </xsl:with-param> </xsl:call-template> </xsl:param> <fo:inline color="blue"> <xsl:call-template name="anchor"/> <xsl:if test="@dir"> <xsl:attribute name="direction"> <xsl:choose> <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when> <xsl:otherwise>rtl</xsl:otherwise> </xsl:choose> </xsl:attribute> </xsl:if> <xsl:copy-of select="$content"/> </fo:inline> </xsl:template> Regards Gerhard Grasboeck Bob Stayton wrote: > > Well, it looks like the ulink.show feature was "misplaced" in the > transition. I wonder if we should continue to use the ulink.show > parameter > name, since it is no longer a ulink element? I suppose so. It should > probably work only when a link element contains an external URL, and not > apply to another element with an xlink that is external. Does that make > sense? > > Since you want custom behavior anyway, this solution or something like it > in a customization layer should work for you: > > <xsl:template match="d:link[@xrefstyle = 'ulink']"> > <xsl:call-template name="simple.xlink"> > <xsl:with-param name="content"> > <xsl:apply-templates/> > <xsl:text> (</xsl:text> > <xsl:value-of select="@xlink:href"/> > <xsl:text>)</xsl:text> > </xsl:with-param> > </xsl:call-template> > </xsl:template> > > It adds the href when the attribute xrefstyle="ulink". > > Bob Stayton > Sagehill Enterprises > DocBook Consulting > bobs@sagehill.net > > > ----- Original Message ----- > From: "ggrasboeck" <g.grasboeck@inode.at> > To: <docbook-apps@lists.oasis-open.org> > Sent: Monday, June 18, 2007 4:58 AM > Subject: [docbook-apps] How to show URL after link text for PDF output > from > Docbook 5.0? > > >> >> We have switched to a Docbook 5.0 toolchain with xsltproc and FOP >> recently. >> All problems regarding output formatting (especially PDF) could be solved >> with one exception. >> >> For nearly all external links we want our destination URLs to be shown >> after >> the link text in PDF output and could find no way to do that with Docbook >> 5.0CR4, docbook5-xsl 1.72.0 and FOP 0.93. ulink.show does not seem to >> work >> anymore, i assume because ulink should be dead in Version 5. >> We also have some exceptions to this rule, so a solution an a per-link >> basis >> would be preferrable for us over a global transformation setting. >> >> Our links all look like this: >> >> <link >> xlink:href="http://parlament.gv.at/path/to/doku/DocName.xml">XML-File</link> >> >> and the output in PDF should look like this: >> >> XML-File (http://parlament.gv.at/path/to/doku/DocName.xml) >> >> with the destination URL shown after the link text. >> >> We did this before with Docbook 4.2 and a LaTeX toolchain but with the >> new >> toolchain we could find no working solution. I have already searched the >> documentation and the forums, but could find no working solution. >> Any help on this would be appreciated. >> >> Regards >> Gerhard Grasboeck >> -- >> View this message in context: >> http://www.nabble.com/How-to-show-URL-after-link-text-for-PDF-output-from-Docbook-5.0--tf3939712.html#a11173914 >> Sent from the docbook apps mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org >> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org >> >> >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org > > > -- View this message in context: http://www.nabble.com/How-to-show-URL-after-link-text-for-PDF-output-from-Docbook-5.0--tf3939712.html#a11195841 Sent from the docbook apps mailing list archive at Nabble.com.
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]