7 september 2005nvo summer school 2005 - aspen1 advanced but ever-so-useful xml technologies:...
TRANSCRIPT
7 September 2005NVO Summer School 2005 - Aspen 1
Advanced but ever-so-useful
XML Technologies:Schema, XPath, XQuery, XSL
an incomplete introduction
Ray Plante
THE US NATIONAL VIRTUAL OBSERVATORY
7 September 2005NVO Summer School 2005 - Aspen 2
XML Schema• What it is:
– A W3C* standard for defining and verifying an XML grammar• An XML Schema document describes…
– a set of legal XML tags and attributes,– what order they go in, and – what values are allowed.
• An XML Schema-aware XML parser can tell you if an XML document follows the rules of the grammar
*World Wide Web Consortium
• Why you might care:– VO uses XML to encode metadata and service messages– XML Schema is used to define metadata encoding and message
syntax– Ability to read XML Schema will help you understand what metadata
is needed by an app and how to encode it• VO end users and many developers will never need to know about Schema• Can be helpful for debugging XML documents and messages
• What you’ll get from this session:– Rudimentary skills for reading an XML Schema document to discern
the specified XML syntax– Understand the role of namespaces in supporting multiple schemas– A tool for validating an instance document
7 September 2005NVO Summer School 2005 - Aspen 3
Schema uses XML to describe syntax
http://www.w3.org/TR/xmlschema-0/
• Contains a list of definitions– Elements and types – Attributes, groups, attribute-groups
• Types– Simple types: string, integer, dateTime, etc.
<title>The Astronomy Digital Image Library</title>
<maxRecords>10000</maxRecords>
<date role=”completed”>2002-09-30T07:45:00</date>
– Complex types: contain other elements– Defining types
• Anonymous type – directly inside the definition of an element• Global type – “top-level” definition, can be reused
7 September 2005NVO Summer School 2005 - Aspen 4
Namespaces• Namespace: a schema’s unique identifier
– Set with the targetNamespace attribute– Used by an XML document to indicate which schema it is
compliant with– URI format (URL or URN)
• Using a schema– Instance document: XML document that follows the
grammar defined by the schema– xmlns attribute used to identify the default namespace that
elements belong to– Tagging elements with namespace prefixes
• Prefix defined (anywhere) with xmlns:prefixxmlns:res="http://nvoss.org/Resource"
• Prefixes attached to element/attribute name denotes it belongs to the associated schema
<res:title>…</res:title>
– Unqualified elements: a special technique for namespaces• Tag the root element (or xsi:type) only• Do not use xmlns • Can make using multiple schemas easier
7 September 2005NVO Summer School 2005 - Aspen 5
Validating an instance document
• A validating parser can test whether an instance document is compliant with its schema
• xsi:schemaLocation attribute tells parser where to find Schema document(s)– Look-up list made up of namespace-location pairs
xsi:schemaLocation=”namespace file-or-URL …”
• xsi:schemaLocation is just a recommendation– Parser may have local copies cached for more
efficient parsing
validate: a tool for validating XML documents against schemas
7 September 2005NVO Summer School 2005 - Aspen 6
Simple schema<?xml version="1.0" encoding="UTF-8"?><xs:schema targetNamespace="http://nvoss.org/VOResource" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="resource"> <xs:complexType> <xs:sequence>
<xs:element name="title" type="xs:string" />
<xs:element name="referenceURL" type="xs:anyURI" minOccurs="0"/>
<xs:element name="type" minOccurs="0" maxOccurs="unbounded"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="Archive" /> <xs:enumeration value="Catalog" /> <xs:enumeration value="Organisation" /> </xs:restriction> </xs:simpleType> </xs:element>
</xs:sequence> <xs:attribute name="created" type="xs:dateTime" /> </xs:complexType> </xs:element></xs:schema>
xmltech-simple.xsd
7 September 2005NVO Summer School 2005 - Aspen 7
<?xml version="1.0" encoding="UTF-8"?><xs:schema targetNamespace="http://nvoss.org/VOResource" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="resource"> <xs:complexType> <xs:sequence>
<xs:element name="title" type="xs:string" />
<xs:element name="referenceURL" type="xs:anyURI" minOccurs="0"/>
<xs:element name="type" minOccurs="0" maxOccurs="unbounded"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="Archive" /> <xs:enumeration value="Catalog" /> <xs:enumeration value="Organisation" /> </xs:restriction> </xs:simpleType> </xs:element>
</xs:sequence> <xs:attribute name="created" type="xs:dateTime" /> </xs:complexType> </xs:element></xs:schema>
Simple schema
targetNamespace
xmltech-simple.xsd
7 September 2005NVO Summer School 2005 - Aspen 8
Simple schema
global = Direct child of xs:schema
Only global elements can serve as a document’s root element
globally-defined element
<?xml version="1.0" encoding="UTF-8"?><xs:schema targetNamespace="http://nvoss.org/VOResource" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="resource"> <xs:complexType> <xs:sequence>
<xs:element name="title" type="xs:string" />
<xs:element name="referenceURL" type="xs:anyURI" minOccurs="0"/>
<xs:element name="type" minOccurs="0" maxOccurs="unbounded"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="Archive" /> <xs:enumeration value="Catalog" /> <xs:enumeration value="Organisation" /> </xs:restriction> </xs:simpleType> </xs:element>
</xs:sequence> <xs:attribute name="created" type="xs:dateTime" /> </xs:complexType> </xs:element></xs:schema>
xmltech-simple.xsd
7 September 2005NVO Summer School 2005 - Aspen 9
Simple schema
Anonymous type definition
<?xml version="1.0" encoding="UTF-8"?><xs:schema targetNamespace="http://nvoss.org/VOResource" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="resource"> <xs:complexType> <xs:sequence>
<xs:element name="title" type="xs:string" />
<xs:element name="referenceURL" type="xs:anyURI" minOccurs="0"/>
<xs:element name="type" minOccurs="0" maxOccurs="unbounded"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="Archive" /> <xs:enumeration value="Catalog" /> <xs:enumeration value="Organisation" /> </xs:restriction> </xs:simpleType> </xs:element>
</xs:sequence> <xs:attribute name="created" type="xs:dateTime" /> </xs:complexType> </xs:element></xs:schema>
xmltech-simple.xsd
7 September 2005NVO Summer School 2005 - Aspen 10
Simple schema
sequence: a list of elements that must appear in order
choice: one from a list of elements may appear
Other models: group, all, any
Content model
<?xml version="1.0" encoding="UTF-8"?><xs:schema targetNamespace="http://nvoss.org/VOResource" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="resource"> <xs:complexType> <xs:sequence>
<xs:element name="title" type="xs:string" />
<xs:element name="referenceURL" type="xs:anyURI" minOccurs="0"/>
<xs:element name="type" minOccurs="0" maxOccurs="unbounded"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="Archive" /> <xs:enumeration value="Catalog" /> <xs:enumeration value="Organisation" /> </xs:restriction> </xs:simpleType> </xs:element>
</xs:sequence> <xs:attribute name="created" type="xs:dateTime" /> </xs:complexType> </xs:element></xs:schema>
xmltech-simple.xsd
7 September 2005NVO Summer School 2005 - Aspen 11
Simple schema
title: any string
referenceURL: URI format
type: restricted to a specified list of strings
Locally-defined elements
<?xml version="1.0" encoding="UTF-8"?><xs:schema targetNamespace="http://nvoss.org/VOResource" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="resource"> <xs:complexType> <xs:sequence>
<xs:element name="title" type="xs:string" />
<xs:element name="referenceURL" type="xs:anyURI" minOccurs="0"/>
<xs:element name="type" minOccurs="0" maxOccurs="unbounded"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="Archive" /> <xs:enumeration value="Catalog" /> <xs:enumeration value="Organisation" /> </xs:restriction> </xs:simpleType> </xs:element>
</xs:sequence> <xs:attribute name="created" type="xs:dateTime" /> </xs:complexType> </xs:element></xs:schema>
xmltech-simple.xsd
7 September 2005NVO Summer School 2005 - Aspen 12
Simple schema
Default: minOccurs=”1” maxOccurs=”1”
minOccurs=”0”: optional
minOccurs=”1”: required
Occurance restrictions
<?xml version="1.0" encoding="UTF-8"?><xs:schema targetNamespace="http://nvoss.org/VOResource" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="resource"> <xs:complexType> <xs:sequence>
<xs:element name="title" type="xs:string" />
<xs:element name="referenceURL" type="xs:anyURI" minOccurs="0"/>
<xs:element name="type" minOccurs="0" maxOccurs="unbounded"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="Archive" /> <xs:enumeration value="Catalog" /> <xs:enumeration value="Organisation" /> </xs:restriction> </xs:simpleType> </xs:element>
</xs:sequence> <xs:attribute name="created" type="xs:dateTime" /> </xs:complexType> </xs:element></xs:schema>
xmltech-simple.xsd
7 September 2005NVO Summer School 2005 - Aspen 13
The compliant instance document
<?xml version="1.0" encoding="UTF-8"?><resource xmlns="http://nvoss.org/VOResource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nvoss.org/VOResource xmltech-simple.xsd" >
<title>NCSA Astronomy Digital Image Library</title>
<referenceURL>http://adil.ncsa.uiuc.edu/</referenceURL>
<type>Archive</type>
</resource>
xmltech-simple.xml
7 September 2005NVO Summer School 2005 - Aspen 14
The compliant instance document
Default namespace
xmltech-simple.xml
<?xml version="1.0" encoding="UTF-8"?><resource xmlns="http://nvoss.org/VOResource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nvoss.org/VOResource xmltech-simple.xsd" >
<title>NCSA Astronomy Digital Image Library</title>
<referenceURL>http://adil.ncsa.uiuc.edu/</referenceURL>
<type>Archive</type>
</resource>
7 September 2005NVO Summer School 2005 - Aspen 15
The compliant instance document
xsi namespacePrefix defined
Default namespace
xmltech-simple.xml
<?xml version="1.0" encoding="UTF-8"?><resource xmlns="http://nvoss.org/VOResource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nvoss.org/VOResource xmltech-simple.xsd" >
<title>NCSA Astronomy Digital Image Library</title>
<referenceURL>http://adil.ncsa.uiuc.edu/</referenceURL>
<type>Archive</type>
</resource>
7 September 2005NVO Summer School 2005 - Aspen 16
The compliant instance document
xsi namespacePrefix defined
Default namespace
xsi:schemaLocation
xsi:schemaLocation says, “Load schema called
http://nvoss.org/VOResource
from local file, xmltech-simple.xsd
xmltech-simple.xml
<?xml version="1.0" encoding="UTF-8"?><resource xmlns="http://nvoss.org/VOResource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nvoss.org/VOResource xmltech-simple.xsd" >
<title>NCSA Astronomy Digital Image Library</title>
<referenceURL>http://adil.ncsa.uiuc.edu/</referenceURL>
<type>Archive</type>
</resource>
7 September 2005NVO Summer School 2005 - Aspen 17
The compliant instance document
xsi namespacePrefix defined
Default namespace
xsi:schemaLocation
xsi:schemaLocation says, “Load schema called
http://nvoss.org/VOResource
from local file, xmltech-simple.xsd
xmltech-simple.xml
<?xml version="1.0" encoding="UTF-8"?><resource xmlns="http://nvoss.org/VOResource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nvoss.org/VOResource xmltech-simple.xsd" >
<title>NCSA Astronomy Digital Image Library</title>
<referenceURL>http://adil.ncsa.uiuc.edu/</referenceURL>
<type>Archive</type>
</resource>
7 September 2005NVO Summer School 2005 - Aspen 18
Global (Reusable) Types<?xml version="1.0" encoding="UTF-8"?><xs:schema targetNamespace="http://nvoss.org/VOResource" xmlns:res="http://nvoss.org/VOResource" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:simpleType name="Type"> <xs:restriction base="xs:string"> <xs:enumeration value="Archive" /> <xs:enumeration value="Catalog" /> <xs:enumeration value="Organisation" /> </xs:restriction> </xs:simpleType>
<xs:complexType name="Resource"> <xs:sequence> <xs:element name="title" type="xs:string" /> <xs:element name="referenceURL" type="xs:anyURI" minOccurs="0"/> <xs:element name="type" type="res:Type" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="created" type="xs:dateTime" /> </xs:complexType>
<xs:element name="resource" type="res:Resource" />
</xs:schema>
Define a prefix forthe targetNamespace
xmltech-globaltypes.xml
7 September 2005NVO Summer School 2005 - Aspen 19
Global (Reusable) Types
Type defined here…
<?xml version="1.0" encoding="UTF-8"?><xs:schema targetNamespace="http://nvoss.org/VOResource" xmlns:res="http://nvoss.org/VOResource" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:simpleType name="Type"> <xs:restriction base="xs:string"> <xs:enumeration value="Archive" /> <xs:enumeration value="Catalog" /> <xs:enumeration value="Organisation" /> </xs:restriction> </xs:simpleType>
<xs:complexType name="Resource"> <xs:sequence> <xs:element name="title" type="xs:string" /> <xs:element name="referenceURL" type="xs:anyURI" minOccurs="0"/> <xs:element name="type" type="res:Type" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="created" type="xs:dateTime" /> </xs:complexType>
<xs:element name="resource" type="res:Resource" />
</xs:schema>
Define a prefix forthe targetNamespace
xmltech-globaltypes.xml
7 September 2005NVO Summer School 2005 - Aspen 20
Global (Reusable) Types
…and used here
Type defined here…
<?xml version="1.0" encoding="UTF-8"?><xs:schema targetNamespace="http://nvoss.org/VOResource" xmlns:res="http://nvoss.org/VOResource" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:simpleType name="Type"> <xs:restriction base="xs:string"> <xs:enumeration value="Archive" /> <xs:enumeration value="Catalog" /> <xs:enumeration value="Organisation" /> </xs:restriction> </xs:simpleType>
<xs:complexType name="Resource"> <xs:sequence> <xs:element name="title" type="xs:string" /> <xs:element name="referenceURL" type="xs:anyURI" minOccurs="0"/> <xs:element name="type" type="res:Type" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="created" type="xs:dateTime" /> </xs:complexType>
<xs:element name="resource" type="res:Resource" />
</xs:schema>
Define a prefix forthe targetNamespace
xmltech-globaltypes.xml
7 September 2005NVO Summer School 2005 - Aspen 21
Global (Reusable) Elements<?xml version="1.0" encoding="UTF-8"?><xs:schema targetNamespace="http://nvoss.org/VOResource" xmlns:res="http://nvoss.org/VOResource" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:simpleType name="Type"> <xs:restriction base="xs:string"> <xs:enumeration value="Archive" /> <xs:enumeration value="Catalog" /> <xs:enumeration value="Organisation" /> </xs:restriction> </xs:simpleType>
<xs:element name="type" type="res:Type"/>
<xs:complexType name="Resource"> <xs:sequence> <xs:element name="title" type="xs:string" /> <xs:element name="referenceURL" type="xs:anyURI" minOccurs="0"/> <xs:element ref="res:type" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="created" type="xs:dateTime" /> </xs:complexType>
<xs:element name="resource" type="res:Resource" />
</xs:schema>
Element defined here…
…and used here
xmltech-elrefs.xml
7 September 2005NVO Summer School 2005 - Aspen 22
<xs:complexType name="Resource"> <xs:annotation> <xs:documentation> Any entity or component of a VO application that is describable and identifiable by a IVOA Identifier. </xs:documentation> </xs:annotation>
<xs:sequence> <xs:element name="title" type="xs:string" > <xs:annotation> <xs:documentation> the full name given to the resource </xs:documentation> </xs:annotation> </xs:element>
<xs:element name="referenceURL" type="xs:anyURI" minOccurs="0"> <xs:annotation> <xs:documentation> URL pointing to a human-readable document describing this resource. </xs:documentation> </xs:annotation> </xs:element> …
Schema Documentationxmltech-documented.xml
• Most schema components can have documentation attached
• Documentation is important for defining metadata schemas
• Carnivore registry extracts documentation directly from schema for display to users
7 September 2005NVO Summer School 2005 - Aspen 23
<xs:complexType name="Service"> <xs:complexContent> <xs:extension base="res:Resource"> <xs:sequence> <xs:element name="accessURL" type="xs:anyURI" /> </xs:sequence> </xs:extension> </xs:complexContent></xs:complexType>
<xs:element name="service" type="res:Service">
Derived Types
• Two ways to derive a new type from an existing one– Extension
• Applicable only to complex types• Adds additional elements or attributes to the content model
<service xmlns="http://nvoss.org/VOResource" created="1994-11-01T12:00:00" > <title>ADIL Query Page</title> <referenceURL>http://adil.ncsa.uiuc.edu/help.html</referenceURL> <type>Archive</type> <accessURL>http://adil.ncsa.uiuc.edu/QueryPage.html</accessURL> </service>
7 September 2005NVO Summer School 2005 - Aspen 24
Derived Types
• Two ways to derive a new type from an existing one– Restriction
• Simple types: restrict the legal values in some wayEx: integer: restrict range string: restrict to match a pattern
• Complex types: – Disallow optional elements, attributes– Restricting occurances– Setting default or fixed values where none were previously set
7 September 2005NVO Summer School 2005 - Aspen 25
Extending Schemas I:plugging-in derived entities
• Suppose you want to define an element in terms of a base type but allow any type derived from it to be inserted in its place– a form of polymorphism
• Two techniques– xsi:type
• a label in the instance document)
– Substitution groups • a label in the schema document
7 September 2005NVO Summer School 2005 - Aspen 26
Extending Schemas I:plugging-in derived entities
• xsi:type techniqueFrom our example…– The resource element has the type Resource– The Service type is derived from the Resource type– Declaring a service element is not necessary
In the instance document…
<resourceList xmlns="http://nvoss.org/VOReso
<resource created="1994-11-01T12:00:00" > <title>NCSA Astronomy Digital Image Li <referenceURL>http://adil.ncsa.uiuc.ed <type>Archive</type> </resource>
<resource xsi:type="Service" created="1994-11-01T12:00:00" > <title>ADIL Query Page</title> <referenceURL>http://adil.ncsa.uiuc.ed <type>Archive</type> <accessURL>http://adil.ncsa.uiuc.edu/Q </resource>
</resourceList>
IVOA VOResource schema uses this technique
In the schema document…
<xs:element name="resourceList"> <xs:complexContent> <xs:sequence> <xs:element name="resource" type="res:Resource" maxOccurs="unbounded" /> </xs:sequence> </xs:complexContent></xs:element>
7 September 2005NVO Summer School 2005 - Aspen 27
Extending Schemas I:plugging-in derived entities
• Substitution group techniqueFrom our example…– The Service type is derived from the Resource type– Add substitutionGroup attribute to service element definition
• means we can substitute service element anywhere a resource is allowed
In the schema document…
<xs:element name="resource" type="res:Resource">
<xs:element name="service" type="res:Service" substitutionGroup="res:resource">
<xs:element name="resourceList"> <xs:complexContent> <xs:sequence> <xs:element ref="res:resource" maxOccurs="unbounded" /> </xs:sequence> </xs:complexContent></xs:element>
In the instance document…
<resourceList xmlns="http://nvoss.org/VOReso <resource created="1994-11-01T12:00:00" > <title>NCSA Astronomy Digital Image Li <referenceURL>http://adil.ncsa.uiuc.ed <type>Archive</type> </resource>
<service created="1994-11-01T12:00:00" > <title>ADIL Query Page</title> <referenceURL>http://adil.ncsa.uiuc.ed <type>Archive</type> <accessURL>http://adil.ncsa.uiuc.edu/Q </service></resourceList>
IVOA Space-Time Coordinates schema uses this technique
7 September 2005NVO Summer School 2005 - Aspen 28
• separate schema file, separate namespace– Enables schema evolution in a backward compatible
way.
– Extension file uses xs:import to load schema being extended
– Instance documents generally must define prefixes for both the original schema namespace and the extension namespace.
• Example: VOResource metadata schemas– Core metadata schema: VOResource
– Extension schemas: VODataService, VORegistry, ConeSearch, SimpleImageAccess
Extending Schemas II:placing extensions into a separate namespace
7 September 2005NVO Summer School 2005 - Aspen 29
A word about namespaces in instance documents…(FYI)
• An instance document must indicate what namespace(s) the elements belong to– So that the document can be validated– 3 ways to indicate this
• controlled by elementFormDefault attribute in Schema file
<?xml version="1.0" encoding="UTF-8"?><xs:schema targetNamespace="http://nvoss.org/VOResource" xmlns:res="http://nvoss.org/VOResource" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
1. Default namespacexmlns tags a whole section
Advantages:• Great for simple ns useDisadvantages:• Can be confusing for authors
when drawing on multiple schema
2. Namespace prefixesInvidually tag elements
Advantages:• Visually explicit about ns
membership• Can mix in elements from
different ns with the same name.
Disadvantages:• Error-prone, ugly when
drawing multiple schema
3. Unqualified: tag (global) root element
Advantages:• Single prefix tag needed at the
top of the document; no other tags needed
• Good for when using multiple schemas together
• Least error prone• Makes XPaths simplerDisadvantage:• Can’t have 2 elements from
different ns w/same name
elementFormDefault="qualified" elementFormDefault="unqualified"
<resource xmlns="http://nvoss.org/VOResource"> <title>…</title> <referenceURL>…</referenceURL> <type>Archive</type></resource>
<vr:resource xmlns:vr="http://nvoss.org/VOResource" xmlns:cv="http://nvoss.org/Coverage"> <vr:title>…</vr:title> <cv:coverage>…<cv:coverage></vr:resource>
<vr:resource xmlns:vr="http://nvoss.org/VOResource"> <title>…</title> <coverage>…<coverage></vr:resource>
IVOA VOResource uses this technique
7 September 2005NVO Summer School 2005 - Aspen 30
A word about namespaces in instance documents…(FYI)
• An instance document must indicate what namespace(s) the elements belong to– So that the document can be validated– 3 ways to indicate this
• controlled by elementFormDefault attribute in Schema file
<?xml version="1.0" encoding="UTF-8"?><xs:schema targetNamespace="http://nvoss.org/VOResource" xmlns:res="http://nvoss.org/VOResource" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
1. Default namespacexmlns tags a whole section
Advantages:• Great for simple ns useDisadvantages:• Can be confusing for authors
when drawing on multiple schema
2. Namespace prefixesInvidually tag elements
Advantages:• Visually explicit about ns
membership• Can mix in elements from
different ns with the same name.
Disadvantages:• Error-prone, ugly when
drawing multiple schema
3. Unqualified: tag (global) root element
Advantages:• Single prefix tag needed at the
top of the document; no other tags needed
• Good for when using multiple schemas together
• Least error prone• Makes XPaths simplerDisadvantage:• Can’t have 2 elements from
different ns w/same name
elementFormDefault="qualified" elementFormDefault="unqualified"
<resource xmlns="http://nvoss.org/VOResource"> <title>…</title> <referenceURL>…</referenceURL> <type>Archive</type></resource>
<vr:resource xmlns:vr="http://nvoss.org/VOResource" xmlns:cv="http://nvoss.org/Coverage"> <vr:title>…</vr:title> <cv:coverage>…<cv:coverage></vr:resource>
<vr:resource xmlns:vr="http://nvoss.org/VOResource"> <title>…</title> <coverage>…<coverage></vr:resource>
IVOA VOResource uses this technique
7 September 2005NVO Summer School 2005 - Aspen 31
XPath
• What it is:– A W3C standard syntax for pointing to elements,
attributes, and/or their values in an XML file
• Why you might care:– XPath is used in two other important XML
technologies: XQuery and XSL
– XPath is used in ADQL to query a registry via the standard Registry Interface
• What you’ll get from this session:– Ability to form simple XPath queries
7 September 2005NVO Summer School 2005 - Aspen 32
Can you tell me how to get to Sesame Street?
• An XPath is a set of directions from one point in an XML document to another
<NewYork>
<Borough name="Brooklyn">
<light/>
<light/>
<light>
<SesameStreet>
<weather>sunny</weather>
</SesameStreet>
</light>
</Borough>
<Borough name="Queens"/>
</NewYork>
/NewYork/Burough[@name="Brooklyn“]/light[3]/SesameStreet
Begin at the start of the document
7 September 2005NVO Summer School 2005 - Aspen 33
Can you tell me how to get to Sesame Street?
• An XPath is a set of directions from one point in an XML document to another
<NewYork>
<Borough name="Brooklyn">
<light/>
<light/>
<light>
<SesameStreet>
<weather>sunny</weather>
</SesameStreet>
</light>
</Borough>
<Borough name="Queens"/>
</NewYork>
/NewYork/Burough[@name="Brooklyn“]/light[3]/SesameStreet
Go to NewYork
7 September 2005NVO Summer School 2005 - Aspen 34
Can you tell me how to get to Sesame Street?
• An XPath is a set of directions from one point in an XML document to another
<NewYork>
<Borough name="Brooklyn">
<light/>
<light/>
<light>
<SesameStreet>
<weather>sunny</weather>
</SesameStreet>
</light>
</Borough>
<Borough name="Queens"/>
</NewYork>
/NewYork/Burough[@name="Brooklyn"]/light[3]/SesameStreet
Find the Borough named Brooklyn
7 September 2005NVO Summer School 2005 - Aspen 35
Can you tell me how to get to Sesame Street?
• An XPath is a set of directions from one point in an XML document to another
<NewYork>
<Borough name="Brooklyn">
<light/>
<light/>
<light>
<SesameStreet>
<weather>sunny</weather>
</SesameStreet>
</light>
</Borough>
<Borough name="Queens"/>
</NewYork>
/NewYork/Burough[@name="Brooklyn"]/light[3]/SesameStreet
Go to the 3rd light
7 September 2005NVO Summer School 2005 - Aspen 36
Can you tell me how to get to Sesame Street?
• An XPath is a set of directions from one point in an XML document to another
<NewYork>
<Borough name="Brooklyn">
<light/>
<light/>
<light>
<SesameStreet>
<weather>sunny</weather>
</SesameStreet>
</light>
</Borough>
<Borough name="Queens"/>
</NewYork>
/NewYork/Burough[@name="Brooklyn"]/light[3]/SesameStreet
And there’s SesameStreet
7 September 2005NVO Summer School 2005 - Aspen 37
XPath syntax
• XPath fields (between the /s)– Each represents a descent in the XML hierarchy
• “//” means drop any number of levels– Points to an XML node
• element name or, if preceeded with an @, an attribute name– Other useful node-matching symbols
* = wildcard (any name) . = current node .. = parent node
• Context node = starting point– If it does not start with a /, XPath is relative to a context-specific
starting point. /NewYork/Burough[@name="Brooklyn"] • @name is an XPath relative to /NewYork/Burough
• Predicates: [ ]– Read “[…]” as “where …”– XPaths inside resolve to string value inside element/attribute pointed
to– Operators: = != < > <= >= and or– Many Useful Functions: contains(string, string), position(),
count(), last(), local-name()– [3] is short-hand for [position()=3]
7 September 2005NVO Summer School 2005 - Aspen 38
XPath as a Query
• An XPath returns matched XML nodes/NewYork/Burough[@name="Brooklyn“]/light[3]/SesameStreet
On…<NewYork>
<Borough name="Brooklyn">
<light/>
<light/>
<light>
<SesameStreet>
<weather>sunny</weather>
</SesameStreet>
</light>
</Borough>
<Borough name="Queens"/>
</NewYork>
Returns…<SesameStreet>
<weather>sunny</weather>
</SesameStreet>
7 September 2005NVO Summer School 2005 - Aspen 39
XPath as a Query
• An XPath returns matched XML nodes/NewYork/Burough/light
On…<NewYork>
<Borough name="Brooklyn">
<light/>
<light/>
<light>
<SesameStreet>
<weather>sunny</weather>
</SesameStreet>
</light>
</Borough>
<Borough name="Queens"/>
</NewYork>
Returns…<light/>
<light/>
<light>
<SesameStreet>
<weather>sunny</weather>
</SesameStreet>
</light>
7 September 2005NVO Summer School 2005 - Aspen 40
XPath as a Query
• An XPath returns matched XML nodes/NewYork/Burough/light/SesameStreet/weather
On…<NewYork>
<Borough name="Brooklyn">
<light/>
<light/>
<light>
<SesameStreet>
<weather>sunny</weather>
</SesameStreet>
</light>
</Borough>
<Borough name="Queens"/>
</NewYork>
Returns…<weather>sunny</weather>
7 September 2005NVO Summer School 2005 - Aspen 41
XPath as a Query
• An XPath returns matched XML nodesstring(/NewYork/Burough/light/SesameStreet/weather)
On…<NewYork>
<Borough name="Brooklyn">
<light/>
<light/>
<light>
<SesameStreet>
<weather>sunny</weather>
</SesameStreet>
</light>
</Borough>
<Borough name="Queens"/>
</NewYork>
Returns…sunny
7 September 2005NVO Summer School 2005 - Aspen 42
XPath as a Query
• An XPath returns matched XML nodes/NewYork/Burough/light/SesameStreet[weather='sunny']
On…<NewYork>
<Borough name="Brooklyn">
<light/>
<light/>
<light>
<SesameStreet>
<weather>sunny</weather>
</SesameStreet>
</light>
</Borough>
<Borough name="Queens"/>
</NewYork>
Returns…<SesameStreet>
<weather>sunny</weather>
</SesameStreet>
weather was automatically convertedto a string before comparison operatorwas applied.
7 September 2005NVO Summer School 2005 - Aspen 43
XPath as a Query
• An XPath “returns” matched XML nodes– If path is ambiguous, all matching nodes are returned– If path does not resolve to an existing node, the empty set is returned– Predicates, […], provide constraints
• In some contexts, XPath is automatically converted to string value inside the matched element or attribute.
• Examples querying a set of VOResource documents /Resource[contains(content/description, 'cluster')]– Return all resource elements where the description contains the word ‘cluster’
/Resource[facility]– Return all resources that have a facility element
/Resource/capability[@xsi:type='cs:ConeSearch']/interface/accessURL– Return the interface URLs of all ConeSearch services
/Resource[@xsi:type='vs:DataCollection']/coverage/stc:STCResourceProfile//stc:AllSky
– Return all data collections that purport to have data distributed overall
7 September 2005NVO Summer School 2005 - Aspen 44
XPath as a Query
• An XPath “returns” matched XML nodes– If path is ambiguous, all matching nodes are returned– If path does not resolve to an existing node, the empty set is returned– Predicates, […], provide constraints
• In some contexts, XPath is automatically converted to string value inside the matched element or attribute.
• Examples querying a set of VOResource documents /Resource[contains(content/description, 'cluster')]– Return all resource elements where the description contains the word ‘cluster’
/Resource[facility]– Return all resources that have a facility element
/Resource/capability[@xsi:type='cs:ConeSearch']/interface/accessURL– Return the interface URLs of all ConeSearch services
/Resource[@xsi:type='vs:DataCollection']/coverage/stc:STCResourceProfile//stc:AllSky
– Return all data collections that purport to have data distributed overall
7 September 2005NVO Summer School 2005 - Aspen 45
XQuery (a.k.a. XML Query)
• What it is:– A W3C standard for querying XML documents
• An analogue to SQL for tables
• Why you might care:– It is one of the supported query languages in
the standard VO Registry Interface. – It can handle certain complex registry
queries that ADQL cannot
• What you’ll get from this session:– Ability to query XML documents by modifying
existing an XQuery
7 September 2005NVO Summer School 2005 - Aspen 46
XQuery: an analogy to SQL
• SQL queries tables– Result of an SQL statement is a table– Columns of result table controlled by the
SELECT clause– Rows controlled by the WHERE clause
• XQuery queries XML documents– Result of an XQuery is an XML document– The form of the XML document is set by the return clause
– The contents of the result is controlled by the for, let, and where clauses
7 September 2005NVO Summer School 2005 - Aspen 47
XQuery syntax: think FLWOR
• XQuery supports several types of expressions that can return XML results – XPath, Constructors, …– FLWOR = for let where orderby return
• FLWOR clauses– for/let clause selects data from source XML
documents
7 September 2005NVO Summer School 2005 - Aspen 48
XQuery syntax: think FLWOR
• Searching for Cone Search services suitable for getting data about galaxy clusters
• To be used with the Carnivore Registry
declare namespace vr= "http://www.ivoa.net/xml/VOResource/v0.10";
declare namespace vs= "http://www.ivoa.net/xml/VODataService/v0.5";
for $vr in //Resource/capability[@xsi:type="cs:ConeSearch"] where contains($vr//description, "quasar") return <conesearch> <title>{string(title)}</title> <url>{string($vr/capability/interface/accessURL)}</url> </conesearch>
7 September 2005NVO Summer School 2005 - Aspen 49
XQuery syntax: think FLWOR
• Searching for Cone Search services suitable for getting data about galaxy clusters
• To be used with the Carnivore Registry
Declare namespaceprefixes to use in query
declare namespace vr= "http://www.ivoa.net/xml/VOResource/v0.10";
declare namespace vs= "http://www.ivoa.net/xml/VODataService/v0.5";
for $vr in //Resource/capability[@xsi:type="cs:ConeSearch"] where contains($vr//description, "quasar") return <conesearch> <title>{string(title)}</title> <url>{string($vr/capability/interface/accessURL)}</url> </conesearch>
7 September 2005NVO Summer School 2005 - Aspen 50
XQuery syntax: think FLWOR
• for clause sets up a loop around matching occurrences– XPath both selects the Resource element node to put into
the variable and constrains which Resources are included
• let clause (not used here) can also set variables. – Used to join across documents, self-joins– If $vr is used in the variable definition, the new value
would be different in each pass of the loop.
Loop over all ConeSearch resources
declare namespace vr= "http://www.ivoa.net/xml/VOResource/v0.10";
declare namespace vs= "http://www.ivoa.net/xml/VODataService/v0.5";
for $vr in //Resource/capability[@xsi:type="cs:ConeSearch"] where contains($vr//description, "quasar") return <conesearch> <title>{string(title)}</title> <url>{string($vr/capability/interface/accessURL)}</url> </conesearch>
Declare namespaceprefixes to use in query
7 September 2005NVO Summer School 2005 - Aspen 51
XQuery syntax: think FLWOR
• where clause further restricts the output– Optional, often don’t need it:
for $vr in //vr:Resource[@xsi:type="cs:ConeSearch“ and contains($vr//vr:description, "quasar")]
Restrict output to ConeSearch servicesabout quasars
declare namespace vr= "http://www.ivoa.net/xml/VOResource/v0.10";
declare namespace vs= "http://www.ivoa.net/xml/VODataService/v0.5";
for $vr in //Resource/capability[@xsi:type="cs:ConeSearch"] where contains($vr//description, "quasar") return <conesearch> <title>{string(title)}</title> <url>{string($vr/capability/interface/accessURL)}</url> </conesearch>
Loop over all ConeSearch resources
Declare namespaceprefixes to use in query
7 September 2005NVO Summer School 2005 - Aspen 52
XQuery syntax: think FLWOR
• return clause sets the output template – { } used to denote non-literal output– Applied to each value of $vr
• XQuery supports several other expression types not shown here– Conditionals, function definition, etc.– Many more predefined funtions
XQuery: a full XML processing language
Loop over all ConeSearch resources
Extract and displayDesired information
Restrict output to ConeSearch servicesabout quasars
Declare namespaceprefixes to use in query declare namespace vr=
"http://www.ivoa.net/xml/VOResource/v0.10"; declare namespace vs=
"http://www.ivoa.net/xml/VODataService/v0.5"; for $vr in //Resource/capability[@xsi:type="cs:ConeSearch"] where contains($vr//description, "quasar") return <conesearch> <title>{string(title)}</title> <url>{string($vr/capability/interface/accessURL)}</url> </conesearch>
7 September 2005NVO Summer School 2005 - Aspen 53
XSL – XML Stylesheet Language
• What it is– A language for describing the transformation of XML
data from one form to another• XML -> HTML• XML -> XML• XML -> Plain text
• Why you might care– XSL can be used to create human readable
renderings of XML data from the VO– XSL is used by the Java Skynode toolkit for
converting ADQL to local SQL
• What you’ll get from this session:– Ability to modify XML transformations via simple changes
to a stylesheet
7 September 2005NVO Summer School 2005 - Aspen 54
XML Stylesheet Language
• An XML document that describes a transformation
• Contains a list of templates – Each describes the transformation for one type of
node (e.g. an element with a particular name)– Node is identified by an XPath
• Relative to current context node– Usually one template for /, the root of the document– A template can call other templates
• XSL provides a number of programming structures– Conditionals, looping, user-defined functions, built-in
functions, extensibilty– Variables are immutable!
• XSLT = XSL Transformation
7 September 2005NVO Summer School 2005 - Aspen 55
A tour through a stylesheetxmltech-VOResource.xsl to transform xmltech-adil.xml into plain text
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns="http://www.ivoa.net/xml/VOResource/v1.0"
xmlns:vr="http://www.ivoa.net/xml/VOResource/v1.0"
xmlns:vs="http://www.ivoa.net/xml/VODataService/v1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
Resource Description Record
<xsl:apply-templates select="Resource" />
</xsl:template>
7 September 2005NVO Summer School 2005 - Aspen 56
A tour through a stylesheetxmltech-VOResource.xsl to transform xmltech-adil.xml into plain text
Define prefixes for all namespaces we’llbe using
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns="http://www.ivoa.net/xml/VOResource/v1.0"
xmlns:vr="http://www.ivoa.net/xml/VOResource/v1.0"
xmlns:vs="http://www.ivoa.net/xml/VODataService/v1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
Resource Description Record
<xsl:apply-templates select="Resource" />
</xsl:template>
7 September 2005NVO Summer School 2005 - Aspen 57
A tour through a stylesheetxmltech-VOResource.xsl to transform xmltech-adil.xml into plain text
• Three output types– xml, html, text
Define prefixes for all namespaces we’llbe using
Our output formatwill be plain text
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns="http://www.ivoa.net/xml/VOResource/v1.0"
xmlns:vr="http://www.ivoa.net/xml/VOResource/v1.0"
xmlns:vs="http://www.ivoa.net/xml/VODataService/v1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
Resource Description Record
<xsl:apply-templates select="Resource" />
</xsl:template>
7 September 2005NVO Summer School 2005 - Aspen 58
A tour through a stylesheetxmltech-VOResource.xsl to transform xmltech-adil.xml into plain text
• When raw text appears, XSLT engine will preserve spacing (like carriage returns) around text
• Resource is the root of our data document
Define prefixes for all namespaces we’llbe using
Our output formatwill be plain text
Our root documenttemplate sets up the output document andcalls next template
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns="http://www.ivoa.net/xml/VOResource/v1.0"
xmlns:vr="http://www.ivoa.net/xml/VOResource/v1.0"
xmlns:vs="http://www.ivoa.net/xml/VODataService/v1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
Resource Description Record
<xsl:apply-templates select="Resource" />
</xsl:template>
7 September 2005NVO Summer School 2005 - Aspen 59
A tour through a stylesheetxmltech-VOResource.xsl to transform xmltech-adil.xml into plain text
• When a template “runs”, it changes the context node to the node matched by the template
• Subsequent XPaths within template are relative to that context node
<xsl:template match="Resource" > <xsl:value-of select="substring-after(@xsi:type,':')"/> <xsl:text> </xsl:text> <xsl:value-of select="title"/> <xsl:text> (</xsl:text> <xsl:value-of select="shortName"/> <xsl:text>) IVOA Identifier: </xsl:text> <xsl:value-of select="identifier"/>
<xsl:apply-templates select="content" /> <xsl:apply-templates select="curation" /> </xsl:template>
<xsl:template match="content"> <xsl:apply-templates select="description" /> <xsl:text> </xsl:text>
<xsl:text>Target Communities: </xsl:text> <xsl:for-each select="contentLevel"> <xsl:value-of select="."/> <xsl:if test="position()!=last()"> <xsl:text>, </xsl:text> </xsl:if>
</xsl:for-each> </xsl:template>
Resource template
7 September 2005NVO Summer School 2005 - Aspen 60
A tour through a stylesheetxmltech-VOResource.xsl to transform xmltech-adil.xml into plain text
text tags can be used totake explicit control ofspacing
Resource template <xsl:template match="Resource" > <xsl:value-of select="substring-after(@xsi:type,':')"/> <xsl:text> </xsl:text> <xsl:value-of select="title"/> <xsl:text> (</xsl:text> <xsl:value-of select="shortName"/> <xsl:text>) IVOA Identifier: </xsl:text> <xsl:value-of select="identifier"/>
<xsl:apply-templates select="content" /> <xsl:apply-templates select="curation" /> </xsl:template>
<xsl:template match="content"> <xsl:apply-templates select="description" /> <xsl:text> </xsl:text>
<xsl:text>Target Communities: </xsl:text> <xsl:for-each select="contentLevel"> <xsl:value-of select="."/> <xsl:if test="position()!=last()"> <xsl:text>, </xsl:text> </xsl:if>
</xsl:for-each> </xsl:template>
7 September 2005NVO Summer School 2005 - Aspen 61
A tour through a stylesheetxmltech-VOResource.xsl to transform xmltech-adil.xml into plain text
• our XPaths point to elements– Relative to vr:Resource!
• value-of will convert it to a string
text tags can be used totake explicit control ofspacing
value-of will print thestring values of nodes
Resource template <xsl:template match="Resource" > <xsl:value-of select="substring-after(@xsi:type,':')"/> <xsl:text> </xsl:text> <xsl:value-of select="title"/> <xsl:text> (</xsl:text> <xsl:value-of select="shortName"/> <xsl:text>) IVOA Identifier: </xsl:text> <xsl:value-of select="identifier"/>
<xsl:apply-templates select="content" /> <xsl:apply-templates select="curation" /> </xsl:template>
<xsl:template match="content"> <xsl:apply-templates select="description" /> <xsl:text> </xsl:text>
<xsl:text>Target Communities: </xsl:text> <xsl:for-each select="contentLevel"> <xsl:value-of select="."/> <xsl:if test="position()!=last()"> <xsl:text>, </xsl:text> </xsl:if>
</xsl:for-each> </xsl:template>
7 September 2005NVO Summer School 2005 - Aspen 62
A tour through a stylesheetxmltech-VOResource.xsl to transform xmltech-adil.xml into plain text
text tags can be used totake explicit control ofspacing
value-of will print thestring values of nodes
Pass control to other templates
Resource template <xsl:template match="Resource" > <xsl:value-of select="substring-after(@xsi:type,':')"/> <xsl:text> </xsl:text> <xsl:value-of select="title"/> <xsl:text> (</xsl:text> <xsl:value-of select="shortName"/> <xsl:text>) IVOA Identifier: </xsl:text> <xsl:value-of select="identifier"/>
<xsl:apply-templates select="content" /> <xsl:apply-templates select="curation" /> </xsl:template>
<xsl:template match="content"> <xsl:apply-templates select="description" /> <xsl:text> </xsl:text>
<xsl:text>Target Communities: </xsl:text> <xsl:for-each select="contentLevel"> <xsl:value-of select="."/> <xsl:if test="position()!=last()"> <xsl:text>, </xsl:text> </xsl:if>
</xsl:for-each> </xsl:template>
7 September 2005NVO Summer School 2005 - Aspen 63
• Normally, apply-templates will automatically loop over multiple occurances
• Here, we need to insert commas
• for-each also changes the context node
A tour through a stylesheetxmltech-VOResource.xsl to transform xmltech-adil.xml into plain text
text tags can be used totake explicit control ofspacing
value-of will print thestring values of nodes
Pass control to other templates
Resource template
Loop over all occurancesof contentLevel
<xsl:template match="Resource" > <xsl:value-of select="substring-after(@xsi:type,':')"/> <xsl:text> </xsl:text> <xsl:value-of select="title"/> <xsl:text> (</xsl:text> <xsl:value-of select="shortName"/> <xsl:text>) IVOA Identifier: </xsl:text> <xsl:value-of select="identifier"/>
<xsl:apply-templates select="content" /> <xsl:apply-templates select="curation" /> </xsl:template>
<xsl:template match="content"> <xsl:apply-templates select="description" /> <xsl:text> </xsl:text>
<xsl:text>Target Communities: </xsl:text> <xsl:for-each select="contentLevel"> <xsl:value-of select="."/> <xsl:if test="position()!=last()"> <xsl:text>, </xsl:text> </xsl:if>
</xsl:for-each> </xsl:template>
7 September 2005NVO Summer School 2005 - Aspen 64
• Use choose/when for if-then-else blocks
A tour through a stylesheetxmltech-VOResource.xsl to transform xmltech-adil.xml into plain text
text tags can be used totake explicit control ofspacing
value-of will print thestring values of nodes
Pass control to other templates
Resource template
Loop over all occurancesof contentLevel
If block
<xsl:template match="Resource" > <xsl:value-of select="substring-after(@xsi:type,':')"/> <xsl:text> </xsl:text> <xsl:value-of select="title"/> <xsl:text> (</xsl:text> <xsl:value-of select="shortName"/> <xsl:text>) IVOA Identifier: </xsl:text> <xsl:value-of select="identifier"/>
<xsl:apply-templates select="content" /> <xsl:apply-templates select="curation" /> </xsl:template>
<xsl:template match="content"> <xsl:apply-templates select="description" /> <xsl:text> </xsl:text>
<xsl:text>Target Communities: </xsl:text> <xsl:for-each select="contentLevel"> <xsl:value-of select="."/> <xsl:if test="position()!=last()"> <xsl:text>, </xsl:text> </xsl:if>
</xsl:for-each> </xsl:template>
7 September 2005NVO Summer School 2005 - Aspen 65
XSL for metadata
• Transformation is a powerful paradigm for metadata processing– Consider all uses of metadata as a
transformation to another form…• User display• An SQL statement• A workflow script• Compile-able code
– XSL stylesheet somewhere between configuration file and script
• Rapid prototyping and adaptation• xsl:import: ability to extend & override other
stylesheets