[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Convert a relative file link to a URL in docbook
Yes, that is the hazard of customizing one of the
templates.
If you are willing to add an extra step to your processing,
you can run the file through an identity stylesheet that leaves everything the
same except the xlink:href attribute for those links. Then you could apply
the regular stylesheet to format it.
If you want to do it all within your customization, then this
should work:
<xsl:template match="link[@role =
'relative']">
<xsl:variable name="new.element"> <foo> <xsl:copy> <xsl:attribute name="xlink:href"> <xsl:value-of select="concat('http://prefix/', @xlink:href)"/> </xsl:attribute> <xsl:apply-templates/> </xsl:copy> </foo> </xsl:variable> <xsl:apply-templates select="exsl:node-set($new.element)/foo/*"/> </xsl:template> </xsl:stylesheet> This puts the modified copy of the element into a fake
element, and saves the result tree fragment to a variable. Then it
converts the fragment to a node-set using the exsl:node-set() function, and then
selects the modified link element to apply-templates to. The fake element
is needed to avoid processing the root of the temporary node set. In
DocBook XSL, the root element is handled in a special way to set up an FO
document with page-masters, and you want to avoid that by *not* processing the
root element. That's the tricky part I was referring to
earlier.
From: natk
Sent: Monday, September 16, 2013 3:30 PM
To: Bob
Stayton
Subject: Re: [docbook-apps] Convert a relative file link to a URL in
docbook Thanks for the prompt reply. Yes I had thought of that solution,
but it does not seem very maintainable. If that template changes when the
library is upgraded, my customization layer will mean that I don't see those
changes.
On Tue, Sep 17, 2013 at 7:48 AM, Bob Stayton <bobs@sagehill.net> wrote:
|
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]