You are on page 1of 8

Biography AlexandruCOSTIN

UsingthePowerofXMLwith Dreamweaver
AlexandruCOSTIN
th October1619 ,2005

PresidentofProductsDivision,InterAKTOnline

InterAKTMacromediapartners ExtendDreamweaverfordevelopers PHPsupportforDreamweaver ColdFusion7supportforDreamweaver

Ideas in motion.

Softwareusability

Assumptions
YouarefamiliarwithDreamweaver YouhavelittleornoColdFusionknowledge YouhavenoexperiencewithXMLandXSL

Topics
AnoverviewofXMLandXSL TheDreamweaverXML/XSLsupport ManagingXMLandXSLfiles XMLbindings VisuallyconstructingXSLtemplates UsingtheXSLcommands Clientsidetransformation Serversidetransformation RSSfeeds AdvancedXML/XSLtechniques DynamicXMLgeneration XSLfragments

WhatisXML?
XMLeXtensibleMarkupLanguage Structureandstoreinformation HTMLdefinethelayoutandformattingofapage XMLdefinethestructureofdata,open Communication Heterogeneousnetworks Webservices Separatedatafrompresentation

XMLsample
<?xmlversion="1.0"encoding="iso88591"?> <bookstore> <bookauthor="JulesVerne"> <title>TwentyThousandLeaguesUnderthe Sea</title> <year>1870</year> </book> <bookauthor="JulesVerne"> <title>Aroundtheworldin80days</title> <year>1872</year> </book> ...

Elements<book>.</book> Attributes author="JulesVerne"

Dreamweaverenvironment

SyntaxHighlighting
NodesandAttributesareblue Attributevaluesaregreen Nodevaluesareblack

Bindingspanel Maincodeeditor

Filespanel PropertyInspector Resultspanel

TheDreamweaverXMLsupport
XMLEditor
Codecompletion,Syntaxhighlighting

Exercise1
OpenDreamweaver SelecttheSA101HsiteintheFilespanel
Thesiteshouldalreadybedefinedforyou.

Doubleclickthebookstore.xmlfileinthe Filespanel,toopenitinDreamweaver.

Autoclosetags

XMLvalidity
WellformedXMLdocuments: Tagsarecorrectlynested(nocrossnesting)
Good:<book><title></title></book> Bad:<book><title></book></title>

WhatisDTD?
DocumentTypeDefinition DescribesthestructureofanXMLfile Allowedelements(nodes) Allowedattributes
<!ELEMENTbook(title,year)> <!ATTLISTbook authorCDATA#REQUIRED

Attributevaluesareenclosedbetweenquotes
Good:<bookauthor=JulesVerne> Bad:<bookauthor=JulesVerne>

ValidXMLdocuments(DTDorXMLSchema) AllowedelementsinanXMLdocument <book>musthavea<title>childnode

> <!ELEMENTbookstore(book+)> <!ELEMENTtitle(#PCDATA)> <!ELEMENTyear(#PCDATA)>

XMLValidationinDreamweaver
Dreamweavertoolbar

Exercise2
CheckingthevalidityofanXML

document
Withthebookstore.xmlfileopen,select ValidateCurrentDocumentfromthe Documenttoolbar Intentionallygenerateseveralerrors,byeditingthe XMLfile.Trytoapplythecommandagain.

DTDvalidation(checkXMLdoccompliance)

WhatisXPath?
LanguageforfindinginformationinanXML

XSLtransformingXMLtrees
XSLExtensibleStylesheetLanguage Powerfullanguage
<xsl:templatematch="/"> <xsl:valueofselect="/bookstore/book[1]/@author"/> </xsl:template>

document
Folderlikesyntax /bookstore/book/title/
TwentyThousandLeaguesUndertheSea

/bookstore/book[1]/@author
JulesVerne

Result:
JulesVerne

TheXSLtransformation

Exercise3
ConvertinganHTMLpagetoan

XSLTdocument:
Openthebookstore.htmlfileinDreamweaver SelectFile>Covert>XSLT1.0toconverttheHTML pageintoanXSLTdocument. SwitchtoCodeView(fromtheDocumenttoolbar) Havealookatthegeneratedcode.

XMLtree

XSLtransformation

Output(XHTMLpage)

XMLbindings
GototheBindingspanel(orselectWindow

LinkingtheXSLTdocumenttobookstore.xml
Bindingspanel: ClickXMLlink,or: ClicktheSourcelinkintheBindingsheader Choosetoattachalocalfile UsetheBrowsebuttontolocateandselectthe bookstore.xmlfile

Bindingstomakeitvisible).

Youcandefinean

XMLdatasourcefor thecurrentXSLT document.

ThecanonizedXMLtree
XMLtree <>node
+ node <> @attribute

DisplayingXMLData
DraganddropfromtheXMLtreeintheBindings

panel

Exercise4
LinkingtheXSLTfiletotheXMLtree LinktheXSLTfilecreatedatExercise3 tobookstore.xmlfile. UsedraganddropinDesignView,toreplace theBooktitle,YearandAuthortextwiththe correspondingXMLnodes

Exercise5
FormattingtheXMLdata ApplyMathFloorformattingfunction ontheyearfield,bydoubleclickingitin yourpage.

Insertingarepeatregion
Displayingmultipletablerows(oneforeachbook)

RepeatRegionRepresentation
Childnodesareupdated(Xpathexpressionsare

relative)

PreviewingtheCompletedOutputPage
AllXMLnodesaredisplayedasrows:

AddFilterConditionontheRepeatRegion
book@author = JulesVerne

TheFilteredOutput
OnlybooksbyJulesVernearedisplayed:

Exercise6
Insertingarepeatregion Selecttablerowthatcontainsbookinfo GotoInsertbarXSLTtabRepeatRegion ClickBuildFilter. Selectthe<book>node,thenclickplustoadda condition Enter'JulesVerne'intheValuetextfield.

TheactualXSLtransformationclientside
Browserinternals RequestXMLfile Detectslinkto XSLfile RequestXSLfile Createsoutput Displayoutput

LinkingtheXSLTFiletoanXMLFile
CommandsAttachanXSLStylesheet

PreviewXMLfileinthebrowser
AutomaticXSLtransformation

Exercise7
ClientsideXSLTransformation Attachthebookstore.xsldocument totheXMLtree(bookstore.xml).

TheactualXSLtransformationserverside
ColdFusionserver LoadXMLfile Requestoutput LoadXSLfile Displayoutput

UsingtheXSLTransformationServerBehavior
Applicationpanel ServerBehaviors

XSLTransformation

Createsoutput

ConfiguringtheXSLTransformation
PreloadXMLfile,ifspecified

Generatedcode
CalltoColdFusionComponent,thathandlesthe

serversidetransformation

Previewinbrowser
XMLtreeistransformedontheserverand

Exercise8
ServersideXSLTransformation

displayedinanybrowser.

ImportinganRSSfeed
RemoteRSSfiles

Exercise9
ImportinganRSSfeed

arecached

AdvancedXSLTechniques
DynamicXMLfromdatabase XSLfragments XSLtemplates Performanceconsiderations

WhatDreamweaverIsNot
DreamweaverdoesnothaveXMLSchema

support
DreamweaverisnotanXMLspy

Summary
DreamweaverisagoodXMLeditor Dreamweaver8isasolidtoolintheXMLworld LearnXMLandXSLconcepts(XMLandXSLTO'ReillyReference) DreamweaveroffersVisualXSLTransformationfeatures XSLTransformation Clientside Serverside

Resources
W3Schools http://www.w3schools.com/default.asp Zvon http://www.zvon.org/

Thankyou.

Ideas in motion.

You might also like