<?xml version='1.0' ?>
<!--
  * DITA Storm XSL Stylesheet
  *
  * Defines transformation to be applied to the original XML document to properly
  * render it in DITA Storm editing area.
  *
  * IMPORTANT: Any changes to this file need to be compiled with provided
  *      Resource Compiler.  Result of compilation (file 'simple.xsl.js'), should
  *      replace original 'simple.xsl.js' in DITAStorm/config directory.
  *
  * (c) LogPerspective Inc. 2006,2007
 -->
 <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

	<xsl:output method="html"/>
    <xsl:param name='editing'></xsl:param>

	<!-- Topic Elements -->

    <xsl:template match='invoice'>
        <h1>Invoice</h1>
        <xsl:apply-templates select='invoiceheader'/>

        <h2 style='padding-top:10px'>Items</h2>
        <table>
            <xsl:apply-templates select='invoicedetails'/>
        </table>
        <A href='#' onclick="_addElement('invoicedetails')" class='genericActiveElement'>Add Item</A>

        <h2 style='padding-top:10px'>Summary</h2>
        <xsl:apply-templates select='invoicesummary'/>
    </xsl:template>

    <xsl:template match='invoiceheader'>
        <table cellspacing='4'>
            <tr><xsl:apply-templates select='party'/></tr>
        </table>
        <A href='#' onclick="_addElement('party')" class='genericActiveElement'>Add Party</A>
    </xsl:template>

    <xsl:template match='party'>
        <td valign='top' style='width:250px'>
            <span style='font-weight:bold'>
                <xsl:choose>
                    <xsl:when test="@type='buyer'">Buyer</xsl:when>
                    <xsl:when test="@type='seller'">Seller</xsl:when>
                    <xsl:when test="@type='invoicee'">Invoicee</xsl:when>
                    <xsl:otherwise>Party</xsl:otherwise>
                </xsl:choose>
            </span>
            <A href='#' onclick="_showProperties()" class='genericActiveElement'> change</A>
            <A href='#' onclick="_delete()" class='genericActiveElement'>delete</A>
            <table style='border:1px solid #CCCCCC; padding:3px' width='100%'>
                <tr>
                    <td align='right' valign='top'>Name:</td>
                    <td width='99%'><xsl:apply-templates select='name'/></td>
                </tr>
                <tr>
                    <td align='right' valign='top'>Address:</td>
                    <td><xsl:apply-templates select='address'/></td>
                </tr>
            </table>
        </td>
    </xsl:template>

    <xsl:template match='name|address|partnum|partdesc|quantity|unitprice|netvalue|taxvalue|grossvalue'>
        <div style='border-bottom: 1px dotted #555555'><xsl:apply-templates/></div>
    </xsl:template>

    <xsl:template match='invoicedetails'>
        <tr>
            <td width='70'>Item:</td>
            <td width='70' valign='bottom'><xsl:apply-templates select='partnum'/></td>
            <td width='300' valign='bottom'><xsl:apply-templates select='partdesc'/></td>
            <td width='50' valign='bottom' align='right'><xsl:apply-templates select='quantity'/></td>
            <td width='70' valign='bottom' align='right'><xsl:apply-templates select='unitprice'/></td>
        </tr>
    </xsl:template>

    <xsl:template match='invoicesummary'>
        <table style='padding:3px'>
            <tr>
                <td align='right' valign='top' width='100'>Net Value:</td>
                <td align='right' width='460'><xsl:apply-templates select='netvalue'/></td>
            </tr>
            <tr>
                <td align='right' valign='top' width='100'>Tax Value:</td>
                <td align='right' width='460'><xsl:apply-templates select='taxvalue'/></td>
            </tr>
            <tr>
                <td align='right' valign='top' width='100'><b>Gross Value:</b></td>
                <td align='right' width='460'><xsl:apply-templates select='grossvalue'/></td>
            </tr>
        </table>
    </xsl:template>

</xsl:stylesheet>
