XSLT and XQuery


XML makes it pos­sible to store con­tent in a stand­ard­ized format that can be con­ver­ted to a vari­ety of out­put media using a broad choice of tech­no­lo­gies. Most of these tech­no­lo­gies build on related W3C stand­ards with both com­mer­cial and open source tools sup­port. XSLT lets you define a trans­form­a­tion of a set of doc­u­ments into a par­tic­u­lar format, so that three XSLT stylesheets could cre­ate pub­lished products from the same con­tent for three dif­fer­ent media. The XQuery lan­guage lets you pull sub­sets of XML con­tent from huge repos­it­or­ies, so that XML data­bases that sup­port XQuery can (among other things) provide dynamic pub­lic­a­tions cus­tom­ized for dif­fer­ent customers.

The classes in this course will show you what you need to put XSLT and XQuery to work, as we look at effi­cient and effect­ive devel­op­ment prac­tices, how to write test-driven XSLT applic­a­tions, and where XSLT, XQuery, and related tech­no­lo­gies best fit into the applic­a­tion archi­tec­ture of a lar­ger system.

Because the “Hands-on Intro­duc­tion to XML” course will provide intro­duct­ory mater­ial on XSLT and XQuery, classes in this course will focus on help­ing exist­ing XSLT and/or XQuery developers get the most out of their code and their devel­op­ment time.

Fac­ulty Board mem­ber Priscilla Walms­ley teaches, as well as Fac­ulty mem­bers Adam Ret­ter, Florent Georges, Tony Gra­ham, and Dr. Jeni Ten­nison.

Classes for 2012

Adding Struc­ture to Con­tent Using XSLT 2.0

Taught by Priscilla Walmsley.

When you repur­pose exist­ing data and con­tent for use in Web and/or Mobile applic­a­tions, eBook read­ers, or other uses requir­ing struc­tured markup, you often need to infer and add that struc­ture to your doc­u­ments. The advanced reg­u­lar expres­sion and group­ing cap­ab­il­it­ies of XSLT 2.0, among other fea­tures, make it an excel­lent lan­guage for con­vert­ing and enhan­cing con­tent. In this class, we will look at the fea­tures of XSLT 2.0 that are most use­ful when you con­vert unstruc­tured or semi-structured con­tent to a more struc­tured vocab­u­lary and work through sev­eral com­mon scen­arios. Attendees are invited to con­trib­ute examples of their real-world con­ver­sion scen­arios either before or dur­ing the session.

Query­ing XML Data­bases with XQuery

Taught by Adam Retter.

This class will provide an over­view of the cap­ab­il­it­ies and use cases of XML data­bases, examin­ing some of the data­base products that sup­port XML and how they are being used. It will then cover the role of XQuery among other XML tech­no­lo­gies in the query­ing of XML databases.

As a group, the class will build a simple search applic­a­tion using XQuery and an XML data­base (eXist). This will provide an oppor­tun­ity for attendees to learn the syn­tax and cap­ab­il­it­ies of XQuery, as well as see it in action. Major fea­tures of the XQuery lan­guage such as FLWOR expres­sions, XML con­struct­ors, and user-defined func­tions will be explained.

Devel­op­ing and Test­ing in XSLT

Taught by Jeni Ten­nison and Tony Graham

Unit tests, pro­fil­ing, debug­ging and, increas­ingly, test-driven devel­op­ment are part of the bread and but­ter of work­ing with other pro­gram­ming lan­guages but are not always so with XSLT or XQuery. In test-driven devel­op­ment, which is a fun­da­mental part of agile approaches to soft­ware devel­op­ment, the developers write tests that describe the desired beha­viour of their applic­a­tion, then write code that meets the tests. This style of devel­op­ment keeps code focused, avoids break­ing exist­ing code and facil­it­ates refactoring.

In this ses­sion, Jeni Ten­nison and Tony Gra­ham will describe both the state of the art in test­ing and debug­ging XSLT and XQuery and how test-driven devel­op­ment applies to XSLT and XQuery devel­op­ment. In par­tic­u­lar, they will focus on the use of the XSpec test­ing framework.

Trends in XSLT/XQuery

Taught by Florent Georges

XSLT 3.0 and XQuery 3.0 are going to come with a lot of new, power­ful fea­tures. Expec­ted to be released by the end of the year (XSLT more likely in 2013), this ver­sion 3.0 will bring those new tools to the XML developers.

XPath 3.0 itself comes with one of the most use­ful of them: func­tion items and higher-order func­tions; that is, the abil­ity to manip­u­late func­tions and pass them around, call­ing them dynam­ic­ally and define new anonym­ous inline func­tions. XQuery 3.0 has numer­ous addi­tions on its own, among them Florent will intro­duce group­ing, win­dow­ing, try/catch, and private func­tions. For XSLT 3.0, the biggest addi­tion is the sup­port for stream­ing trans­form­a­tion; Florent will also intro­duce the pack­ages, the eval­u­ation of dynam­ic­ally com­puted XPath expres­sions, the exten­sion of tem­plate rules to atomic val­ues, the try/catch mech­an­ism and the new xsl:assert instruc­tion. As the final spe­cific­a­tions have not been released yet, those fea­tures might still change, even though some are very stable now. This intro­duc­tion will give you an over­view of the new fea­tures that you will be able to use soon. Pro­cessors even imple­ment some of them already!

The class will also cover XProc, the W3C XML Pipeline lan­guage for describ­ing oper­a­tions to be per­formed on XML doc­u­ments. Released in May 2010, XProc was the miss­ing piece in the XML stack. Every time you used more than one XML tech­no­logy, you had to use another lan­guage, like Java or .NET, in order to glue them together. You then had to know the APIs very well and to be care­ful in con­nec­ted all the pieces together, again and again. XProc allows you to describe your pro­cessing as a net­work of steps, between which flows your XML doc­u­ments. XProc describes the pro­cessing in a declar­at­ive way. No more micro plumb­ing needed in other lan­guages, just use XProc for your pipelin­ing needs!