Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 December 24th, 2007, 05:19 AM
Authorized User
 
Join Date: Mar 2007
Location: Dubai, dubai, United Arab Emirates.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Invalid Token

I have a xml file having following data

<?xml version="1.0" encoding="utf-8" ?>
<Company>
    <emp sDate="01-11-2007" eDate="30-11-2007">
        <Adult>90</Adult>
        <Child>50</Child>
    </emp>
    <emp sDate="01-12-2007" eDate="31-12-2007">
        <Adult>190</Adult>
        <Child>150</Child>
    </emp>

</Company>

and then i use this XPath to get the value

$CheckInDate = 20071225;

company/emp[concat(substring-after(substring-after(@sDate,'-'),'-'),substring(substring-after(@sDate,'-'),1,2),substring-before(@sDate,'-')) &lt; $CheckInDate and concat(substring-after(substring-after(@eDate,'-'),'-'),substring(substring-after(@eDate,'-'),1,2),substring-before(@eDate,'-')) &gt;= $CheckInDate]/Child

but it gives error that expression [u]has an invalid token.</u>

any sort of help will be appreciated.


I Love XML and family
__________________
I Love XML and family
Reply With Quote
  #2 (permalink)  
Old December 24th, 2007, 05:40 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well you could simplify matters by breaking down the date extraction into separate parts and also by using substring(@eDate, 7, 4) to get the year.

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #3 (permalink)  
Old December 25th, 2007, 01:42 AM
Authorized User
 
Join Date: Mar 2007
Location: Dubai, dubai, United Arab Emirates.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks joefawcett, problem solved after applying your suggestion.


I Love XML and family
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
xpath contains error 'has an invalid token' XMLUser XSLT 7 February 5th, 2008 02:31 AM
XPath Invalid token Hughesie78 XSLT 13 November 29th, 2007 12:59 PM
Can't get past "Token StartElement" error Colonel Angus Classic ASP XML 1 August 10th, 2005 01:21 PM
Unrecognized token was found Dennis Huisman BOOK: Professional Crystal Reports for VS.NET 0 September 6th, 2004 07:08 AM
Token error using process.start Raif ASP.NET 1.0 and 1.1 Professional 3 August 17th, 2004 08:42 PM



All times are GMT -4. The time now is 07:12 AM.


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