|
Subject:
|
help in xsl getting row number
|
|
Posted By:
|
pandian
|
Post Date:
|
1/23/2006 2:22:30 AM
|
Dear Friends,
I am genarating n number of record dynamically in xml
format . i am dispaly it in table format with xsl. Each record
contains a run button . in that xsl i am using the same code for each
record .
now the problem is , when click the particular button (say
button in row 2 ) it should return the row number( ie 2).
i am using the same code for button generation , so it will call
the same function on a click of all Button .i can't get specific
row number ?
please give me some idea.
|
|
Reply By:
|
mhkay
|
Reply Date:
|
1/23/2006 4:16:38 AM
|
There are various ways you can generate a sequential number in XSLT, for example the position() function, or the xsl:number instruction.
Michael Kay http://www.saxonica.com/ Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|
Reply By:
|
pandian
|
Reply Date:
|
1/23/2006 4:59:44 AM
|
how to identify which button is clicked ,by the
same function?
|
|
Reply By:
|
mhkay
|
Reply Date:
|
1/23/2006 6:03:00 AM
|
Remember that you use XSLT to generate the HTML source code, not to respond to user events in the browser. Identifying the button that's been clicked is something that happens long after the XSLT has finished executing. Think about how you would write an HTML page with multiple buttons "by hand", (i.e. with each button having a unique label), and then think about how to write the XSLT to generate that HTML.
Michael Kay http://www.saxonica.com/ Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|
Reply By:
|
pandian
|
Reply Date:
|
1/23/2006 7:18:58 AM
|
thankz for ur reply. how can we get the source
of click ( name of the button ) in OnClick Event?
i am calling same function for every button's
onClick Event ?
|
|
Reply By:
|
mhkay
|
Reply Date:
|
1/23/2006 8:00:26 AM
|
Call the function with a parameter that identifies the button.
In your XSLT, generate the code for the function call to include a value for this parameter, eg..
<button onClick="process-button({position()})">
Michael Kay http://www.saxonica.com/ Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|
Reply By:
|
pandian
|
Reply Date:
|
1/23/2006 9:00:48 AM
|
very very thankz for reply sir......it really
works well.
|