Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 23rd, 2006, 03:22 AM
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default help in xsl getting row number

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 With Quote
  #2 (permalink)  
Old January 23rd, 2006, 05:16 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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 With Quote
  #3 (permalink)  
Old January 23rd, 2006, 05:59 AM
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

how to identify which button is clicked ,by the

same function?
Reply With Quote
  #4 (permalink)  
Old January 23rd, 2006, 07:03 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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 With Quote
  #5 (permalink)  
Old January 23rd, 2006, 08:18 AM
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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 With Quote
  #6 (permalink)  
Old January 23rd, 2006, 09:00 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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 With Quote
  #7 (permalink)  
Old January 23rd, 2006, 10:00 AM
Authorized User
 
Join Date: Dec 2005
Location: , , .
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

very very thankz for reply sir......it really

works well.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
To retrieve a row by giving row number prad_a MySQL 1 March 22nd, 2007 11:20 PM
Serial Number with each table row ketannsharma Access 3 March 16th, 2007 06:44 AM
use of xsl:number alleycat XSLT 4 February 27th, 2006 04:21 AM
Select row number N 1kHz SQL Language 4 December 27th, 2004 06:22 AM
xsl:number N.Todd XSLT 3 October 7th, 2003 08:32 PM



All times are GMT -4. The time now is 05:22 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.