Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Namespaces

XML Namespaces can be used in XUL Templates by binding the namespace URI and prefix to the template element.  For example using the following XML document containing a list of people:

<people xmlns="www.example.com/people">
  <person name="Napoleon Bonaparte" gender="male"/>
  <person name="Cleopatra" gender="female"/>
  <person name="Julius Caesar" gender="male"/>
  <person name="Ferdinand Magellan" gender="male"/>
  <person name="Laura Secord" gender="female"/>
</people>
<listbox datasources="people.xml" ref="*" querytype="xml">
  <template xmlns:ns="www.example.com/people">
    <query expr="ns:person"/>
    <action>
      <listitem uri="?" label="?ns:name"/>
    </action>
  </template>
</listbox>

Once added to the template element the namespaces can then be referenced inside temple rule elements too, this works both in RDF and XML templates.

<listbox datasources="people.xml" ref="*" querytype="xml">
  <template xmlns:ns="www.example.com/people">
    <query expr="ns:person"/>
    <rule ns:gender="male">
      <label uri="?" label="?ns:name"/>
    </action>
  </template>
</listbox>

Document Tags and Contributors

 Contributors to this page: Sheppy, nstansbury
 Last updated by: Sheppy,