[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Substring of an attribute.

Michael Kay mike at saxonica.com
Mon Jan 4 08:43:59 PST 2010


  Substring of an attribute.
 


  _____  

From: Sweta Kedia [mailto:http://x-query.com/mailman/listinfo/talk] 
Sent: 04 January 2010 04:33
To: Michael Kay
Subject: Re:  Substring of an attribute.


Hi,

The Error message I am getting is
 XPTY0004: A sequence of more than one item is not allowed as the first
argument of
  compare() ("", "", ...) 
 
Thank you. That tells us exactly what is wrong: there is more than one
$s/loc element, and you can't compare them all at once. However, you haven't
made it clear what output you want, for example in the case where one <loc>
element satisfies the condition and other <loc> elements do not. I can't
tell you how to correct your code because you haven't explained the
requirements clearly.
 
You could replace compare($s/loc[EXP], translate(...))=0 by
$s/loc[EXP]=translate(...) -- that would test whether ANY of the $s/loc
elements satisfies the condition. But I don't know if that's the right logic
for you.
 
Michael Kay
(P.S. You replied off list, I'm sure that was unintentional). 


2010/1/2 Michael Kay <http://x-query.com/mailman/listinfo/talk>


> This query is giving error.
 
Hey, we all enjoy doing puzzles over the holiday. But puzzles are more fun
when you give people clues. Just to make it a bit easier, could you tell us
the error message?
 
Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

 


  _____  

From: http://x-query.com/mailman/listinfo/talk [mailto:http://x-query.com/mailman/listinfo/talk] On Behalf
Of Sweta Kedia
Sent: 01 January 2010 19:41
To: http://x-query.com/mailman/listinfo/talk
Subject:  Substring of an attribute.


Hello,

I want to take substring from the value of attribute and compare it with
other string.Here is the sample xml files and sample xquery code.

This is first File.


  <bvf:DocumentAndEntityInformationAbstract id="DIM820"
contextRef="I2008_AccumulatedOtherComprehensiveIncomeMember" unitRef="USD"
decimals="-3">62582000</bvf:StockholdersEquityBeforeComprehensiveIncomeNetOf
Tax> 
  <bvf:StockholdersEquityBeforeComprehensiveIncomeNetOfTax id="DIM830"
contextRef="I2008" unitRef="USD"
decimals="-3">1038608000</bvf:StockholdersEquityBeforeComprehensiveIncomeNet
OfTax> 
  <us-gaap:NetIncomeLoss id="DIM840"
contextRef="D2008_RetainedEarningsMember" unitRef="USD"
decimals="-3">199904000</us-gaap:NetIncomeLoss> 
  <us-gaap:NetIncomeLoss id="DIM850" contextRef="D2008" unitRef="USD"
decimals="-3">199904000</us-gaap:NetIncomeLoss> 



This is second File

- <>  <presentationLink
xlink:role="http://www.biovail.com/2008-12-31/role/DocumentandEntityInformat
ion" xlink:type="extended">
  <loc
xlink:href="http://taxonomies.xbrl.us/us-gaap/2009/non-gaap/dei-2009-01-31.x
sd#dei_EntityRegistrantName" xlink:label="EntityRegistrantName"
xlink:type="locator" /> 
  <loc
xlink:href="bvf-20081231.xsd#bvf_DocumentAndEntityInformationAbstract"
xlink:label="DocumentAndEntityInformationAbstract" xlink:type="locator" /> 
  <presentationArc order="10" use="optional"
xlink:arcrole="http://www.xbrl.org/2003/arcrole/parent-child"
xlink:from="DocumentAndEntityInformationAbstract"
xlink:to="EntityRegistrantName"
xlink:title="presentation:DocumentAndEntityInformationAbstract to
EntityRegistrantName" xlink:type="arc" />

I am trying to take element name from first file and translating ":" into
"-". Then i want to take attribute value of <loc> element and take substring
of attribute affter "#" and compare with element name from first file.
If the comparison is equal , I want all the <loc> elements.

This is xquery code:
for $x in
fn:doc("C:/Users/A/Documents/Sweta/users/sweta231119791251796126671/Other/20
08/Quarterly/2nd Quarterly/bvf-20081231/bvf-20081231.xml")//*[@contextRef
and @unitRef]
for $s in
fn:doc("C:/Users/A/Documents/Sweta/users/sweta231119791251796126671/Other/20
08/Quarterly/2nd
Quarterly/bvf-20081231/bvf-20081231_pre.xml")/linkbase/presentationLink
return
if(compare($s/loc[substring-after(@xlink:href,'#')],translate(name($x),':','
_'))=0)
then $s/loc
else count($s/loc)

 This query is giving error. Please suggest how can i do this.
Thanks

Sweta.






On Wed, Dec 23, 2009 at 1:30 AM, <http://x-query.com/mailman/listinfo/talk> wrote:


Send talk mailing list submissions to
       http://x-query.com/mailman/listinfo/talk

To subscribe or unsubscribe via the World Wide Web, visit
       http://x-query.com/mailman/listinfo/talk
or, via email, send a message with subject or body 'help' to
       http://x-query.com/mailman/listinfo/talk

You can reach the person managing the list at
       http://x-query.com/mailman/listinfo/talk

When replying, please edit your Subject line so it is more specific
than "Re: Contents of talk digest..."


Today's Topics:

  1. Follow Up Re:  [ANN] XML Prague 2010 Final Call
     for       Participation (CFP) (James Fuller)


----------------------------------------------------------------------

Message: 1
Date: Tue, 22 Dec 2009 18:27:49 +0100
From: James Fuller <http://x-query.com/mailman/listinfo/talk>
Subject: Follow Up Re:  [ANN] XML Prague 2010 Final Call
       for     Participation (CFP)
To: Daniela Florescu <http://x-query.com/mailman/listinfo/talk>
Cc: xquery-discuss <http://x-query.com/mailman/listinfo/talk>
Message-ID:
       <http://x-query.com/mailman/listinfo/talk>
Content-Type: text/plain; charset=ISO-8859-2

as promised, here is a more official followup from the University
about speakers presentations and published papers.

* In Czech law copyright is always implicit and remains with the
original author, unless an explicit agreement (Copyright Transfer
Agreement) is signed by the Author. The copyright symbol has no real
meaning in legal terms so it being attached or not means naught.

* as for licensing, If there is no written agreement about license
terms in Czech, authors are always giving non-exclusive rights to
publishers as default setting.

* In last years proceedings you will see the following copyrights asserted

Copyright (c) 2009 Jiří Kosek, Vít Janota
Copyright (c) 2009 MATFYZPRESS, vydavatelství Matematicko-fyzikální fakulty

Copyright of individual articles remains in hands of original authors.

MATFYZPRESS retains copyright only on the cover pages, whilst Mr.
Kosek and Mr. Janota retain copyright on the design and
ordering/layout of the articles. Once again, by czech law, the
copyright symbols themselves mean nothing and all rights would get
asserted based on authorship or separate signed agreements.

hope that clears up any misunderstandings.

regards, Jim Fuller


On Thu, Dec 17, 2009 at 6:56 PM, Daniela Florescu <http://x-query.com/mailman/listinfo/talk> wrote:
> James, Michael,
>
> thanks for your answers.
>
> I think my question wasn't clear.
>
> XML Prague has to take a clear decision about the status of the papers:
> (a) are they part of an informal proceedings (in which case they can be
> submitted
> somewhere else without infringing any copyright and affecting prior
> publication
> status), or (b)  they are part of a copyrighted publication (in which case
> they cannot).
>
> The Web site doesn't say either way, and that causes problems.
> [[ I understand from James's answer that (a) is what is meant to be, but
> it's not clear...]]
> [[ and unfortunately, being published "on the Web" can be interpreted
either
> way...]]
>
> For example, if a student submits a research proposal to XML Prague, and
> sends it
>  in the same time to a copyrighted publication (like Sigmod), then Sigmod
> had serious
> grounds for rejecting the submission because of the lack of clarity of the
> XML Prague
> web site about this issue.
>
> The students I am working with are worried about this.  Copyrights are
> serious business
> in their world.
>
> Thanks, best regards
> Dana
>
>
>
>
>
>
>
>
>
>
>
>
> On Dec 17, 2009, at 1:33 AM, Michael Kay wrote:
>
>>>
>>> here is link to 2007 proceedings
>>>
>>> http://www.xmlprague.cz/2007/images/xmlprague2007.pdf
>>>
>>> to give you an idea.
>>>
>>
>> Having attended and spoken at several past events, but not being in any
>> way
>> involved in the organisation, I would say: concentrate on saying
something
>> that is going to be interesting to the audience, and not commercial;
don't
>> worry too much about the academic criteria of originality or full
>> citations
>> of previous related work. For example, if you were to talk on scripting
in
>> XQuery, present the current state of play, not the delta changes that
have
>> occurred in the three months since your last paper on the subject. No-one
>> except other researchers in your own field wants to hear that kind of
>> paper,
>> and this is not primarily a conference where you are addressing other
>> researchers in your own field.
>>
>> It is (or has been in the past) a single-stream conference, which means
>> your
>> audience is less specialized. This also means that because everyone is
>> present at the same talks, speakers get a lot of opportunity to relate
>> their
>> work to other things that have been discussed in the conference, which
>> makes
>> it a more interactive experience.
>>
>> Michael Kay
>>
>>
>
>


------------------------------

_______________________________________________
http://x-query.com/mailman/listinfo/talk
http://x-query.com/mailman/listinfo/talk

End of talk Digest, Vol 80, Issue 12
************************************




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20100104/b25efb35/attachment-0001.htm


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.