<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
  <xsl:template match="/data">
  
    <xsl:choose>
        <xsl:when test="
                            (
                                (
                                    (./InkLevelCart1 &lt;=./InkLowThresholds2 and (./InkLevelPrevJobCart1 &gt;./InkLowThresholds2))
                                    or 
                                    (./InkLevelCart1 &lt;=./InkLowThresholds1 and (./InkLevelPrevJobCart1 &gt;./InkLowThresholds1))
                                )
                                and not (./CartridgeAuthenticityCart1='0x03') 
                                and not (./InkLevelCart1 &lt;=./InkVeryLowThresholds)
                            )
                        or 
                            (
                                (
                                    (./InkLevelCart2 &lt;=./InkLowThresholds2 and (./InkLevelPrevJobCart2 &gt;./InkLowThresholds2))
                                    or 
                                    (./InkLevelCart2 &lt;=./InkLowThresholds1 and (./InkLevelPrevJobCart2 &gt;./InkLowThresholds1))
                                )
                                and not (./CartridgeAuthenticityCart2='0x03') 
                                and not (./InkLevelCart2 &lt;=./InkVeryLowThresholds)
                            )
                        or 
                            (
                                (
                                    (./InkLevelCart3 &lt;=./InkLowThresholds2 and (./InkLevelPrevJobCart3 &gt;./InkLowThresholds2))
                                    or 
                                    (./InkLevelCart3 &lt;=./InkLowThresholds1 and (./InkLevelPrevJobCart3 &gt;./InkLowThresholds1))
                                )
                                and not (./CartridgeAuthenticityCart3='0x03') 
                                and not (./InkLevelCart3 &lt;=./InkVeryLowThresholds)
                                and not (./CartridgeTypeCart3='Invalid')
                                and not (./CartridgeTypeCart3='Missing')
                            )
                        or 
                            (
                                (
                                    (./InkLevelCart4 &lt;=./InkLowThresholds2 and (./InkLevelPrevJobCart4 &gt;./InkLowThresholds2))
                                    or 
                                    (./InkLevelCart4 &lt;=./InkLowThresholds1 and (./InkLevelPrevJobCart4 &gt;./InkLowThresholds1))
                                )
                                and not (./CartridgeAuthenticityCart4='0x03') 
                                and not (./InkLevelCart4 &lt;=./InkVeryLowThresholds)
                                and not (./CartridgeTypeCart4='Invalid')
                                and not (./CartridgeTypeCart4='Missing')
                            )
                       ">
                      INK_LOW
        </xsl:when>
     
        <xsl:when test="(./InkLevelCart1 &lt;=./InkVeryLowThresholds and not(./CartridgeAuthenticityCart1='0x03') )
                     or (./InkLevelCart2 &lt;=./InkVeryLowThresholds and not(./CartridgeAuthenticityCart2='0x03') ) 
                     or (./InkLevelCart3 &lt;=./InkVeryLowThresholds 
                         and not(./CartridgeAuthenticityCart3='0x03') 
                         and not(./CartridgeTypeCart3='Invalid')
                         and not(./CartridgeTypeCart3='Missing') 
                        ) 
                     or (./InkLevelCart4 &lt;=./InkVeryLowThresholds 
                         and not(./CartridgeAuthenticityCart4='0x03')
                         and not(./CartridgeTypeCart4='Invalid')
                         and not(./CartridgeTypeCart4='Missing') 
                        )">
                     INK_VERY_LOW 
        </xsl:when> 

    </xsl:choose>
  </xsl:template>
</xsl:stylesheet>
