0

I am new to xslt trying to capture and evaluate the IP address of user through authzrule using xslt. I know the IP can be evaluated by azn_cred_ip_address

<xsl:choose>
<xsl:when test=" azn_cred_ip_address = '100.200.300.400'">!TRUE!</xsl:when>
<xsl:otherwise>!FALSE!</xsl:otherwise>
</xsl:choose>

However the IP is not always the same, but I want to check to see if the first 3 digits are 100. How can I modify the above xslt to see if the IP starts with 100 or not?

borna
  • 906
  • 3
  • 12
  • 32

2 Answers2

1

You could use substring-before here (as this will also work if the first number is less than 3 digits too.

<xsl:when test="substring-before(azn_cred_ip_address, '.') = '100'">!TRUE!</xsl:when>
Tim C
  • 70,053
  • 14
  • 74
  • 93
1

probably the most direct translation of the test would be

<xsl:when test="starts-with(azn_cred_ip_address,'100.')">
David Carlisle
  • 5,582
  • 1
  • 19
  • 23