Saturday, 25 December 2010

Difference between a .doc file and a .docx file

What is the difference between a .doc file and a .docx file?  Why is this difference relevant to XML?

# Initially, both are Microsoft Word document files, they were developed for Microsoft word distribution in the office suite. ".docx" is the file extension that newer Microsoft Word version uses like Microsoft Office 2007 and 2010, while the older versions like Microsoft 2003 save word files as ".doc" files. The biggest benefits of the new file format is that it is open, which means it can be read by applications other than Microsoft Word that support XML.

The difference between .doc files and .docx files is a letter “x”, which indicates the use of XML for its creation which was created by Microsoft for MS Office 2007.  It has been designed on the structural design of XML and its uses Zip compression scheme to condense the size of a file. We can find many advantages of using the XML technology. In latest version of Microsoft Office 2007, XML based Office replaced the binary file format as the default. The filename extensions for that format are .docx or .docm. The most recent version Microsoft Office 2010 is supported by Office 2007 and it also uses the similar format. The original uses for the extension have largely departed from the PC world.

Usually, Microsoft Word saved .docx extension file typically in XML format. It is not compatible with non-XML versions of Word (older than 2007) although I believed that Microsoft offers a plugin for older versions which allows to read XML documents with previous versions of Word.

Basically, DOC files often contain more text formatting information in compare to files using other document file formats such as Rich Text Format and HyperText Markup Language, but are generally less widely compatible. Depending on the task, we can choose the application that we would like to. Such as, if we wish to create a document with many pages which can be shared with other people than those that Microsoft software, and then we need to choose Microsoft Word and organize a DOC file.
           
Microsoft Word 2007 uses the latest format of filename extension which is .docx and the earlier version makes use of .doc format. There are some advantages to .docx but the normal person would not notice them. We can found a converter online to change .docx to .doc from Microsoft.
                                                                                                                                 

AJAX both a success and a failur

“AJAX both a success and a failure?”  Discuss and provide examples of success and failure.

# AJAX is a combination of organized web development techniques used on the client-side to create interactive web applications. AJAX stands for Asynchronous JavaScript and XML. With the help of AJAX, web applications can retrieve data from the server in the background without interfering with the display of the active page. Basically, it makes the life developer life easier. It has emerged as the leading way to bring desktop-quality software features to Web applications running on browsers. Its library for Visual Data Flex, in performance with Visual Fata Flex’s web application server middleware, offers exceptional capabilities to create and implement AJAX- based Rich Internet Applications (RIAs), its developers are effectively extending application of using AJAX library to the web and also developing entirely new rich internet applications with it.
            In upcoming days, AJAX could be accepted as a major technology, adopted by many organizations, as it is rich in user experience.
           
On the other hand, one of the negative aspects of the technology is that organisations need to consider the huge amount or programming languages that AJAX consists of. It has been revealed that even for a normal AJAX applications development, broad background knowledge is needed. So without a full knowledge of AJAX technology, it is presumed that the employ of this technology will result in a major risk of failure.
            Security issues have been surrounding scripting language all the time. Likewise, there is no different in AJAX security problems. For instance, the security issues relates to the Server side code being “pushed” into the Client side, which has been suggested as “dangerous”. Web services that used to be Server side are being opened up to the public allowing anyone to access the same features which used to be protected.
           
It has been stated that AJAX is still in the early development and also because of the major concerns surrounding it; many organizations are not willing for adopting the technology. Even though many big organizations and professionals have successfully implemented it, AJAX still has risks. So, under the present economic climate, organisations are not sure of implementing it.
            In present, the major concerns of the technology are security and accessibility. Though there are possibilities of solving these drawbacks during upcoming developments but for now they still stand as major downfalls. Even major companies such as Microsoft and Adobe have build up their own technologies (RIA technologies: Silverlight and Flex). These also provide similar features as of AJAX.
           
In conclusion, AJAX is not a failure but not yet the success that it could be. 

Wrong with XML

What is wrong with XML? Illustrate your responses with examples.

# XML is the document containing structure information for developing upcoming web applications. There’s no any suspicion about XML performance in this arena. However, XML also has some problems which need to be inspected and improved. Such as, one of the major problems of XML is that, it does not have any satisfactory applications for processing.
  • There are no browsers yet to read XML, it needs an application processing system. XML still have to depend on HTML in order to read in a browser. Because of which, it has to be transformed to HTML before it is implemented.
  •  It does not have any specific platform; it has a neutral platform requirement which may be a problem in few circumstances. XML can be complex and also costly to setup. For instance, a freelancer can create, write and format a document using any of the software available sitting at his home with his own pace. However, with the XML, the entire course of action could get really complex to take the document further.
  •  XML is not especially good at managing huge amounts of data.
  • XML can be become complex to read there are number if information contained on one file.
  • XML develop lots of reliance on single factors which can let the program down for several times.
  •  XML syntax is redundant in comparison to the binary representations of similar data.
  • XML does not provide any specific notion of data type such as “string”, “integer”, etc.
  • XML namespaces are tricky and challenging to use and its support can be complicated to implement correctly in an XML parser.
  •  XML is generally describes as “self- documenting” but this delineation pay no attention to critical ambiguity.

Friday, 24 December 2010

Security issue associated with XML

What are the most important security issues associated with XML?  Discuss with examples.

# There are number of important security issues associated with XML which are as follows:
  • XSD, XPath and XSLT are string- based languages in which operation can be specified that use a lot of time or memory. It’s a application programmers duty to validate XSD, XPath or XSLT strings form the suspicious source for not being malicious or to inspect and mitigate the possibility that evaluating these strings will lead to excessive system resource consumption.
  •  XSD schemas are inherently vulnerable to denial of service attacks; so schemas should not be accepted from any untrusted sources.
  •  XSD and XSLT can contain references to other documents or files and those references can result in cross-zone and cross-domain attacks. By default we can access any locations that do not require credentials.
  •  Due to the external entities in DTDs it can result in cross-zone and cross-domain attacks.
  •  DTDs are vulnerable to denial of service attacks. For example, DTD may contain nested entities or complex content models that can take an inordinate amount of time to process.
  • Some exceptionally deep documents can cause denial of service issue so need to limit the depth of XML documents.
  •  Due to scripts blocks in XSLT style sheets, it may expose a number of attacks.
  • Again while constructing dynamic XPath expressions, it need to be validate carefully before doing it.
  • XMLReaderSettings objects can include sensitive information such as user credentials and it can be used by an untrusted component and also the user credentials to create XMLReader objects to read data.

The Semantic Web is a failure

“The semantic web is a failure.”  Discuss, illustrating your answer with examples.

# Semantic Web is a group of methods and technologies which describes things in a way that computers can understand the meaning of information in the World Wide Web. The specific goals of semantic web is driving the evolution of the current web by allowing users to use it to its full potential thus allowing users to find, share and combine information more easily.
            The logic that is being applied to develop the Semantic Web does not consider the concept of time, since it is simply logic and metonymic lacks the metaphor. And according to Godel’s theorems, “The concluding tautology of each manufacture or metonymic mathematical language, which leads to inconsistencies”.
The idea behind Semantic Web is entirely contradictory to the logic that formulates inconsistent use of time, inherent in human unconscious, but the use of time is construct on the lack, not on optimistic things, it is based on abstaining and absences, and it is impossible to reflect on a machine because of the perceived lack of the required self awareness is acquired with the absence.
            The main problem is to build an intelligent system to replace the way of human thinking, at least in the information search, but the special nature of human mind is the use of time which lets human beings reach a termination, therefore does not exist in the human mind the halting problem.
            Because of which all the exertions faced toward semantic web are doomed to failure a priori if the aim is to broaden the human way of thinking into machines, they lack the metaphorical speech, because it’s only a mathematical construction which will always be redundant and metonymic, and inadequacy the use of the time that is what leads to the conclusion.
             Below I have illustrated some problems those we likely to run into when we reach the semantic web:
·         The emergence of Semantic web may truly affect the so-called “Privacy”. Although the fact behind it is to help people more effectively search the web but they might be intentionally abused by some intended bad peoples. 
·         Reduced anonymity on the web. Such as when we sign up for an account on sits like twitter, face book, etc, we are feeding them our information during registration. More he personal information increases the website will rely n querying the “web as a database” for information about its visitors for mission critical functionality. If this change takes place having personal information on the web may become comfortable norm. It will soon shift in the importance of anonymity. Openness and transparency may become the “in thing”.
·         Vocabulary incompabilities such as a trend of viewing in which systems create Semantic Web URIs, metadata and triples probabilistically. For example, some services take raw text and try to semanticize it. This weakens all the deterministic benefits that the Semantic Web promises. For instance, if there is a word pitch, one of these services give the wrong meaning to the word such as tree pitch, cricket pitch, etc trough a probabilistic process, often the process will be incorrect. But the meaning the service chooses will be hard wired in the text using Semantic Web markup.

Thursday, 23 December 2010

XUL

What is XUL and how is it used?  Give examples.

# XUL (Extensible User-interface Language) is created in a standard way to replace data that describes a program's user interface. Traditionally, user interfaces have been a complex work to customize so they would work across different operating platforms such as Windows and Macintosh. Netscape and Mozilla, an open group that develops Netscape, have jointly created XUL to overcome this problem.
The splendour of XUL lies in its simplicity. It is easier to work in comparison to the other interface programming tools found on the ancient days. A few lines of XUL can accomplish for the task where many lines of code were required previously. With a little knowledge, one can create a simple Web browser interface implementing XUL, due to which it may ultimately turn into lower cost for the development of user interfaces. Also, another asset of XUL is its flexibility nature.
Basically, it is a standard way to swap the data that describes a program's user interface, or at least the segment of it which can be managed by programming.
XUL interface is typically defined as three separate sets of components:
·         Content: XUL documents, whose elements describes the skeleton of user interface
·         Skin: CSS and image files, define the outline of an application
·         Locale: The files having user-visible strings easy for software localization
It defines a wide range of elements, which generally belong to the following types:
Top-level elements (such as window, page, etc), widgets (such as label, button, etc), box model (such as box, grid, etc), events & scripts (such as script, key, etc), data source (such as template, rule, etc) and others (such as iframe, browser, etc).

Below is the simple example of XUL:
<?xml version= “1.0”?>
<window title=“Hello world!”
Xmlns=“http://mozilla.org/keymaster/gatekeeper/there.is.only.xul” width=“250” height=“200”>
<hbox fex=“1” align=“center”>
<image src=“Mozilla-big.gif”/>
<text style=“fong-weight: bold;” value=“Hellow World!”/>
</hbox>
</window>
Output of an example:


XIML

What is XIML and how is it used?  Give examples.

# XIML is a technology developed purposefully for an interactive website/user interface development with flawless multimedia integration. It gives a standard mechanism for applications and tools to interchange interaction data and to interoperate within integrated user-interface engineering processes, from design, to operation, to evaluation. It is a simple markup language enabling functionality previously available only with complex programmed applications. It is a universal known technology appropriate for creating full featured websites, mini-sites, widgets, GUI in desktop applications, touch screens, etc.
            In order to effectively define a representation mechanism for interaction data, it is necessary to clearly establish the requirements of such a representation in terms of expressiveness, scope, and underlying support technologies. And these requirements are as follows:
·         The language must enable a comprehensive, structured storage mechanism for interaction data
·         The language must enable support functionality throughout the complete lifecycle of a user interface.
·         It must be able to exemplify the abstract aspects of a user interface such as the specific widgets that are to be displayed on a screen.
·         It must effectively relate a variety of elements captured within the scope of its representation
It is also known to be as the easiest way to build interactive websites. It is for support of functionality across the entire lifecycle of a user interface: design, development, operation, management, organization, and evaluation. It is so simple that everyone can easily understand and implement without limitations. Below is the example of a simple function:
 <el eltype="txt" x="30" y="30" datatype="static" dataval="Kshitij Munankami" font="Arial" color="blue" size="20" bold="true" embedFonts="true" _rotation="5" letterSpacing="5"/>

XML in E-Commerce

What is the value of XML in e-commerce?  Give examples of its usage.

# In the current business world, there is an intense demand of online marketplace. To be successful in this immense competition of business one should have to effectively support and guide to customers in online relationship spectrum and have to appreciate that the intermediate goal of product recognition, web traffic, registered users and online sales which is not as essential as generating customer loyalty. These identified opportunities can be employed by implementing XML technology; will have the most success designing and effective online marketing strategies.
Some of the significant values of XML towards e-commerce are as follows:
  •  Promotional awareness: Initially, companies have to catch the attention of marketplace by representing how their products are relevant to potential customers. For that, company can grab lots of benefits by managing promotional information directly in XML. For instance, particular promotional XML documents can be circulated via multiple distribution channels. Using XML allows company to create multiple versions of promotional material to targeting more to the customers by using separate transformations for assorted market segments.
  •  Longevity: XML data exists as plain text which gives data long life with potential of readability and reuse of data. So, even if the system becomes obsolete, data will remain there for a long term.
  • Business to Business communication: While conducting e-commerce, it involves communication between other companies and often might poses a challenge. XML make the communication easier. For instance, company don’t have to bother to know how the other’s back-end system are organized, by developing the mapping to transform CML document into the internal format used be the back-end systems will keep privacy. Likewise, by following the protocol (the XML vocabulary), the host company don’t have to bother to interact with the system of the new company for an addition of another partner, etc.
  • Freedom of Extensibility: XML provides a standard framework to create business-oriented markup vocabularies as it is a meta-language.
  • Loyalty: XML can facilitate organizations implement strategies targeted to retain the satisfactory of the customer such as, XML provides companies with a mechanism to improve their online customer support by allowing users to directly access enterprise support information such as technical documentation or operations data. Similarly, it can ensure the delivery of the product, once customers have acquired items online and also it make sure that the services is executed as promised. XML- based web services facilitate to link business partners together in order to provide the high quality service that encourages repeat purchases.



Wednesday, 22 December 2010

Why is the W3C XML Schema important?  Give examples of its role.

# XML is established based on two facts, represent documents and data as trees and represent the types of documents and data using tree grammars. Tree grammars are represented based on DTDs or XML Schema. In additional, W3C XML schema was the initial separate schema language for XML to get recommendation status by W3C. Due to the confusion of XML schema as a specific W3C specification and use of the same term to describe schema languages in general, some referred it as WXS, and rest referred as XSD.
W3C XML schema provides a mechanism for specifying the structure and constraints on XML documents. They offer a means for describing the structure, content and semantics if XML documents in more details. It is more powerful than DTDs. Among other things, it uses a uniform XML syntax, supports derivation of documents types, permits al groups and nested definitions and provides automatic data types in addition to character data.  Below is some more importance of W3C XML Schema:
  • One of the most significance of XML Schemas is its support for data types. With support for data types it makes easier for many works such as to describe document content, validate the correctness of data, work with data from a database, convert data between different data types, etc. For instance, below is the simple schema document to describe student details.



<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified"
  <xs:element name="StudentDetails">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="StudentID" type="xs:string" minOccurs="0"/>
        <xs:element name="Name" type="xs:string" />
        <xs:element name="Course" type="xs:string" />
        <xs:element name="Year" type="xs:string" />
        <xs:element name="Email" type="xs:string" />
         </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>  
  • Another great strength of XML Schema is written in XML. Because of those benefits we don’t have to learn a new language if we have knowledge about XML, can use XML editor to modify the schema files, can use XML parser to parse schema files, etc.
  •  XML Schemas are extensible in nature because they are written in XML. And with this features of XML Schema we can reuse schema on other schemas, we can create individual data types resulting from the standard types, reference multiple schemas in the same document.
  • The XML document should always be in well-formed and for that the document should follow all the rules of the XML syntax. But even if documents are well-formed they can still have some errors and that can be a serious problem which can be caught by the use of XML Schema.

Monday, 20 December 2010

Simple API for XML (SAX)

Evaluate SAX (the XML API, giving examples of usage)

# SAX stands for Simple API for XML. It is a sequential access parser API for XML. It provides a mechanism for reading data from an XML document. It is callback implementation. Some open source projects like Apache and also some commercial users like Sun, IBM, and Microsoft uses it broadly. SAX is known for being the most efficient standard way to process XML, far from the easiest. It is a java base API and is very robust and effective.  Likewise DOM, it also allows the access of information in an XML document, but its different form DOM. When using DOM, the DOM object is instantiated, the XML document is loaded and the elements and attributes are accessed as needed from the data tree. The document can be transformed, added to it and can be output in any style. However, the SAX is event driven; the full XML document doesn’t load at the starting. Instead, it loads part by part, in sequence. An even executes at each stage as the section developments. For instance, consider the following XML code:
<?xml version=“1.0” ?>
<Student>
            <name>Kshitij Munankami</name>
</Student>

The parse steps and executes in following events:
startDocument
startElement: Student
startElement: name
character: Kshitij Munankami
endElement: name
endElement: Student
endDocument
In compare to DOM, it requires a bit more work for setting up a program. As SAX is an event-driven method, it is harder to visualize. Also back up to an earlier part or rearrangement of the document is not allowed in SAX. However, even if we plan to build DOM application, there are lots of important reasons that we should know about SAX model:
  •  Same error handling: Both SAX and DOM APIs generate similar expectations, so the error handling code is vertically identical.
  •  Handling validation errors: By default, the specifications want that validation errors ignored. So, we should have the knowledge of how SAX error handling works, if wants to throw an exception in the event of a validation error. 
  • Converting existing data: There is some mechanism to convert a data to an XML. So, take benefits of that mechanism requires knowledge of the SAX model.

Document Object Model (DOM)

What is the Document Object Model? Describe its purposes and its use, with examples.

# The Document Object Model (DOM) is a collection of cross-platform and language-independent interface which will allow programs and scripts to access and modify the content, style, layout and structure of documents. The public interface of a DOM is specifies in its application programming interface (API). It is based on an object structure that closely resembles that structure of the documents it models. For example, consider the following code extract from an XHTML document:
<table>
  <tbody>
    <tr>
      <td>Kshitij</td>
      <td>Bidhya</td>
    </tr>
    <tr>
      <td>Lee</td>       
      <td>Baldoph</td>
    </tr>
  </tbody>
</table>
Its graphical representation is as follows:


 And an example of DOM manipulation using ECMAScript:
//access the tbody element from the table element
Var myTbodyElement = myTableElement.firstChild;
//remove first id element
mySecondTrElement.removeChild(mySecondTrElement.firstChild);

Basically, it helps for representing and interacting with objects in HTML, XHTML and XML documents. It states the logical structure of documents and the way a documents is accessed and operated. XML is a mark up language that is used as a way of representing and organizing different kinds of data and information. It present this data as documents where as DOM may be used to manage this data. DOM facilitates developers to build documents, navigate their structure, update, modify, add & delete elements and contents.
With the help of DOM, programmers can easily accessed and update the content in an HTML or XML document.
The goals of DOM objects and interfaces are it gives a consistent and flexible view of document’s contents. A program not only allows its data to be manipulated by other routines, by supporting the DOM API it also allows to reuse those manipulations other DOMs, or to take benefit of those solutions which are already written from those DOMs. The valid example of this was dynamic-HTML scripts; being agreed on the DOM as their standard representation of the document; that scripts written will work properly on all browsers. This not only applies to small programming instead it does to larger-scale programming as well. For instance, a server-side solution might be built out of multiple reusable components, which may or may not all share a single DOM implementation.
So if there is a better implementation on one of the modules which become available, then the existing connection could be unplug and plug in the new component with less recoding.
Likewise, as DOM implementation should be interoperable, they may be different significantly in code size, presentation of individual operations, etc. So, the aptitude to unplug and replace the DOM itself may also be very useful for programmer.

XML-SVG

Describe and discuss Graphical XML – SVG, giving examples.

# SVG stands for Scalable Vector Graphics (SVG). It is a family of specification of an XML based file format for describing 2D graphics, both static and dynamic. Its image and their behaviours are identified in XML text files. Since they are XML files, SVG image cab be created and modified with any text editor. SVG is mostly applied to create graphical web pages and it also could be merged with XUL. To develop graphics for web, it replaces flash. XML numeric data can be twist into graphics by the help of an XSL transformation. In a simple word, it is an XML document with graphical tags. Its output is viewed with an ordinary browser with a plug-in, or a unique viewer with a common browser with a plug-in. It is compatible with HTML 4.0 and XHTML 1.0. It can be used by following:
·         As a individual webpage
·         Embed with the include tags
·         Linked with the link <a> tag.
·         Included by a CSS or XSL property or in XHTML.
For example:
<embed src=”kshitij.svg” type=”image/svg+xml” width=”100” height=”100”>

Following extension can be used on SVG documents:
·         XLink
·         XPointer
·         Stylesheet
·         DOM
            The key idea for motivating SVG was simple to create a generic document-oriented solution for graphics that can be adapted to modern media. As with XML, SVG also lets a developer to organize graphical objects hierarchically in a tree structure. And through inheritance, the grouping and structuring ability offers a great flexibility for both transformation and styling. For instance, some distinct graphical objects (let’s say four) with one single transformation instruction. Likewise, all the objects could be filled with a particular colour by using a single styling instruction at the group level. Moreover, all SVG elements can be given individual XML Ids so they can be reference easily in other parts of the document. So, SVG is not the only possible candidate available, but its integration with other rock-solid XML technologies makes it an ideal fit for ever expanding XML workflows. Below is the simple example for SVG:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC>
<svg width="100%" height="100%" version="1.1"
xmlns="
http://kshitij-palpa.blogspot.com/">
<circle cx="100" cy="50" r="40" stroke="black"
stroke-width="2" fill="red"/>
</svg>


Tuesday, 7 December 2010

XLink

Discuss the notion of Xlink.  What is its purpose and how do you use it? Give example to illustrate your answers.

# Xlink stands for XML Linking Language. It allows elements to be inserted into XML documents in order to create and describe links between resources. It uses XML syntax to create structures that can describe the simple unidirectional hyperlinks of today’s HTML, as well as more sophisticated links. It is an explicit relationship between resources. There are six XLink elements; only two of them are considered linking elements. Whereby, others provide various pieces of information that describe the characteristic of a link. One of the common uses of XLink is to create hyperlinks. Along with providing linking data structures, it also gives a minimal link behaviour model; higher-level applications layered on XLink will often specify alternate or more sophisticated rendering and processing treatments. It has been informed by knowledge of established hypermedia systems and standards. It especially influences the following standards:
  • HTML: defines many element types that represent links.
  • HyTime: defines inline and inbound and third-party link structures and some semantic features, including traversal control and presentation of objects.
  • Text Encoding Initiative Guidelines: gives structure for creating links, aggregate objects and link collections.

In HTML, we know that the <a> element defines a hyperlink. But, this is now how it works with XML. In XML, any names can be given to the element; therefore it is difficult for browser to predict what hyperlink elements will be called in XML documents.
For example:
<?xml version="1.0"?>
<homepages xmlns:xlink="
http://kshitij-palpa.blogspot.com/ ">
<homepage xlink:type="simple"
xlink:href="
http://kshitij-palpa.blogspot.com/ ">Visit blog</homepage>
</homepages>
For access to the XLink attributes and features, XLink namespace must be declare at the top of the document.
The XLink namespace is: "http://kshitij-palpa.blogspot.com/".
The xlink:type and the xlink:href attributes in the <homepage> elements define that the type and href attributes come from the xlink namespace.
The xlink:type="simple" creates a simple, two-ended link (means "click from here to go there"). We will look at multi-ended (multidirectional) links later.

XSLT transforming and sorting XML

How can XSLT be used (a) to transform an XML structure and (b) to sort the contents of an XML document?

# To start the process, the XSLT processor begins with a node list containing only the document root. It finds the template matching this root node—typically the rule with match="/"—and instantiates the contents of the template in the result tree. If the template contains elements from the XSLT namespace that select other nodes to process, the sequence of matching and template content instantiation continues recursively until there are no nodes left to process. When processing is completed, the result tree represents the target document produced by the transformation.
It has some templates rules which have a pattern of identifying the nodes it matches and a template to be instantiate and output when the pattern is matched. During the process of transforming an XML document using an XSLT style sheet, XSLT walks the XML document tree, looking at each node in turn.
The processor compares each node on the XML document with the guide of each template rule in the style sheet and if the processor finds a node that matches a template rule's pattern, it outputs the rule's template.  A diagram for transformation process is as follows:


Previously, in blog there are number of enormous benefits for XSLT has been stated to transform XML documents. Such as one can carefully organize document content before formatting it for display with CSS or XSL-FO.
            XSLT also helps in sorting and the simplest way to do so in to use the <xsl:sort> element. This element allows sorting the nodes in a node set according to specified criteria. One of the most common operations performed on databases is sorting, in which items are organized according such as date, quantity, etc. For example, in the given code it uses the name element as the key and then sorts nodes within the node set in ascending order. The data type is set to text to indicate that the sorting routine is text-based.
<xsl:for-each select="studentdetails">
  <xsl:sort select="name" order="ascending"/>
  <div style="width:450px; padding:5px; margin-bottom:10px; border:5px double black;
    color:black; background-color:white; text-align:left">
    <xsl:apply-templates select="name"/>
    <xsl:apply-templates select="course"/>
    <xsl:apply-templates select="year"/>
    <hr />
    <xsl:apply-templates select="grade"/>
    <hr />
    <xsl:apply-templates select="email"/>
  </div>
</xsl:for-each>
In this example, the xsl:sort element is used to sort the student details prior to display each of them.

XSLT style sheet

How can XML be styled using XSLT style sheets?  What are the strengths and weaknesses of using XSLT style sheets?  Give example to illustrate your answers.

# XSLT stands for Extensible Stylesheet Language Transformation. It is declarative, XML-based language used for the transformation of XML documents into other XML documents. It is also used to convert XML data into HTML or XHTML documents for display as a web page. XML is the partition between content and the layout achievable through applying external CSS or XSL style sheets to XML documents. However, since work started on XSL, the centre of attention has shifted from presentation towards transformation. It has given a birth to XSLT. It is much more widely used than its formatting counterpart, XSL formatting objects. http://www.xml.com/pub/a/2000/07/26/xslt/xsltstyle.html
It has some templates rules which have a pattern of identifying the nodes it matches and a template to be instantiate and output when the pattern is matched. During the process of transforming an XML document using an XSLT style sheet, XSLT walks the XML document tree, looking at each node in turn.
The processor compares each node on the XML document with the guide of each template rule in the style sheet and if the processor finds a node that matches a template rule's pattern, it outputs the rule's template. For instance:
<?xml version="1.0" encoding="UTF-8"?>
 <MiddlesexUniversity>
  <Student username="KM993">
    <name>Kshitij</name>
    <ID>M00310873</ID>
  </Student>
  <Student username="BG984">
    <name>Bidya</name>
    <ID>M00310863</ID>
  </Student>
</MiddlesexUniversity>

A transformation of his document operates on its corresponding node tree. The tree of nodes always begins with a root node for XML document which represents the document itself. In the given example, the child nodes of root can be the single document element node <MiddlesexUniversity >. The child nodes of document element can be any blending of text nodes and element nodes. Due to which, each of which may have same child nodes. This nesting of nodes forms a tree.

Transforming the given XML document using XSLT which provide template to do so:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:output method="xml" indent="yes"/>

  <xsl:template match="/ MiddlesexUniversity ">
    <root>
      <xsl:apply-templates select="Student"/>
    </root>
  </xsl:template>

  <xsl:template match="Student">
    <name username="{@username}">
      <xsl:value-of select="name" />
    </name>
  </xsl:template>
 </xsl:stylesheet>
Its assessment results to a new XML document:
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <name username="KM993">Kshitij</name>
  <name username="BG984">Bidya</name>
</root>

To start the process, the XSLT processor begins with a node list containing only the document root. It finds the template matching this root node—typically the rule with match="/"—and instantiates the contents of the template in the result tree. If the template contains elements from the XSLT namespace that select other nodes to process, the sequence of matching and template content instantiation continues recursively until there are no nodes left to process. When processing is completed, the result tree represents the target document produced by the transformation.
Some of its strength and weakness are as follows:
Strength:
  • XSLT is native to XML
  • Easy to merge XML data into a presentation
  • More resilient to changes in the details of XML document
  • It is a very powerful language as a little code can do a lot
  • Reasonably fast

Weakness:
  • It is suited to handling what’s marked up not what isn’t
  • Memory intensive and suffers a performance penalty
  • Difficult to implement complicated business rules
  • Have to learn a new language if not already familiar
  • Can’t change the value of variables (require recursions)


CSS to style XML

How can XML be styled using CSS?  What are the strengths and weaknesses of using CSS?  Give example to illustrate your answers.

# Cascading Style Sheets (CSS) is a style sheet mechanism that has been specifically developed to meet the needs of Web designers and users. It enables the separation of document content from document presentation, including elements such as layout, colours, and fonts.
XML uses markup to describe the structure and data content of a document, making it easy both for authors to write it and for computer programs to process it. But it is not a language of display. In fact, documents written with XML will have no formatting at all. So there comes CSS. CSS makes it possible to present that document to the user in a browser. The key to viewing XML in a browser is CSS. It allows defining every aspect of XML document, from the size and colour of text to the background and position of non-text objects.
Some of its strengths and weakness if using CSS are as follows:
Strengths:
  • Flexibility: A considerable amount of flexibility can be programmed, which allow a contributor to select the layout of document although not familiar with CSS.
  • Efficiency: It can be used on multiple pages without being reloaded, increasing download speeds and reducing data transfer over a network.
  • Consistency: Any changes or adjustment can be made easily, simply by editing a few rules.
  • Simple Page Editing: With its feature, with a simple change one one line, a different stylesheet can be used for the same page.

Also there are many weaknesses that can be found using CSS to style XML, such as:
  • Inconsistent browser support
  • Selectors are unable to ascend
  • Vertical control limitations
  • Absence of expressions
  • Lack of orthogonality
  • Margin collapsing

Not powerful as XSL, this is another language use to style XML document.
Example of XML document styled using CSS:
Step1: Create and XML file and save it:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet type="text/css" href="CSSexamples.css"?>
<CSSexamples>
< CSSexample>
<name>XML </name>
</CSSexample>
<CSSexample>
<name>Kshitij Munankami</name>
</CSSexample>
</CSSexamples>
Step 2: Create a CSS file and save it into the same folder where the XML file is:
CSSexamples 
{
margin:10px;
background-color:#ccff00;
font-family:verdana,helvetica,sans-serif;
}
 name
{
display:block;
font-weight:bold;
}