[SlugBug] more xslt questions. ignore if offended!
Chris J
cej at nightwolf.org.uk
Tue Jun 21 18:26:22 BST 2005
[[ much snippage ]]
And Lo! The Great Prophet Mike Dewar uttered these words of wisdom:
>
> For some reason, though, when I run the xslt the only page that is
> displayed is the other page, the "World Domination Map" page. I've
> tried not putting the attribute in the template match, like this:
>
What are you using as the XSL engine? Perl? PHP? Something custom using a
library? Something else? :-)
One problem I've had with both MSXML's engine and older versions of Sablotron
is the lack of a template to handle the root element. So I'd advise to
start with having a simple:
<xsl:template match="/">
<xsl:apply-tempates select="site" />
</xsl:template>
And treat that essentially as the entry point.
You may even be able to do:
<xsl:template match="/site">
.
.
[your existing template that's just matching on site]
.
.
</xsl:template>
i.e., the addition of the '/' before site.
You may also need to modify the top of your XSLT thusly:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
Without the namespace declaration, Sablotron didn't want to know (complained
that 'xsl' was not a declared prefix - which is fair enough; any XML parser
worth its salt will fall over at syntax issues like undeclared namespaces).
Tweak them to start with, let me know what happens :-)
Other things you could do is change the output format to xml from html -
this will ensure you spit out XHTML (I notice you've mentioned XHTML in the
comments of site.xml :-) ).
You'll also need to tweak your site.xml graphics elements. Sablotron is
spitting out this:
<img src="%0a%09%09%09globe_section.png%0a%09%09%09"> (HTML out)
or
<img src=" 			globe_section.png 			"/> (XML out)
So put your pic spec on one line:
<graphic>globe_section.png</graphic>
That's all I can see for now :-)
Chris...
--
\ Chris Johnson \ NP:
\ cej at nightwolf.org.uk \
\ http://cej.nightwolf.org.uk/ \
\ http://redclaw.org.uk/ ~---------------------------------------
More information about the SlugBug
mailing list