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] why do user templates generate empty xmlns attributes?

Well, namespaces are a known confusion factor.  There is the namespace on 
the input elements, which is the DocBook 5 namespace, and the namespace on 
the output elements, which is XHTML's namespace.

In my previous response, I thought we were still talking about reading an 
external file with the dbhtml-insert processing instruction to insert an 
HTML fragment.  If that were the case, then that fragment in the external 
file would need:

<html xmlns="http://www.w3.org/1999/xhtml";>
  <p>My stuff</p>

Since this content is just copied, the input namespace also needs to be the 
XHTML namespace.  Then when that content is copied, the elements are in the 
right namespace for XHTML output.

In your present case, however, you are generating the HTML fragment in the 
stylesheet's user.header.content template.  The xhtml-1_1/docbook.xsl 
stylesheet that the epub stylesheet imports has this namespace declaration:

<xsl:stylesheet xmlns=http://www.w3.org/1999/xhtml  (among others)

By not including a namespace prefix, this declaration sets the default 
output namespace for any generated elements to this namespace.  That means 
that any output elements that don't otherwise have a namespace assigned to 
them will get the XHTML namespace.

However, your stylesheet customization lacks this default namespace 
declaration, so the elements your customization generates are *not* in that 
namespace (a default namespace is not inherited by xsl:import).

So any stylesheet customization using XHTML output needs to declare this 
default namespace.  The last example on this page shows this:


Bob Stayton
Sagehill Enterprises

----- Original Message ----- 
From: "Robert Nagle" <idiotprogrammer@gmail.com>
To: "Bob Stayton" <bobs@sagehill.net>
Cc: <docbook-apps@lists.oasis-open.org>
Sent: Wednesday, October 14, 2009 1:47 PM
Subject: Re: [docbook-apps] why do user templates generate empty xmlns 

Alas, now I am even more confused (but hopeful!).

what do you mean by the "root element of the included html"? I'm not
sure what action I can take here.

i have an index.xml file plus several xinclude files. one such
xincluded file is called nt001.xml.

The top stuff of nt001.xml.  looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book [
<!ENTITY % isopub SYSTEM 
<chapter xmlns="http://docbook.org/ns/docbook"; version="5.0" xml:id="nt001">
 <title>Would Kafka have kept a weblog? </title>

the generated html file  nt001.html looks like this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.1//EN"
<html xmlns="http://www.w3.org/1999/xhtml";><head><title>Would Kafka
have kept a weblog?

the top stuff of the index.xml file looks like this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book [
<!ENTITY % isopub SYSTEM 
<book xmlns="http://docbook.org/ns/docbook";
    xmlns:xlink="http://www.w3.org/1999/xlink"; version="5.0" 

I wish to add that I can't even begin to guess how to add this
namespace reference or what it would look like. Common sense would
tell me that I'd need to add <html
xmlns="http://www.w3.org/1999/xhtml";> at the beginning of the
xincluded file. If I recall, my xml editor Oxygen couldn't validate
the character entities in my docbook project without a doctype
declaration, and that was preventing me from adding <html
xmlns="http://www.w3.org/1999/xhtml";>. My memory becomes fuzzy.....

thanks for your help. .


On Wed, Oct 14, 2009 at 1:58 PM, Bob Stayton <bobs@sagehill.net> wrote:
> Hi Robert,
> 1) The epub stylesheet generates XHTML, which is in the XHTML namespace:
> xmlns="http://www.w3.org/1999/xhtml";
> You will need to add that namespace attribute to the root element of your
> included HTML. If you don't then the processor marks it as being outside 
> of
> the XHTML namespace.

> ----- Original Message ----- From: "Robert Nagle"
> <idiotprogrammer@gmail.com>
> To: <docbook-apps@lists.oasis-open.org>
> Sent: Wednesday, October 14, 2009 11:30 AM
> Subject: [docbook-apps] why do user templates generate empty xmlns
> attributes?
>> When on the advice of Bob Stayton's last email
>> (http://lists.oasis-open.org/archives/docbook-apps/200910/msg00021.html)
>> I created a custom template for my customization layer , I notice
>> something strange.
>> </head><body><p xmlns=""><b>Hi Mom!</b></p><div class="chapter"
>> title="Would Kafka have kept a weblog?"><div
>> class="titlepage"><div><div><h1 class="title"><a
>> xmlns:saxon="http://icl.com/saxon"; id="nt001"/>Would Kafka have kept a
>> weblog? </h1></div></div></div>
>> Two questions:
>> 1)why does <p xmlns=""> show an empty value. (That actually makes the
>> code invalid and the resulting .epub invalid as well).
>> 2)what is going on here: <a xmlns:saxon="http://icl.com/saxon";> Why
>> is this namespace value there in the first place?
>> I notice that these kinds of weirdness/errors pop up all the time
>> whenever I try to put an xsl:template statement in my customization
>> layer file. I could live with the second error, but not the first.
>> Any idea what is causing this to happen?
>> My customization layer is pretty vanilla. It's for epub/chunked html
>> output.
>> ********************
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>> version="1.0">
>> <xsl:import
>> href="http://docbook.sourceforge.net/release/xsl/1.75.2/epub/docbook.xsl"/>
>> <xsl:param name="epub.metainf.dir">META-INF/</xsl:param>
>> <xsl:param name="epub.oebps.dir">OEBPS/</xsl:param>
>> <xsl:param name="use.id.as.filename">1</xsl:param>
>> <xsl:param name="html.stylesheet">first.css</xsl:param>
>> <!--<xsl:param name="show.comments">1</xsl:param>-->
>> <xsl:param name="label.from.part" select="0"></xsl:param>
>> <xsl:param name="chapter.autolabel">0</xsl:param>
>> <xsl:param name="part.autolabel">0</xsl:param>
>> <xsl:param name="img.src.path">images/</xsl:param>
>> <xsl:template name="user.header.content">
>> <p><b>Hi Mom!</b></p>
>> </xsl:template>
>> </xsl:stylesheet>
>> *******************
>> --
>> Robert Nagle
>> htpt://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

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