Hi.
I see it appears that xquery is case senstitive for looking for particular attribute values etc.
Is there a standard way around this? Say I want to see all nodes with an attribute valued
"copyright" or some such?
Finally, is there a "like" function similar to sql? I perused the docs and did not see anything, but
was wondering if I missed it, or if there is a way around it? Maybe I need to write a user function?
Thanks
Jeff 4 4098
Jeff Kish wrote: I see it appears that xquery is case senstitive for looking for particular attribute values etc. Is there a standard way around this? Say I want to see all nodes with an attribute valued "copyright" or some such?
In XPath you could do
//*[translate(@attribute, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz') = 'copyright']
and as XQuery has the same functions that should work there too.
And you have regular expression matching in XPath 2.0 respectively
XQuery 1.0.
Also there are easier ways to do that in XPath 2.0 and XQuery 1.0, there
is a function
lower-case
see http://www.w3.org/TR/xquery-operators/#func-lower-case
Finally, is there a "like" function similar to sql? I perused the docs and did not see anything, but was wondering if I missed it, or if there is a way around it?
There are functions using regular expressions http://www.w3.org/TR/xquery-operators/#string.match
--
Martin Honnen http://JavaScript.FAQTs.com/
On Fri, 22 Oct 2004 13:27:51 +0200, Martin Honnen <ma*******@yahoo.de> wrote:
Jeff Kish wrote:
I see it appears that xquery is case senstitive for looking for particular attribute values etc. Is there a standard way around this? Say I want to see all nodes with an attribute valued "copyright" or some such?
In XPath you could do //*[translate(@attribute, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'copyright'] and as XQuery has the same functions that should work there too. And you have regular expression matching in XPath 2.0 respectively XQuery 1.0. Also there are easier ways to do that in XPath 2.0 and XQuery 1.0, there is a function lower-case see http://www.w3.org/TR/xquery-operators/#func-lower-case
Finally, is there a "like" function similar to sql? I perused the docs and did not see anything, but was wondering if I missed it, or if there is a way around it?
There are functions using regular expressions http://www.w3.org/TR/xquery-operators/#string.match
This appears to be a huge help. Thanks.
Jeff Kish
On Fri, 22 Oct 2004 13:27:51 +0200, Martin Honnen <ma*******@yahoo.de> wrote:
Jeff Kish wrote:
I see it appears that xquery is case senstitive for looking for particular attribute values etc. Is there a standard way around this? Say I want to see all nodes with an attribute valued "copyright" or some such?
In XPath you could do //*[translate(@attribute, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'copyright'] and as XQuery has the same functions that should work there too. And you have regular expression matching in XPath 2.0 respectively XQuery 1.0. Also there are easier ways to do that in XPath 2.0 and XQuery 1.0, there is a function lower-case see http://www.w3.org/TR/xquery-operators/#func-lower-case
Finally, is there a "like" function similar to sql? I perused the docs and did not see anything, but was wondering if I missed it, or if there is a way around it?
There are functions using regular expressions http://www.w3.org/TR/xquery-operators/#string.match
I seem to be having difficulty making this lower-case work...
For example I want to see if any attribute equals a value, so I tried this (which was worthless
except to show it was not right):
for $b in document("labrep.xml")//presentation
for $a in $b//*
where $a[fn:lower-case(@*)="pageHeader"]
return
<theElement> {name($a)}
<theAttributes>
{ $a/@*, name($a)}
</theAttributes> </theElement>
you can use lower-case() you don't need fn:lower-case()
lower-case expects a string but you have done fn:lower-case(@*) so you
have passed a sequence of nodes (from all the attributes) in XPath1
coersion to string would just take the first node and junk the rest, in
Xquery it's an error if you have more than one attribute.
Do you really not know the attribute name that may
or may not have the pageHeader value? also the lowercase of anything is
not likely to be equal to "pageHeader" as H is not lower case.
You want
$a[(for $at in @* return lower-case($at)) ="pageheader"]
or just use =
$a[ @* ="pageHeader"]
and set the default collation to be a case insensitive comparison (if
your system has such a collation available)
David This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: inquirydog |
last post by:
Can anyone explain to me why the following XQuery expression (a simple
xpath expression) returns a different result than the same expression
in xslt?
document("document.xml")//a/@b
For the...
|
by: Tony Lavinio |
last post by:
Dear Stylus Studio Friends,
The new year is scarcely one month old, but we already have lots to report!
For starters, there's Stylus Studio 6 Release 2. The latest release of
Stylus Studio...
|
by: FBS |
last post by:
Hi everybody,
I wonder if somebody could help me with this issue.
I would like to rum some XQuery codes aginst my XML files and since I'm
quite new in this area I'm not sure what to do. It is...
|
by: Clamps |
last post by:
So I've been reading about XQuery, but cannot find a dll or namespace
download to use the technology in vs.net 2002 or 2003. Any directions would
be great.
--
"If I'm the president, we're going...
|
by: BK |
last post by:
I am working on system that will have a cataloging component which would
essentially be a Folder/File structure. So far I have coded the Iteration
over a selected folder and am displaying the...
|
by: Manish |
last post by:
I am new to XML. Initially I was saving all the settings in either PHP
or text files or database tables and use to parse the config variables
from files or query from the database. Now I want to...
|
by: ismailj |
last post by:
Hi,
I'm using Weblogic 9.2 which uses Saxon 8.1.1 as its XQuery Engine. I'm using max function and in the argument I'm passing the node which has two dateTime values. It is giving exception.
...
|
by: Bloody Viking |
last post by:
Namaste, Y'all!
I've got a valid XQuery expression that I need to convert to XPath
2.0. This expression will be stored in a resource file and applied to
XML by a Java program with saxon8.jar...
|
by: henryrhenryr |
last post by:
Hi
I know the title's a bit odd. I'm trying to set up an XQuery for which the xpath is set previously according to input parameters.
If I was going to do this normally I'd do something like:
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| | |