Next in thread → Next in month →

RE: [docbook-apps] Changing default olink behavior

From
Cramer, David W (David) <>
Date
2010-08-31T17:39:22+00:00
ID
Thread
RE: [docbook-apps] Changing default olink behavior
Thanks Bob,

It occurs to me that I
preprocess before generating straight DocBook too, so I should be ok
interoperability-wise if I just strip the link text in my preprocess.xsl.

 

My thinking in doing it this way
is that generally I want olinks to behave like xrefs so the link text is always
fresh, but that it’s nice to have the title of the target there when you’re
editing, even if the title text is potentially stale if the target has changed
since you inserted the olink. Another option would be to have the editor’s
olink insertion mechanism by default insert the olink link text as a comment,
so it would be visible in the editor but not used in rendering.

 

Anyway, the high-level goal is
to have olinks that behave like xrefs, but still give the writer some
information about the what the target is (beyond the targetdoc and targetptr
values). I’ll have to ponder more what the ideal way to achieve that would
actually be.

 

Thanks,

David 

 

From: Bob Stayton
[mailto:] 

Sent: Monday, August 30, 2010 10:28 PM

To: Cramer, David W (David); DocBook Apps

Subject: Re: [docbook-apps] Changing default olink behavior

 

Hi,

There
is no parameter option to do that.  You could customize the template named
"olink.hottext" in common/olink.xsl, which generates the link
text.  That template has grown to be quite large to handle all the options
for generating the link text, so you would be copying a big template to your
customization layer. In that template is a big xsl:choose, with the first
option being to process the content:

 

 
<xsl:choose>

    <!-- If it has elements or text (not just PI or comment)
-->

    <xsl:when test="child::text() or child::*">

      <xsl:apply-templates/>

    </xsl:when>

  
...

 

You
would need to add a condition to that xsl:when's test attribute to get finer
control.

 

Bob
Stayton

Sagehill Enterprises



 

 

-----
Original Message ----- 

From: Cramer, David W (David) 

To: DocBook Apps 

Sent: Sunday, August 29,
2010 10:53 AM

Subject: [docbook-apps]
Changing default olink behavior

 

Hi there,

I would like to change the behavior of olinks so that by
default the default olink text from the olink database is used instead of the link
text (the contents of the olink element). However, I would like the writer to
be able to specify individual cases that the link text should be used. I can
think of easy ways to do this (e.g. I already preprocess the source, so I could
just prune the link text unless it has some flag like
xrefstyle=”use.olink.text”), but I was wondering if there’s a
supported or better way.

 

Thanks,

David
Next in thread → Next in month →