I'm using jstl xml to get specified values from an XML
Here I'm using a "userRoleSelector" as a variable to select the node. The variable is set as,
<c:set var="userRoleSelector" value="role-id='test'" scope='session'/>
The tag where I use the variable is as follows,
<x:if select="$parsedRoleXML//roles/role[$userRoleSelector]/features/feature[text()='viewEvents']">
//html code
</x:if>
The node is not selected according to the role-id provided. it works if I use only the right hand side as a variable.
What is the issue here?
There are a few problems here:
[$userRoleSelector]
is not doing a comparisonuserRoleSelector
is not an XPath variablec:set
variables are not in the XML scope, unlikex:parse
variablesuserRoleSelector
is a JSP variableTo test the role-id properly, try this instead:
To test the JSP variable, try this instead:
References