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>