Reputation: 9080
I'm using XSLT 1.0
I have a node that sometimes has a ~ in it:
<node id="123~001"/>
And sometimes it doesn't:
<node id="123"/>
I'm wondering if the substring-before command allows for optional characters? If it doesn't what is the best way to check to see if the ~ exists or not?
Upvotes: 0
Views: 90
Reputation: 16927
Just add an -, then there always is one:
substring-before(concat(@id, "-"), "-")
Upvotes: 1