Re: Handling toplevel docs which don't set an id



On Fri, 2006-01-13 at 14:11 -0500, Joe Shaw wrote:
> Hi,
> 
> Most GNOME docbook entries start in the format:
> 
>         <article id="index" lang="en">
> 
> However, most KDE entries start like so:
> 
>         <book lang="en">
>         
> yelp-db-pager already knows about both article and book as "divisions",
> but it does not handle divisions which lack an "id" property well.  In
> yelp-xslt-pager.c:xslt_yelp_document(), there is this code:
> 
>     page_id = xsltEvalAttrValueTemplate (ctxt, inst,
>                                          (const xmlChar *) "href",
>                                          NULL);
>     if (page_id == NULL) {
>         xsltTransformError (ctxt, NULL, inst,
>                             _("No href attribute found on yelp:document"));
>         /* FIXME: put a real error here */
>         error = NULL;
>         yelp_pager_error (pager, error);
>         goto done;
>     }
> 
> There are two problems with this: first, page_id will never be NULL.  If
> the href is empty, it'll return "" rather than NULL.  Secondly, if it
> were NULL, yelp would completely bail out here, and that doesn't "help"
> anybody.  Ha Ha.
> 
> Probably the better thing to do here is to assume that documents with
> empty ids are probably the toplevel "index".  I'm attaching a patch
> which does this.
> 
> Please CC me on any replies, I'm not on the list yet.

Brent committed some code a few days back to add id attributes
to any sans-id element that we need to chunk on.  The top-level
element isn't the only one to have caused this issue:

http://bugzilla.gnome.org/show_bug.cgi?id=154934

I think this should solve the problem you're seeing.

--
Shaun






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]