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

Nodes in p:inline with non-xml content-type #667

Closed
xml-project opened this issue Dec 8, 2018 · 8 comments
Closed

Nodes in p:inline with non-xml content-type #667

xml-project opened this issue Dec 8, 2018 · 8 comments
Assignees

Comments

@xml-project
Copy link
Member

In connection with pr #666 (sorry for the number), the question of how to treat nodes in p:inline with non-xml content-type came up. Suppose the following fragment:

<p:with-input>
  <p:inline content-type="text/plain">
    <node>text</node>
  </p:inline>
<p:with-input>

Which of the following happens and where do we say this?

  1. The children of p:inline are serialised, so the result is a text node with "text".
  2. We take the text value of the children of p:inline, so the result is a text node with "text".
  3. It is an error, because when the content-type is non-XML the children of p:inline are required to be text nodes only.

Of course the above fragment is somewhat strange, but it might happen! And it might even happen indirectly with a text value template {$var} where $var contains an element node.

Personally I have a slight preference for option (2), but I am not sure you all would agree on this.

@xml-project xml-project self-assigned this Dec 8, 2018
@xatapult
Copy link
Contributor

xatapult commented Dec 9, 2018

I'm not sure I understand the difference between 1 and 2... Would you care to elaborate?

@xml-project
Copy link
Member Author

Yes, that is confusing because Git somehow ate the markup. Sorry.
The idea in (1) is to serialize the nodes, so a text node with "&lt;node&gt;text&lt;/node\gt;" is produced.

@gimsieke
Copy link
Contributor

gimsieke commented Dec 9, 2018

I think it should be interpreted like the @content-type/@override-content-type attributes on p:load, p:document, or p:http-request. And I think if they read such a document from disk, they would return the serialized document as a text node. In your example above, this will be the content that is between the quotes:

"
    <node>text</node>
  "

This will be variant (1), with escaped XML characters unescaped, I’d say.
I don’t know though whether there is a use case for reading p:inline content as serialized XML. There is certainly one for p:load etc.
So I’d say this is the most consistent way to specify it. But as we have experienced, other people may have other perspectives on consistency.

@xml-project
Copy link
Member Author

@gimsieke

  1. I do not argue there is a use case for this. I just say it is something, we have to deal with.
  2. Not sure what I missed, but I think we have to escape the content between the quotes, if we want it to be the value of a text node.

@gimsieke
Copy link
Contributor

gimsieke commented Dec 9, 2018

  1. Yes, this is how I understood your question.
  2. Isn’t it that only when the text node is serialized, characters such as < need to be escaped?

@ndw
Copy link
Contributor

ndw commented Dec 9, 2018

We already say this is an error:

It is a dynamic error (err:XD0063) if the p:inline contains any XML markup and has a content type that is not an XML media type.

@gimsieke
Copy link
Contributor

gimsieke commented Dec 9, 2018

Ah Ok, then we can leave it at that. As I said, reading it as a text node would be more in line with p:load, but I don’t think there is much need for it.

@xml-project
Copy link
Member Author

@ndw Thanks Norm. Overlooked this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants