I want to assign a value to a variable if a particular attribute returns a particular value. In here I want to assign the value “young” to vaiable “person” if pr:all/[@pr:name=current()/@cx:name]/pr:properties/(@ls:middlename) is “cengie”. Is that possible?
<xsl:variable
name='person' select='pr:all/[@pr:name=current()/@cx:name]/pr:properties/(@ls:middlename)'>
</xsl:variable>
You can put any xslt code within an xsl:variable and the result will be assigned to the variable. In this case you could make use of an xsl:if to check your condition
If you wanted an ‘else’ case here, you would use xsl:choose instead.