Simple elements cannot have attributes. If an element has attributes, it
is considered to be of a complex type. But the attribute itself is always declared
as a simple type.
Attributes are optional by default. To specify that the
attribute is required, use the "use" attribute:
<xs:attribute name="lang" type="xs:string" use="required"/>
The whiteSpace constraint is set to "preserve", which means that
the XML processor WILL NOT remove any white space characters:
<xs:whiteSpace value="preserve"/>
The whiteSpace constraint is set to "replace", which means that the
XML processor WILL REPLACE all white space characters (line feeds, tabs, spaces,
and carriage returns) with spaces:
Constraint
Description
enumeration
Defines a list of acceptable values
fractionDigits
Specifies the maximum number of decimal places allowed.
Must be equal to or greater than zero
length
Specifies the exact number of characters or list items
allowed. Must be equal to or greater than zero
maxExclusive
Specifies the upper bounds for numeric values (the value
must be less than this value)
maxInclusive
Specifies the upper bounds for numeric values (the value
must be less than or equal to this value)
maxLength
Specifies the maximum number of characters or list items
allowed. Must be equal to or greater than zero
minExclusive
Specifies the lower bounds for numeric values (the value
must be greater than this value)
minInclusive
Specifies the lower bounds for numeric values (the value
must be greater than or equal to this value)
minLength
Specifies the minimum number of characters or list items
allowed. Must be equal to or greater than zero
pattern
Defines the exact sequence of characters that are
acceptable
totalDigits
Specifies the exact number of digits allowed. Must be
greater than zero
whiteSpace
Specifies how white space (line feeds, tabs, spaces, and
carriage returns) is handled
A complex element is an XML element that contains other elements
and/or attributes.
There are four kinds of complex elements:
empty elements
elements that contain only other elements
elements that contain only text
elements that contain both other elements and text
Note: Each of these elements may contain attributes as well!
A Name is a
token beginning with a letter or one of a few punctuation characters, and
continuing with letters, digits, hyphens, underscores, colons, or full stops,
together known as name characters.] Names beginning with the string "
xml", or any string which would match (('X'|'x') ('M'|'m') ('L'|'l'))
, are reserved for standardization in this or future versions of this
specification.
An
Nmtoken (name token) is any mixture of name characters.
The <xsl:value-of> element is used to extract the value of a selected node.
<xsl:value-of select="catalog/cd/title"/>
he value of the select attribute is an XPath
expression.
An XPath expression works like navigating a file system; where a forward slash (/) selects subdirectories.