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] [PATCH PING] Re: [docbook-apps] Namespace issues with titlepage templates in slides


Hi Alexey,
Sorry, I should have acknowledged your posting.  Just haven't had time to digest it, yet. 
 
Bob Stayton
Sagehill Enterprises
bobs@sagehill.net

Sent: Friday, May 03, 2013 11:16 PM
Subject: [docbook-apps] [PATCH PING] Re: [docbook-apps] Namespace issues with titlepage templates in slides

Posted a week ago, no response so far...

 

Regards,

Alexey.

 

On Sunday, April 28, 2013 11:44:37 PM Alexey Neyman wrote:

Hi all,

 

I've tried using the stylesheets in slides directory; it seems that they are improperly declaring the namespaces for wrapping elements. Hence, in the output the respective elements (fo:block and div) are declared without a namespace, which leads to empty title pages in both XHTML and PDF outputs.

 

Adding a namespace is possible either by passing a parameter to the stylesheet (<xsl:param name="ns"/>). The titlepage.xsl stylesheet tries to guess the namespace for wrapping elements by looking if any elements in the input are declared in the XSL-FO or XHTML namespace. The templates for slides do not contain any elements in the target namespace, though.

 

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. Same with t:element - this is especially important, as that element may be in a non-DocBook namespace; for example, "DocBook slides" format declares elements in a separate namespace (dbs:slides, dbs:foil, etc.). Current titlepage.xsl cannot deal with template XML where DocBook elements are in non-default namespace - it outputs XPath expressions such as "d:d:title".

 

Also, it looks like some of the templates for the titlepages abuse the namespaces: for example, xhtml/titlepage.templates.xml declares default namespace as XHTML (xmlns="http://www.w3.org/1999/xhtml") but contains both DocBook elements (<title/>, <corpauthor/>, ...) as well as XHTML elements (<hr/>) in the default namespace.

 

Attached patches deal with these issues:

 

- titlepage.xsl.diff (patch for titlepage generation stylesheet):

* New attribute on t:templates: t:copy-namespaces; contains the list of

namespace prefixes to copy from the template to the resulting stylesheet

(currently, titlepage.xsl just copies exsl: and d: prefixes from the

titlepage.xsl itself); this results in appropriate namespace prefix being

defined at the top of the resulting stylesheet rather than on every

element.

* New template, output.wrapper, outputs the wrapper element with the

namespace as defined in the template - no "guessing" needed. The 'ns'

parameter is no longer needed and is thus removed. Also, template for

attributes in "copy.literal.atts" mode is no longer needed - also

removed.

* Move common code for "document.order" and "stylesheet.order" templates

into common templates, t.element.info and t.element.altinfo. Make these

new templates also namespace-aware (e.g., if the element is in non-DocBook

namespace, it does not make sense to check for DocBook-specific 'altinfo'

names such as <artheader/>

* New template, t.element.name, to be used in place of references to

@t:element where this name is used to generate mode and attribute set

names (strips namespace from @t:element)

* Use local-name(.) instead of name(.) where d: prefix is output to the

resulting stylesheet (otherwise, if DocBook elements are in non-default

namespace in the template, stylesheet contains XPaths such as "d:d:title")

* Generalize param:node template to support other XPath axes (but still,

only at the beginning of an _expression_) and recognize elements in a

namespace following axis specifier, if any. By default, only param:node

is handled - but new attribute, @t:xpath-fixup, allows to apply this

behavior to other param:* attributes (e.g., HTML templates also contain

param:object which expects to be run through the same fixup).

* Output a message and fail if t:titlepage-content contains any elements in

non-DocBook namespace. This will indicate when customizations would need

to be updated with proper namespace specifications.

 

- templates-namespace.diff (patch for templates in the DocBook XSL outputs):

* epub3, html, xhtml, webhelp: add DocBook namespace with d: prefix, to

separate from output namespace; declare XPath fixup to apply to

param:object

* fo: define default namespace to be DocBook; copy fo: namespace prefix

definition to output; declare XPath fixup to apply to param:title

(previously, this hack was hardcoded in the titlepage.xsl - but this

template is the only one which uses param:title)

* slides/fo: declare namespaces for DocBook, DocBook slides, copy namespaces

for DocBook slides and XSL-FO; specify which (DocBook/DocBook slides)

namespace applies to which element.

* slides/xhtml: declare namespaces for DocBook, DocBook slides, copy

namespace for DocBook slides; specify DocBook namespace on elements.

 

- generated.diff (diff for stylesheets generated with the above changes)

* except for slides/fo and slides/xhtml; the changes are movement of the

namespace declarations from individual elements to the stylesheet. The

addition of the d:docinfo appears even if I regenerate stylesheets from

templates in the unmodified sources. What is this <docinfo/>, by the way?

It is not declared in the DocBook 4.x or 5.x schemas.

 

Regards,

Alexey.





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