Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subtle question about QName-magic #786

Closed
xml-project opened this Issue Mar 10, 2019 · 10 comments

Comments

Projects
None yet
4 participants
@xml-project
Copy link
Contributor

xml-project commented Mar 10, 2019

Suppose the following pipeline fragment:

<p:declare-step version="3.0"
  xmlns:p="http://www.w3.org/ns/xproc"
  xmlns="http://default-namespace">
<!... >
  <p:add-attribute attribute-name="att" ...

Since attribute-name is declared as xs:QName the QName-magic will take place here. But what QName is produced?

  1. A QName with the local name att in no namespace
  2. A QName with the local name att and the namespace-url http://default-namespace

In the current version of the specs I am not able to find an answer to this question. What did I miss?

@gimsieke

This comment has been minimized.

Copy link
Contributor

gimsieke commented Mar 10, 2019

I’m leaning towards 1, but I have a hard time applying the XML namespace spec to this issue.

https://www.w3.org/TR/REC-xml-names/#defaulting

The first part of this sentence seems to be clear: “Default namespace declarations do not apply directly to attribute names”

The second part, however, muddies the water again: “the interpretation of unprefixed attributes is determined by the element on which they appear”. What does this mean?

If 2. were true then the processor would need to invent a prefix for the default namespace if there is no prefix associated with this namespace. How can you then create attributes in no namespace when a default namespace is in force? However, creating an attribute in no namespace is what you do when a default namespace is in place and you create <xsl:attribute name="foo" select="'bar'"/>. So an XSLT processor, for one, seems to heed the first part of the sentence.

So if someone would corroborate that only the first part of the sentence in the namespace spec applies here (or as a bonus, helps me understand what the second part is supposed to say), then 1. is the answer.

@xml-project

This comment has been minimized.

Copy link
Contributor Author

xml-project commented Mar 10, 2019

@gimsieke So you agree it's not properly spelled out in the current specs and we need to do some clarification here?

@gimsieke

This comment has been minimized.

Copy link
Contributor

gimsieke commented Mar 10, 2019

I think it is properly specified (one indication is that everyone seems to follow this interpretation) but I’m not sure what to make of the 2nd half of the namespace spec sentence.

@xml-project

This comment has been minimized.

Copy link
Contributor Author

xml-project commented Mar 10, 2019

IMHO the second sentence is the important one. I choose p:add-attribute as an example, but there are other options where the QName-magic needs to be applied (and they are not related to attributes on xml documents), e.g.

  • method on p:compare
  • code on p:error
  • algorithm on p:hash
  • attribute on p:label-element
  • wrapper on p:pack
  • new-name on p:rename
  • wrapper on p:wrap and p:wrap-sequence

Where do we say something about this?

@eriksiegel

This comment has been minimized.

Copy link
Contributor

eriksiegel commented Mar 10, 2019

Maybe we can specify that our QName magic applies only to prefixed names and that a default namespace is not taken into account?

@xml-project

This comment has been minimized.

Copy link
Contributor Author

xml-project commented Mar 10, 2019

After doing some research, I think that we need to say more about QName-magic in this special case. We explain QName-magic with reference to the EQName production rules in XPath 3.1. And there it says:

local-name only (for example, invoice).
A name written in this form has no prefix, and the rules for determining the namespace depend on the context in which the name appears.

Since the context is XProc, we have to say whether the default namespace is taken into account here or not. Given this, I do not think that "https://www.w3.org/TR/REC-xml-names/#defaulting" (quoted by @gimsieke) is automatically relevant. It might be relevant, if we say it is.

@ndw

This comment has been minimized.

Copy link
Contributor

ndw commented Mar 12, 2019

Like XSLT, a name without a colon is never in a namespace.

@xml-project

This comment has been minimized.

Copy link
Contributor Author

xml-project commented Mar 13, 2019

Where do we say this?

@ndw

This comment has been minimized.

Copy link
Contributor

ndw commented Mar 13, 2019

The phrase If it does not contain a prefix then it is in no namespace occurs all over the place. If it's missing somewhere, I think we should add it.

@xml-project xml-project self-assigned this Mar 13, 2019

@xml-project

This comment has been minimized.

Copy link
Contributor Author

xml-project commented Mar 13, 2019

Will add it to the section on QName-magic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.