Originally posted by zeitghost
View Post

<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:h="http://www.w3.org/1999/xhtml"> <xsl:output indent="yes" encoding="UTF-8"/> <xsl:param name="spidered-at">Now</xsl:param> <xsl:template match="/"> <page> <xsl:attribute name="spidered-at"><xsl:value-of select="$spidered-at"/></xsl:attribute> <nextpage> <xsl:attribute name="href"> <xsl:value-of select="/h:html/h:body/h:div/h:div/h:div[1]/h:table/h:tr/h:td/h:table[3]/h:tr/h:td[2]/h:div/h:table/h:tr/h:td/h:a[normalize-space(text()) = '>']/@href"/> </xsl:attribute> </nextpage> <lastpage> <xsl:attribute name="href"> <xsl:value-of select="/h:html/h:body/h:div/h:div/h:div[1]/h:table/h:tr/h:td/h:table[3]/h:tr/h:td[2]/h:div/h:table/h:tr/h:td/h:a[starts-with(normalize-space(text()), 'Last')]/@href"/> </xsl:attribute> </lastpage> <xsl:apply-templates select="/h:html/h:body/h:div/h:div/h:div/h:table/h:tr/h:td/h:div[@id='posts']"/> </page> </xsl:template> <xsl:template match="h:div[@id='posts']"> <posts> <xsl:apply-templates select="h:div[@align='center']/h:div/h:div/h:div/h:table"/> </posts> </xsl:template> <xsl:template match="h:table"> <post> <xsl:attribute name="cukid"><xsl:value-of select="substring-after(@id, 'post')"/></xsl:attribute> <xsl:attribute name="tpdid"><xsl:value-of select="h:tr[1]/h:td[2]/h:a/@name"/></xsl:attribute> <xsl:attribute name="time"><xsl:value-of select="normalize-space(h:tr[1]/h:td[1]/text()[2])"/></xsl:attribute> <xsl:apply-templates select="h:tr[2]/h:td[@class='alt2']"/> <xsl:apply-templates select="h:tr[2]/h:td[@class='alt1']"/> </post> </xsl:template> <xsl:template match="h:td[@class='alt2']"> <poster> <name><xsl:value-of select="h:div[1]/h:a[1]/text()"/></name> <page> <xsl:attribute name="href"> <xsl:value-of select="h:div[1]/h:a[1]/@href"/> </xsl:attribute> </page> <avatar> <xsl:attribute name="href"> <xsl:value-of select="h:div[3]/h:a/h:img/@src"/> </xsl:attribute> </avatar> <joined><xsl:value-of select="substring-after(h:div[3]/h:div[1]/text(), 'Join Date: ')"/></joined> </poster> </xsl:template> <xsl:template match="h:td[@class='alt1']"> <content> <title> <xsl:attribute name="icon"> <xsl:value-of select="h:div[1]/h:img/@src"/> </xsl:attribute> <text><xsl:value-of select="h:div[1]/h:strong/text()"/></text> </title> <body> <xsl:copy-of select="h:div[2]"/> </body> </content> </xsl:template> </xsl:stylesheet>
Comment