Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="UTF-8"?>
- <?xml-stylesheet href="election.xsl" type="text/xsl" ?>
- <?xml-stylesheet type="text/xsl" href="election.xsl"?>
- <election>
- <poll>
- <province>Province 1</province>
- <district>District 1</district>
- <division>Division 1</division>
- <year>2013</year>
- <registered_voters>2000</registered_voters>
- <vote_rejected>50</vote_rejected>
- <vote_received>
- <party>
- <partyname>Party 1</partyname>
- <symbol>Symbol 1</symbol>
- <color>Red</color>
- <candidate_name>Mr. X</candidate_name>
- <no_votes>1750</no_votes>
- </party>
- <party>
- <partyname>Party 2</partyname>
- <symbol>Symbol 2</symbol>
- <color>Green</color>
- <candidate_name>Mr. Y</candidate_name>
- <no_votes>200</no_votes>
- </party>
- </vote_received>
- </poll>
- <poll>
- <province>Province 2</province>
- <district>District 1</district>
- <division>Division 3</division>
- <year>2013</year>
- <registered_voters>1000</registered_voters>
- <vote_rejected>20</vote_rejected>
- <vote_received>
- <party>
- <partyname>Party 1</partyname>
- <symbol>Symbol 3</symbol>
- <color>Blue</color>
- <candidate_name>Mr. Z</candidate_name>
- <no_votes>860</no_votes>
- </party>
- <party>
- <partyname>Party 2</partyname>
- <symbol>Symbol 4</symbol>
- <color>Black</color>
- <candidate_name>Mr. A</candidate_name>
- <no_votes>120</no_votes>
- </party>
- </vote_received>
- </poll>
- </election>
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- Edited by XMLSpy® -->
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:template match="/">
- <html>
- <body>
- <xsl:for-each select="election/poll">
- <xsl:sort select="." order="ascending"/>
- <table border="1">
- <tr>
- <td>
- <table>
- <tr>
- <td><xsl:value-of select="province"/></td>
- </tr>
- <tr>
- <td><xsl:value-of select="district"/></td>
- </tr>
- <tr>
- <td><xsl:value-of select="division"/></td>
- </tr>
- <tr>
- <td><xsl:value-of select="year"/></td>
- </tr>
- </table>
- </td>
- <td>
- <table>
- <tr bgcolor="#9acd32">
- <td>Registered Voters: <xsl:value-of select="registered_voters"/></td>
- <td>Votes Rejected: <xsl:value-of select="vote_rejected"/></td>
- </tr>
- <xsl:for-each select="vote_received/party">
- <tr>
- <td colspan="2">
- <table border="1">
- <tr bgcolor="#9acd32">
- <td>Party Name: <xsl:value-of select="partyname"/></td>
- </tr>
- <tr>
- <td>Symbol: <xsl:value-of select="symbol"/></td>
- </tr>
- <tr>
- <td>Color: <xsl:value-of select="color"/></td>
- </tr>
- <tr>
- <td>Candidate Name: <xsl:value-of select="candidate_name"/></td>
- </tr>
- <tr>
- <td>Number of Votes: <xsl:value-of select="no_votes"/></td>
- </tr>
- </table>
- </td>
- </tr>
- </xsl:for-each>
- <tr bgcolor="#9acd32">
- <td>Total Votes Received: <xsl:value-of select="sum(vote_received/party//no_votes)"/></td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </xsl:for-each>
- </body>
- </html>
- </xsl:template></xsl:stylesheet>
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="UTF-8"?>
- <?xml-stylesheet href="election.xsl" type="text/xsl" ?>
- <?xml-stylesheet type="text/xsl" href="election.xsl"?>
- <election xmlns="http://www.w3schools.com"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.w3schools.com election.xsd">
- <poll>
- <province>Province 1</province>
- <district>District 1</district>
- <division>Division 1</division>
- <year>2013</year>
- ..........