Wednesday, 31 March 2010

CMT3315 – Laboratory 10 – 2 December 09

Quick Questions

1. With CSS the most specific rule will be used

2.No, because the number 10000 is within a the sentence, and the sentence is used as
an element, the only way you can get the number on its own is if
the number 10000 is contained as an element on its own


Longer Questions

1. <?xml version="1.0"?>

<!DOCTYPE chemElements SYSTEM "chemElements2.dtd">

<?xml-stylesheet href="stylesheet01.css" type="text/css"?>



2. The following are xpath expressions used to get attributes, nodes. The expressions can also contain conditions such as the ones bellow demonstrates: -
a)


b) //tracks[@total="5"]   <<<This is a condition where tracks is returned if the attribute value of “total” is equal to 5

c) //title[contains(name(), "Pendericki")]  <<<<This condition returns the title if the name is equal to “pendericki”

d) //title[string-length(name())>11] <<<This condition returns the title if the name length is greater than 11 characters

e) /musicList/cd/sibling::    <<<<this expression does not contain a condition but will return the “sibling”.  This expression goes into the parent tag “musicList” and finds the child tag “cd” inside it, which contains the “sibling” element.




Lecture Reflection-WEEK 10 – Hyperlinks, Anchors and X-Pointers

This week was spent studying hyperlinks and anchors. A hyperlink allows a user to select images, other web pages, movies etc and links them directly to the correct resource using HTML.
An anchor is a specific location within a web page that can be jumped to by clicking onto a hyperlink.

Example of a hyperlink in a HTML: -


<a href="url">Link text</a>


o The href attribute defines the link address.
o The element acts as a description for the link, it doesn't have to be text as it can be an image or any other HTML element.

Example of a anchor inside an HTML: -


<a name="content">the main content of the document</a>

A link to the above anchor from the same document

<a href="#content">Jump to the main content section</a>



XLink describes hyperlinks that offer a greater degree of functionality than those in HTML.
Simple links and extended links are two different types of hyperlinks in XML.
Extended links can be multidirectional, linking from, within, and between XML documents.

Simple links are unidirectional and therefore offer no more functionality than hyperlinks in HTML.
Hyperlinks in XML = XLinks
Anchors = XPointers.

To write an XLink in XML the XLink name space must be in the beginning of the document: -

xmlns:xlink="http://www.w3.org/1999/xlink"

Simple XLink Demonstration

1. Declare the namespace

<homepages xmlns:xlink="http://www.w3.org/1999/xlink">


2. Make the link

<homepage xlink:type="simple"

xlink:href="http://xml4u.blogspot.com/">Visit My Blog</homepage>

The xlink:type="simple" creates a simple, two-ended link (means "click from here to go there")

Extended XLinks = these can connect more than two documents and the link specification can be in any of the documents.

XPointers = these can e used to use a specific part of a document without the necessitate of an anchor.
http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main

No comments:

Post a Comment