Working great except for one thing - it displays the channel info even
though I'm not calling that info anywhere? (It displays: atom:id,
lastBuildDate, category domain, title, link, managing Editor, and the
openSearch variables. Basically - everything within the main channel
that has a value. )
It displays it unformatted - just a straight block of text with no
spaces.
Using this to process:
[code]
// Load the XML source
$xml = new DOMDocument;
$xml->load('http://spreadsheets.google.com/feeds/list/
tqBgup5Bmbdgh-rgyxqh2Pw/od6/public/basic?alt=rss');
$xsl = new DOMDocument;
$xsl->load('calendarparse.xsl');
// Configure the transformer
$proc = new XSLTProcessor;
$proc->importStyleSheet($xsl); // attach the xsl rules
echo $proc->transformToXML($xml);
[/code]
Result File - http://studentorgs.vanderbilt.edu/vsg/atvandy/
Source XML - http://spreadsheets.google.com/feeds/list/tqBgup5Bmbdgh-rgyxqh2Pw/od6/public/basic?alt=rss
XSL - http://studentorgs.vanderbilt.edu/vsg/atvandy/calendarparse.xsl
Thoughts? What am I missing? I can't figure out why it's displaying
information I'm not calling.
Well you have nothing but two templates, one with match="/", one with
match="item". How do expect the processing ends up with your
match="item" template? That is because of built-in templates that does
<xsl:apply-templates/>
So that way your match="item" template is applied but that way also
other nodes are processed and the built-in templates for text nodes does
<xsl:value-of select="."/> so that is why you see all those text values
in your output.
As you don't want that you will either need to ensure that you process
only 'item' elements by doing
<xsl:template match="/">
<xsl:apply-templates select="rss/channel/item"/>
<xsl:template>
or you will need to override the built-in template for text nodes by doing
<xsl:template match="text()"/>
--
Martin Honnen --- MVP XML
http://msmvps.com/blogs/martin_honnen/
Ahhh!!! I had tried select="item" -- but then nothing displayed. I
guess I needed to go up to the top node!
Perfect :) Thanks Martin!
~L