Ivan Marsic • Rutgers University
244
• matches
any element
• chapter|appendix matches any chapter element and any appendix element • olistitem
matches any item element with an olist parent • appendixpara matches any para element with an appendix ancestor element
• matches the root node
• text matches any text node
• itemsitem[position1] matches any item element that has a items parent and that is not the first item child of its parent
• item[position mod 2 = 1] would be true for any item element that is an odd-numbered item child of its parent
• class matches any class attribute not any element that has a class attribute • div[class=appendix]p matches any p element with a div ancestor
element that has a class attribute with value appendix The following example is a combination of a URL and an XPointer and refers to the seventh child
of the fourth section under the root element: http:www.foo.combar.htmlroot.child4,SECTION.child7
6.3.2 XLink
A link is an explicit relationship between two or more data objects or parts of data objects. A linking element
is used to assert link existence and describe link characteristics. XML Linking Language XLink allows elements to be inserted into XML documents in order to
create and describe links between resources. In HTML, a link is unidirectional from one resource to another and has no special meaning, except it brings up the referred document when clicked in
a browser. XLink uses XML syntax to create structures that can describe the simple unidirectional hyperlinks of today’s HTML as well as more sophisticated multidirectional and
typed links. With XLink, a document author can do the following, among others:
• Associate semantics to a link by giving a “role” to the link. • Define a link that connects more than two resources.
• Define a bidirectional link.
A link is an explicit relationship between two or more data objects or portions of data objects. A linking element
is used to assert link existence and describe link characteristics. Linking elements are recognized based on the use of a designated attribute named xml:link. Possible values are
“simple” and “extended” as well as “locator”, “group”, and “document”, which identify other related types of elements. An element that includes such an attribute should be
treated as a linking element of the indicated type. The following is an example similar to the HTML A link:
A xml:link=simple href=http:www.w3.orgXMLXLink0.9 The XLinkA
Chapter 6 • XML and Data Representation
245
An example of an extended link is: xlink:extended xmlns:xlink=http:www.w3.orgXMLXLink0.9
role=resources title=Web Resources
showdefault=replace actuatedefault=user
xlink:locator href=http:www.xml.com role=resource
title=XML.com xlink:locator href=http:www.mcp.com
role=resource title=Macmillan
xlink:locator href=http:www.netscape.com role=resource
title=Netscape Communications xlink:locator href=http:www.abcnews.com
role=resource title=ABC News
Link Behavior
XLink provides behavior policies that allow link authors to signal certain intentions as to the timing and effects of link traversal. These include:
• Show: The show attribute is used to express a policy as to the context in which a resource
that is traversed to should be displayed or processed. It may take one of three values: embed, replace, new.
• Actuate: The actuate attribute is used to express a policy as to when traversal of a link
should occur. It may take one of two values: auto, user.
• Behavior: The behavior attribute is used to provide detailed behavioral instructions.
6.4 Document Transformation and XSL
As explained above, XML is not a fixed tag set like HTML so the tags do not carry a fixed, application-specific meaning. A generic XML processor has no idea what is “meant” by the
XML. Because of this, a number of other standards to process the XML files are developed. Extensible Stylesheet Language XSL is one such standard. XML markup usually does not
include formatting information. The information in an XML document may not be in the form in which it is desired to be presented. There must be something in addition to the XML document
that provides information on how to present or otherwise process the XML. XSL transforms and translates XML data from one XML format into another. It is designed to help browsers and other
applications display XML. Stated simply, a style sheet contains instructions that tell a processor