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

2013-05-14 Thread Jirka Kosek
On 11.5.2013 7:05, Alexey Neyman wrote:

 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).

Indeed

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

But might be your code might be extended to handle this case as well and
emit warning message?

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

No, they are generated from the single source which currently is
docbook-xsl. During the build process correct namespace declarations and
d: prefixes are added into all XPath expressions and docbook-xsl-ns is
created.

 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.

Currently master one is non-ns version, but there is plan to reverse the
process in a due future.

Conversion is done by xslns-build Perl script in releasetools directory.

Jirka

-- 
--
  Jirka Kosek  e-mail: ji...@kosek.cz  http://xmlguru.cz
--
   Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document processing
--
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 rep.
--
Bringing you XML Prague conferencehttp://xmlprague.cz
--



signature.asc
Description: OpenPGP digital signature


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

2013-05-10 Thread Jirka Kosek
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.

 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.

 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.

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.

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)?

Thanks,

Jirka

-- 
--
  Jirka Kosek  e-mail: ji...@kosek.cz  http://xmlguru.cz
--
   Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document processing
--
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 rep.
--
Bringing you XML Prague conferencehttp://xmlprague.cz
--



signature.asc
Description: OpenPGP digital signature


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

2013-05-10 Thread Alexey Neyman
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