Alastair's solution produces a wrong result: the value of the "author" attribute produced is "nshmyrev" but it must be: "ckirbach".
The solution below is tested to work correctly.
Here is a solution, which works for different extensions that must be ignored (specified in a global <xsl:param/>
).
This transformation:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:param name="pIgnExt" select="'.pi'"/>
<xsl:variable name="vExtLen"
select="string-length($pIgnExt)"/>
<xsl:template match="logs">
<logs>
<xsl:apply-templates select="*/*/path"/>
</logs>
</xsl:template>
<xsl:template match="path">
<xsl:variable name="vthisLen"
select="string-length(.)"/>
<xsl:if test=
"not(substring(.,$vthisLen -$vExtLen +1)
=
$pIgnExt
)">
<LogEntry revision="{../../@revision}"
author="{../../author}"
action="{@action}">
<xsl:copy-of select="node()"/>
</LogEntry>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
when applied on the original XML document (corrected to be well-formed!):
<logs>
<logentry revision="648">
<author>nshmyrev</author>
<date>2008-09-21T19:43:10.819236Z</date>
<paths>
<path action="M">/trunk/po/ru.pi</path>
</paths>
<msg>2008-09-21 Nickolay V. Shmyrev [email protected] * ru.po: Updated Russian translation.</msg>
</logentry>
<logentry revision="647">
<author>ckirbach</author>
<date>2008-09-21T16:25:58.369324Z</date>
<paths>
<path action="M">/trunk/po/de.po</path>
<path action="M">/trunk/po/ChangeLog</path>
</paths>
<msg>* de.po: Updated German translation.</msg>
</logentry>
</logs>
produces the wanted result:
<logs>
<LogEntry revision="647" author="ckirbach" action="M">/trunk/po/de.po</LogEntry>
<LogEntry revision="647" author="ckirbach" action="M">/trunk/po/ChangeLog</LogEntry>
</logs>
Do note, that this can be used as implementation in XPath 1.0 of the function ends-with(), which is only available in XPath 2.0.