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] how to do modular glossaries with 5.0 ?


Hi,
 
I testet out the suggested XSL for approach #3 with the 1.75 stylesheets and found that some changes are required to produce output identical to otherterm with xlink:href. Below is the revised version of the xsl handling xlink:href.
 
The problem was that xpointer.idref template returns an empty string, since no xpointer is used here. The fix is to omit the assignment of idref variable and use xhref directly . You also need to add xref.properties if you want identical styling.
 
<xsl:when test="$xhref">
     <xsl:variable name="xtargets" select="key('id',$xhref)"/>
     <xsl:variable name="xtarget" select="$xtargets[1]"/>
 
     <xsl:call-template name="check.id.unique">
       <xsl:with-param name="linkend" select="$xhref"/>
     </xsl:call-template>
 
     <xsl:choose>
       <xsl:when test="count($xtarget) = 0">
         <xsl:message>
           <xsl:text>XLink to nonexistent id: </xsl:text>
           <xsl:value-of select="$xhref"/>
         </xsl:message>
      </xsl:when>
 
       <xsl:otherwise>
         <fo:basic-link internal-destination="{$xhref}" xsl:use-attribute-sets="xref.properties">
          <xsl:choose>
            <xsl:when test="string-length(.) != 0">
               <xsl:apply-templates/>
             </xsl:when>
             <xsl:otherwise>
               <xsl:apply-templates select="$xtarget" mode="xref-to"/>
             </xsl:otherwise>
           </xsl:choose>
         </fo:basic-link>
       </xsl:otherwise>
     </xsl:choose>
  </xsl:when>
 
Also, the gentext templates adds the trailing period mark, so that should be omitted from the last xsl:choose block
 
Best regards,
Bergfrid Skaara
 
 
 
 
On Fri, Mar 20, 2009 at 9:38 PM, Bob Stayton<bobs@sagehill.net> wrote:
> Regarding option #1 using olinks for cross references within a glossary
> collection, I don't think this will work with the current setup.  The
> problem is that the templates that collect the olink target data do not
> process an automatic glossary before extracting the target information.  It
> probably should, but currently does not.  So that means the olink database
> won't have the target information for the generated glossentries.  You could
> file that as a bug report on the SourceForge DocBook site so it gets fixed.
>
> I think approach #3 is probably easiest.  Below is an example XSL code to
> the template for glossseealso to add an xsl:when clause when an xlink is
> available.  It also handles the "See Also" part.  It uses mode="xref-to" to
> generate the link text for the target entry if the glossseealso element is
> empty.
>
> <xsl:template match="d:glossseealso" mode="glossary.as.list">
>  <xsl:variable name="otherterm" select="@otherterm"/>
>  <xsl:variable name="targets" select="key('id', $otherterm)"/>
>  <xsl:variable name="target" select="$targets[1]"/>
>  <xsl:variable name="xhref" select="@xlink:href"/>
>
>  <xsl:choose>
>   <xsl:when test="$target">
>     <fo:basic-link internal-destination="{$otherterm}"
>                    xsl:use-attribute-sets="xref.properties">
>       <xsl:apply-templates select="$target" mode="xref-to"/>
>     </fo:basic-link>
>   </xsl:when>
>   <xsl:when test="$xhref">
>     <xsl:variable name="idref">
>       <xsl:call-template name="xpointer.idref">
>         <xsl:with-param name="xpointer" select="$xhref"/>
>       </xsl:call-template>
>     </xsl:variable>
>
>     <xsl:variable name="xtargets" select="key('id',$idref)"/>
>     <xsl:variable name="xtarget" select="$xtargets[1]"/>
>
>     <xsl:call-template name="check.id.unique">
>       <xsl:with-param name="linkend" select="$idref"/>
>     </xsl:call-template>
>
>     <xsl:choose>
>       <xsl:when test="count($xtarget) = 0">
>         <xsl:message>
>           <xsl:text>XLink to nonexistent id: </xsl:text>
>           <xsl:value-of select="$idref"/>
>         </xsl:message>
>       </xsl:when>
>
>       <xsl:otherwise>
>         <fo:basic-link internal-destination="{$idref}">
>           <xsl:choose>
>             <xsl:when test="string-length(.) != 0">
>               <xsl:apply-templates/>
>             </xsl:when>
>             <xsl:otherwise>
>               <xsl:apply-templates select="$xtarget" mode="xref-to"/>
>             </xsl:otherwise>
>           </xsl:choose>
>         </fo:basic-link>
>       </xsl:otherwise>
>     </xsl:choose>
>
>   </xsl:when>
>   <xsl:when test="$otherterm != '' and not($target)">
>     <xsl:message>
>       <xsl:text>Warning: glossseealso @otherterm reference not found:
> </xsl:text>
>       <xsl:value-of select="$otherterm"/>
>     </xsl:message>
>     <xsl:apply-templates mode="glossary.as.list"/>
>   </xsl:when>
>   <xsl:otherwise>
>     <xsl:apply-templates mode="glossary.as.list"/>
>   </xsl:otherwise>
>  </xsl:choose>
>
>  <xsl:choose>
>   <xsl:when test="position() = last()">
>     <xsl:text>.</xsl:text>
>   </xsl:when>
>   <xsl:otherwise>
>     <xsl:text>, </xsl:text>
>   </xsl:otherwise>
>  </xsl:choose>
> </xsl:template>
>
>
>
> Bob Stayton
> Sagehill Enterprises
> bobs@sagehill.net
>
>
> ----- Original Message ----- From: "Bergfrid Skaara"
> <bergfrid.digitaldias@gmail.com>
> To: <docbook-apps@lists.oasis-open.org>
> Sent: Friday, March 20, 2009 10:07 AM
> Subject: [docbook-apps] how to do modular glossaries with 5.0 ?
>
>
>> Hi, I'm building multiple glossaries from a modular master glossary
>> and find the validation errors triggered by the otherterm constraint
>> on glosssee and glossseealso distracting.
>> The modularization is done as follows: 1 file for each letter a-z
>> containing individual glossentries on that letter + 1 master book file
>> for each glossary,  xincluding by xml:id from those files.
>>
>> What I would like most of all is to use the same setup as for master
>> bibliography, referencing a single bib. file using bibliomixed, but I
>> don't get this to work since the glossentries are split on 26 files.
>> My immediate challenge is however validation of the individual files,
>> since the otherterm constraint on glosssee and glossseealso uses id
>> and not xml:id and only see elements within the same document (file).
>> I can live with this, but our non-technical wysiwyg users cannot.
>> I'm considering the following options - any pro/con, implementation
>> suggestions, and alternative solutions are welcome.
>>
>> 1) redefine glosssee and glossseealso to behave like olinks by
>> replacing otherterm attribute with targetdoc and targetptr and writing
>> some templates to handle it (which we are already using)
>> 2) suppress the otherterm validation errors by customization (removing
>> schematron rules) - guess I'd have to QA the see links manually then
>> 3) link by using xlink:href rather than otherterm and write a custom
>> template to add and format the generated text (See / See also)
>>
>> Best regards, Bergfrid Skaara
>>
>> ---------------------------------------------------------------------
>> 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]