XSLT Similar functionality to SQL "WHERE LIKE"
- by Fishcake
I have the following XML
<Answer>
<Label>FCVCMileage</Label>
<Value>3258</Value>
<Iteration>0</Iteration>
<DataType>NUMBER</DataType>
</Answer>
And need to get the Value underneath the Mileage label. However the 4 letter prefix to Mileage could be any 1 of 8 different prefixes.
I know I could find the value by testing for every combination using xsl:if or xsl:choose but is there a more elegant way that would work similar to the following SQL and also wouldn't need changes to code being made if other prefixes were added.
WHERE label LIKE '%Mileage'
NB. There will only ever be 1 label element containing the word Mileage
Cheers!