Here is my HAML code for the XML document:
<?xml version='1.0' encoding='utf-8' ?>
<?xml-stylesheet type='text/xsl' href='/styles/application.xsl' ?>
%page(name=@title)
%content
=yield
Here is the XSLT code:
<?xml version='1.0' encoding='utf-8' ?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output method='html' indent='no'/>
<xsl:template match='page'>
<html lang='en'>
<head>
<title><xsl:value-of select='@name'/></title>
</head>
<body>
<xsl:apply-templates select='content'/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
And, the Ruby code to serve the page:
get '/' do
@title = 'Page Title'
haml :index, :layout => :application
end

New Topic/Question
Reply







MultiQuote


|