fn:boolean What does it for?How does one parse XML files?Simplest way to have a configuration file in a Windows Forms C# ApplicationWhat characters do I need to escape in XML documents?What does “xmlns” in XML mean?What does <![CDATA[]]> in XML mean?What does the 'standalone' directive mean in XML?Oracle 11g: Extracting and Counting XML elementsDocx or XPS(or ooxml in general) Relationship transform exampleIs it possible to use OR on a where clause in XQuery?Where to find where a function originates in eclipse, using XML? (MAC)
Three Subway Escalators
Nilpotent elements of Lie algebra and unipotent groups
Quickest way to move a line in a text file before another line in a text file?
Is it ethical to tell my teaching assistant that I like him?
A Real World Example for Divide and Conquer Method
How far off did Apollo 11 land?
Why didn't NASA launch communications relay satellites for the Apollo missions?
What is the intuition for higher homotopy groups not vanishing?
What's a German word for »Sandbagger«?
Why is there an extra "t" in Lemmatization?
P-adic functions on annuli
Aren't all schwa sounds literally /ø/?
Does a hash function have a Upper bound on input length?
Are there foods that astronauts are explicitly never allowed to eat?
TCP connections hang during handshake
I want light controlled by one switch, not two
Do you need to have the original move to take a "Replaces:" move?
Linux ext4 restore file and directory access rights after bad backup/restore
Linearize or approximate a square root constraint
Redirection operator, standard input and command parameters
Improving an O(N^2) function (all entities iterating over all other entities)
Making an example from 'Clean Code' more functional
Inside Out and Back to Front
You have no, but can try for yes
fn:boolean What does it for?
How does one parse XML files?Simplest way to have a configuration file in a Windows Forms C# ApplicationWhat characters do I need to escape in XML documents?What does “xmlns” in XML mean?What does <![CDATA[]]> in XML mean?What does the 'standalone' directive mean in XML?Oracle 11g: Extracting and Counting XML elementsDocx or XPS(or ooxml in general) Relationship transform exampleIs it possible to use OR on a where clause in XQuery?Where to find where a function originates in eclipse, using XML? (MAC)
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have already read some articles but I am still confused about the "fn:boolean"in XQuery3.0...Is this a function to
This is where I look at:
http://www.xqueryfunctions.com/xq/fn_boolean.html
For instance:
If I put fn:boolean ((1,2) > (5000,6,1)), it is true.
If I put fn:boolean ((6,1) > (1,99,22)), it is true as well!
I am really confused about this function even though the article online stating that this function is rarely called but I still want to figure out what does it for...
xml xquery
add a comment |
I have already read some articles but I am still confused about the "fn:boolean"in XQuery3.0...Is this a function to
This is where I look at:
http://www.xqueryfunctions.com/xq/fn_boolean.html
For instance:
If I put fn:boolean ((1,2) > (5000,6,1)), it is true.
If I put fn:boolean ((6,1) > (1,99,22)), it is true as well!
I am really confused about this function even though the article online stating that this function is rarely called but I still want to figure out what does it for...
xml xquery
add a comment |
I have already read some articles but I am still confused about the "fn:boolean"in XQuery3.0...Is this a function to
This is where I look at:
http://www.xqueryfunctions.com/xq/fn_boolean.html
For instance:
If I put fn:boolean ((1,2) > (5000,6,1)), it is true.
If I put fn:boolean ((6,1) > (1,99,22)), it is true as well!
I am really confused about this function even though the article online stating that this function is rarely called but I still want to figure out what does it for...
xml xquery
I have already read some articles but I am still confused about the "fn:boolean"in XQuery3.0...Is this a function to
This is where I look at:
http://www.xqueryfunctions.com/xq/fn_boolean.html
For instance:
If I put fn:boolean ((1,2) > (5000,6,1)), it is true.
If I put fn:boolean ((6,1) > (1,99,22)), it is true as well!
I am really confused about this function even though the article online stating that this function is rarely called but I still want to figure out what does it for...
xml xquery
xml xquery
asked Mar 26 at 12:35
PeterPeter
92 bronze badges
92 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
The function fn:boolean(X)
returns the effective boolean value of X. For example, the effective boolean value of 1 is true, 0 is false, "true" is true, "" is false, "false" is (wait for it) true. The EBV of a node (or a non-empty node-sequence) is true, which is what makes expressions like X[following-sibling::X]
work.
The effective boolean value of a boolean is the boolean unchanged: and that's the case with your example.
There are two cases where a call to fn:boolean is pointless:
where the argument to the function is already a boolean, as in your example
where the call appears in a context, such as the condition of an XPath 2.0 "if" expression, or a predicate in square brackets, or the
test
attribute ofxsl:if
, where there is in effect an implicit call onfn:boolean()
already.
In other contexts, for example where you are supplying an argument to a function or binding the value of an XSLT or XQuery variable, calling fn:boolean explicitly can be useful to force the value to the right type. It can also help the reader of your code to understand that there is a type conversion happening.
add a comment |
Well, what do you think is the result of (6,1) > (1,99,22)
in XQuery? That gives a boolean value already so maybe you should start figuring out to understand comparison of sequences first: https://www.w3.org/TR/xquery-31/#id-general-comparisons says "The result of the comparison is true if and only if there is a pair of atomic values, one in the first operand sequence and the other in the second operand sequence, that have the required magnitude relationship". So as 6
from the first sequence on the left is greater than 1
in the second sequence the comparison gives true.
Calling boolean
then on that value does not change that as that function for boolean values does not give anything but the boolean value passed in.
So how about the ((1,2) > (5000,6,1))? 1 is way smaller than 5000 and the "greater than"is not true at all...
– Peter
Mar 26 at 13:03
Edit: I think I figured it out and please correct me if my concept is wrong.. If any number of the left is greater than the right, it is "True"..So If I put ((2,3) > (90,99,100)) , the return is "False".
– Peter
Mar 26 at 13:11
Yes, you are right, "there is a pair of (..) values, one in the first operand sequence and the other in the second operand sequence, that have the required magnitude relationship" for your case with>
could be expressed as "any number on the left is greater than the right" or perhaps as "there is at least one number on the left greater than at least one number on the right".
– Martin Honnen
Mar 26 at 14:49
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55357347%2ffnboolean-what-does-it-for%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The function fn:boolean(X)
returns the effective boolean value of X. For example, the effective boolean value of 1 is true, 0 is false, "true" is true, "" is false, "false" is (wait for it) true. The EBV of a node (or a non-empty node-sequence) is true, which is what makes expressions like X[following-sibling::X]
work.
The effective boolean value of a boolean is the boolean unchanged: and that's the case with your example.
There are two cases where a call to fn:boolean is pointless:
where the argument to the function is already a boolean, as in your example
where the call appears in a context, such as the condition of an XPath 2.0 "if" expression, or a predicate in square brackets, or the
test
attribute ofxsl:if
, where there is in effect an implicit call onfn:boolean()
already.
In other contexts, for example where you are supplying an argument to a function or binding the value of an XSLT or XQuery variable, calling fn:boolean explicitly can be useful to force the value to the right type. It can also help the reader of your code to understand that there is a type conversion happening.
add a comment |
The function fn:boolean(X)
returns the effective boolean value of X. For example, the effective boolean value of 1 is true, 0 is false, "true" is true, "" is false, "false" is (wait for it) true. The EBV of a node (or a non-empty node-sequence) is true, which is what makes expressions like X[following-sibling::X]
work.
The effective boolean value of a boolean is the boolean unchanged: and that's the case with your example.
There are two cases where a call to fn:boolean is pointless:
where the argument to the function is already a boolean, as in your example
where the call appears in a context, such as the condition of an XPath 2.0 "if" expression, or a predicate in square brackets, or the
test
attribute ofxsl:if
, where there is in effect an implicit call onfn:boolean()
already.
In other contexts, for example where you are supplying an argument to a function or binding the value of an XSLT or XQuery variable, calling fn:boolean explicitly can be useful to force the value to the right type. It can also help the reader of your code to understand that there is a type conversion happening.
add a comment |
The function fn:boolean(X)
returns the effective boolean value of X. For example, the effective boolean value of 1 is true, 0 is false, "true" is true, "" is false, "false" is (wait for it) true. The EBV of a node (or a non-empty node-sequence) is true, which is what makes expressions like X[following-sibling::X]
work.
The effective boolean value of a boolean is the boolean unchanged: and that's the case with your example.
There are two cases where a call to fn:boolean is pointless:
where the argument to the function is already a boolean, as in your example
where the call appears in a context, such as the condition of an XPath 2.0 "if" expression, or a predicate in square brackets, or the
test
attribute ofxsl:if
, where there is in effect an implicit call onfn:boolean()
already.
In other contexts, for example where you are supplying an argument to a function or binding the value of an XSLT or XQuery variable, calling fn:boolean explicitly can be useful to force the value to the right type. It can also help the reader of your code to understand that there is a type conversion happening.
The function fn:boolean(X)
returns the effective boolean value of X. For example, the effective boolean value of 1 is true, 0 is false, "true" is true, "" is false, "false" is (wait for it) true. The EBV of a node (or a non-empty node-sequence) is true, which is what makes expressions like X[following-sibling::X]
work.
The effective boolean value of a boolean is the boolean unchanged: and that's the case with your example.
There are two cases where a call to fn:boolean is pointless:
where the argument to the function is already a boolean, as in your example
where the call appears in a context, such as the condition of an XPath 2.0 "if" expression, or a predicate in square brackets, or the
test
attribute ofxsl:if
, where there is in effect an implicit call onfn:boolean()
already.
In other contexts, for example where you are supplying an argument to a function or binding the value of an XSLT or XQuery variable, calling fn:boolean explicitly can be useful to force the value to the right type. It can also help the reader of your code to understand that there is a type conversion happening.
answered Mar 26 at 15:02
Michael KayMichael Kay
115k6 gold badges64 silver badges122 bronze badges
115k6 gold badges64 silver badges122 bronze badges
add a comment |
add a comment |
Well, what do you think is the result of (6,1) > (1,99,22)
in XQuery? That gives a boolean value already so maybe you should start figuring out to understand comparison of sequences first: https://www.w3.org/TR/xquery-31/#id-general-comparisons says "The result of the comparison is true if and only if there is a pair of atomic values, one in the first operand sequence and the other in the second operand sequence, that have the required magnitude relationship". So as 6
from the first sequence on the left is greater than 1
in the second sequence the comparison gives true.
Calling boolean
then on that value does not change that as that function for boolean values does not give anything but the boolean value passed in.
So how about the ((1,2) > (5000,6,1))? 1 is way smaller than 5000 and the "greater than"is not true at all...
– Peter
Mar 26 at 13:03
Edit: I think I figured it out and please correct me if my concept is wrong.. If any number of the left is greater than the right, it is "True"..So If I put ((2,3) > (90,99,100)) , the return is "False".
– Peter
Mar 26 at 13:11
Yes, you are right, "there is a pair of (..) values, one in the first operand sequence and the other in the second operand sequence, that have the required magnitude relationship" for your case with>
could be expressed as "any number on the left is greater than the right" or perhaps as "there is at least one number on the left greater than at least one number on the right".
– Martin Honnen
Mar 26 at 14:49
add a comment |
Well, what do you think is the result of (6,1) > (1,99,22)
in XQuery? That gives a boolean value already so maybe you should start figuring out to understand comparison of sequences first: https://www.w3.org/TR/xquery-31/#id-general-comparisons says "The result of the comparison is true if and only if there is a pair of atomic values, one in the first operand sequence and the other in the second operand sequence, that have the required magnitude relationship". So as 6
from the first sequence on the left is greater than 1
in the second sequence the comparison gives true.
Calling boolean
then on that value does not change that as that function for boolean values does not give anything but the boolean value passed in.
So how about the ((1,2) > (5000,6,1))? 1 is way smaller than 5000 and the "greater than"is not true at all...
– Peter
Mar 26 at 13:03
Edit: I think I figured it out and please correct me if my concept is wrong.. If any number of the left is greater than the right, it is "True"..So If I put ((2,3) > (90,99,100)) , the return is "False".
– Peter
Mar 26 at 13:11
Yes, you are right, "there is a pair of (..) values, one in the first operand sequence and the other in the second operand sequence, that have the required magnitude relationship" for your case with>
could be expressed as "any number on the left is greater than the right" or perhaps as "there is at least one number on the left greater than at least one number on the right".
– Martin Honnen
Mar 26 at 14:49
add a comment |
Well, what do you think is the result of (6,1) > (1,99,22)
in XQuery? That gives a boolean value already so maybe you should start figuring out to understand comparison of sequences first: https://www.w3.org/TR/xquery-31/#id-general-comparisons says "The result of the comparison is true if and only if there is a pair of atomic values, one in the first operand sequence and the other in the second operand sequence, that have the required magnitude relationship". So as 6
from the first sequence on the left is greater than 1
in the second sequence the comparison gives true.
Calling boolean
then on that value does not change that as that function for boolean values does not give anything but the boolean value passed in.
Well, what do you think is the result of (6,1) > (1,99,22)
in XQuery? That gives a boolean value already so maybe you should start figuring out to understand comparison of sequences first: https://www.w3.org/TR/xquery-31/#id-general-comparisons says "The result of the comparison is true if and only if there is a pair of atomic values, one in the first operand sequence and the other in the second operand sequence, that have the required magnitude relationship". So as 6
from the first sequence on the left is greater than 1
in the second sequence the comparison gives true.
Calling boolean
then on that value does not change that as that function for boolean values does not give anything but the boolean value passed in.
answered Mar 26 at 12:45
Martin HonnenMartin Honnen
116k6 gold badges63 silver badges82 bronze badges
116k6 gold badges63 silver badges82 bronze badges
So how about the ((1,2) > (5000,6,1))? 1 is way smaller than 5000 and the "greater than"is not true at all...
– Peter
Mar 26 at 13:03
Edit: I think I figured it out and please correct me if my concept is wrong.. If any number of the left is greater than the right, it is "True"..So If I put ((2,3) > (90,99,100)) , the return is "False".
– Peter
Mar 26 at 13:11
Yes, you are right, "there is a pair of (..) values, one in the first operand sequence and the other in the second operand sequence, that have the required magnitude relationship" for your case with>
could be expressed as "any number on the left is greater than the right" or perhaps as "there is at least one number on the left greater than at least one number on the right".
– Martin Honnen
Mar 26 at 14:49
add a comment |
So how about the ((1,2) > (5000,6,1))? 1 is way smaller than 5000 and the "greater than"is not true at all...
– Peter
Mar 26 at 13:03
Edit: I think I figured it out and please correct me if my concept is wrong.. If any number of the left is greater than the right, it is "True"..So If I put ((2,3) > (90,99,100)) , the return is "False".
– Peter
Mar 26 at 13:11
Yes, you are right, "there is a pair of (..) values, one in the first operand sequence and the other in the second operand sequence, that have the required magnitude relationship" for your case with>
could be expressed as "any number on the left is greater than the right" or perhaps as "there is at least one number on the left greater than at least one number on the right".
– Martin Honnen
Mar 26 at 14:49
So how about the ((1,2) > (5000,6,1))? 1 is way smaller than 5000 and the "greater than"is not true at all...
– Peter
Mar 26 at 13:03
So how about the ((1,2) > (5000,6,1))? 1 is way smaller than 5000 and the "greater than"is not true at all...
– Peter
Mar 26 at 13:03
Edit: I think I figured it out and please correct me if my concept is wrong.. If any number of the left is greater than the right, it is "True"..So If I put ((2,3) > (90,99,100)) , the return is "False".
– Peter
Mar 26 at 13:11
Edit: I think I figured it out and please correct me if my concept is wrong.. If any number of the left is greater than the right, it is "True"..So If I put ((2,3) > (90,99,100)) , the return is "False".
– Peter
Mar 26 at 13:11
Yes, you are right, "there is a pair of (..) values, one in the first operand sequence and the other in the second operand sequence, that have the required magnitude relationship" for your case with
>
could be expressed as "any number on the left is greater than the right" or perhaps as "there is at least one number on the left greater than at least one number on the right".– Martin Honnen
Mar 26 at 14:49
Yes, you are right, "there is a pair of (..) values, one in the first operand sequence and the other in the second operand sequence, that have the required magnitude relationship" for your case with
>
could be expressed as "any number on the left is greater than the right" or perhaps as "there is at least one number on the left greater than at least one number on the right".– Martin Honnen
Mar 26 at 14:49
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55357347%2ffnboolean-what-does-it-for%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown