866c51bbbc8be6201c43422ef19d3f825c787365
[utils] /
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
3     xmlns:xhtml="http://www.w3.org/1999/xhtml"
4     version="1.0">
5     
6     <xsl:template match="/">
7         <xsl:element name="result">
8             <xsl:choose>
9                 <xsl:when test="count(//xhtml:h1[contains(text(), 'Error')]) = 1">
10                     <xsl:choose>
11                         <xsl:when test="count(//xhtml:body/text()[contains(., 'already in the')]) =
12                             1">
13                             <xsl:text>DUPLICATE</xsl:text>
14                         </xsl:when>
15                         <xsl:when test="count(//xhtml:body/text()[contains(., 'conflicts with a
16                             recording')]) =
17                             1">
18                             <xsl:text>CONFLICT</xsl:text>
19                         </xsl:when>
20                         <xsl:otherwise>
21                             <xsl:text>ERROR</xsl:text>
22                         </xsl:otherwise>
23                     </xsl:choose>
24                 </xsl:when>
25                 <xsl:otherwise>
26                     <xsl:text>OK</xsl:text>
27                 </xsl:otherwise>
28             </xsl:choose>
29             
30         </xsl:element>
31     </xsl:template>
32     
33     <xsl:template match="xhtml:body">
34         <xsl:value-of select="text()"/>
35     </xsl:template>
36     
37     <xsl:template match="text()">
38         TEXT NODE
39         <xsl:value-of select="."/>
40     </xsl:template>
41 </xsl:stylesheet>