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 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
 
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)
 
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




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





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