Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why Are Only the Child Nodes Inserted?

child inserted nodes
0
Posted

Why Are Only the Child Nodes Inserted?

0

When appending a document fragment to a node, only the child nodes of the document fragment (but not the document fragment itself) are inserted. Wouldn’t the parser check the owner document of these child nodes? Answer: A document fragment should not be bound to a root node, since, by definition, a fragment could very well be just a list of nodes. The root node, if any, should be considered a single child. That is, you could for example take all the lines of an Invoice document, and add them into a ProviderOrder document, without taking the invoice itself. How do we create a document fragment without root? As the XSLT processor does, so that we can append it to other documents.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123