xsl-list
[Top] [All Lists]

Re: [xsl] Namespace conflicts processing Word documents

2008-10-06 10:14:53
At 2008-10-06 14:30 +0100, Andrew Welch wrote:
> This makes it appear that namespaces cannot be inherited from an outer XSLT
> file to an included or imported one; in effect that the omission of
> namespace declarations on the included/imported xsl:stylesheet element
> nullifies all outer namespace declarations.
>
> Is this correct, or have I missed something?

No it's correct - namespaces operate at the XML level, not the XSLT
level.

But the XSLT level relies on the XML-level namespaces in context.

I often get confused about that, and think that somehow import
precedence would allow you to do what you are trying to do, so you're
no alone.

Since XSLT files are XML files, and each imported or included XSLT stylesheet has to be a properly formed XSLT stylesheet, I think the current specification is most appropriate.

To be honest, I'm not too sure things are correct as they stand now.
A prefix used in an XPath doesn't stop the XML from being namespace
well-formed, so I don't see why that namespace needs to be declared in
that particular file. It seems an artificial restriction.

Not to me. Importation and inclusion doesn't happen at a syntax level, it happens at a semantic level. Therefore, building the semantic components of an XSLT stylesheet has to happen solely from the XML syntax being used to express the components, not to any contextual use of the syntax by other copmonents.

To fix your problem, you could just define two different prefixes, say
"w" and "w2" for example (not for real)  and then modify all of your
stylesheets to handle both... not great I know.  Or if possible just
match on *.  Or alternatively do a 2 pass transform and convert the
input to use the other namespace, then process as normal.

I'm not sure about the conversion ... if you transform an OOXML <p> into a WordML <p> then when it comes time to act on <p> you don't know which it really means.

I hope this helps.

. . . . . . . . . . . Ken

--
Upcoming XSLT/XSL-FO hands-on courses:      Wellington, NZ 2009-01
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video sample lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg
Video course overview:  http://www.youtube.com/watch?v=VTiodiij6gE
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--