<A href="hyperlink.html">About</a>XLink
XPointer
Framework for creating
XLink namespace: http://www.w3.org/1999/xlink
<my:crossReference
xmlns:my="http://example.com/"
xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:href="students.xml"
xlink:role="http://www.example.com/linkprops/studentlist"
xlink:title="Student List"
xlink:show="new"
xlink:actuate="onRequest">
Current List of Students
</my:crossReference>
Extended links
Simple links
title
resource
locator
arc
"simple" Creates a simple link"extended" Creates an extended link"locator" Creates a locator link that points to a resource"arc" Creates an arc with multiple resources and various traversal paths"resource" Creates a resource link, which indicates a specific resource"title" Creates a title link. Such elements are useful for internationalizetion purposes.<CLASS_SLIDE xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:show="new" xlink:href="http://www.cs.rpi.edu/~puninj/XMLJ/classes.xml# xpointer(/child::*[position()=8]/child::*[position()=first()])"> XLinks and XPointers </CLASS_SLIDE>
Optional attributes
<CLASS_SLIDE xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:show="new" xlink:role="http://www.cs.rpi.edu/~puninj/XMLJ/slideroles" xlink:title="XLinks and XPointers" xlink:href="http://www.cs.rpi.edu/~puninj/XMLJ/classes.xml# xpointer(/child::*[position()=8]/child::*[position()=first()])"> XLinks and XPointers </CLASS_SLIDE>
"replace" Replaces the current resource in the same window"new" Opens a new display area, such as a new window, to disply the new resource"embed" Embeds the linked-to resource in the current resource"other" The application should look for other markup present in the link to determine the appropiate behavior"none" No other markup is present to help the application determine the appropiate behavior"onRequest" Indicates that the link should be traversed only on the user'srequest"onLoad" Indicates that the link should be traversed when the document or resource is loaded"other" The application should look for other markup present in the linkto determine the appropiate behavior"none" No other markup is present to help the application determine the appropiate behavior<!ELEMENT person EMPTY>
<!ATTLIST person
xlink:type (locator) #FIXED "locator"
xlink:href CDATA #REQUIRED
xlink:role CDATA #IMPLIED
xlink:title CDATA #IMPLIED
xlink:label NMTOKEN #IMPLIED>
<!ELEMENT course EMPTY>
<!ATTLIST course
xlink:type (locator) #FIXED "locator"
xlink:href CDATA #REQUIRED
xlink:role CDATA #FIXED "http://www.example.com/linkprops/course"
xlink:title CDATA #IMPLIED
xlink:label NMTOKEN #IMPLIED>
<person xlink:href="students/patjones62.xml"
xlink:label="student62"
xlink:role="http://www.example.com/linkprops/student"
xlink:title="Pat Jones" />
<person xlink:href="profs/jaysmith7.xml"
xlink:label="prof7"
xlink:role="http://www.example.com/linkprops/professor"
xlink:title="Dr. Jay Smith" />
<course xlink:href="courses/cs101.xml"
xlink:label="CS-101"
xlink:title="Computer Science 101" />
<!ELEMENT gpa ANY> <!ATTLIST gpa xlink:type (resource) #FIXED "resource" xlink:role CDATA #FIXED "http://www.example.com/linkprops/gpa" xlink:title CDATA #IMPLIED xlink:label NMTOKEN #IMPLIED> <gpa xlink:label="PatJonesGPA">3.5</gpa>
xlink:from What resource an arc comes from
xlink:to What resource an arc goes to
xlink:label Label of a resource of locator element
xlink:from or xlink:to attribute, it must
correspond to the same value form some xlink:label attribute on a locator
or resource element
<!ELEMENT go EMPTY>
<!ATTLIST go
xlink:type (arc) #FIXED "arc"
xlink:arcrole CDATA #IMPLIED
xlink:title CDATA #IMPLIED
xlink:show (new|replace|embed|other|none) #IMPLIED
xlink:actuate (onLoad|onRequest|other|none) #IMPLIED
xlink:from NMTOKEN #IMPLIED
xlink:to NMTOKEN #IMPLIED>
<go xlink:from="CS-101"
xlink:arcrole="http://www.example.com/linkprops/auditor"
xlink:to="student62"
xlink:show="replace"
xlink:actuate="onRequest"
xlink:title="Pat Jones, auditing the course" />
XPointer is build on top of the XML Path Language. These extensions allow:
xlink:href="http://www.cs.rpi.edu/~puninj/XMLJ/classes.xml#
xpointer(/child::*[position()=8]/child::*[position()=first()])">
axis::node_test[predicate]
For example:
child::STUDENT[position() = 3]
* Any Elementnode() Any Nodetext() A text nodecomment() A comment nodeprocessing-instruction() A processing instructionpoint() A point in a resourcerange() A range in a resourcestart-point()
For example:
<?xml version="1.0"?>
<BOOK>
<P>chapter 1 - Intro</P>
<P>chapter 2 - conclusion</P>
</BOOK>
points right before the character 'e'
xpointer(/BOOK/P[2]/text()/start-point()[position() = 5])
"range-to" Function
For each location in the context, range-to returns a range
Example: Locates the range from the start point of the element with
ID "chap1" to the end point of the element with ID "chap2"
xpointer(id("chap1")/range-to(id("chap2")))
"string-range" Function
Returns a location set with one range for every nonoverlapping match to the search string. The match operation is case-sensitive.
Examples:string-range(/,"John") string-range(/,"John")[2] string-range(//STUDENT[3]/NAME, "John")[3] string-range(//STUDENT[3]/NAME, "John",6,2)[3]