Transforming XML to SQL-Based Databases

During any discussion of advanced XSLT topics, it’s worthwhile to mention Saxon’s SQL extension elements. Using Java Database Connectivity (JDBC), you can work with SQL-based databases. You’ve already seen XML to XML transformations, to HTML, to XHTML, to plain text, to RTF, to JavaScript, and so on in this book. Now you’ll see an XML transformation to a SQL-based database.

Using Instant Saxon

Note that you cannot use the prebuilt Windows-only saxon.exe to connect to JDBC databases. You should run the Saxon Java class com.icl.saxon.StyleSheet instead, as I do at the end of this example.

In this example, I add the data in planets.xml to a Microsoft Access-style database, planets.mdb. If you want to follow ...

Get Inside XSLT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.