namespace question

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

namespace question

Swithun Crowe
Hello

I have a troublesome XForms document. The default namespace is for the
XHTML elements, and inside one of the instances, I have elements which
belong to the TEI namespace:

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:tei="http://www.tei-c.org/ns/1.0" ...
...
<xf:instance id="text_instance">
<tei:TEI xmlns="">
...

I have set the default namespace inside this instance to be empty. But
when I submit the instance, the default namespace is the XHTML one.

A small version of the XForms document is here:

http://swithun.servebeer.com/namespace.xhtml

According to the W3C site
(http://www.w3.org/TR/REC-xml-names/#defaulting),

"The scope of a default namespace declaration extends from the beginning
of the start-tag in which it appears to the end of the corresponding
end-tag, excluding the scope of any inner default namespace declarations.
In the case of an empty tag, the scope is the tag itself."

So, the XHTML namespace shouldn't be the default one, when the instance
gets submitted.

Has anyone noticed this, or found a work around? I'd rather not have to
prefix all the XHTML elements.

Thanks.

Swithun.
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: namespace question

Dan McCreary
On Jul 12, 4:25 pm, Swithun Crowe <[hidden email]>
wrote:

> Hello
>
> I have a troublesome XForms document. The default namespace is for the
> XHTML elements, and inside one of the instances, I have elements which
> belong to the TEI namespace:
>
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:tei="http://www.tei-c.org/ns/1.0" ...
> ...
> <xf:instance id="text_instance">
> <tei:TEI xmlns="">
> ...
>
> I have set the default namespace inside this instance to be empty. But
> when I submit the instance, the default namespace is the XHTML one.
>
> A small version of the XForms document is here:
>
> http://swithun.servebeer.com/namespace.xhtml
>
> According to the W3C site
> (http://www.w3.org/TR/REC-xml-names/#defaulting),
>
> "The scope of a default namespace declaration extends from the beginning
> of the start-tag in which it appears to the end of the corresponding
> end-tag, excluding the scope of any inner default namespace declarations.
> In the case of an empty tag, the scope is the tag itself."
>
> So, the XHTML namespace shouldn't be the default one, when the instance
> gets submitted.
>
> Has anyone noticed this, or found a work around? I'd rather not have to
> prefix all the XHTML elements.
>
> Thanks.
>
> Swithun.
This is right:

<html
xmlns:tei="http://www.tei-c.org/ns/1.0"

I think you might want to try the following:

<xf:instance id="text_instance">
 <tei:TEI xmlns:tei="http://www.tei-c.org/ns/1.0">

This should put all of the elements with the tei prefix in the
http://www.tei-c.org/ns/1.0 namespace.  I believe using the xmlns=""
is the problem.

Good Luck! - Dan

_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: namespace question

Swithun Crowe
Hello

DM I think you might want to try the following:

DM <xf:instance id="text_instance">
DM  <tei:TEI xmlns:tei="http://www.tei-c.org/ns/1.0">

DM This should put all of the elements with the tei prefix in the
DM http://www.tei-c.org/ns/1.0 namespace.  I believe using the xmlns="" is
DM the problem.

Thanks for the ideas. It didn't work, but it got me thinking again.

The solution was to remove the prefix for the elements in the instance.
So, instead of:

<xf:instance ...>
  <teiTEI: xmlns:tei="http..."

I use:

<xf:instance ...>
  <TEI xmlns="http..."

then the default namespace from the XHTML ancestor nodes is gone.

I don't know what the XForms spec says, but the XML spec says that a
descendant node can change the default namespace set by an ancestor. So
this may be a small bug in the XForms processor. Should I file a bug
report?

Swithun.
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: namespace question

Aaron Reed
In reply to this post by Dan McCreary
It sounds like what you wanted to do was correct, but could you get
verification from the XForms WG or verify that it works as you expect in
a different processor like formsPlayer?  Then open the bug and attach a
testcase.

Thanks,
--Aaron

Swithun Crowe wrote:

> Hello
>
> DM I think you might want to try the following:
>
> DM <xf:instance id="text_instance">
> DM  <tei:TEI xmlns:tei="http://www.tei-c.org/ns/1.0">
>
> DM This should put all of the elements with the tei prefix in the
> DM http://www.tei-c.org/ns/1.0 namespace.  I believe using the xmlns="" is
> DM the problem.
>
> Thanks for the ideas. It didn't work, but it got me thinking again.
>
> The solution was to remove the prefix for the elements in the instance.
> So, instead of:
>
> <xf:instance ...>
>   <teiTEI: xmlns:tei="http..."
>
> I use:
>
> <xf:instance ...>
>   <TEI xmlns="http..."
>
> then the default namespace from the XHTML ancestor nodes is gone.
>
> I don't know what the XForms spec says, but the XML spec says that a
> descendant node can change the default namespace set by an ancestor. So
> this may be a small bug in the XForms processor. Should I file a bug
> report?
>
> Swithun.
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

RE: namespace question

Klotz, Leigh
A fully (dis-)functional but minimal example posted here would be great.
Leigh.

-----Original Message-----
From: dev-tech-xforms-bounces+leigh.klotz=[hidden email]
[mailto:dev-tech-xforms-bounces+leigh.klotz=[hidden email]]
On Behalf Of Aaron Reed
Sent: Monday, July 14, 2008 10:26 AM
To: [hidden email]
Subject: Re: namespace question

It sounds like what you wanted to do was correct, but could you get
verification from the XForms WG or verify that it works as you expect in
a different processor like formsPlayer?  Then open the bug and attach a
testcase.

Thanks,
--Aaron

Swithun Crowe wrote:

> Hello
>
> DM I think you might want to try the following:
>
> DM <xf:instance id="text_instance">
> DM  <tei:TEI xmlns:tei="http://www.tei-c.org/ns/1.0">
>
> DM This should put all of the elements with the tei prefix in the DM
> http://www.tei-c.org/ns/1.0 namespace.  I believe using the xmlns=""
> is DM the problem.
>
> Thanks for the ideas. It didn't work, but it got me thinking again.
>
> The solution was to remove the prefix for the elements in the
instance.

> So, instead of:
>
> <xf:instance ...>
>   <teiTEI: xmlns:tei="http..."
>
> I use:
>
> <xf:instance ...>
>   <TEI xmlns="http..."
>
> then the default namespace from the XHTML ancestor nodes is gone.
>
> I don't know what the XForms spec says, but the XML spec says that a
> descendant node can change the default namespace set by an ancestor.
> So this may be a small bug in the XForms processor. Should I file a
> bug report?
>
> Swithun.
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

RE: namespace question

Swithun Crowe
Hello

KL A fully (dis-)functional but minimal example posted here would be great.

AR It sounds like what you wanted to do was correct, but could you get
AR verification from the XForms WG or verify that it works as you expect in
AR a different processor like formsPlayer?  Then open the bug and attach a
AR testcase.

Formsplayer produced the output I would expect from this - just the
namespace used in the instance, rather than all the namespaces used by the
parent document.

I've filed a bug.

Swithun.
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: namespace question

Aaron Reed
In reply to this post by Klotz, Leigh
I've looked at the code in Mozilla and I looked at the bugs that caused
the code into question to be checked in.  It looks like we were confused
as to whether we should serialize a xmlns="" (an empty default namespace
element) or not.  So we chose not to unless
@includenamespaceprefixes="#default" was set.  And whether an empty
default namespace should be inherited from a parent element or not.  So
what happened in your case is that we'll go up the tree and we'll see
the non-empty default namespace and use it since the default namespace
hadn't already been set (since we ignored the empty one).

Leigh, can you please verify whether we should or should not serialize
an empty default namespace and whether we should or should not inherit
an empty default namespace from a parent (xf:instance, xf:model, owner
doc document element(the root)) if the default namespace hasn't be
specified on the instance document document element (instance document
root)?

I just want to make sure I fix this correctly.

Thanks,
--Aaron

Swithun Crowe wrote:

> Hello
>
> KL A fully (dis-)functional but minimal example posted here would be great.
>
> AR It sounds like what you wanted to do was correct, but could you get
> AR verification from the XForms WG or verify that it works as you expect in
> AR a different processor like formsPlayer?  Then open the bug and attach a
> AR testcase.
>
> Formsplayer produced the output I would expect from this - just the
> namespace used in the instance, rather than all the namespaces used by the
> parent document.
>
> I've filed a bug.
>
> Swithun.
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

RE: namespace question

Klotz, Leigh
Aaron,
We discussed the issue today in the WG call and Nick van den Bleeken was
tasked with providing the official answer.  Specific implementation
questions should be a response to that message; then they'll get
tracked.  

However, since you asked me personally, I think if xmlns="" namespace
declaration is in scope, you can omit all xmlns=* declarations and
serialize the document without any xmlns=* declaration. The current bug
appears to be that it omits just that declaration, resulting in
inherited non-"" xmlns= declarations to be serialized, which is wrong.

XForms itself doesn't give you guidance about how to serialize <data
xmlns="" />; i.e., whether to put in xmlns="" or not.  I don't think it
matters, personally.  But when in doubt, the WG usually investigates
what XSLT 1.0 did.  Unfortunately, now there's XSLT 2.0 so we have
choices, yet XForms 1.2 won't be using XPath 2.0, so we're still stuck
in trying to be like XSLT 1.0.  So I suspect XSLT 1.0 would not put
xmlns="" on serialized instances, but I don't know.

Erik Bruchez of Orbeon had misread the initial message sent the
public-forms on this issue and thought it was related to creation of
InfoSet from inline instance markup, so his email responses were geared
towards that question, and are laregely irrelevant in the submission
serialiazation discussion.  Erik agreed quite readily that the Mozilla
behavior is a bug.  

We then went on to discuss the proposal from Erik Bruchez to add an
attribute to instance for the inline instance case to control which
namespace declarations are copied over from the XForms and host document
elements into the new DOM that's being constructed to represent the
inline instance.  It's a subtle difference from serialiation time, but
it allows you referential transparency when blindly copy-pasting an
external instance inline because you can rely on there being on effect
from the in-scope namespace declarations (or at least the listed ones
omitted, or something, we never got that far).  Erik says XProc
specifies it, but Orbeon doesn't implement it.  In fact I read that
there are no full implementations yet so it's iffy to start copying
features from it, so we decided to take no action on Erik's proposal.

Leigh.
 
-----Original Message-----
From: dev-tech-xforms-bounces+leigh.klotz=[hidden email]
[mailto:dev-tech-xforms-bounces+leigh.klotz=[hidden email]]
On Behalf Of Aaron Reed
Sent: Tuesday, July 15, 2008 7:38 PM
To: [hidden email]
Subject: Re: namespace question

I've looked at the code in Mozilla and I looked at the bugs that caused
the code into question to be checked in.  It looks like we were confused
as to whether we should serialize a xmlns="" (an empty default namespace
element) or not.  So we chose not to unless
@includenamespaceprefixes="#default" was set.  And whether an empty
default namespace should be inherited from a parent element or not.  So
what happened in your case is that we'll go up the tree and we'll see
the non-empty default namespace and use it since the default namespace
hadn't already been set (since we ignored the empty one).

Leigh, can you please verify whether we should or should not serialize
an empty default namespace and whether we should or should not inherit
an empty default namespace from a parent (xf:instance, xf:model, owner
doc document element(the root)) if the default namespace hasn't be
specified on the instance document document element (instance document
root)?

I just want to make sure I fix this correctly.

Thanks,
--Aaron

Swithun Crowe wrote:
> Hello
>
> KL A fully (dis-)functional but minimal example posted here would be
great.
>
> AR It sounds like what you wanted to do was correct, but could you get

> AR verification from the XForms WG or verify that it works as you
> expect in AR a different processor like formsPlayer?  Then open the
> bug and attach a AR testcase.
>
> Formsplayer produced the output I would expect from this - just the
> namespace used in the instance, rather than all the namespaces used by

> the parent document.
>
> I've filed a bug.
>
> Swithun.
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: namespace question

Aaron Reed
In reply to this post by Aaron Reed
Hey Leigh,

Ok, once we get the answer, I'll fix the bug.  It should be fairly trivial.

Thanks for helping out,
--Aaron

Klotz, Leigh wrote:

> Aaron,
> We discussed the issue today in the WG call and Nick van den Bleeken was
> tasked with providing the official answer.  Specific implementation
> questions should be a response to that message; then they'll get
> tracked.  
>
> However, since you asked me personally, I think if xmlns="" namespace
> declaration is in scope, you can omit all xmlns=* declarations and
> serialize the document without any xmlns=* declaration. The current bug
> appears to be that it omits just that declaration, resulting in
> inherited non-"" xmlns= declarations to be serialized, which is wrong.
>
> XForms itself doesn't give you guidance about how to serialize <data
> xmlns="" />; i.e., whether to put in xmlns="" or not.  I don't think it
> matters, personally.  But when in doubt, the WG usually investigates
> what XSLT 1.0 did.  Unfortunately, now there's XSLT 2.0 so we have
> choices, yet XForms 1.2 won't be using XPath 2.0, so we're still stuck
> in trying to be like XSLT 1.0.  So I suspect XSLT 1.0 would not put
> xmlns="" on serialized instances, but I don't know.
>
> Erik Bruchez of Orbeon had misread the initial message sent the
> public-forms on this issue and thought it was related to creation of
> InfoSet from inline instance markup, so his email responses were geared
> towards that question, and are laregely irrelevant in the submission
> serialiazation discussion.  Erik agreed quite readily that the Mozilla
> behavior is a bug.  
>
> We then went on to discuss the proposal from Erik Bruchez to add an
> attribute to instance for the inline instance case to control which
> namespace declarations are copied over from the XForms and host document
> elements into the new DOM that's being constructed to represent the
> inline instance.  It's a subtle difference from serialiation time, but
> it allows you referential transparency when blindly copy-pasting an
> external instance inline because you can rely on there being on effect
> from the in-scope namespace declarations (or at least the listed ones
> omitted, or something, we never got that far).  Erik says XProc
> specifies it, but Orbeon doesn't implement it.  In fact I read that
> there are no full implementations yet so it's iffy to start copying
> features from it, so we decided to take no action on Erik's proposal.
>
> Leigh.
>  
> -----Original Message-----
> From: dev-tech-xforms-bounces+leigh.klotz=[hidden email]
> [mailto:dev-tech-xforms-bounces+leigh.klotz=[hidden email]]
> On Behalf Of Aaron Reed
> Sent: Tuesday, July 15, 2008 7:38 PM
> To: [hidden email]
> Subject: Re: namespace question
>
> I've looked at the code in Mozilla and I looked at the bugs that caused
> the code into question to be checked in.  It looks like we were confused
> as to whether we should serialize a xmlns="" (an empty default namespace
> element) or not.  So we chose not to unless
> @includenamespaceprefixes="#default" was set.  And whether an empty
> default namespace should be inherited from a parent element or not.  So
> what happened in your case is that we'll go up the tree and we'll see
> the non-empty default namespace and use it since the default namespace
> hadn't already been set (since we ignored the empty one).
>
> Leigh, can you please verify whether we should or should not serialize
> an empty default namespace and whether we should or should not inherit
> an empty default namespace from a parent (xf:instance, xf:model, owner
> doc document element(the root)) if the default namespace hasn't be
> specified on the instance document document element (instance document
> root)?
>
> I just want to make sure I fix this correctly.
>
> Thanks,
> --Aaron
>
> Swithun Crowe wrote:
>> Hello
>>
>> KL A fully (dis-)functional but minimal example posted here would be
> great.
>> AR It sounds like what you wanted to do was correct, but could you get
>
>> AR verification from the XForms WG or verify that it works as you
>> expect in AR a different processor like formsPlayer?  Then open the
>> bug and attach a AR testcase.
>>
>> Formsplayer produced the output I would expect from this - just the
>> namespace used in the instance, rather than all the namespaces used by
>
>> the parent document.
>>
>> I've filed a bug.
>>
>> Swithun.
> _______________________________________________
> dev-tech-xforms mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-tech-xforms
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms