custom-element demo

for-each loop

The <for-each> element iterates over a node-set selected by XPath expression and renders its content for each node.

XHTML namespace use
HTML elements like <table>, <tr>, <td> have strict content model rules - only specific child elements are permitted. For example, <table> only allows <thead>, <tbody>, <tr> as children; <tr> only allows <th> or <td>.
When the browser parses HTML, it moves non-permitted elements (like <for-each>) outside the table before JavaScript runs.
Using xhtml: namespace prefix (e.g., <xhtml:table>, <xhtml:tr>) prevents the browser from recognizing these as standard HTML elements during initial parsing, preserving the template structure for DCE to process correctly. See examples 4 and 6.