Planet web2.0thebook Aggregated content relevant to the upcoming book "Professional Web 2.0 Programming"...."> Planet web2.0thebook Aggregated content relevant to the upcoming book "Professional Web 2.0 Programming"....">

Presentation is loading. Please wait.

Presentation is loading. Please wait.

Set 8.5: XSLT Continued IT452 Advanced Web and Internet Systems.

Similar presentations


Presentation on theme: "Set 8.5: XSLT Continued IT452 Advanced Web and Internet Systems."— Presentation transcript:

1 Set 8.5: XSLT Continued IT452 Advanced Web and Internet Systems

2 XML with namespaces <rdf:RDF xmlns:rdf="http://realPrefixRemovedForThisDemo.org#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" > Planet web2.0thebook http://web2.0thebook.org/ Aggregated content relevant to the upcoming book "Professional Web 2.0 Programming". <item rdf:about="http://www.orbeon.com/blog/2006/06/13/firebug-a-must-have..."> XForms Everywhere http://www.orbeon.com/blog/2006/06/13/firebug-a-must-have Alessandro Vernet recommends FireBug... evlist 2006-06-15T05:56:16Z ajax debugger dom firefox javascript... Web 2.0 at Prague http://eric.van-der-vlist.com/blog/2504_Web_2.0_at_XML_Prague.item Eric van der Vlist will do a presentation about Web 2.0......

3 Example 1: XML transformed by XSLT <rdf:RDF xmlns:rdf="http://realPrefixRemovedForThisDemo.org#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" > Planet web2.0thebook http://web2.0thebook.org/ Aggregated content relevant to the upcoming book "Professional Web 2.0 Programming"....

4 Example 1: The XSLT (1_rss.xsl) <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://realPrefixRemovedForThisDemo.org#" xmlns:rss="http://purl.org/rss/1.0/" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="rdf rss">

5 Status Check We have XML documents. We have XSLT stylesheets. We changed XML docs into entire XHTML pages. Let’s transform XML into a subpart of an XHTML page. –Use Javascript. Don’t create and tags, just create a or and insert it into the page.

6 Example 2: HTML inserts transformed XML Professional Web 2.0 Programming A page with some exciting content Web 2.0 offers developers substantial advantages if they design their web applications as service providers and service consumers. This change in architecture has opened up an incredible number of options for flexible design, creative reuse, and easier updates. There is, however a cost: doing this requires rethinking how to apply many traditional web development technologies, as well as adding some new ideas. Below is some content from elsewhere: This element should be replaced by JS. If you see this content, something went wrong with the XSLT!

7 Example 2: HTML inserts transformed XML var xml = null; var xsl = null; function transform (xmlFileName, xslFileName) { // Get the XML input data $.get(xmlFileName, function(data) { xml = data; insertXML(); }); // Get the XSLT file $.get(xslFileName, function(data) { xsl = data; insertXML(); }); } function insertXML() { // Make sure both AJAX requests have returned. if( xml != null && xsl != null ) { // Transform the XML via the XSLT var processor = new XSLTProcessor(); processor.importStylesheet(xsl); var newDocument = processor.transformToDocument(xml); // Replace part of original document with the new content var o = document.getElementById("planet"); var n = newDocument.getElementById("planet"); o.parentNode.replaceChild(n, o); // Reset the variables to null. xml = null; xsl = null; }

8 Example 3: Improved XSL... A page with some exciting content...

9 Example 3: Improved XSL <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://realPrefixRemovedForThisDemo.org#" xmlns:rss="http://purl.org/rss/1.0/" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="rdf rss">... (more on next page)

10 Example 3: Improved XSL --> -->

11 Example 4: Nicer Looking XSL Output... A page with some exciting content...

12 Example 4: Nicer Looking XSL Output <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://realPrefixRemovedForThisDemo.org#" xmlns:rss="http://purl.org/rss/1.0/" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="rdf rss">.... Get it!

13 Example 4: Nicer Looking XSL Output --> -->

14 Example 5: Simplified XSLT <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://realPrefixRemovedForThisDemo.org#" xmlns:rss="http://purl.org/rss/1.0/" xmlns="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="rdf rss">.... Get it!

15 Example 5: Simplified XSLT -->


Download ppt "Set 8.5: XSLT Continued IT452 Advanced Web and Internet Systems."

Similar presentations


Ads by Google