At 2004-11-01 15:24 +0000, George James wrote:
Going off slightly at a tangent, could I use the same trick to avoid having
to type xsl: throughout my stylesheets?
It would seem to work if my output is plain text but not if the output is an
xml document.
You can choose to use the default namespace for XSLT and an explicit
namespace for your result XML ... that is an XML choice in writing your
stylesheet, not a constraint.
But because of a lot of necessary default namespace declarations, it would
be unwieldy to try and have both XSLT and your literal result elements take
turns using the default namespace.
I've never seen any examples where the xsl: namespace prefix is not used,
would it be considered bad form anyway?
I do tell my students that while it isn't bad form, it can be awkward: when
you want to use one of the reserved XSLT attributes in a literal result
element, you are obliged to use a namespace prefix. If you already have
the "xsl" prefix declared, there is no extra work to do, but if you are
using the default namespace for XSLT then you have to declare the use of a
prefix for the literal result element to take advantage of the XSLT attribute.
So, I advise my students to use a prefix, typically "xsl:" for the XSLT
instructions.
Note that I am a big fan (not sure there are any others!) of using the
default namespace for the result tree when constructing using the XSL-FO
vocabulary ... and I teach XSL-FO this way (without a namespace
prefix). Same rules: it is an XML decision to use the default namespace,
not a stylesheet constraint. Note, however, there are XSL-FO formatting
engines and XML editing tools that are hardwired to the "fo:" prefix and
are not doing appropriate namespace detection, and this will trip me up
periodically, but for the most part I find working with the stylesheets
easier when there is no prefix on the literal result elements.
So, in parallel, you may find there are editing tools or SVG processors out
there that are not true XML applications in that they are not
namespace-aware and they improperly trigger on the namespace prefix rather
than the in-play namespace URI. They may be expecting "svg:" when the
default namespace is entirely appropriate due to XML rules.
I hope this helps.
....................... Ken
--
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal