rdytmire
asked on
How to AND two hex numbers in XSLT and test the result?
I'd like to select a set of nodes based on an ItemState bitmask this number is an integer and I need to test if this integer has certain bits set.
My XPath would look something like /root/itemRecord[ItemState Mask AND 0x40000000 == 0x40000000]
If applied against this document, both records should be returned.
<root>
<itemRecord>
<ItemStateMask>1073741824< /ItemState Mask>
</itemRecord>
<itemRecord>
<ItemStateMask>1073741826< /ItemState Mask>
</itemRecord>
</root>
What is the correct syntax to do a select like this?
My XPath would look something like /root/itemRecord[ItemState
If applied against this document, both records should be returned.
<root>
<itemRecord>
<ItemStateMask>1073741824<
</itemRecord>
<itemRecord>
<ItemStateMask>1073741826<
</itemRecord>
</root>
What is the correct syntax to do a select like this?
Just to help my confusion, how/why does the second value "1073741826" get returned as a matching value?
ASKER
Ok..the ItemStateMask value is a Hex value presented as an int.
So:
1073741826 = 0x40000002
1073741824 = 0x40000000
I want anything that can mask with: 0x40000000
So... 0x40000002 & 0x40000000 = 0x40000000 so it should match.
My issue is how to do the & operation on two bit masked values inside a XPATH query...
So:
1073741826 = 0x40000002
1073741824 = 0x40000000
I want anything that can mask with: 0x40000000
So... 0x40000002 & 0x40000000 = 0x40000000 so it should match.
My issue is how to do the & operation on two bit masked values inside a XPATH query...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well...that sucks...gonna have to work this a bit...