[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] hr separator? insert external HTML code?
Hi Robert,
My answers are below.
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net
----- Original Message -----
From: "Robert Nagle" <idiotprogrammer@gmail.com>
To: <docbook-apps@lists.oasis-open.org>
Sent: Wednesday, October 14, 2009 3:11 AM
Subject: [docbook-apps] hr separator? insert external HTML code?
> Is there a direct way you can insert a separator (i.e., like the <hr
> tag) into the HTML output?
>
> While doing research into that question, I notice that the XSL book
> mentions a way to insert external HTML code into the page content
> (i.e., not the footer or header)
> http://www.sagehill.net/docbookxsl/InsertExtHtml.html#CodeInPage
>
> I'm not quite sure I understand the directions here and the example.
>
> Is it not enough just to add the code
> </para>
> <?dbhtml-include href="mycode.html"?>
> <para>
> ...
> in the appropriate place? (I'm assuming no).
Yes, that is sufficient, as long as mycode.html contains a well-formed XML
document.
> To use a trivial example: Suppose mycode.html contained only:
>
> <hr />
>
> Would that be sufficient or would I need to wrap it inside html. i.e.,
> <html>
> <hr />
> </html>
Either way works. The external file must be a well-formed XML file or it
will generate an error when it is opened by the XSLT document() function
that the processing instruction template employs. If you want to include a
well-formed XML element, then you don't need the <html> wrapper. However,
if you want to include a sequence of elements, a sequence does not
constitute a well-formed document. So wrap the sequence in <html></html>,
and the stylesheet will strip off the wrapper and use the sequence. It only
does that if the root element is <html>.
> Judging from the context, I'm guessing that I would need to
> create/modify a template. Can you confirm this?
No, this feature is already available in the stylesheet.
> The XSL example given for customizing the header is:
>
> <xsl:template name="user.header.content">
> <xsl:variable name="codefile" select="document('mycode.html',/)"/>
> <xsl:copy-of select="$codefile/htmlcode/node()"/>
> </xsl:template>
>
> However, that refers to a specific template called user.header.content
> (which is already part of the docbook xsl sheets).
The user.header.content template is a placeholder template in the
stylesheets. You are just customizing it to do something useful. See:
http://www.sagehill.net/docbookxsl/EmptyTemplates.html
> In my trivial example of inserting the hr tag via mycode.html, would
> I need to invent a template name out of thin air? Or use an existing
> one?
>
> If a template is required, can you point me to an example of how to
> accomplish this?
A new template is not required.
> (Again, I realize that using a dbhtml-include statement simply to
> insert an hr tag is trivial, but is useful for instructive purposes).
Understood. Let me know if it doesn't work for you.
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]