decalecture8

Uploaded from authorPOINTLite
Views:
 
Category: Entertainment
     
 

Presentation Description

No description available.

Comments

Presentation Transcript

Displaying the XML document: 

Displaying the XML document Summary of last week Coding the stylesheet - .xsl including examples of code XSL Design issues E-Commerce issues Summary

Summary of last week: 

Summary of last week Via XML Spy we used the Microsoft XML parser which includes an XSLT processor. This is the MSXML 4.0 parser (which is pre-installed within IE6.0+) but we could have used any external XSLT processor for this purpose. We assigned a XML stylesheet (a .xsl file) to an XML document (a .xml file). <?xml-stylesheet type="text/xsl" href="PODstyle.xsl"?> MIME type

Summary of last week: 

Summary of last week The XSLT processor analyses the XML document into a hierarchical tree structure (starting with the root) made up of what are called “nodes” – this is called a node tree. This node tree is for internal use.

Part Picture of a node tree: 

Part Picture of a node tree Proofofdelivery Deliverydetails productid rad100 element nodes text node root node

Summary of last week: 

Summary of last week Nodes can be: elements e.g. poddetail attributes e.g. price text e.g. 50.00 The XSLT processor will then use the stylesheet assigned to the XML document, transforming the element that it finds into HTML via your XSL templates. The XSL stylesheet contains instructions on how to use (navigate and display) the nodes.

XSL coding: 

XSL coding What follows is a selection of useful things which we think you can use for the assignment. Exploring everything about XSL/XSLT coding is beyond the scope of this module – too large! For those interested there are a few professional books on this subject area in the library. Look for books by publishers Wrox Press and O’Reilly.

XSL code: 

XSL code Last week we used the xsl:template match=“/” e.g. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www….. "> <xsl:template match="/" /> What does this do?

XSL code: 

XSL code <xsl:stylesheet version="1.0“ xmlns:xsl="http://www.w3….."> This is assigned to create a default namespace – elements declared in the .xsl stylesheet beginning with the prefix xsl will be recognised as belonging to this namespace. To recap on namespaces see the www.w3schools site.

XSL code: 

XSL code We need namespaces in the cases where we want to build an XML document using element names from multiple schemas that might clash with each other e.g. a book tag from Amazon might have a different structure to one from Waterstones but our order XML document offers us the choice of supplier so how does the XML document validate itself?

XSL code: 

XSL code <xsl:value-of select=“element”/> Example of use: <td width="200“ bgcolor="#aaaaff"> <b>Customer ID:</b> <xsl:value-of select="ProofOfDelivery/Customer/CustomerID"/> </td> What does this do? Tree location

XSL coding – useful tips: 

XSL coding – useful tips “static” or constant information. Remember that the stylesheet can incorporate simple text formatting e.g. in our example from last week the POD header information for the address of Westlake Radiators and an associated image. This is good when appropriate – which is; do we need to send this data in the .xml file or do we just need to display it?

XSL code – useful tips: 

XSL code – useful tips Dealing with iteration – how are you going to display the lines of the POD? Firstly revisit the Schema solution for the delivery details. The schema should show that the delivery lines are unbounded i.e. we can have more than one line per POD. We need to reflect this in the stylesheet – how? See next slide…

For-each: 

For-each for-each and value-of tags help us process data effectively. <xsl:for-each select="ProofOfDelivery/DeliveryDetails"> <div align="center"> <xsl:value-of select="LineNo"/> </div> <xsl:for-each />

XSL code – useful tips: 

XSL code – useful tips Creating HTML tables. Use of the HTML tags for tables. <table> can have a border and spacing info specified <tr> rows can have custom styling (also see <th> tag) <td> data cells contain displayable information </td> </tr> </table> Use hex values for colour (named colours work but are not part of the web standards.)

XSL code – useful tips: 

XSL code – useful tips Using HTML attributes Incorporating gif or jpeg files <div align="center"> <img src="title.jpg" width="300" height="200" /> </div> Image width and height attributes are in pixels (naturally) and notice that the img tag has a / at the end of it to comply with the ‘well-formedness’ requirements of XML.

E-Commerce issues: 

E-Commerce issues The how of what to display can be understood but… The what to display is more difficult. Who decides what to display? Do we replicate the existing documents or use the opportunity for change – the XSLT Designer tool might be of some use in this respect in the design of forms. There is obviously a business process reengineering issue (BPR) with the above – the paperless dream! Interesting XML standard for BPR see www.bpmi.org

Summary : 

Summary XSL/XSLT is a programming environment which can be used for web publishing and as we will see in later weeks – manipulation and querying. Business to Business Commerce is all about business forms – E-Commerce of course is the electronic version (or should be…) It follows that careful design of the viewable form is important.