Click here to Skip to main content
15,886,106 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hello!

I am working on a xml schema for a custom xml based template system. Similar to XSL, control statements like "foreach" or "if" are supported.

But I got stuck to make the following xml snippet valid:
XML
<html:table
      xmlns="http://www.my-site.com/xsd/template/control/1.0"
      xmlns:html="http://www.w3.org/1999/xhtml">
  <foreach var="row" in="rows">
    <html:tr>[...]</html:tr>
  </foreach>
</html:table>


As defined in the XHTML schema, no other children than "tr" (and some others) are allowed for the table element.
But how can I define the "foreach" element as "transparent" in my custom schema, so that the document will be valid?

I have already discovered a XML schema for XSL[^], but even after copying the relevant parts (the for-each element and its dependencies) it does not work (Visual Studio still complains: The element 'table' in namespace 'http://www.w3.org/1999/xhtml' has invalid child element 'foreach' in namespace 'http://www.my-site.com/xsd/template/control/1.0'. List of possible elements expected: 'caption, col, colgroup, thead, tfoot, tbody, tr' in namespace 'http://www.w3.org/1999/xhtml').

My current schema can be found here.

Thanks in advance and in hope there is a solution,
Henning
Posted
Updated 1-Nov-12 23:24pm
v2
Comments
Henning Dieterichs 2-Nov-12 5:25am    
Does nobody has any hints / ideas? Or do I have to write my custom xml-editor?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900