p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XSLT (http://p2p.wrox.com/forumdisplay.php?f=86)
-   -   Invalid Token (http://p2p.wrox.com/showthread.php?t=64787)

sani723 December 24th, 2007 05:19 AM

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

joefawcett December 24th, 2007 05:40 AM

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)

sani723 December 25th, 2007 01:42 AM

Thanks joefawcett, problem solved after applying your suggestion.


I Love XML and family


All times are GMT -4. The time now is 06:53 AM.

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