OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[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


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

Bob Stayton
Sagehill Enterprises
bobs@sagehill.net

--------------------------------------------------
From: "Jirka Kosek" <jirka@kosek.cz>
Sent: Tuesday, September 17, 2013 2:33 AM
To: <docbook-apps@lists.oasis-open.org>
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: jirka@kosek.cz      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: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org





[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]