A346 Home Work 4 - Project |
Modified: |
IE caches files by default which can prevent opening of a later version. The effect is particularly noticeable during repeated tests when XML references an XSL file that has been changed but is not opened because of a cached version of the XSL.
The solution is to require IE to check for new versions on every visit to a page. In IE: Tools | Internet Options | Temporary Internet Files Settings | Every Visit to Page
The stock trading site has two main functions: managing access to the site
and managing site functions.

Managing access - Home work 3 completed the user interface for registration and logging in of stock traders and logging out the current trader out. The user view to manage access appears at right.

Managing function - This home work will complete the bulk of the user interface for the site function. The user view to manage site function appears at right. The new left menu provides access to the functions after user login, the center provides display of function results.
Our concern will be the user interface exclusively; managing the data and maintaining system integrity (i.e. programming logic) is the responsibility of software development. In the following, we will develop methods that allow testing each user interface module without the programming logic.
There are three main site functions.
User Interface - A common user interface structure with site navigation at top, application navigation at left and content in the center. The major user interface content is implemented by the following style sheets:

The portfolio is the list of an individual's stock SYMBOL, stock NAME, SHARES owned, PRICE, STOCK VALUE and TOTAL worth. The PortfolioContent.htm style sheet transforms the following XML data set to the HTML rendering at right.
Portfolio.XML<?xml-stylesheet type="text/xsl" href="PortfolioContent.htm"?>
<xml xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<rs:data>
<z:row SYMBOL="MSFT" NAME="Microsoft" SHARES="100" PRICE="10.0000" STOCKVALUE="1000.0000"/>
<z:row SYMBOL="FORD" NAME="Ford Motor" SHARES="500" PRICE="15.6700" STOCKVALUE="7835.0000"/>
<z:row SYMBOL="IBM" NAME="IBM" SHARES="10" PRICE="15.0500" STOCKVALUE="150.5000"/>
</rs:data>
</xml>
|
PortfolioContent.htm <xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"
xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<xsl:output method="html" />
<xsl:template name="PortfolioContent">
<h1>Portfolio Summary</h1>
<xsl:for-each select="xml/rs:data/z:row">
<xsl:value-of select="@SYMBOL" /> - <xsl:value-of select="@SHARES" /> -
<xsl:value-of select="@PRICE" /> - <xsl:value-of select="@STOCKVALUE" /> <br />
</xsl:for-each>
</xsl:template>
<xsl:template match="/">
<xsl:call-template name="PortfolioContent" />
</xsl:template>
</xsl:stylesheet>
|
The key points to review are:
This is how all XML trees are defined (i.e. node names) when generated using the Microsoft MSXML2.DOMDocument class.
|
The key improvements to make are:
PortfolioContent.htm <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<xsl:output method="html" />
<xsl:template name="PortfolioContent">
<h1>Portfolio</h1>
<table border="1">
<tr>
<td>Symbol</td>
<td>Shares</td>
<td>Price</td>
<td>Value</td>
</tr>
<xsl:for-each select="xml/rs:data/z:row">
<tr>
<td><xsl:value-of select="@SYMBOL" /></td>
<td><xsl:value-of select="@SHARES" /></td>
<td><xsl:value-of select="format-number(@PRICE, '$#,###,###.00')" /></td>
<td><xsl:value-of select="format-number(@STOCKVALUE, '$#,###,###.00')" /></td>
</tr>
</xsl:for-each>
<tr>
<td></td>
<td></td>
<td>Total</td>
<td>
<xsl:value-of select="format-number(sum(xml/rs:data/z:row/@STOCKVALUE), '$#,###,###.00')" />
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="/">
<xsl:call-template name="PortfolioContent" />
</xsl:template>
</xsl:stylesheet>
|
||||||||||||||||||||||||||||||||
Portfolio
|
|
The trader summary is the account information of trader's ID, FIRSTNAME, LASTNAME, and BALANCE.
The XML below for testing has been copied to the Project directory.
TraderSummary.XML<?xml-stylesheet type="text/xsl" href="TraderSummaryContent.htm"?> <xml xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema"> <rs:data> <z:row ID="Ray" FIRSTNAME="Raymond" LASTNAME="Wisman" BALANCE="990.0000"/> </rs:data> </xml> |
|

<form name="StockListForm" method="get" action="BuyStock.asp">
The XML below for testing has been copied to the Project directory.
BuyList.XML<?xml-stylesheet type="text/xsl" href="BuyListContent.htm"?> <xml xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema"> <rs:data> <z:row SYMBOL="MSFT" NAME="Microsoft" PRICE="10.0000"/> <z:row SYMBOL="GMC" NAME="General Motors" PRICE="38.1000"/> <z:row SYMBOL="FORD" NAME="Ford Motor" PRICE="15.6700"/> <z:row SYMBOL="UAL" NAME="United Airlines" PRICE="7.6400"/> <z:row SYMBOL="IBM" NAME="IBM" PRICE="15.0500"/> </rs:data> </xml> |
where < is < and > is >, which must also be hidden.
|

<form name="StockSellForm" method="get" action="SellStock.asp">
The below XML for testing has been copied to the Project directory.
SellList.XML<?xml-stylesheet type="text/xsl" href="SellListContent.htm"?> <xml xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema"> <rs:data> <z:row SYMBOL="MSFT" NAME="Microsoft" SHARES="100" PRICE="10.0000" STOCKVALUE="1000.0000"/> <z:row SYMBOL="FORD" NAME="Ford Motor" SHARES="500" PRICE="15.6700" STOCKVALUE="7835.0000"/> <z:row SYMBOL="IBM" NAME="IBM" SHARES="10" PRICE="15.0500" STOCKVALUE="150.5000"/> </rs:data> </xml> |
The solution is nearly the same as BuyListContent.htm.
|

<form name="CartListForm" method="get" action="CartEdit.asp">
The below XML for testing has been copied to the Project directory.
CartSummary.XML<?xml-stylesheet type="text/xsl" href="CartSummaryContent.htm"?> <xml xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema"> <rs:data> <z:row TRADEID="95" ID="Ray" SYMBOL="IBM" PRICE="20.0000" SHARES="5" BUY="False"/> <z:row TRADEID="100" ID="Ray" SYMBOL="MSFT" PRICE="10.0000" SHARES="10" BUY="True"/> <z:row TRADEID="101" ID="Ray" SYMBOL="MSFT" PRICE="10.0000" SHARES="100" BUY="False"/> </rs:data> </xml> |
The solution is similar to BuyListContent.htm and SellListContent.htm.
|
Assignment
Implement:
- List current stock holdings and value (PortfolioContent.htm) - Completed in class.
- List the trader summary (TraderSummaryContent.htm) - Mostly completed in class.
- List available stocks to buy (BuyListContent.htm). - Mostly completed in class.
- List stocks owned to sell (SellListContent.htm).
- List shopping cart contents (CartSummaryContent.htm).
Turn in