XSLT and XML

So this semester at Florida International University (FIU) I’m learning a lot about working with XML.

So far I’ve been able to use XSLT files to take the data from an XML file and display it as HTML. One thing I seem to be having trouble with is managing HTML tables when nesting XSL templates. Here’s a sample code:

<?xml version=”1.0″ encoding=”utf-8″?>
<xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform&#8221;
xmlns:msxsl=”urn:schemas-microsoft-com:xslt” exclude-result-prefixes=”msxsl”
>
<xsl:output method=”html” indent=”yes”/>

<xsl:template match=”/”>

<html>
<title>Investment Accounts</title>
<h1>Investment Account</h1>
<body>
<p></p>
<table border=”1″ width=”800″>
<tr align=”center” style =”font-weight=bold”>
<td>ID</td>
<td>Name</td>
</tr>
<tr align=”center”>
<td>
<xsl:value-of select=”/accounts/account/id”/>
</td>
<td>
<xsl:value-of select=”/accounts/account/name”/>
</td>
</tr>
<tr>
<xsl:apply-templates select=”/accounts/account/investment”/>
</tr>
</table>
</body>
</html>

</xsl:template>

<xsl:template match =”/accounts/account/investment”>
<table border=”1″ width=”800″>
<tr>
<td style =”font-weight=bold”>Transactions for investment <xsl:value-of select=”@ticker”/>:
</td>
</tr>
<tr align=”center” font-weight=”bold”>
<td>Date</td>
<td>Price</td>
<td>Shares</td>
<td>Values</td>
</tr>
<tr>
<xsl:apply-templates select=”transaction”/>
</tr>
<tr style =”font-weight=bold”>
<td></td>
<td>Total Shares Processed: </td>
<td>
<xsl:value-of select=”sum(transaction/numShares)”/>
</td>
</tr>
</table>

</xsl:template>

<xsl:template match=”/accounts/account/investment/transaction”>
<tr align=”center”>
<td>
<xsl:value-of select=”date”/>
</td>
<td>
<xsl:value-of select=”price”/>
</td>
<td>
<xsl:value-of select=”numShares”/>
</td>
<td>
<xsl:value-of select=”format-number(price * numShares, ‘00,000.00’)”/>
</td>
</tr>

</xsl:template>

</xsl:stylesheet>
Now I’m learning about reading XML files from a URL and then using JAVA to manipulate the data and then write a new XML, this should be fun!

The Blogging World

Hi! My name is Miguel Suarez. This crazy idea to start blogging came to my mind and I thought, hey why not?

So here’s a little bit about me. I’m 26 years old, currently an undergraduate at Florida International University(FIU), majoring in Information Technology with a minor in business. I plan on being a web/software developper, and the purpose of this blog is mainly to talk about the things I learn as I try out new technologies.

So far I’ve worked with HTML, Java, C++, Visual Basic, JavaScript, and some flash/dreamweaver. It’s definately alot of fun and I’m looking forward to becoming an expert on some of these languages.

Here is some of my work: http://www.technove.com/ www.mastersecuritysolutions.com http://www.huntingtonsdiseasefl.org. Check them out!

Well, this is my introductory blog, I hope to be able to blog a couple times a week with new stuff I’ve learned. Check every now and then for coding samples and whatnot!

Thanks for reading!