[Phoenix] Constraints on XML documents to work with Yulup
(elaborated)
Andreas Wuest
awuest at student.ethz.ch
Fri Sep 22 22:49:55 CEST 2006
Hi
Let me give some examples for the constraints mentioned below.
On 22.9.2006 21:46 Uhr, Andreas Wuest wrote:
> Hi
>
> Summing up the previously mentioned problems, an XML source document
> and its associated XSLT have to fulfil the following constraints to
> currently work with Yulup:
>
> XML source: (1) IFF namespace(s) are used in a XML document, then all
> elements MUST be prefixed.
This means that a document
<foo xmlns="foo.org">
<bar/>
</foo>
is ruled out, and instead must look like
<f:foo xmlns:f="foo.org">
<f:bar>
</f:foo>
> (2) IFF namespace(s) are used in a XML document, then all namespace
> declarations MUST occur at the document root element.
This means that a document
<f:foo xmlns:f="foo.org">
<b:bar xmlns:b="bar.org"/>
</f:foo>
is ruled out, and instead must look like
<f:foo xmlns:f="foo.org" xmlns:b="bar.org">
<b:bar>
</f:foo>
> (3) IFF namespace(s) are used in a XML document, then namespace
> prefixes MUST NOT be overridden in a descendant element (but this is
> ruled out by constraint number 2 anyway).
This means that a document
<f:foo xmlns:f="foo.org">
<f:bar xmlns:f="bar.org"/>
</f:foo>
is ruled out, and instead must look like
<f:foo xmlns:f="foo.org" xmlns:b="bar.org">
<b:bar>
</f:foo>
The same goes for documents which override the default namespace like
<foo xmlns="foo.org">
<bar xmlns="bar.org"/>
<foo>
> XSLT: (4) Namespace prefix tuples (i.e. {prefix,namespace}) used in
> the XSLT stylesheet MUST be equal to those used in the XML source.
>
> Note that you can happily use XML documents which don't make use of
> namespaces though.
>
> Note also that we might be able to drop constraint number (1) by
> introducing custom prefixes for all elements.
>
> Note also that we might be able to drop constraint number (2) by
> first gathering all namespace information contained in that document,
> but this would be mutually exclusive with solving constraint number
> (3).
>
> Note also that we might be able to drop constraint number (4) by
> copying all namespace declarations used in the XSLT stylesheet to an
> intermediate copy of the XML source.
>
> And last but not least, note that implementing namespace-unawareness
> resolves all of those 4 constraints (although at the cost of
> introducing new problems).
New problems like the one mentioned earlier by Thomas Comiotto:
> The only problem one can run into with this approach is in situations
> where the xpath expression becomes ambiguous when ignoring ns
> information, i.e. a document that has
>
> foo:table/foo:tr/xhtml:td/text()
>
> xhtml:table/xhtml:tr/foo:td/text()
>
> Never came across this, but it can't be ruled out either of course;)
--
Kind regards,
Andi
More information about the Phoenix
mailing list