<?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:variable name="hexchars" select="'0123456789ABCDEF'" />

    <xsl:template name="convert-to-hex">
        <xsl:param name="number" />
        <xsl:param name="result" />
        <xsl:variable name="to-base-digit" select="substring($hexchars,$number mod 16 + 1,1)" />
        <xsl:choose>
            <xsl:when test="$number >= 16">
                <xsl:call-template name="convert-to-hex">
                    <xsl:with-param name="number" select="floor($number div 16)" />
                    <xsl:with-param name="result" select="concat($to-base-digit,$result)" />
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="concat($to-base-digit,$result)" />
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>


    <xsl:template match="/Root">

    <html>
        <body>
            <xsl:variable name="FSName" select="PropertyBag/Property[@name='PartitionProperties::FileSystemRawText']" /> 

            <table style="margin-left:0px"  align="left">
                <tr>
                    <td class="label">
                        <span style="color: #7c7d7d;">
                        <nobr><xsl:value-of select="PropertyList/Property[@propname='HdmCommonProperties::TypeText']" /></nobr>
                        </span>
                    </td>
                    <td>
                        <xsl:value-of select="PropertyBag/Property[@name='HdmCommonProperties::TypeText']" />
                    </td>
                </tr>
                <tr>
                    <td class="label">
                        <span style="color: #7c7d7d;">
                        <nobr><xsl:value-of select="PropertyList/Property[@propname='HdmCommonProperties::ShortSizeText']" /></nobr>
                        </span>
                    </td>
                    <td>
                        <xsl:value-of select="PropertyBag/Property[@name='HdmCommonProperties::ShortSizeText']" /><br />
                        <xsl:value-of select="PropertyBag/Property[@name='HdmCommonProperties::LongSizeText']" />
                    </td>
                </tr>
                <tr>
                    <td class="label">
                        <span style="color: #7c7d7d;">
                        <nobr><xsl:value-of select="PropertyList/Property[@propname='HdmCommonProperties::HddNumber']" /></nobr>
                        </span>
                    </td>
                    <td>
                        <xsl:value-of select="PropertyBag/Property[@name='HdmCommonProperties::HddNumber']" />
                    </td>
                </tr>
                <tr>
                    <td class="label">
                        <span style="color: #7c7d7d;">
                        <nobr><xsl:value-of select="PropertyList/Property[@propname='PartitionProperties::PartitionNumber']" /></nobr>
                        </span>
                    </td>
                    <td>
                        <xsl:value-of select="PropertyBag/Property[@name='PartitionProperties::PartitionNumber']" />
                    </td>
                </tr>

                <xsl:if test="$FSName != 'UNKNOWN' and $FSName != 'INVALID' and $FSName != 'UNFORM' and $FSName != 'FREE' and $FSName != 'SYSRESERVED'">

                    <xsl:if test="$FSName != 'EXTENDED' and $FSName != 'BACKUPCAPSULE'">
                        <tr>
                            <td class="label">
                                <span style="color: #7c7d7d;">
                                <nobr><xsl:value-of select="PropertyList/Property[@propname='PartitionProperties::LabelDecorated']" /></nobr>
                                </span>
                            </td>
                            <td>
                                <xsl:value-of select="PropertyBag/Property[@name='PartitionProperties::LabelDecorated']" />
                            </td>
                        </tr>
                    </xsl:if>

                    <xsl:if test="string-length(PropertyBag/Property[@name='PartitionProperties::MbrTypeText']) != 0">
                        <tr>
                            <td class="label">
                                <span style="color: #7c7d7d;">
                                <nobr><xsl:value-of select="PropertyList/Property[@propname='PartitionProperties::MbrTypeText']" /></nobr>
                                </span>
                            </td>
                            <td>
                                <xsl:value-of select="PropertyBag/Property[@name='PartitionProperties::MbrTypeText']" />
                            </td>
                        </tr>
                    </xsl:if>

                    <xsl:if test="$FSName != 'EXTENDED'">
                        <xsl:if test="string-length(PropertyBag/Property[@name='PartitionProperties::SerialNumber']) != 0">
                            <tr>
                                <td class="label">
                                    <span style="color: #7c7d7d;">
                                    <nobr><xsl:value-of select="PropertyList/Property[@propname='PartitionProperties::SerialNumber']" /></nobr>
                                    </span>
                                </td>
                                <td>
                                    <xsl:value-of select="PropertyBag/Property[@name='PartitionProperties::SerialNumber']" />
                                </td>
                            </tr>
                        </xsl:if>
                    </xsl:if>

                    <xsl:if test="$FSName != 'EXTENDED' and $FSName != 'BACKUPCAPSULE'">
                        <xsl:if test="string-length(PropertyBag/Property[@name='PartitionProperties::BootSize']) != 0">
                            <tr>
                                <td class="label">
                                    <span style="color: #7c7d7d;">
                                    <nobr><xsl:value-of select="PropertyList/Property[@propname='PartitionProperties::BootSize']" /></nobr>
                                    </span>
                                </td>
                                <td>
                                    <xsl:value-of select="PropertyBag/Property[@name='PartitionProperties::BootSize']" />
                                </td>
                            </tr>
                        </xsl:if>
                        
                        <xsl:if test="string-length(PropertyBag/Property[@name='PartitionProperties::ClusterSize']) != 0">
                            <tr>
                                <td class="label">
                                    <span style="color: #7c7d7d;">
                                    <nobr><xsl:value-of select="PropertyList/Property[@propname='PartitionProperties::ClusterSize']" /></nobr>
                                    </span>
                                </td>
                                <td>
                                    <xsl:value-of select="PropertyBag/Property[@name='PartitionProperties::ClusterSize']" />
                                </td>
                            </tr>
                        </xsl:if>
                    </xsl:if>
                </xsl:if>
            </table>


           <br /> 
            <!--<table cellspacing="0" cellpadding="0" align="left">-->
            <table  align="left">
                <tr>
                    <td/>
                    <td class="label" align="right">
                        <span style="color: #7c7d7d;">
                            QT_TRANSLATE_NOOP("QObject", "Sector No:")
                        </span>
                    </td>
                    <td class="label" align="right">
                        <span style="color: #7c7d7d;">
                            QT_TRANSLATE_NOOP("QObject", "Cyl:")
                        </span>
                    </td>
                    <td class="label" align="right">
                        <span style="color: #7c7d7d;">
                            QT_TRANSLATE_NOOP("QObject", "Hd:")
                        </span>
                    </td>
                    <td class="label" align="right">
                        <span style="color: #7c7d7d;">
                            QT_TRANSLATE_NOOP("QObject", "Sec:")
                        </span>
                    </td>
                    <!--<td width="100%"/>-->
                </tr>
                <tr>
                    <td class="label">
                        <span style="color: #7c7d7d;">
                            <nobr><xsl:value-of select="PropertyList/Property[@propname='HdmCommonProperties::StartInSectors']" /></nobr>
                        </span>
                    </td>
                    <td align="right">
                        <xsl:variable name="StartSecDec" select="PropertyBag/Property[@name='HdmCommonProperties::StartInSectors']" />
                        <xsl:variable name="StartSecHex">
                            <xsl:call-template name="convert-to-hex">
                                <xsl:with-param name="number" select="$StartSecDec" />
                            </xsl:call-template>
                        </xsl:variable>
                        <nobr>0x<xsl:value-of select="$StartSecHex" /></nobr>&#160;<nobr>(<xsl:value-of select="$StartSecDec" />)</nobr>
                    </td>
                    <td align="right">
                        <nobr><xsl:value-of select="PropertyBag/Property[@name='PartitionProperties::StartCylinderInChs']" /></nobr>
                    </td>
                    <td align="right">
                        <nobr><xsl:value-of select="PropertyBag/Property[@name='PartitionProperties::StartHeadInChs']" /></nobr>
                    </td>
                    <td align="right">
                        <nobr><xsl:value-of select="PropertyBag/Property[@name='PartitionProperties::StartSectorInChs']" /></nobr>
                    </td>
                    <!--<td width="100%" />-->
                </tr>

                <tr>
                    <td class="label">
                        <span style="color: #7c7d7d;">
                            <nobr><xsl:value-of select="PropertyList/Property[@propname='HdmCommonProperties::EndInSectors']" /></nobr>
                        </span>
                    </td>
                    <td align="right">
                        <xsl:variable name="EndSecDec" select="PropertyBag/Property[@name='HdmCommonProperties::EndInSectors']" />
                        <xsl:variable name="EndSecHex">
                            <xsl:call-template name="convert-to-hex">
                                <xsl:with-param name="number" select="$EndSecDec" />
                            </xsl:call-template>
                        </xsl:variable>
                        <nobr>0x<xsl:value-of select="$EndSecHex" /></nobr>&#160;<nobr>(<xsl:value-of select="$EndSecDec" />)</nobr>
                    </td>
                    <td align="right">
                        <nobr><xsl:value-of select="PropertyBag/Property[@name='PartitionProperties::EndCylinderInChs']" /></nobr>
                    </td>
                    <td align="right">
                        <nobr><xsl:value-of select="PropertyBag/Property[@name='PartitionProperties::EndHeadInChs']" /></nobr>
                    </td>
                    <td align="right">
                        <nobr><xsl:value-of select="PropertyBag/Property[@name='PartitionProperties::EndSectorInChs']" /></nobr>
                    </td>
                    <!--<td width="100%" />-->
                </tr>

                <tr>
                    <td class="label">
                        <span style="color: #7c7d7d;">
                            <nobr>QT_TRANSLATE_NOOP("QObject", "Hard disk geometry:")</nobr>
                        </span>
                    </td>
                    <td align="right" />
                    <td align="right">
                        <nobr><xsl:value-of select="PropertyBag/Property[@name='HddProperties::NumberOfCylinders']" /></nobr>
                    </td>
                    <td align="right">
                        <nobr><xsl:value-of select="PropertyBag/Property[@name='HddProperties::NumberOfHeads']" /></nobr>
                    </td>
                    <td align="right">
                        <nobr><xsl:value-of select="PropertyBag/Property[@name='HddProperties::SectorsPerTrack']" /></nobr>
                    </td>
                    <!--<td width="100%" />-->
                </tr>
            </table>
        </body>
    </html>

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


