Hacker Public Radio

HPR2425: Intro to XSL


Listen Later

Sure, you can use pandoc to process your Docbook XML, but why not learn a little XSL this weekend?
Requirements
You must have xsltproc installed. It's available from your software repository.
Here is some sample XML for you:
<xml version="1.0">
<para>
My name is <author>Foo</author>.
</para>
<para>
You're listening to <emphasis role="bold">Hacker Public
Radio</emphasis>.
</para>
</xml>
And here's the complete XSL as demonstrated:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="para">
<p><span><xsl:apply-templates/></span></p>
</xsl:template>
<xsl:template match="emphasis">
<em><xsl:apply-templates/></em>
</xsl:template>
<xsl:template match="emphasis[@role='bold']">
<strong><xsl:apply-templates/></strong>
</xsl:template>
<xsl:template match="author" name="host">
<xsl:choose>
<xsl:when test="$host = 'Klaatu'">
<xsl:text>Klaatu</xsl:text>
</xsl:when>
<xsl:when test="$host = 'Gort'">
<xsl:text>Gort</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Links
Norm Walsh
dpawson
O'Reilly
DM Schema
...more
View all episodesView all episodes
Download on the App Store

Hacker Public RadioBy Hacker Public Radio

  • 4.2
  • 4.2
  • 4.2
  • 4.2
  • 4.2

4.2

34 ratings


More shows like Hacker Public Radio

View all
The Infinite Monkey Cage by BBC Radio 4

The Infinite Monkey Cage

1,952 Listeners

Click Here by Recorded Future News

Click Here

418 Listeners

Hacker And The Fed by Chris Tarbell & Hector Monsegur

Hacker And The Fed

168 Listeners