We use CruiseControl for our build server. It compiles our applications using MSBuild and uses its own XML logger that spits out something like the following XML:
<project name="CI">
<target name="CompileApp">
<project name="Project1.csproj">
<target name="build">
<error>Compilation error one!</error>
</target>
<target name="BeforeBuild">
<project name="Project2.csproj">
<target name="build">
<error>Compilation error two!</error>
</target>
</project>
</target>
</project>
</target>
</project>
I want to transform this into a report that outputs each project's errors. I don't want to report on the errors in other projects.
Project "Project1.csproj": 1 error(s)
Error(s):
Compilation error one!
Project "Project2.csproj": 1 error(s)
Error(s):
Compilation error two!
This is the closest I've gotten, but it's not right. It doesn't filter out project2's errors when showing project1's errors.
<xsl:template>
<xsl:variable select="//project[.//error]" name="projects.with.errors" />
<xsl:apply-templates select="$projects.with.errors" />
</xsl:template>
<xsl:template match="project">
<xsl:variable select="./*[not(project)]//error" name="errors" />
<xsl:if test="count($errors) > 1">
<!-- display errors -->
</xsl:if>
</xsl:template>
How can I filter out any error nodes that have a different project ancestor than my current project node? I.e., how can I only select descendant error nodes that don't have a project ancestor?
The error nodes can have an arbitrary number of parent elements (usually , but not always).