ISBN: 1491915103

2nd edition, , O'Reilly Media, Inc.

Chapter 21: Working with Qualified Names, URIs, and IDs

Please note that the book contains many inline examples and informal tables that are not provided here.

Example 21-1. Namespaces in XML (names.xml)
  <pre:prefixed xmlns="http://datypic.com/unpre"
    <unprefixed pre:prefAttr="a" noNSAttr="b">123</unprefixed>
Example 21-2. Using names as result data
  for $prod in doc("catalog.xml")//product
  return (<p>Product # {string($prod/number)}</p>,
            for $child in $prod/(* except number)
            return <li>{local-name($child)}: {string($child)}</li>
  <p>Product # 557</p>
    <li>name: Fleece Pullover</li>
    <li>colorChoices: navy black</li>
  <p>Product # 563</p>
    <li>name: Floppy Sun Hat</li>
  <p>Product # 443</p>
    <li>name: Deluxe Travel Bag</li>
  <p>Product # 784</p>
    <li>name: Cotton Dress Shirt</li>
    <li>colorChoices: white gray</li>
    <li>desc: Our favorite shirt!</li>
Example 21-3. Document using xml:base (http://datypic.com/input/cats.xml)
  <catalog name="ACC" xml:base="http://datypic.com/ACC/">
    <product number="443" href="prod443.html"/>
    <product number="563" href="prod563.html"/>
  <catalog name="WMN" xml:base="http://datypic.com/WMN/">
    <product number="557" href="prod557.html"/>
Datypic XQuery Services