Writing the Stylesheet
So far, you have three XML documents that contain three very
different, but randomly overlapping, grammars. (The
species
and name
elements
appear in different roles in the two main content documents.) Your
goal is to make this information available on the Web to HTML
browsers. You want to reach the widest possible audience, and that
means maintaining the lowest possible expectations of the requesting
client’s capabilities. That is, you cannot rely on
everyone who wants to read your pages having a thoroughly modern
browser capable of doing appropriate client-side transformations to
your XML documents via CSS or XSLT. You must deliver basic HTML if
you expect your data to be widely accessible.
With this in mind, you need a way to transform the disparate data structures contained in each of your XML documents into the unified grammar of simple HTML.That’s where AxKit’s transformational languages and stylesheets enter the picture. AxKit offers many ways to transform XML data. (We will examine the merits of many of these in later chapters.) In this example, we examine how you can transform your cryptozoology documents into HTML using two of the more popular transformation languages: XSLT and XPathScript.
I will save the examination of the lower-level details of these languages for later. At this point, it suffices to understand that both XSLT and XPathScript offer a declarative syntax that provides a way to create new documents by applying transformations to all ...
Get XML Publishing with AxKit 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.