xml&xslt
hi, can anyone help me out
this is my problem..
i want to retrieve data from XML using XSLT..
and when user gives the input in textbox(for example grouping)
it must give the result....
this is my xml format...
<?xml version="1.0" encoding="utf-8" ?>
<bank>
<customername>
<branchid>V667320</branchid>
<name>ram</name>
<balance>1000</balance>
<quantity>178</quantity>
<location>tnagar</location>
</customername>
<customername>
<branchid>M382932</branchid>
<name>sam</name>
<balance>2000</balance>
<quantity>129</quantity>
<location>adyar</location>
</customername>
<customername>
<branchid>U3923839</branchid>
<name>raj</name>
<balance>3000</balance>
<quantity>200</quantity>
<location>tnagar</location>
</customername>
<customername>
<branchid>Q3929302</branchid>
<name>rakesh</name>
<balance>4000</balance>
<quantity>623</quantity>
<location>adyar</location>
</customername>
<customername>
<branchid>L930389</branchid>
<name>mani</name>
<balance>5000</balance>
<quantity>45</quantity>
<location>tnagar</location>
</customername>
<customername>
<branchid>P9392393</branchid>
<name>suresh</name>
<balance>20000</balance>
<quantity>3,230</quantity>
<location>adyar</location>
</customername>
<customername>
<branchid>P8228829</branchid>
<name>vinoth</name>
<balance>2000</balance>
<quantity>129</quantity>
<location>adyar</location>
</customername>
<customername>
<branchid>Y7829232</branchid>
<name>nanda</name>
<balance>4555</balance>
<quantity>299</quantity>
<location>adyar</location>
</customername>
<customername>
<branchid>M7382393</branchid>
<name>krishna</name>
<balance>26556</balance>
<quantity>1,198</quantity>
<location>adyar</location>
</customername>
<customername>
<branchid>L2329303</branchid>
<name>mugun</name>
<balance>6263</balance>
<quantity>2,450</quantity>
<location>adyar</location>
</customername>
<customername>
<branchid>E2930230</branchid>
<name>viki</name>
<balance>6526</balance>
<quantity>299</quantity>
<location>adyar</location>
</customername>
<customername>
<branchid>I3029320</branchid>
<name>bala</name>
<balance>4844</balance>
<quantity>3,450</quantity>
<location>adyar</location>
</customername>
<customername>
<branchid>V123049</branchid>
<name>mala</name>
<balance>2458</balance>
<quantity>1,030</quantity>
<location>tnagar</location>
</customername>
<customername>
<branchid>C039890</branchid>
<name>ganesh</name>
<balance>45454</balance>
<quantity>1,430</quantity>
<location>tnagar</location>
</customername>
<customername>
<branchid>M392829</branchid>
<name>mahesh</name>
<balance>4544</balance>
<quantity>129</quantity>
<location>tnagar</location>
</customername>
<customername>
<branchid>D190315</branchid>
<name>hari</name>
<balance>2112</balance>
<quantity>45</quantity>
<location>tnagar</location>
</customername>
<customername>
<branchid>E938393</branchid>
<name>ajesh</name>
<balance>1232</balance>
<quantity>230</quantity>
<location>tnagar</location>
</customername>
<customername>
<branchid>V392839</branchid>
<name>ashkott</name>
<balance>23233</balance>
<quantity>95</quantity>
<location>tnagar</location>
</customername>
<customername>
<branchid>K928379</branchid>
<name>balaji</name>
<balance>3213</balance>
<quantity>329</quantity>
<location>tnagar</location>
</customername>
<customername>
<branchid>I303920</branchid>
<name>kumar</name>
<balance>31154</balance>
<quantity>698</quantity>
<location>tnagar</location>
</customername>
<customername>
<branchid>V123049</branchid>
<name>muaran</name>
<balance>4484</balance>
<quantity>30</quantity>
<location>adyar</location>
</customername>
<customername>
<branchid>V392039</branchid>
<name>vignesh</name>
<balance>4848</balance>
<quantity>335</quantity>
<location>tnagar</location>
</customername>
<customername>
<branchid>L930389</branchid>
<name>kishore</name>
<balance>8551</balance>
<quantity>30</quantity>
<location>adyar</location>
</customername>
</bank>
my XSLT is below
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" />
<xsl:key name="bank" match="customername" use="location" />
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="bank">
<xsl:call-template name="Style" />
<h1>Grouping of bank by location</h1>
<xsl:for-each select="//customername[generate-id(.)=generate-id(key('bank',location))]">
<xsl:sort select="name" order="ascending" />
<h3>
<xsl:value-of select="location" />
location
</h3>
<table border="1">
<tr>
<th>customername Name</th>
<th>balance</th>
<th>location</th>
</tr>
<xsl:for-each select="key('bank',location)">
<xsl:sort select="name" />
<tr>
<td>
<xsl:value-of select="name" />
</td>
<td>
<xsl:value-of select="balance" />
</td>
<td>
<xsl:value-of select="location" />
</td>
</tr>
</xsl:for-each>
</table>
<br />
<br />
</xsl:for-each>
</xsl:stylesheet>
</xsl:template>
</xsl:stylesheet>
my program is right.. but i dnt want to hardcode it........
i mean when i give the input in textbox and when i press search button.. it must list the corresponding details...........
please help me out... or do u hve any sample programs of this kind...
|