This repo mainly contains exercises for xml in the introduction to database course held by Stanford. It also includes related exercises from the Database Systems: The Complete Book.
The bin
folder contains script to run xquery or xslt easier.
The vim-utils
contains a util funciton I used to make xquery easier to run inside vim.
First, install the xpath/xslt implementation on unix system - saxon.
On Mac:
brew install saxon
Others, follow the instruction on the official site.
Use the bin file xquery
in this repo. It is a simple wrapper around saxon
to make queries easier to type.
Important: Each xpath file should only contain one return
clause, so you need to comment out other clauses to make it running.
xquery <xpath file>
If you are using vim
you could use the function I write in vim to run the pieces of code one by one. Just select the code you need to run in a visual block, and press<leader>xe
to run them.
More detailed usage: checkout the document on the official site for more details.
Use the bin file xslt
in this repo. It is a simple wrapper around saxon
to make queries easier to type.
xslt -xsl:<xslt file> <original xml>
More detailed usage: checkout the document on the official site for more details.