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] titlepage + XHTML + empty xmlns element: why?

Excellent explanation....

And yes, I simply added xmlns="http://www.w3.org/1999/xhtml";

So my resulting rjtitlepage.xsl has this statement at the top:

<xsl:stylesheet  xmlns="http://www.w3.org/1999/xhtml";
xmlns:exsl="http://exslt.org/common"; version="1.0"

I'm glad that there is a quick solution here.

Let me say that the concept of a "titlepage" in HTML output  seems
intended more for XSL-FO than HTML; that's probably why these kind of
kludges have to be used.

I'll file a bug indeed. Thanks.


On Sun, Dec 19, 2010 at 10:08 PM, Bob Stayton <bobs@sagehill.net> wrote:
> Hi Robert,
> I think you have discovered a hole in the DocBook stylesheet setup of XHTML.
>  Since you asked "why?", here is the long explanation.
> As it should, the XHTML output generated by xhtml/docbook.xsl or chunk.xsl
> puts all HTML elements in the xhtml namespace, by setting the default
> namespace on the root element of the XHTML output:
> <html xmlns="http://www.w3.org/1999/xhtml";>
> When generating namespaced output, any output that includes a reference to
> the null namespace by showing xmlns="" is an indication that some template
> or customization forgot that it was outputting elements in that namespace.
> So instead, those elements are output in the null namespace, and that
> xmlns="" must be added to those elements to indicate such. If they didn't
> have that declaration, they would inherit the root element's namespace
> declaration and be in the XHTML namespace.  But since those elements are not
> in the XHTML namespace, they have to opt out with xmlns="" to show that they
> have no namespace.
> Such "opting out" is usually the result of not including the declaration of
> that namespace as the default output of the stylesheet.  In the XHTML
> stylesheets, that is done on the root element of the stylesheet:
> <xsl:stylesheet  xmlns="http://www.w3.org/1999/xhtml";  etc.
> Note that there is no namespace prefix in this declaration.  This becomes
> the default namespace for generated elements.  After the XSLT processor has
> processed all the content into memory and is ready to serialize the output,
> it tries to minimize the number of namespace declarations in the output.  If
> all goes as planned and all elements are in that namespace, then the
> processor can put a single namespace declaration on the root element, and
> all descendant elements will inherit it.
> In XSL, it isn't enough to put this declaration on the main stylesheet file
> that you call, such as docbook.xsl or chunk.xsl.  Rather, this declaration
> must appear in *all* the file modules that are imported or included to make
> up the stylesheet. If you look in the DocBook xhtml directory, you will see
> that all the xsl files have that declaration, including
> titlepage.templates.xsl.
> But when you generated a new titlepage.templates.xsl from your custom spec
> file, it did not have that default namespace declaration. Thus any instances
> of "<div>" or other HTML elements appearing in those templates do not have a
> namespace, so they are not in the XHTML namespace.  So the XSLT processor
> has to indicate that lack of namespace by adding xmlns="" to those elements,
> so they won't inherit the default XHTML namespace from the root element.
> To make a long story short, all you need to do to fix this problem is to
> manually add xmlns="http://www.w3.org/1999/xhtml"; to the <xsl:stylesheet>
> element of your generated titlepage.templates.xsl. Then all the output from
> that module will also be in the XHTML namespace, and the processor won't
> need to generate xmlns="" for them.
> The "hole" that I mentioned at the start is that the stylesheet file
> (template/titlepage.xsl)  that generates a new titlepage.templates.xsl from
> a spec file is not aware that the output for XHTML should be in that
> namespace.  That's why you need to add in manually after you generate the
> file.
> So how does the xhtml/titlepage.templates.xsl that ships with DocBook XSL
> get that declaration?  Because it is not generated by
> templates/titlepage.xsl.  Rather, it is generated by the program that
> converts the html stylesheet files to xhtml stylesheet files.  That
> conversion program adds the namespace declaration to all the modules,
> including that one.  You probably noticed that the xhtml directory does not
> have a titlepage.templates.xml (that's .xml, not .xsl) spec file.
> I would appreciate if you would file a bug report on this issue.
> Bob Stayton
> Sagehill Enterprises
> bobs@sagehill.net
> ----- Original Message ----- From: "Robert Nagle"
> <idiotprogrammer@gmail.com>
> To: <docbook-apps@lists.oasis-open.org>
> Sent: Sunday, December 19, 2010 2:44 PM
> Subject: [docbook-apps] titlepage + XHTML + empty xmlns element: why?
>> My goal is to make chunked  XHTML or HTML output. I wish to have an
>> abstract, but I want it to appear only in a meta tag, not in the main
>> text. In my customization layer I enabled the parameter
>> (generate.meta.abstract)
>> Bob Stayton has suggested a way to do this:
>> http://lists.oasis-open.org/archives/docbook-apps/201012/msg00077.html
>> Customize the titlepage template for HTML so that abstract is not
>> included in the main content for chapter.
>> This method works, but it produces invalid HTML and XHTML code.  The
>> div tag which previously contained ABSTRACT now has a blank attribute
>> for xsmlns.
>> I tried using the latest docbook-ns and the regular docbook chunk xsl.
>> I tried both HTML and XHTML. The problem goes away when I remove the
>> line in the customization layer to include my customized titlepage
>> template.
>> This sounds like a bug to me. Can anyone confirm this and/or suggest a
>> way to solve this? Thanks.
>> rj
>> *****************************************
>> <head>
>> ...
>> <meta name="description" content="This is a test of the emergency
>> broadcast system." />
>> </head>
>> <body>
>>     <div class="chapter" title="Chapter 4. RJ  Test">
>>        <div xmlns="" class="titlepage"></div>
>>        <div class="mediaobject">
>> etc...
>> ******************************************************
>> <t:titlepage t:element="chapter" t:wrapper="div" class="titlepage">
>>  <t:titlepage-content t:side="recto">
>>   <title/>
>>   <subtitle/>
>>   <corpauthor/>
>>   <authorgroup/>
>>   <author/>
>>   <othercredit/>
>>   <releaseinfo/>
>>   <copyright/>
>>   <legalnotice/>
>>   <pubdate/>
>>   <revision/>
>>   <revhistory/>
>> <!--    <abstract/>-->   HERE"S WHAT I CHANGED
>>  </t:titlepage-content>
>> --
>> Robert Nagle
>> 12777 Ashford Point Dr #1417
>> Houston, Texas 77082
>> 713 893 3424
>> http://www.robertnagle.info
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
>> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org

Robert Nagle
12777 Ashford Point Dr #1417
Houston, Texas 77082
713 893 3424

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