<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  version="1.0">

<xsl:output 
  method="html" 
  version="4.0" 
  encoding="UTF-8" 
  omit-xml-declaration="yes" 
  indent="yes"/>

<xsl:template name="SrcTgtDescription">
  <xsl:param name="Node"/>
  <xsl:choose>
    <xsl:when test="$Node/disk">QT_TRANSLATE_NOOP("QObject", "Hard Disk") <xsl:value-of select="$Node/disk/param[@name='number']/@valuedescription"/>
    </xsl:when>
  
    <xsl:when test="$Node/partition">
      <xsl:choose>
        <xsl:when test="normalize-space($Node/partition/param[@name='letter']/@valuedescription)">QT_TRANSLATE_NOOP("QObject", "Volume") <xsl:value-of select="$Node/partition/param[@name='letter']/@valuedescription"/> QT_TRANSLATE_NOOP("QObject", "on hard disk") <xsl:value-of select="$Node/partition/param[@name='disk']/@valuedescription"/>
        </xsl:when>
		<xsl:otherwise>QT_TRANSLATE_NOOP("QObject", "Unmounted volume") <xsl:value-of select="$Node/partition/param[@name='number']/@valuedescription"/> QT_TRANSLATE_NOOP("QObject", "on hard disk") <xsl:value-of select="$Node/partition/param[@name='disk']/@valuedescription"/>
  			</xsl:otherwise>  
      </xsl:choose>
    </xsl:when>
  
    <xsl:when test="$Node/archive">QT_TRANSLATE_NOOP("QObject", "Archive") "<xsl:value-of select="$Node/archive/param[@name='archivename']/@valuedescription"/>"</xsl:when>
  
  </xsl:choose>
</xsl:template>

<xsl:template name="TextDetails">
<xsl:text>******************************************&#xa;</xsl:text>
<xsl:value-of select="@description"/><xsl:text>&#xa;</xsl:text>

<xsl:if test="source">
    QT_TRANSLATE_NOOP("QObject", "Source:")
        <xsl:for-each select="source">
            <xsl:text>&#x9;</xsl:text>
            <xsl:call-template name="SrcTgtDescription">
                <xsl:with-param name="Node" select="."/>
            </xsl:call-template>
            <xsl:text>&#xa;</xsl:text>
        </xsl:for-each>
</xsl:if>

<xsl:if test="target">
	QT_TRANSLATE_NOOP("QObject", "Target:")
	<xsl:text>&#x9;</xsl:text><xsl:call-template name="SrcTgtDescription">
		<xsl:with-param name="Node" select="target"/>
	</xsl:call-template>
	<xsl:text>&#xa;</xsl:text>
</xsl:if>

<xsl:if test="params">
	QT_TRANSLATE_NOOP("QObject", "Parameters:")
	<xsl:for-each select="params/param">
	<xsl:text>&#x9;</xsl:text><xsl:value-of select="@description"/>: <xsl:value-of select="@valuedescription"/><xsl:text>&#xa;</xsl:text><xsl:text>&#x9;</xsl:text>
	</xsl:for-each>
</xsl:if>

<xsl:if test="error">
	<xsl:text>&#x9;</xsl:text>QT_TRANSLATE_NOOP("QObject", "The operation has failed:")
	<xsl:text>&#x9;</xsl:text><xsl:value-of select="error/@description"/> (<xsl:value-of select="error/@code"/>)
</xsl:if>
<xsl:text>&#xa;</xsl:text>

</xsl:template>

<xsl:template name="HTMLDetails">

  <li>
    <h4><xsl:value-of select="@description"/></h4>

      <xsl:if test="source">
		  <b>QT_TRANSLATE_NOOP("QObject", "Source:")</b><br/>
          
          <xsl:for-each select="source">
              <xsl:call-template name="SrcTgtDescription">
                <xsl:with-param name="Node" select="."/>
              </xsl:call-template>
              <br/>
          </xsl:for-each>
      </xsl:if>

      <xsl:if test="target">
		  <b>QT_TRANSLATE_NOOP("QObject", "Target:")</b><br/>
          <xsl:call-template name="SrcTgtDescription">
            <xsl:with-param name="Node" select="target"/>
          </xsl:call-template>
			<br/>
      </xsl:if>

	    <xsl:if test="params">
        <b>QT_TRANSLATE_NOOP("QObject", "Parameters:")</b><br/>
        <xsl:for-each select="params/param">
          <xsl:value-of select="@description"/>: <xsl:value-of select="@valuedescription"/><br/>
        </xsl:for-each>
	    </xsl:if>
  </li>
  
  <br/>
  <xsl:if test="error">
    <b>QT_TRANSLATE_NOOP("QObject", "The operation has failed:")</b>&#xa;
    <xsl:value-of select="error/@description"/> (<xsl:value-of select="error/@code"/>)

  </xsl:if>

</xsl:template>

<xsl:template match="/report">

<html>

  <h2>QT_TRANSLATE_NOOP("QObject", "Full E-mail notification report.")</h2>
	
  <p>
    <h3>QT_TRANSLATE_NOOP("QObject", "System info:")</h3>
  	QT_TRANSLATE_NOOP("QObject", "Computer Name: ")<xsl:value-of select="computer"/><br/>
    <xsl:value-of select="OS"/>
  </p>

  <p>
  <h3>QT_TRANSLATE_NOOP("QObject", "Summary:")</h3>
	QT_TRANSLATE_NOOP("QObject", "Generated: ")<xsl:value-of select="generated"/><br/><br/>
  <xsl:choose>
    <xsl:when test="error">
      QT_TRANSLATE_NOOP("QObject", "Not the all operations have been applied.")
      <br/>QT_TRANSLATE_NOOP("QObject", "The following error had occured: ")
      <xsl:value-of select="error/@description"/> (<xsl:value-of select="error/@code"/>)
    </xsl:when>
    <xsl:otherwise>
      QT_TRANSLATE_NOOP("QObject", "All operations have been applied successfully.")
    </xsl:otherwise>
  </xsl:choose>
  </p>  
  
  <p>
    <h3>QT_TRANSLATE_NOOP("QObject", "The following operations have been performed:")</h3>
    <ol>
    <xsl:for-each select="action[@type='physical']">
	    <xsl:call-template name="HTMLDetails"/>
    </xsl:for-each>
    </ol>
  </p>

  <xsl:if test="string(snapshot) = 'True'">
    <p>
      <h3>QT_TRANSLATE_NOOP("QObject", "The system snapshot:")</h3>
      QT_TRANSLATE_NOOP("QObject", "Your hard disks before the changes:")<br/>
      <img src="cid:snapshot_before.png"/><br/>
      QT_TRANSLATE_NOOP("QObject", "Your hard disks after the changes:")<br/>
      <img src="cid:snapshot_after.png"/><br/>
    </p>
  </xsl:if>
  
  <hr/><br/>
  <font color="gray" size="-1">
  	QT_TRANSLATE_NOOP("QObject", "You have requested full e-mail reports from <ProductName>")<br/>
    QT_TRANSLATE_NOOP("QObject", "Please change e-mail options to get short reports or to stop getting the reports.")
  </font>

</html>  
</xsl:template>

</xsl:stylesheet>
