On Mon, Dec 02, 2002 at 12:41:46PM -0500, Chris Thompson wrote:
> 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>
You could do like:
<style type="text/css">
<xsl:comment>
<xsl:text> @import "</xsl:text>
<xsl:value-of select="somthing that gives the path to advanced.css"/>
</xsl:text>"; </xsl:text>
</xsl:comment>
</style>
I don't do that anymore though. I link it straight to something that
will handle the CDATA @import from a <link> tag. Put the @import "advanced.css"
inside a file such as advanced-boot.css.
Then:
<link rel="stylesheet" type="text/css" href="advanced-boot.css" media="all"/>
And the contents of "advanced-boot.css" would be:
@import "advanced.css";
Same effect except its another request to the server (no big deal).
I've found external links are the way to go for CDATA like javascript and css.
Plus xhtml really does like it better this way.
The w3 rec touches on this issue.
>
> 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"?>
You might try adding an encoding="UTF-8" to your <xsl:output/>
> B) How can I prevent extra namespaces in the XSLT sheet from migrating
> to the output html?
add: exclude-result-prefixes="foo bar blog"
to your: <xsl:stylesheet/>
I hope this helps. Either way you should find what your looking
for in the w3 xslt rec easier with these bits I've hinted at.
Ed
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]