Edward Rayl wrote:...
OK, having finally got fed up with the Linux Today site, I decided that I should try to get to grips with some more of JPluck's features.
Thanks Ed.
JPluck's strength is allowing XSLT processing. Even though I'm a Java programmer myself, I prefer XSLT for this kind of stuff. Even if you get this work, you still only have half a job. From a JPluck perspective, all good plucks, i.e. The Register, use XPath expressions to pluck the article and throw away the fluff. For this you need need the DOM Inspector in Mozilla. Take a look at the various scripts that ship with JPluck.
I was kinda hoping that I could start with something a bit easier as my XSLT skills are rather basic as yet. I was going to give that a go next.
OK, so I found some time and had a go with the XSLT stuff, here is my first attempt at a more PDA friendly version of the Linux Today site. Just add or link the XSL as explained on the JPluck web site.
Please forgive me if this is not the right place to share this, just let me know.
-------------------------------
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="jpluck.xsl"/>
<xsl:template match="html">
<html>
<head/>
<body>
<h3>Linux Today</h3>
<xsl:apply-templates select="//p"/>
</body>
</html>
</xsl:template>
<xsl:template match="p">
<!-- Match on the paras only, the rest is rubbish -->
<p>
<!-- Handle the links rewriting them to the printer friendly versions -->
<xsl:apply-templates select="a"/>
</p>
<!-- The span contains the articles timestamp and feedback links -->
<!-- So using value-of drops the links -->
<xsl:value-of select="span"/>
<p>
<!-- Put the summary text back in -->
<xsl:value-of select="text()"/>
</p>
</xsl:template>
<xsl:template match="a">
<!-- Matching for links to rewrite them to the printer friendly version -->
<!-- The section name for the article -->
<xsl:variable name="a1" select="substring-before(substring-after(@href,'/'),'/')"/>
<!-- The article id -->
<xsl:variable name="a2" select="substring-after(substring-after(@href,'/'),'/')"/>
<!-- Split up the article ID -->
<xsl:variable name="a2year" select="substring($a2,1,4)"/>
<xsl:variable name="a2month" select="substring($a2,5,2)"/>
<xsl:variable name="a2day" select="substring($a2,7,2)"/>
<xsl:variable name="a2a" select="substring($a2,9,3)"/>
<xsl:variable name="a2b" select="substring($a2,12,2)"/>
<xsl:variable name="a2texta" select="substring($a2,14,2)"/>
<xsl:variable name="a2textb" select="substring($a2,16,2)"/>
<!-- Join article ID with dashes -->
<xsl:variable name="a3" select="concat($a2year,'-',$a2month,'-',$a2day,'-',$a2a,'-',$a2b,'-',$a2texta,'-',$a2textb)"/>
<!-- Create Printer friendly link -->
<xsl:variable name="a4" select="concat('/',$a1,'/','mailprint.php3?action=pv&ltsn=',$a3)"/>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="$a4"/>
</xsl:attribute>
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
---
Enjoy.
-- Julian Knight, http://www.knightnet.org.uk/ Sheffield, United Kingdom Security, Directory, Messaging, Network & PC Consultant Instant Messaging:[EMAIL PROTECTED], Yahoo!=knighjm _______________________________________________ plucker-list mailing list [EMAIL PROTECTED] http://lists.rubberchicken.org/mailman/listinfo/plucker-list

