I transform multiple documents at once using XSLT. Those documents may have elements like
<a:updated></a:updated> or <app:edited></app:edited> and some of them have both <a:updated></a:updated> and <app:edited></app:edited>.
In this case some of the outputed document (besides it's standard elements like title, link, content) have two times a <posted></posted> element.
The question here is how do I remove the one <posted></posted> if <app:edited> and <a:updated> are found in the same <entry></entry>?
This is the heading of XSLT
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app">
This is the template
<xsl:template match="a:updated | app:edited">
<posted>
<xsl:apply-templates select="node() | @*" />
</posted>
</xsl:template>
this is how I process it
$xproc = new XsltProcessor();
$xslt = new DomDocument;
$xslt->load('stylesheet.xslt');
$xproc->importStylesheet($xslt);
and this is basically the XML
<entry>
<id></id>
<title></title>
<content></content>
<link></link>
<a:updated></a:updated>
<app:edited></app:edited>
</entry>
<xsl:apply-templates>instruction that selects this template. The solution, therefore is to apply templates only on one of the occurences ofa:updated,updated,app:edited- Dimitre Novatchev