Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 12th, 2006, 10:35 PM
Registered User
 
Join Date: Apr 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default comma delimited input.how to extract value&compare

Hi,

I am getting input like this to XSLT:

<STUDENT_ANSWER>A,B,E,F</STUDENT_ANSWER>

In xsl,how to extract these values and compare with actual answers i have in xml.

Example:
I have xml,where i have this information

<answer correctness="100" value="B"></answer>
<answer correctness="100" value="E"></answer>
<answer correctness="100" value="F"></answer>
<answer correctness="100" value="G"></answer>

what ever user input delimited student answers i need to extract and compare with answer value and let user know how many student scored correctly.

Please let me know,how to take these comma delimited and compare with actual answer?

Thanks,
Vijay

 
Old April 13th, 2006, 02:44 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


1. Use XSLT 2.0 which has a tokenize() function

2. With XSLT 1.0, go to www.exslt.org, find the str:tokenize template, and incorporate it into your code.

3. Or do the same thing by hand: it's a recursive template that uses substring-before() to extract the content before the first comma, and then calls itself to process the substring-after() the first comma.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old April 13th, 2006, 10:13 AM
Registered User
 
Join Date: Apr 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much for the details.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Comma delimited file to Excel Sheet vinod_yadav1919 VB How-To 0 August 5th, 2005 10:09 AM
Comma delimited text files bmurrin Beginning VB 6 8 February 26th, 2004 02:07 PM
Comma Delimited Update? mariakovacs Access ASP 6 October 13th, 2003 03:49 PM





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