Connecting Tech Pros Worldwide Help | Site Map

slightly convoluted query question

  #1  
Old October 25th, 2008, 12:15 AM
kishjeff
Guest
 
Posts: n/a
I'm still looking at this.. is this even possible?
I'd like to search a set of xml files
I want to skip all xml files that have a <clientelement that
contains more than one <majortabelement,
but otherwise search for some elements with a @select attribute.

So I'm not sure how to skip the docs (or at least prevent them from
being included in the results) that have say:

<client>
<majortab ... /><majortab ... />
</client>

thanks for the hints.. still reading honestly!

Jeff
  #2  
Old October 25th, 2008, 12:05 PM
Martin Honnen
Guest
 
Posts: n/a

re: slightly convoluted query question


kishjeff wrote:
Quote:
I'm still looking at this.. is this even possible?
I'd like to search a set of xml files
I want to skip all xml files that have a <clientelement that
contains more than one <majortabelement,
but otherwise search for some elements with a @select attribute.
>
So I'm not sure how to skip the docs (or at least prevent them from
being included in the results) that have say:
>
<client>
<majortab ... /><majortab ... />
</client>
Well if you use XSLT or XQuery then you can certainly check whether
count(/client/majortab) 1
With XSLT 2.0 or XQuery 1.0 you can load multiple XML source documents
using the collection function, see
http://www.saxonica.com/documentatio...llections.html for
instance how that works with Saxon 9.



--

Martin Honnen
http://JavaScript.FAQTs.com/
  #3  
Old October 25th, 2008, 02:55 PM
Jeff Kish
Guest
 
Posts: n/a

re: slightly convoluted query question


On Sat, 25 Oct 2008 13:00:41 +0200, Martin Honnen <mahotrash@yahoo.de>
wrote:
Quote:
>kishjeff wrote:
Quote:
>I'm still looking at this.. is this even possible?
>I'd like to search a set of xml files
>I want to skip all xml files that have a <clientelement that
>contains more than one <majortabelement,
>but otherwise search for some elements with a @select attribute.
>>
>So I'm not sure how to skip the docs (or at least prevent them from
>being included in the results) that have say:
>>
><client>
><majortab ... /><majortab ... />
></client>
>
>Well if you use XSLT or XQuery then you can certainly check whether
count(/client/majortab) 1
>With XSLT 2.0 or XQuery 1.0 you can load multiple XML source documents
>using the collection function, see
>http://www.saxonica.com/documentatio...llections.html for
>instance how that works with Saxon 9.
Yes, I have used the collection to load multiples, but I am not sure
how to exclude them from the processing based on whether or not they
have a certain element combination.

It is xquery, but a slightly older version... it is actually
ipsi-xq-1.3.4

I really like it.
Unfortunately it seems to be having a problem with starts-with
functions so I might have to cast about for another implementation if
I need to use that.

So I'm not sure how to structure the query so that the client/majortab
count 1 go ahead v.s. skip if < =1

thanks
Jeff
  #4  
Old October 25th, 2008, 04:45 PM
Martin Honnen
Guest
 
Posts: n/a

re: slightly convoluted query question


Jeff Kish wrote:
Quote:
So I'm not sure how to structure the query so that the client/majortab
count 1 go ahead v.s. skip if < =1
Well you could use the condition in a predicate when you select nodes e.g.

collection('file:///C:/someDir?select=*.xml')/foo/client[count(majortab)
Quote:
1]
or you could use a where condition

for $client in collection('file:///C:/someDir?select=*.xml')/foo/client
where count($client/majortab) 1
return $client

--

Martin Honnen
http://JavaScript.FAQTs.com/
  #5  
Old October 27th, 2008, 11:05 PM
kishjeff
Guest
 
Posts: n/a

re: slightly convoluted query question


On Oct 25, 11:37*am, Martin Honnen <mahotr...@yahoo.dewrote:
Quote:
Jeff Kish wrote:
Quote:
So I'm not sure how to structure the query so that the client/majortab
count 1 go ahead v.s. skip if < =1
>
Well you could use the condition in a predicate when you select nodes e.g..
>
collection('file:///C:/someDir?select=*.xml')/foo/client[count(majortab)
*1]
>
or you could use a where condition
>
* *for $client in collection('file:///C:/someDir?select=*.xml')/foo/client
* *where count($client/majortab) 1
* *return $client
>
--
>
* * * * Martin Honnen
* * * *http://JavaScript.FAQTs.com/
I'll try it, thanks much.
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
slightly convoluted sorry if repost didn't see last one kishjeff answers 0 October 25th, 2008 12:25 AM
return Oracle stored function value back to Access VBA colmkav answers 8 July 17th, 2007 12:55 PM
Design frustration - how often does this happen to you... BlueDolphin answers 10 November 12th, 2005 04:41 PM
Unification of Methods and Functions David MacQuigg answers 99 July 18th, 2005 12:28 PM