What a great idea.  That looks to be very useful for a variety of purposes.

Bob Stayton
Sagehill Enterprises
[email protected]

--------------------------------------------------
From: "Jirka Kosek" <[email protected]>
Sent: Tuesday, September 17, 2013 2:33 AM
To: <[email protected]>
Subject: Re: [docbook-apps] Convert a relative file link to a URL in docbook

On Mon, Sep 16, 2013, at 21:13, Natalie Kershaw wrote:
<xsl:template match="d:link[@role='relative']">
  <xsl:copy>
    <xsl:attribute name="xlink:href">
      <xsl:value-of select="concat('http://prefix/', @xlink:href)"/>
    </xsl:attribute>
  </xsl:copy>
  <xsl:apply-templates select="d:link"/>
</xsl:template>

This seems to half-work in that it does prepend the prefix to the link
href, but then it does not convert the link element into FO.

Bob already described, why it doesn't work. However you can quite easily
use this approach. Use profiling stylesheets (ones starting with
profile-, eg. profile-docbook.xsl) and put your template into profile
mode. By default profile mode copies source document and you can change
this behaviour to do some changes in your source document, for example:

<xsl:template match="d:link[@role='relative']" mode="profile">
 <xsl:copy>
  <xsl:copy-of select="@*"/>
   <xsl:attribute name="xlink:href">
     <xsl:value-of select="concat('http://prefix/', @xlink:href)"/>
   </xsl:attribute>
   <xsl:apply-templates mode="profile"/>
 </xsl:copy>
</xsl:template>

That should do the trick.

Jirka

--
------------------------------------------------------------------
 Jirka Kosek      e-mail: [email protected]      http://xmlguru.cz
------------------------------------------------------------------
      Professional XML consulting and training services
 DocBook customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------
OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to