[SlugBug] more xslt questions. ignore if offended!

Mike Dewar m.dewar at sheffield.ac.uk
Tue Jun 21 15:56:51 BST 2005


Hi all,

I'm going batshit trying to work out this xslt thingy. I've posted here 
before about xslt and xml and stuff before but i still want to 
apologise about asking this in case it's not appropriate for the list. 
Anyway, here goes.

i'm writing two files:

site.xml (http://www.mikedewar.org/site.xml)
home.xsl (http://www.mikedewar.org/home.xsl)

the sylesheet is supposed to generate an html file by picking out a bit 
of site.xml and formatting it or whatever. There are <page> elements in 
the xml file and the page elements have the attribute "title" like 
this:

<page title="Home"> ... </page>

In the stylesheet, I'm trying to select just the <page> with the 
attribute "Home" using the following:

<xsl:apply-templates select="page[@title='Home']"/>

then

<xsl:template match="page[@title='Home']">
...
</xsl:template>

so that when i run the home.xsl stylesheet only the "Home" page is 
created.

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:

<xsl:template match="page">
...
</xsl:template>

and it changes nothing.

I can't figure out why it doesn't work like I think it bloody well 
should and I'm going hardcore crazy - the point at which I usually 
email you lot and/or give up. Any help would be greatly appreciated.

Cheers,

Mike Dewar



More information about the SlugBug mailing list