Megan Taylor

front-end dev, volunteacher, news & data junkie, bibliophile, Flyers fan, sci-fi geek and kitteh servant

Intro to Databases: Querying XML, XSLT

Extensible Stylesheet Language with Transformations

XSLT: Rule-Based Transformations
– Match template and replace
– Recursively match templates
– Extract values
– Iteration (for-each)
– Conditionals (if)
– Strange default/whitespace behavior
– Implicit template priority scheme

Using bookstore data

Query Template

Book and magazine titles, relabeled

All books costing less than $90

Discard books, but also copy books and magazines

ERROR: Ambiguous rule match
Still does transformation, uses the “most specific” template, or second template if specificity is equal

Copy entire input data

Copy entire input data (recursively)

allows adding exceptions

copy document but transform all attributes to subelements, author name subelements to attributes

HTML table of books costing less than $90, sorted by price

Expunge “Jennifer”, change “Widom” to “Ms. Widom”

Same transformation with one template

November 17, 2011 | Comments Off on Intro to Databases: Querying XML, XSLT | Categories: Posts | Permalink

Comments are closed.