欢迎来到天天文库
浏览记录
ID:7265600
大小:451.44 KB
页数:37页
时间:2018-02-09
《ajax in action live search using xslt》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、iTePub.Net-CollectLivesearchusingXSLTThischaptercovers■Dynamicsearchtechniques■UsingXSLTtotranslateXMLtoHTML■Bookmarkingdynamicinformation■Buildingalivesearchcomponent466LicensedtojonathanzhengiTePub.Net-CollectUnderstandingthesearchtechniques467WithAjax,it’seasytoperform
2、server-sideactionswhilecontrollingwhatishap-peningontheclient.Ifaprocesstakesanextendedperiodoftime,wecanshowanimatedGIFsthatdisplaymessagesthatlettheuserknowwhat’shappening.Theusercanperformotheractionswhiletheserver-sideprocessistakingplaceandwillbelesslikelytothinkthatthebrowserhasfrozen.
3、Inthischapter,weusethisAjaxtechniquetocreatealivesearch.ItutilizesExtensibleStylesheetLanguageTransformations(XSLT)totransformanXMLdocumentintoanHTMLlayout.TheXSLTtranslationiseasiertomaintainthanthecodetomanuallyparsetheXMLandproduceHTMLusingJavaScriptstate-ments.Itusesatree-orientedtransfo
4、rmationonadynamicallygeneratedXMLdocument,whichreplacestheserver-sidecodeandtheJavaScriptonwhichthepreviousprojectsrelied.WeareeliminatingthehasslesofmanuallymakingsurethatalltheHTMLelementsareformedproperly.Aswithpreviousexamples,wefirstdevelopthecodeinastraightforwardwayandthenrefactoritin
5、toareusablecomponent.Bytheendofthischapter,youshouldunderstandtheprinciplesofusingXSLTwithAjaxandhaveaready-rolledsearchcomponentthatyoucandropintoyourownprojects.12.1UnderstandingthesearchtechniquesWhenweperformsearches,weareaccustomedtoseeingthepagefreezewhilethesearchisconductedontheserve
6、r.(Atleast,thisisthecaseonwebsitesthatdonothave1,200clusteredserversthatperformasearchover8billionpagesinlessthanasecond.Thebudgetconstraintsofyourprojectmayvary.)Toeliminatethepause,somedevelopersimplementpop-upwindowsandframes.Theadditionalwindowisusedtoperformtheprocessingsotheuser’sexper
7、iencecanbeenhanced,butthisalsocreatesproblems.WithAjax,wecaneliminatethecom-mondelaysoftheclassicformandframesubmissions.12.1.1LookingattheclassicsearchInaclassicsearchprocess,whenweincludeasearchformonourwebsite,oneormoreformelementsarepostedbackt
此文档下载收益归作者所有