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] Bibliography vs. olinks


Hi Bob,

First, adding space does not work because <biblioentry/> gets the space 
stripped; see xsl:strip-space in common/common.xsl.

Second, I decided to add a customization for biblioentry template anyway, as 
I'd like the <olink> to generate both <citetitle/> and <biblioid/> for the 
referenced document. So I've modified DTD to allow <olink/> as a direct child 
of <biblioentry> and use the following template for FO output:

 <xsl:template match="biblioentry">
  <xsl:param name="label">
   <xsl:call-template name="biblioentry.label"/>
  </xsl:param>

  <xsl:choose>
   <xsl:when test="olink">
    <xsl:variable name="tgtdoc" select="olink/@targetdoc"/>
    <xsl:variable name="id">
      <xsl:call-template name="object.id"/>
    </xsl:variable>
    <xsl:variable name="target.database.filename">
     <xsl:call-template name="select.target.database"/>
    </xsl:variable>
    <xsl:variable name="olink.database" 
select="document($target.database.filename,/)"/>

    <xsl:if test="count($olink.database//document[@targetdoc = $tgtdoc]) = 0">
     <xsl:message terminate="yes">Document <xsl:value-of select="$tgtdoc"/> 
not found in olink database.</xsl:message>
    </xsl:if>
    <xsl:variable name="target.info" 
select="$olink.database//document[@targetdoc = $tgtdoc]"/>

    <!-- Create a fake bibliography and load our entry from it -->
    <xsl:variable name="fake.biblioentry">
     <citetitle><olink targetdoc="{$tgtdoc}"><xsl:value-of 
select="$target.info/div[@element='book']/ttl"/></olink></citetitle>
     <biblioid><olink targetdoc="{$tgtdoc}"><xsl:value-of 
select="$target.info/div[@element='book']/obj[@element='biblioid']/xreftext"/></olink></biblioid>
    </xsl:variable>

    <fo:block id="{$id}" xsl:use-attribute-sets="biblioentry.properties">
     <xsl:copy-of select="$label"/>
     <xsl:apply-templates select="exsl:node-set($fake.biblioentry)/*" 
mode="bibliography.mode"/>
    </fo:block>

   </xsl:when>
   <xsl:otherwise>
    <xsl:apply-imports/>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:template>

Regards,
Alexey.

On Sunday, September 01, 2013 12:55:42 pm Bob Stayton wrote:
> Hi Alexey,
> This is really a stylesheet glitch.  Only empty biblioentries should
> trigger a lookup in the bibliography database, but that test is
> insufficient, because it uses:
> 
>   <xsl:when test="string(.) = ''>
> 
> It really should first do an apply-templates into a variable to see if the
> entry has generated content, and then test to see if it is empty.
> 
> I think if  you add a blank space to the biblioentry, it should get past
> that test and process the content normally.
> 
> Bob Stayton
> Sagehill Enterprises
> bobs@sagehill.net
> 
> 
> From: Alexey Neyman
> Sent: Saturday, August 31, 2013 11:27 PM
> To: docbook-apps@lists.oasis-open.org
> Subject: [docbook-apps] Bibliography vs. olinks
> 
> 
> Hi all,
> 
> 
> 
> I have a set of documents that cross-reference each other. They also
> mention each other in their bibliography sections.
> 
> 
> 
> So, the most natural way I thought of was:
> 
> 
> 
> <biblioentry>
> 
> <olink targetdoc="some-other-document"/>
> 
> </biblioentry>
> 
> 
> 
> Indeed, since all the necessary document info is already in the olink
> database - why not use it? Unfortunately, DTD stopped me from doing that.
> :)
> 
> 
> 
> So, I tried to wrap the <olink/> above in <citetitle/>. That passed the
> validation, but the docbook-xsl stylesheets interpreted this as a
> reference to an external bibliography file, and failing to load that
> external entity, emitted an error message:
> 
> 
> 
> warning: failed to load external entity
> "http://docbook.sourceforge.net/release/bibliography/bibliography.xml";
> 
> No bibliography entry: idp71680 found in
> http://docbook.sourceforge.net/release/bibliography/bibliography.xml
> 
> 
> 
> So, I see two possible ways of dealing with this:
> 
> 
> 
> - to process the whole set of documents to create that "bibliography
> collection" (which, I guess, would work - but seems to be an overkill,
> given the availability of the required information in the olink database)
> 
> 
> 
> OR
> 
> 
> 
> - to customize the DTD to allow <olink/> as a direct child of
> <biblioentry/> and to customize the match="biblioentry" template to handle
> such olinks.
> 
> 
> 
> Am I missing some obvious way of dealing with this problem?
> 
> 
> 
> If I follow the latter approach, would it be a welcome addition to
> docbook-xsl stylesheets?
> 
> 
> 
> Regards,
> 
> Alexey.


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