Reducing Web Site and Application Maintenance Using XML with ASP PowerPoint PPT Presentation

presentation player overlay
1 / 44
About This Presentation
Transcript and Presenter's Notes

Title: Reducing Web Site and Application Maintenance Using XML with ASP


1
Reducing Web Site and Application Maintenance
Using XML with ASP
  • Paul Spencer
  • Boynings Consulting
  • paul.spencer_at_boynings.co.uk
  • http//www.boynings.co.uk

2
AGENDA
  • XML in 60 seconds
  • How XML can ease maintenance
  • 4 examples
  • Consistent display from different sources
  • Different displays from the same source
  • Data entry form
  • Using XML when neither the server nor browser
    supports it

3
XML in 60 seconds
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

7 8 9 10 11 12
13 14 15 16 17 18
19 20 21 22 23 24
25 26 27 28 29 30
31 32 33 34 35 36
37 38 39 40 41 42
43 44 45 46 47 48
49 50 51 52 53 54
55 56 57 58 59 60
4
How XML can ease maintenance
5
How XML can ease maintenance
  • Enforcing a common format
  • Re-use of data
  • Multiple display formats
  • Common material in pages

6
Consistent display from different sources
7
Travel example
regional host
small local systems
server
users
remote hosts
8
Consistent display?
  • HTML - no
  • HTML CSS - not really
  • XML
  • Definitely
  • And we can allow controlled variations

9
Different displays from the same source (1)
10
The original system
1200/75 bps dialup or 1200 bps leased line
travel agents
Viewdata (videotex)
11
The mark 1 web-based system
Web Server
travel agents
Active Server Pages (application and display)
Comms
12
The new system
Web Server
travel agents
Active Server Pages (application)
Comms
XSL (display)
13
Benefits of XML
  • More reliable web applications
  • Easier to customize
  • Easier application maintenance

14
Different displays from the same source (2)
15
(No Transcript)
16
(No Transcript)
17
(No Transcript)
18
Benefits of XML
  • Automatically change drop-down lists
  • Simple stylesheets for display
  • Easy to customize stylesheets

19
Data entry form
20
Problems using HTML
  • Problem
  • Several hundred fields over many pages
  • Users keep changing screen layouts
  • Solution
  • Define the pages and fields using XML
  • Use XSL and the DOM to display them

21
Displaying a screen of data
repository (XML)
HTML
page descriptions (XML)
forms data
XSL
22
Benefits of this approach
  • Simple to move data from one screen to another
  • Simple to make global layout changes
  • Data such as enumerated values are stored once
    in the repository and used in both the display
    and later for messaging

23
Using XML when neither the server nor browser
supports it
24
Boynings Consulting web site
  • Three types of page
  • Navigation and static pages to be browser
    independent
  • ISP does not support XML (or ASP)
  • I want to minimize my work

25
(No Transcript)
26
My solution
  • Develop in XML
  • Pre-process to HTML before upload

27
The static page tags
28
Docinfo element
  • ltxsltemplate match"docinfo"gt
  • ltHEADgt
  • ltxslapply-templates select"description" /gt
  • ltxslapply-templates select"keywords" /gt
  • ltxslcommentgtCreated
  • ltxslvalue-of select"/.//created/_at_day" /gt
  • ltxslvalue-of_ select"/.//created/_at_month"
    /gt
  • ltxslvalue-of select"/.//created/_at_year" /gt
  • lt/xslcommentgt
  • ltxslcommentgtLast modified
  • ltxslvalue-of select"/.//modified/_at_day" /gt
  • ltxslvalue-of_ select"/.//modified/_at_month"
    /gt
  • ltxslvalue-of select"/.//modified/_at_year"
    /gt
  • lt/xslcommentgt
  • ltLINK rel"stylesheet" type"text/css"
    href"boynings.css" /gt
  • ltxslapply-templates select"robots" /gt

29
Robots element
  • ltxsltemplate match"robots"gt
  • ltMETAgt
  • ltxslattribute name"name"gtrobotslt/xslattribu
    tegt
  • ltxslattribute name"content"gt
  • ltxslvalue-of select"_at_content" /gt
  • lt/xslattributegt
  • lt/METAgt
  • lt/xsltemplategt

30
Defined HTML elements
  • ltxsltemplate match"TABLE TR TD SELECT
    OPTION MAP AREA A BR"gt
  • ltxslcopygtltxslapply-templates select"_at_
    text()"/gtlt/xslcopygt
  • lt/xsltemplategt

31
General HTML elements
  • ltxsltemplate match"html"gt
  • ltxslapply-templatesgt
  • ltxsltemplate match" _at_ comment()
    text()"gt
  • ltxslcopygt
  • ltxslapply-templates select"_at_
    comment() text()" /gt
  • lt/xslcopygt
  • lt/xsltemplategt
  • lt/xslapply-templatesgt
  • lt/xsltemplategt

32
Handling script - XML
  • ltscriptgt
  • lt!CDATA
  • function onLoad()
  • var str,browser
  • if (navigator.appVersion.indexOf("MSIE 4") !
    -1)
  • document.all("ie4").innerHTML 'ltA
    href"salesie4/sales.htm" target"_top"gtTry the
    systemlt/Agt'
  • if (navigator.appVersion.indexOf("MSIE 5") !
    -1)
  • document.all("ie5").innerHTML 'ltA
    href"salesie5/sales.htm" target"_top"gtTry the
    systemlt/Agt'
  • gt
  • lt/scriptgt

33
Handling script - HTML
  • ltSCRIPTgt
  • //lt!--
  • function onLoad()
  • var str,browser
  • if (navigator.appVersion.indexOf("MSIE 4") !
    -1)
  • document.all("ie4").innerHTML 'ltA
    href"salesie4/sales.htm" target"_top"gtTry the_
    systemlt/Agt'
  • if (navigator.appVersion.indexOf("MSIE 5") !
    -1)
  • document.all("ie5").innerHTML 'ltA
    href"salesie5/sales.htm" target"_top"gtTry the_
    systemlt/Agt'
  • //--gt
  • lt/SCRIPTgt

34
Handling script - templates
  • ltxsltemplate match"script"gt
  • ltSCRIPTgt
  • ltxslapply-templates select"_at_"/gt
  • ltxslapply-templates /gt
  • lt/SCRIPTgt
  • lt/xsltemplategt
  • ltxsltemplate match"cdata()"gt
  • //ltxslcommentgtltxslvalue-of /gt//lt/xslcommentgt
  • lt/xsltemplategt

35
The navigation frame XML
  • lt?xml version"1.0"?gt
  • lt?xml-stylesheet type"text/xsl" href"toc.xsl"?gt
  • lttocgt
  • ltentry href"main.htm" text"Home" /gt
  • ltentry href"relation.htm" text"Relationship
    Management" /gt
  • ltentry href"xml.htm" text"XML"gt
  • ltentry href"book.htm"gtBook - XML Design and
    Implementationlt/entrygt
  • ltentry href"x-eg.htm" text"Examples"gt
  • ltentry href"x-eg1.htm" text"Multiple
    Outputs from an XML source" /gt
  • ltentry href"x-eg2.htm" text"A
    Browser-based Sales System" /gt
  • ltentry href"x-eg3.htm" text"XML for Data
    Collection /gt
  • lt/entrygt
  • ltentry href"x-tut-fr.htm" text"DOM
    Illustration" /gt
  • ltentry href"x-links.htm" text"XML
    Resources" /gt
  • ltentry href"seminar.htm"gtXML Traininglt/entrygt
  • ltentry href"x-serv.htm" text"Boynings
    Consulting's XML Services" /gt
  • lt/entrygt
  • ltentry href"about.htm" text"About This Site"
    /gt
  • ltentry href"profile.htm" text"Consultant
    Profile" /gt

36
The navigation frame
37
The entry template
  • ltxsltemplate match"entry"gt
  • ltDIVgt
  • ltxslattribute name"Style"gt
  • margin-left1em font-sizeltxslevalgt12-dept
    h(this)lt/xslevalgtpt
  • lt/xslattributegt
  • ltA target"right"gt
  • ltxslattribute name"href"gt
  • http//www.boynings.co.uk/ltxslvalue-of
    select"./_at_href" /gt
  • lt/xslattributegt
  • ltxslvalue-of select"./_at_text" /gt
  • lt/Agt
  • ltxslapply-templates/gt
  • lt/DIVgt
  • lt/xsltemplategt

38
Building the pages - page list
  • lt?xml version"1.0"?gt
  • ltfilesgt
  • ltfilegtmainlt/filegt
  • ltfilegtaboutlt/filegt
  • ltfilegtxmllt/filegt
  • ltfilegtcommercelt/filegt
  • ltfilegtx-eglt/filegt
  • ltfilegtx-eg1lt/filegt
  • ltfilegtx-eg2lt/filegt
  • ltfilegtx-eg3lt/filegt
  • ltfilegtx-linkslt/filegt
  • ltfilegtrelationlt/filegt
  • ltfilegtseminarlt/filegt
  • ltfilegtx-servlt/filegt
  • ltfilegtprofilelt/filegt
  • ltfilegtbooklt/filegt
  • ltfilegttoclt/filegt
  • lt/filesgt

39
The ASP code structure
  • // get the set of files to process
  • // start the display table
  • // now transform each one and save it
  • // get the XML file
  • // if there is a stylesheet PI, get the
    stylesheet (otherwise use make.xsl)
  • // load the stylesheet
  • // process it
  • // save the resulting HTML in the parent
    directory
  • // end the display table

40
Getting the stylesheet name
  • for (var j 0 j lt domSource.childNodes.leng
    th j)
  • var current domSource.childNodes.item(j)
  • if (current.nodeType 7
    current.nodeName "xml-stylesheet")
  • var strPi stripSpace(current.data)
  • var start current.data.indexOf("href")
    6
  • var end current.data.indexOf(".xsl")
    4
  • style current.data.substr(start,end-star
    t)

41
A successful make
42
Benefits of XML
  • Easy to maintain navigation frame
  • Single list of pages, even for browser-specific
    navigation
  • Common text is in the stylesheet
  • (could use entity substitutions in a DTD)
  • I can redesign the site by changing a single
    stylesheet

43
Summary
44
Why use XML with ASP?
  • XML eases the control of display formats for data
    from different sources
  • XML makes it easy to customize displays
  • XML allows us to use the same information in
    different places
Write a Comment
User Comments (0)
About PowerShow.com