Re: Fw: [docbook-apps] Namespace issues with titlepage templates in slides

From
Alexey Neyman <>
Date
2013-05-11T05:05:04+00:00
ID
1994322.ZYQCGLmzvI@mistral
Thread
Re: Fw: [docbook-apps] Namespace issues with titlepage templates in slides
On Friday, May 10, 2013 06:01:22 PM Jirka Kosek wrote:

> On 8.5.2013 7:19, Bob Stayton wrote:

> > Would have time to take a look at this?  It seems Alexey spent a

> > great deal of time sorting out the namespace issues for the DocBook

> > titlepage template system, and has proposed many improvements.  As

> > far as I can tell, they make sense, but I think you should look at

> > it.

> 

> Sure, I originally skipped message as from subject line I got impression

> it's related to slides only.

 

Sorry for a confusing title. This originated as a narrow fix for slides templates, but, through that notorious "let's-fix-one-more-issue" approach quickly evolved into a rework of namespace handling.

 

> > This issue, however, shows that the titlepage.xsl is not not fully

> > namespace aware. First, it shouldn't "autoguess" the namespace for

> > t:wrapper - instead, it should just discover the namespace referred

> > to by the t:wrapper attribute.

> 

> Autoguessing is here just for backward compatibility. Ideally namespace

> should be passed by ns parameter. Problems you have seen in slides

> titlepages are caused by missing ns parameter in the build script.

 

I agree that the problem was the slides templates were incorrectly generated - I stated so in my original email. However, my point is that target namespace can be precisely determined by checking the namespace declaration for the wrapper element; this approach works even if that element has no namespace declaration (as in HTML).

 

> > Attached patches deal with these issues:

> Thanks for the patches. There are many good ideas in your code, but I'm

> little bit worried about backward compatibility -- in past we have tried

> very hard to keep old titlepage templates to work with newer versions of

> stylesheets. I'm not sure whether this is still true with all your

> proposed changes.

 

Unfortunately, it is not possible to fix the issues with namespace while fully preserving backwards compatibility: as I mentioned in the original email, the problem is that some of the current templates use the default namespace for elements from different XML vocabularies: for example, XHTML and DocBook:

 

  <t:titlepage-content t:side="recto">

    <title/>

    <subtitle/>

    ...

  </t:titlepage-content>

  ...

  <t:titlepage-separator>

    <hr/>

  </t:titlepage-separator>

 

As you see, this template uses default namespace for title/subtitle (DocBook elements) as well as hr (XHTML element).

 

> Also what's not clear to me is whether your patch will work with non-ns

> version of stylesheets which is primarily targeted for DocBook V4.x.

> Your code has several tests for DocBook namespace which suggests that

> you target only ns version of stylesheets.

 

Indeed, I do. I thought that docbook-xsl and docbook-xsl-ns are separate packages, isn't it so?

 

If it is not the case, could you explain which one is considered "master" distribution, ns-aware or non-ns version? And how one is produced from the other? I could probably modify the stylesheet to account for that case as well.

 

> For example how titlepage will look like for for HTML (not XHTML, so no

> namespace) for non-ns stylesheets (DocBook V4.x, again no namespace)?

 

Right now it would fail with the following message:

 

t:titlepage-content contains elements in non-DocBook namespace

 

(which is an attempt to fail gracefully rather than misinterpreting a non-ns aware template)

 

Then, if template has DocBook 5.0 namespace declared, it would generate a titlepage.template.xsl with DocBook elements being in a 5.0 namespace. Non-ns variant could probably be accommodated, though - see the questions above.

 

Regards,

Alexey.

 

> 

> Thanks,

> 

> 				Jirka