xmlgraphics-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vincent Hennebert <vhenneb...@gmail.com>
Subject Attributes in the XSL-FO Namespace
Date Fri, 01 Oct 2010 16:48:57 GMT
Hi,

Posting here as this may be of interest to Batik devs, since the same
issue equally applies to SVG.

A colleague of mine recently stumbled upon an interesting issue: he was
mixing elements in the XSL-FO namespace with custom extension elements
in another namespace, that were re-using some of the existing XSL-FO
properties. Something like this:
  <fo:block font-family="Times">
    Lorem ipsum dolor <ext:my-extension-element fo:background-color="blue">...
  </fo:block>

He was using XSLT attribute-sets that could be applied to FO elements as
well as extension elements, and found things like the following among
the result:
  <fo:block fo:font-family="Helvetica">
    Blah...
  </fo:block>

Which makes me wonder: is there anything wrong with that? According to
the XML Namespaces Recommendation [1]: “The namespace name for an
unprefixed attribute name always has no value”. So in case 1 above, the
“font-family” attribute has no namespace. But if I want to re-use it on
some extension element, I obviously have to specify that it comes from
XSL-FO, so will prefix it with ‘fo’. In which case it will be in the
XSL-FO namespace.

But then why wouldn’t I be able to prefix it when I specify it on an FO
element, like in case 2 above?

It seems to me that it would have been more logical to state, in the XML
Namespaces recommendation, that the namespace name for an unprefixed
attribute name is the same as the element on which it is defined. But we
obviously cannot change the recommendation. So the solution probably is
for FOP to treat attributes in the XSL-FO namespace the same way as
non-prefixed attributes. This is simple to do and can be found in the
attached patch.

My questions are:
• does anyone have an idea of why the XML Namespaces recommendation was
  written this way?
• what do you think of the attached patch?
• any general thoughts on this?

[1] http://www.w3.org/TR/xml-names/#defaulting

Thanks,
Vincent

Mime
View raw message