Example filters that delete duplicate author information
This commit is contained in:
parent
cece1e68b8
commit
dfad84eab7
29
filters/delDupName/byline_author.xslt
Normal file
29
filters/delDupName/byline_author.xslt
Normal file
@ -0,0 +1,29 @@
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
||||
xmlns:atom="http://www.w3.org/2005/Atom"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<!-- Replace atom:author/atom:name with the byline author -->
|
||||
<xsl:template match="atom:entry/atom:author[../atom:content/xhtml:div/xhtml:span[@class='byline-author' and substring(.,1,10)='Posted by ']]">
|
||||
<xsl:copy>
|
||||
<atom:name>
|
||||
<xsl:value-of select="substring(../atom:content/xhtml:div/xhtml:span[@class='byline-author'],11)"/>
|
||||
</atom:name>
|
||||
<xsl:apply-templates select="*[name()!='name']"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Remove byline author -->
|
||||
<xsl:template match="xhtml:div/xhtml:span[@class='byline-author' and substring(.,1,10)='Posted by ']"/>
|
||||
|
||||
<!-- Remove two line breaks following byline author -->
|
||||
<xsl:template match="xhtml:br[preceding-sibling::*[1][@class='byline-author' and substring(.,1,10)='Posted by ']]"/>
|
||||
<xsl:template match="xhtml:br[preceding-sibling::*[2][@class='byline-author' and substring(.,1,10)='Posted by ']]"/>
|
||||
|
||||
<!-- pass through everything else -->
|
||||
<xsl:template match="@*|node()">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*|node()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
17
filters/delDupName/p_by_name.xslt
Normal file
17
filters/delDupName/p_by_name.xslt
Normal file
@ -0,0 +1,17 @@
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
||||
xmlns:atom="http://www.w3.org/2005/Atom"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<!-- If the first paragraph consists exclusively of "By author-name",
|
||||
delete it -->
|
||||
<xsl:template match="atom:content/xhtml:div/xhtml:p[1][. =
|
||||
concat('By ', ../../../atom:author/atom:name)]"/>
|
||||
|
||||
<!-- pass through everything else -->
|
||||
<xsl:template match="@*|node()">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*|node()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
15
filters/delDupName/p_from.xslt
Normal file
15
filters/delDupName/p_from.xslt
Normal file
@ -0,0 +1,15 @@
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
||||
xmlns:atom="http://www.w3.org/2005/Atom"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<!-- If the first paragraph consists contains @class="from", delete it -->
|
||||
<xsl:template match="atom:content/xhtml:div/xhtml:div[@class='comment']/xhtml:p[1][@class='from']"/>
|
||||
|
||||
<!-- pass through everything else -->
|
||||
<xsl:template match="@*|node()">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="@*|node()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
Loading…
Reference in New Issue
Block a user