Home > Enterprise >  How to match an attribute's format to "a.b.c.com" in .xsl stylesheet xml version 1.0?
How to match an attribute's format to "a.b.c.com" in .xsl stylesheet xml version 1.0?

Time:12-15

I need to perform some action based on the condition that host name is in the format : a.b.c.com,( example : she01-qlv.abc.jio.com). Is their any inbuilt function to match this format?

CodePudding user response:

There is no regex support in XSLT 1.0. If you want something relatively simple, you could test that the input contains 3 periods using:

translate($host, translate($host, '.', ''), '') = '...'

and that it ends with .com using:

substring($host, string-length($host)-3) = '.com'

However this will also pass an input like abc...com.

  • Related