Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 June 12th, 2013, 10:48 AM
Registered User
 
Join Date: Jun 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default read string from xml

Hello all!

I need to read a string because I need to know some specific words.
For exampel my string looks like this in xml:
[...]
<text>The final date for the presentation is 03.04.2013 and the exam is on 10.05.2013.</text>
[...]

I need in my XSL-doc both dates and don't know how to read the XML-doc.
Can anybody help me please?
Unfourtunaly there is no other option to write the dates e.g. into a seperate field.
Also the lenght of the text or the position can change because every teacher writes like he wants.

Best regards, Anna
 
Old June 12th, 2013, 11:07 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If "every teacher writes what they want" then you have no chance. You've no way of detecting "Ides of March" as a date, and you've no way of knowing whether 3/4/2013 is the 3rd of April or the 4th of March.

So you'll have to decide what you're going to accept - that is, you need to write a specification of your problem. No-one can help you write code until you have done that.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old June 14th, 2013, 08:56 AM
Registered User
 
Join Date: Jun 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello mhkay,

I just needed to cut out the dates and print it on the paper.
So it doesn't matter if the teacher wrote "04.03.2013" or "04/03/2013". I just wanted to say that the dates will be at different positions in the string.

Anyway, I solved the problem with functions substring-before and substring-after.





Similar Threads
Thread Thread Starter Forum Replies Last Post
DTS Package, XML task. Read XML file and store it Victoria SQL Server DTS 0 July 24th, 2006 02:43 PM
I Need to Read an Xml from String anand_asv XML 3 March 18th, 2005 12:04 AM
read a string from a comport john.wijnands Access VBA 1 September 8th, 2003 10:59 PM
How to read a string with a space? megabytes C# 4 August 1st, 2003 03:26 PM





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