Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
how can I have a tag check its content? I can't use starts-with because I want the answer to be "1" and there is also a "10".
I am looking for when hazid = 1 or the first time hazid has content.
(And how would another tag check hazid's content?)
Thanks!
Thanks Brandon! I want to check from <icon>
<exp>
<icon><title></title><hazid></hazid><hazdesc></hazdesc>
<icon><title></title><hazid></hazid><hazdesc></hazdesc>
<icon><title></title><hazid></hazid><hazdesc></hazdesc>
</exp>
from icon: following-sibling::hazid[. = '1']
is not right...it is coming up true when hazid is empty as well as when hazid = 1
My mistake, <icon/> is a single tag, it is not the parent of hazid (as I understand it)
Via styler 5.4, I am inserting a condition onto <icon/> using xpath: following-sibling::hazid[. = '1'] is true
If I put test gentext "
<exp>
TRUE <icon><title>title</title> <hazid></hazid><hazdesc>text.</hazdesc>
TRUE<icon><title>title</title><hazid>2</hazid><hazdesc>text</hazdesc>
<icon><title>title</title><hazid>4</hazid><hazdesc>text</hazdesc>
</exp>
Thanks for any help!
Thanks, everyone!
following-sibling::hazid[1][normalize-space(.) = '1'] worked as I wished.
Is there a way to write the condition in Styler so it doesn't convert to a Boolean and just checks the value?
following-sibling::hazid[text()='1'] returned the same results as following-sibling::hazid[. = '1'] with TRUE in the empty hazids.