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] Olinks failing -- CaseA NOT matched, No case matchedfor lang 'en' -- database build process


Hi again,

No one else seems to have experienced an issue like this, so apologies 
for posting to the list if this isn't of general interest.

Bob Stayton suggests that the problem is in the olinkdb.xml file, and my 
research shows that the most significant change between the time the 
olinks worked and the time when they all failed is a change in the way 
the olinkdb.xml is generated, and its location. The olinkdb.xml changed 
from a hand-built file to an auto-generated file, and moved to a 
higher-level etc directory. It used to live (until two months ago) in 
DotOrg/Khelp with the global Makefiles and customization layer. Now the 
olinkdb.xml is generated automatically by code that checks to see which 
of the Kavi applications are installed on the website.
>
>
> Bob Stayton wrote:
>
> Most likely the problem is in setting up the olinkdb.xml.  That file 
> must be manually constructed.  It references (through XInclude or 
> system entity references) the target files for each book, which are 
> generated by the stylesheet when the $collect.xref.targets parameter 
> is set to 'yes'.
>
> Bob Stayton
> Sagehill Enterprises
> bobs@sagehill.net
>> Hi,
>> This should work.  Can you provide more details on your olinkdb.xml 
>> file and how the individual target.db files are generated for each book?
Here's that info. Let me know if there are any omissions.

--------Snippets from the top-level Makefile that generate olinkdb.xml 
and local targetdbs----------------

# See which products are installed for this site
PRODUCTS = $(shell find $(PRODUCTDIR) -type d -name Khelp)


# Find all currently installed products
INSTALLED_PRODUCTS = $(shell m=''; \
    for prd in $(PRODUCTS); \
    do \
      basedir=`dirname $$prd`; \
      prodname=`basename $$basedir`; \
      m="$$m$$prodname $$prd/user_help/xml/target.db,"; \
    done; \
    echo $$m )


all: olinks target_dbs
    @ for prd in $(PRODUCTS); \
    do \
      echo "Building Help for $$prd"; \
      $(MAKE) -k -C $$prd/user_help/xml/; \
    done


olinks: FORCE
    $(XSL_PROC) -o $(DOTORGPATH)/etc/olinkdb.xml \
    --stringparam installed_apps "$(INSTALLED_PRODUCTS)" \
    olinkdb.xml.xslt olinkdb.xml.default
    
target_dbs:
    @ for prd in $(PRODUCTS); \
    do \
      echo "Building target.db for $$prd"; \
      $(MAKE) -k -C $$prd/user_help/xml/ target.db; \
    done;
    
# File ends with

FORCE:


----------------------------------new versus old olinkdb.xml 
files--------------
 
New version snippet:
 
Note: the declaration in the new version is missing the encoding and is 
simply <?xml version="1.0"?>

     <dir name="members">
        <dir name="user_help">
          <dir name="html">
            <document targetdoc="MembersHelp">
        <xi:include 
href="/export/play/teya/tbkorg30/dev/dotorg/share/cgi-lib/p\
ython/Products/Members/Khelp/user_help/xml/target.db"
          xmlns:xi="http://www.w3.org/2001/XInclude"; />
      </document>
          </dir>
        </dir>
      </dir>
 
 
Old version snippet:
Has entity references at the top, such as

<!ENTITY memberstargets      
      SYSTEM "../../Members/Khelp/user_help/xml/target.db">   
     
which is called here as &memberstargets

   <dir name="members">
        <dir name="user_help">
        <dir name="html">
         &memberstargets;        
       </dir>      
       </dir>      
       </dir>    

--------------In case this helps, here are some changes in the 
customization layer----------------
Local Makefiles call kavi_chunk.xsl, which imports kavi_docbook.xsl and 
html/chunk-common.xsl, and includes html/manifest.xsl.

 Here is a comment from kavi_docbook.xsl:
 <!-- Instead of including chunk.xsl as normal here, we do the
  includes that stylesheet does by hand, since we need to override
  some things.
  -->

kavi_chunk.xsl comment:
the chunk-element-content template from chunk-common.xsl is overwritten 
so we only get the stuff between the body tags.

--------------error messages from 'make html' process after adding 
debugging messages----------------
This make operation is performed at the local level against the test 
files. Before doing this, the target.dbs and html here and in the 
glossary directory (which contains the targets of these olinks) were 
deleted then regenerated. This is running against the existing 
olinkdb.xml, which was generated with the 'make all' or 'make olinks' 
command in the top-level help directory DotOrg/Khelp.

$ make html
mkdir -p ../html
/usr/bin/xsltproc --xinclude -o ../html/index.html \
        --stringparam target.database.document 
/export/home/tburnham/tbkorg30/dev/dotorg/share/cgi-lib/python/Products/DotOrg/Khelp/olinkdb.xml 
\
        --stringparam current.docid MembersHelp \
        
/export/home/tburnham/tbkorg30/dev/dotorg/share/cgi-lib/python/Products/DotOrg/Khelp/kavi_chunk.xsl 
index.xml
ID recommended on partintro
kavi_docbook.xsl: end if
Olink debug: root element of target.database 
'/export/home/tburnham/tbkorg30/dev/dotorg/share/cgi-lib/python/Products/DotOrg/Khelp/olinkdb.xml' 
is 'targetset'.
Olink debug: cases for targetdoc='DotOrgHelp' and 
targetptr='gloss_test_def' in language 'en'.
Olink debug: CaseA NOT matched
Olink debug: No case matched for lang 'en'.
Olink debug: cases for targetdoc='DotOrgHelp' and 
targetptr='gloss_test_def' in language ''.
Olink debug: CaseA NOT matched
Olink debug: No case matched for lang ''.
Error: unresolved olink: targetdoc/targetptr = 'DotOrgHelp/gloss_test_def'.
kavi_docbook.xsl: exiting sect1 template
kavi_docbook.xsl: end if
Olink debug: root element of target.database 
'/export/home/tburnham/tbkorg30/dev/dotorg/share/cgi-lib/python/Products/DotOrg/Khelp/olinkdb.xml' 
is 'targetset'.
Olink debug: cases for targetdoc='DotOrgHelp' and 
targetptr='gloss_test_def' in language 'en'.
Olink debug: CaseA NOT matched
Olink debug: No case matched for lang 'en'.
Olink debug: cases for targetdoc='DotOrgHelp' and 
targetptr='gloss_test_def' in language ''.
Olink debug: CaseA NOT matched
Olink debug: No case matched for lang ''.
Error: unresolved olink: targetdoc/targetptr = 'DotOrgHelp/gloss_test_def'.
kavi_docbook.xsl: exiting sect1 template
kavi_docbook.xsl: end if
Olink debug: root element of target.database 
'/export/home/tburnham/tbkorg30/dev/dotorg/share/cgi-lib/python/Products/DotOrg/Khelp/olinkdb.xml' 
is 'targetset'.
Olink debug: cases for targetdoc='KEditorHelp' and 
targetptr='edit_content_tab_overview' in language 'en'.
Olink debug: CaseA NOT matched
Olink debug: No case matched for lang 'en'.
Olink debug: cases for targetdoc='KEditorHelp' and 
targetptr='edit_content_tab_overview' in language ''.
Olink debug: CaseA NOT matched
Olink debug: No case matched for lang ''.
Error: unresolved olink: targetdoc/targetptr = 
'KEditorHelp/edit_content_tab_overview'.
kavi_docbook.xsl: exiting sect1 template
Exiting user.header.navigation template and kavi_docbook.xsl.
preparing to call chunk-code.xsl and exit kavi_chunk.xsl
Writing test.html for chapter(test)
Exiting user.header.navigation template and kavi_docbook.xsl.
preparing to call chunk-code.xsl and exit kavi_chunk.xsl

--------------------the section from kavi_docbook.xsl where the olink 
errors seem to arise---------------------
Note: the chunking section was moved here from a file that used to be in 
each local dir but was replaced by the global kavi_chunk.xsl. Everything 
preceding this is unchanged except for the comment mentioned previously.

<!--
  Chunking html parameters.  These are used in the kavi_chunk.xsl stylesheet
  kept here for ease of configuration.
  -->
  <xsl:param name="chunker.output.indent" select="'yes'" />
  <xsl:param name="chunker.output.encoding" select="'iso8859-1'" />
  <xsl:param name="chunk.section.depth" select="0" />
  <xsl:param name="chunker.output.omit-xml-declaration" select="'no'" />
  <xsl:param name="use.id.as.filename" select="1" />

  <!-- Auto add a Back To Top anchor at the end of each sect1 -->
<xsl:template match="sect1">
  <div class="{name(.)}">
    <xsl:call-template name="language.attribute" />
    <xsl:call-template name="sect1.titlepage"/>

    <xsl:variable name="toc.params">
      <xsl:call-template name="find.path.params">
        <xsl:with-param name="table" 
select="normalize-space($generate.toc)"/>
      </xsl:call-template>
    </xsl:variable>
    
<xsl:if test="contains($toc.params, 'toc')                   and 
$generate.section.toc.level &gt;= 1">
      <xsl:call-template name="section.toc">
        <xsl:with-param name="toc.title.p" select="contains($toc.params, 
'title')"/>
      </xsl:call-template>
      <xsl:call-template name="section.toc.separator"/>
    </xsl:if>

<xsl:message>kavi_docbook.xsl: end if</xsl:message>


-------------comments and questions-------------------

Comments:
The error is thrown as the process leaves the one if statement in 
kavi_docbook.xsl, but the actual error may have been encountered further 
upstream.

There are very few changes in kavi_docbook.xsl, and the sections above 
the chunking section are completely unchangd. The chunking section is 
new here and the encoding in this section was recently changed from 
UTF-8 to ISO8859-1.


QUESTIONS:

1) collect.xref.targets is set to 'only' in Makefile.inc, which is 
included by the local Makefiles. CVS shows it has always been this way 
(and the olinks used to work), and setting the value to 'yes' as a test 
didn't make the olink process work, but perhaps I was only generating 
target.dbs and html and didn't regenerate the olinkdb.xml. Can this be 
ruled out as the problem?

2) The error message suggests that a language mismatch occurs during 
olink processing. The section just above the if clause calls the 
template named language.attribute. Language isn't set anywhere in our 
customization layer, although 'en' appears to be specified here in the 
xml documents themselves:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE glossary PUBLIC "-//OASIS//DTD DocBook XML V4.2//en"
                  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd";>
                  
The error about CaseA refers to a section of /common/olink.xsl:

 <!-- Customize these cases if you want different selection logic -->
  <xsl:variable name="CaseA">
    <!-- targetdoc.att = not blank
         targetptr.att = not blank
    -->
    <xsl:if test="$targetdoc.att != '' and
                  $targetptr.att != ''">
      <xsl:for-each select="$target.database">
        <xsl:variable name="key"  
                      select="concat($targetdoc.att, '/',  
                                     $targetptr.att, '/',
                                     $target.lang)"/>
        <xsl:choose>
          <xsl:when test="key('targetptr-key', $key)/@href != ''">
            <xsl:value-of select="$key"/>
            <xsl:if test="$olink.debug != 0">
              <xsl:message>Olink debug: CaseA matched.</xsl:message>
            </xsl:if>
          </xsl:when>
          <xsl:when test="$olink.debug != 0">
            <xsl:message>Olink debug: CaseA NOT matched</xsl:message>
          </xsl:when>
        </xsl:choose>
      </xsl:for-each>
    </xsl:if>
  </xsl:variable>
 
3) Could encoding be an issue? There is some variation. The files are in 
UTF-8. The olinkdb.xml lacks encoding in the declaration. Output in 
chunks is set to ISO8859-1

4) Or is something in the olink or targetdb build definitely the issue? 
If it isn't visible in the info I've provided, can someone (esp. Bob) 
point me at gaps in the info...any suggestions for tests, etc?

Otherwise, I guess my next step is to roll all the changes back to the 
beginning of the year and see if the olink builds succeed, then begin 
reintroducing the changes incrementally until something breaks.

Regards to all; thanks especially to Bob,

Teya

-- 

Teya Burnham

Product Documentation Specialist
Kavi Corporation
DDN 503.813.9378
tburnham@kavi.com

Advance the Standard!



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