Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > xquery help please

Reply
Thread Tools

xquery help please

 
 
paul.rusu@gmail.com
Guest
Posts: n/a
 
      11-08-2005
In the xquery code bellow, i can't seem to get the syntax arranged
starting with this line if (empty($bb)) then . The problem is either
syntax error or i have xquery code shown in the output xml. I would
appreciate help with the syntax of those last lines - how to place the
curly brackets.


for $x in doc ($doc_name)/ProcessValueTrace/Trace
return
<Trace>
{

for $y in $x/DtsResult
let $bb:=for $xx in $y/DtsRequest where (contains($xx/PDU,
string($pdu_byte_pattern))) return $xx
return
(: my problem is from here down. i have 3 outputs - first the beginning
tag and a few tags i just output
if (empty($bb)) then
""
else
return
<DtsResult>
{ $y/LogicalLink }
{ $y/ComPrimitive }

(: than i output some selected tags
for $z in $y/DtsRequest
where (contains($z/PDU, string($pdu_byte_pattern)))
return
$z

(: than i output the close tag - in case i had something before it
if (empty($bb)) then
""
else
</DtsResult>

</Trace>

I tried to place each of the 3 outputs in {..} but i kept getting
error. I played a little with the {} but i didn't get them and the
output right. I appreciate your help.

Best regards.
Paul

 
Reply With Quote
 
 
 
 
Priscilla Walmsley
Guest
Posts: n/a
 
      11-08-2005
Hi,

You don't have to have two different if-then-elses for the start and end
tag, you can just do it in one go, like below. You also had an extra
"return", and need to have { } around the FLWOR expression within the
DtsResult element. You were also missing a } before the </Trace>

for $x in doc ($doc_name)/ProcessValueTrace/Trace
return
<Trace>
{

for $y in $x/DtsResult
let $bb:=for $xx in $y/DtsRequest where (contains($xx/PDU,
string($pdu_byte_pattern))) return $xx
return
(: my problem is from here down. i have 3 outputs - first the beginning
tag and a few tags i just output
if (empty($bb)) then
""
else
<DtsResult>
{ $y/LogicalLink }
{ $y/ComPrimitive }

(: than i output some selected tags
{for $z in $y/DtsRequest
where (contains($z/PDU, string($pdu_byte_pattern)))
return
$z}
</DtsResult>

}</Trace>

That last FLWOR expression can also be just {$bb}, since it is the same
thing, as in:

<DtsResult>
{ $y/LogicalLink }
{ $y/ComPrimitive }
{ $bb }
</DtsResult>

Hope that helps,
Priscilla

----------------------------------
Priscilla Walmsley
Author, Definitive XML Schema
Coming soon: Definitive XQuery
http://www.datypic.com
----------------------------------

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Some XQuery/SQL Server 2005 help please CK XML 1 11-27-2006 08:03 PM
xquery help paul.rusu@gmail.com XML 0 11-07-2005 04:25 PM
Help Support XQuery in the Microsoft .NET Framework 2.0 Tony Lavinio XML 0 04-28-2005 09:20 PM
xquery help Jeff Kish XML 7 10-18-2004 02:29 PM
please help... ...me learn C++ please please please :) KK C++ 2 10-14-2003 02:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57