I'm trying to transform PHPSysInfo's XML output using my own XSL. Here's a snippet PHP: <phpsysinfo> <Generation version="2.5.2_rc3" timestamp="1159205078"/> <Vitals> <Hostname>somewhere.co.uk</Hostname> <IPAddr>XXX.XXX.XXX.XXX</IPAddr> <Kernel>3.2</Kernel> <Distro>Debian</Distro> <Distroicon>Debian.png</Distroicon> <Uptime>1178621.57</Uptime> <Users>1</Users> <LoadAvg>0.00 0.00 0.00</LoadAvg> </Vitals> ... <phpsysinfo> I've got the hostname with PHP: <xsl:for-each select="phpsysinfo/Vitals"> <xsl:value-of select="Hostname" /> </xsl:for-each> What I can't figure out, is how to get the timestamp attribute. Any ideas?
gah trying to remember this stuff from uni so don't shout if i'm wrong but i think that its: Code: <xsl:value-of select="Generation[@timestamp]" /> Let me know if i'm wrong and i'll dig out my XML books
That's not working. I've tried some minor variations so that and still no joy. Would you recommend any of the books you have?
Got it (thanks to XMLSpy) PHP: <xsl:value-of select="phpsysinfo/Generation/@timestamp" /> I wonder if there's a date format function...
ah ok cool. A half decent book for XML in general is Learning XML by O'Reilly which covers most of the basics including XSLT it was one of out course books