xsl-list
[Top] [All Lists]

Re: filtering XML file using starts-with

2003-12-18 13:08:14
OK, I found the problem.  I was actually looking at the wrong XML file so 
David's original answer was really all I needed.  Thanx David

---------- Original Message ----------------------------------
From: "Dan" <dan(_at_)theroadside(_dot_)org>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Date:  Thu, 18 Dec 2003 10:42:14 -0600

Thanx, but I don't think this is it.  I checked the original XML file and the 
! isn't there, it is an l as it should be.  I did a copy paste and it must 
have been bungled somewhere along the line.  The same XML file comes through 
fins if I don't try and filter it.  weird though.  Thanx.

---------- Original Message ----------------------------------
From: "Vasu Chakkera" <vasucv(_at_)hotmail(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Date:  Thu, 18 Dec 2003 16:43:10 -0800

Dan,
I can see a problem in your XML.Its not a problem  If its a typo . Your XML
is not well formed because you have missspelt <value> as <va!lue>
I am putting *** around where I think you have misspelt
<?xml version="1.0"?>
<Sales><Summary><Employee><value>Gazlay-Martin,
Janet</value></Employee><Module><value>101</value></Module><ResignTotalQuota
<value>8686333</value></ResignTotalQuota><NewTotalQuota><value>263844006.92
5</value></NewTotalQuota><StrategicTotalQuota><value>60794058.915</value></S
trategicTotalQuota><TotalTotalQuota><value>272530339.925</value></TotalTotal
Quota><NewBucketQuota><value>0</value></NewBucketQuota><ResignTotalObjective
<value>0</value></ResignTotalObjective><NewTotalObjective><value>181000000<
/value></NewTotalObjective><NewBucketObjective><value>0</value></NewBucketOb
jective><StrategicTotalObjective><value>18100000</value></StrategicTotalObje
ctive><TotalTotalObjective><value>181000000</value></TotalTotalObjective><Pe
rcentResignTotal><value>0</value></PercentResignTotal><PercentNewTotal><valu
e>145.77</value></PercentNewTotal><PercentStrategicTotal><value>335.87</valu
e></PercentStrategicTotal><PercentTotalTotal><value>150.56</value></PercentT
otalTotal><PercentNewBucket>
***<va!
lue>0</value></PercentNewBucket><JobTitleCode><value>BSEM</value></JobTitleC
ode><MarketSegmentCode><value>1</value></MarketSegmentCode><RowCounter><valu
e>368</value></RowCounter></Summary>

If it is an exact copy then it is wrong ....try to change and see. It should
normally get you an exception if the XML is not wellformed

Hope this helps
Vasu
----- Original Message -----
From: "Dan" <dan(_at_)theroadside(_dot_)org>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Thursday, December 18, 2003 8:12 AM
Subject: Re: [xsl] filtering XML file using starts-with


You are exactly right about the pretty print and I suspect right about the
rest.  However, I am still getting no results back.  Here is the exact XML
copied from notepad this time:

<?xml version="1.0"?>
<Sales><Summary><Employee><value>Gazlay-Martin,
Janet</value></Employee><Module><value>101</value></Module><ResignTotalQuota
<value>8686333</value></ResignTotalQuota><NewTotalQuota><value>263844006.92
5</value></NewTotalQuota><StrategicTotalQuota><value>60794058.915</value></S
trategicTotalQuota><TotalTotalQuota><value>272530339.925</value></TotalTotal
Quota><NewBucketQuota><value>0</value></NewBucketQuota><ResignTotalObjective
<value>0</value></ResignTotalObjective><NewTotalObjective><value>181000000<
/value></NewTotalObjective><NewBucketObjective><value>0</value></NewBucketOb
jective><StrategicTotalObjective><value>18100000</value></StrategicTotalObje
ctive><TotalTotalObjective><value>181000000</value></TotalTotalObjective><Pe
rcentResignTotal><value>0</value></PercentResignTotal><PercentNewTotal><valu
e>145.77</value></PercentNewTotal><PercentStrategicTotal><value>335.87</valu
e></PercentStrategicTotal><PercentTotalTotal><value>150.56</value></PercentT
otalTotal><PercentNewBucket><va!

lue>0</value></PercentNewBucket><JobTitleCode><value>BSEM</value></JobTitleC
ode><MarketSegmentCode><value>1</value></MarketSegmentCode><RowCounter><valu
e>368</value></RowCounter></Summary>

And here is the for-each line I am using

<xsl:for-each select="Sales/Summary[starts-with(Module/value,'10')]">

Thanx for your help, do you ahve a book recomendation BTW?

---------- Original Message ----------------------------------
From: David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Date:  Thu, 18 Dec 2003 15:44:39 GMT


- <Module>
 <value>101</value>
 </Module>

You posted an IE6 "pretty print" view of the file (I would guess)
not your real input.

which means I'm still lacking information, however if the source
does really look like that (without the "-") then the string value of
Module is
newline space space 1 0 1 newline space space
so doesn't start with "10"

You probably want (starts-with(Module/value,'10')

--
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list