In an effort to not lose whatever technical skills I have left while the
rest atrophies as I slave in a post dotcom non technical job, I have been
messing with AxKit, again, in an effort to actually do something useful
with it.
I'm using the Moveable Type blog software and messing around with its
templates to make it generate XML, which I'm then feeding through AxKit and
XML::LibXSLT and my stylesheets to generate XHTML. The goal here is to
generate valid XHTML 1.1 that validates through the w3.org validator.
I've surprised myself at how well it works. In the past I've use MT to
generate HTML by having the HTML in the templates themselves. The downside
to this is that if you change any HTML, such as layout, or hardcoded links,
you have to regenerate each and every page on the system, which takes time.
So what I did is define my own XML vocabulary (throwing caution to the wind
and not checking for an existing one), and dropped it in the namespace
<blog:...>.
MT now outputs only XML, which looks, in part like...
<blog:entry>
<blog:entrytitle>This is a Title</blog:entrytitle>
<blog:entryfulldate>November 29, 2002</blog:entryfulldate>
<blog:entrycat>Main</blog:entrycat>
<blog:entryid>1</blog:entryid>
<blog:entrycomments>0</blog:entrycomments>
<blog:body><p>Here is the body</p></blog:body>
<blog:xbody><p>Here is the Extended Entry</p></blog:xbody>
<blog:entrysummary>How about an excerpt</blog:entrysummary>
</blog:entry>
So far, so good. The output passes xmllint with flying colors.
So I took a design I had done which validated in XHTML 1.1, and converted
it to an XSLT stylesheet. I struggled a bit as I'm no XSLT expert, but got
it almost where I want it. Two snags, however, I'd like some help on.
First, in the <head> section of my output xhtml, I use a browser trick to
hide the more advanced box model parts of my CSS2 stylesheets from older
browsers by doing...
<link rel="stylesheet" type="text/css" href="basic.css" />
<style type="text/css" media="all">
@import "advanced.css";
</style>
Which, it's escaping the " around advanced.css as " which the browser
breaks on. I've fixed it by wrapping that line in CDATA, but I was
wondering if there were an easier/more elegant way.
Second, with <xsl:output> I'm having a problem with namespace declarations.
Since I'm defining my own namespace in the output document, and including
that namespace in the header for the stylesheet, such as...
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:blog="http://xml.logimeta.com/2002/Blog"
version="1.0"
>
Using the settings...
<xsl:output
method="xml"
media-type="text/html"
omit-xml-declaration="no"
doctype-public="-//W3C//DTD XHTML 1.1//EN"
doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
/>
It works in the browser just fine. But the w3.org validator complains
because LibXSLT has taken the blog:xmlns definition and inserted it into
the <html> tag.
The stylesheet says...
<xsl:template match="blog">
<html>
<head>
....
the output says...
<html xmlns:blog="http://xml.logimeta.com/2002/Blog"><head>
and the validator doesnt like the xmlns:blog attribute. It also throws a
warning because there's no encoding in the xml header.
So,
A) How can I have the output XML header be i
<?xml version="1.0" encoding="UTF-8"?>
B) How can I prevent extra namespaces in the XSLT sheet from migrating
to the output html?
Thanks,
P.S. The other reason I'm doing this is that I think it will be slick to
have a separate stylesheet which feeds RSS generated from the same data.
_______________
Chris Thompson
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]