[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: [relax-ng-comment] A lightweight include mechanism
I am trying to code the Mozilla XUL syntax into a Relax NG schema. One problem is the use of the <template> mechanism in XUL http://www.mozilla.org/docs/xul/xulnotes/template-primer.html . A <template> can be used almost anywhere in XUL to control generation of the interface from an RDF datasource. Given a valid <widget> definition, the <template> pattern can be interposed into that definition. This is similar to the xhtml <table> example in the Relax NG tutorial - but much more general. The problem, if I understand it correctly, is that the nested grammar idiom uses the <include> mechanism with attendant copying of the included definitions. This is completely impractical for the XUL <template> - the multiplication factor would be huge. What I am suggesting is a parameterized <ref> mechanism which would allow definitions to sandwich themselves into other definitions without the need for copying - a sort of pattern subroutine. 1. Define a parameterized pattern (possibly included - but only once). <define name="foo"> <parameter name="p1"/> <!-- not strictly necessary, the use of parameterName on a ref element is sufficient--> .... <ref parameterName="p1"/> .... </define> 2. use the pattern, supplying bar as the instance of p1 to use in this case: <define name="bar"> ... <ref name="foo"> <parameter name="p1">bar</parameter> </ref> .... </define> 3. the supplied parameter pattern: <define name="bar"> ... </define>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC