Hi guys,
Ages ago (February actually) I reported a WebHelp bug:
-------- Original Message --------
Subject: WebHelp bug?
Date: Mon, 25 Feb 2013 12:14:46 +0100
From: Stefan Hinz <[email protected]>
To: DocBook Apps <[email protected]>
Building one of our books in WebHelp format gives a fatal error:
No template for "/book/chapter/mediaobject/imageobject/imagedata" (or
any of its leaves) exists in the context named "title" in the "en"
localization.
XPath error : Invalid type xmlXPathCompiledEval: 1
objects left on the stack.
A took some investigation to boil down the issue to this:
A construct like this makes WebHelp builds fail:
<mediaobject>
<imageobject><imagedata .../>...</imageobject>
<textobject><programlisting>...</programlisting></textobject>
</mediaobject>
(...)
This turned out to be a fairly tricky problem, which we've eventually
created a workaround for in our customization layer, but I thought I'd
share what our implementer found (and fixed) on this forum. So here goes ...
We had problems with two templates:
(1) <xsl:template name="write.longdesc"> in xhtml/graphics.xsl
(used to write out long descriptions for accessibility, for images and
for tables)
(2) <xsl:template match="legalnotice" mode="titlepage.mode"> in
xhtml/titlepage.xsl
(used to write out legal notices into separate files if the
generate.legalnotice.link parameter is set to 1)
The default templates still work (just) but the resulting output has not
been changed/customized for webhelp and so the files look a little odd.
So these probably need to be looked at by the webhelp folks.
Also both of the above templates call the template user.head.content to
insert a <title> element in the HTML <head>. The user.head.content
template is defined in xhtml/docbook-no-doctype.xsl and then overridden
in the webhelp layer in webhelp-common.xsl. The webhelp template assumes
that the object being processed always has a child <title> element (it
does in most cases).
This is Ok for legal notices, but for images it fails because for image
long descriptions, the object being processed is actually <imagedata>.
And this is what was causing your build failure and explains the error
message you saw:
"No template for "/book/chapter/mediaobject/imageobject/imagedata" (or
any of its leaves) exists in the context named "title" in the "en"
localization."
There were two choices:
(1) Customize the write.longdesc template to pass the text of the title
as a parameter when we call user.head.content.
(2) Change user.head.content to account for the differing situations
when the node might not have a title element.
As we have our own customizations of the write.longdesc template, I
implemented (1).
For (2) the title parameter needs a bit of thought. For <figure>
elements, you can select the ancestor figure element because that has a
title. But other objects, such as <informalfigure> or <mediabject> might
not have a title, so in those situations you need gentext to create a
notional title for the generated file. Again, this is one for the
webhelp folks.
--
Cheers,
Stefan Hinz <[email protected]>, MySQL Documentation Manager
Phone: +49-30-82702940, Fax: +49-30-82702941, http://dev.mysql.com/doc
ORACLE Deutschland B.V.& Co. KG
Registered Office: Riesstr. 25, 80992 Muenchen, Germany
Commercial Register: Local Court Of Munich, HRA 95603
Managing Director: Jürgen Kunz
General Partner: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Register Of Chamber Of Commerce: Midden-Niederlande, No. 30143697
Managing Directors: Alexander van der Ven, Astrid Kepper, Val Maher
--
Cheers,
Stefan Hinz <[email protected]>, MySQL Documentation Manager
Phone: +49-30-82702940, Fax: +49-30-82702941, http://dev.mysql.com/doc
ORACLE Deutschland B.V.& Co. KG
Registered Office: Riesstr. 25, 80992 Muenchen, Germany
Commercial Register: Local Court Of Munich, HRA 95603
Managing Director: Jürgen Kunz
General Partner: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Register Of Chamber Of Commerce: Midden-Niederlande, No. 30143697
Managing Directors: Alexander van der Ven, Astrid Kepper, Val Maher
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]