Welcome to Vortx Community Forum, where you can ask questions and receive answers from the staff at Vortx and other members of the community.

If you had a user account on our previous forums website, you will need to register a new account here.

Learn more about...


Regex in XML package?


I need to make a check in a variable string to see if it contains a certain pattern. Then I tried this:

<xsl:value-of select="matches(/root/AllPartInfo/AllPartInfoRow/Options,'\b[1-9][BCDEFHJKLNPRSGT][1-9]\b')" disable-output-escaping="yes" />

But then I just get a broken page saying that "matches() is an unknown XSLT function".

Any idea?


asked May 12, 2016 in MultiStore by Yan Kleber (1,245 points)

1 Answer

0 votes
matches() is an XSLT 2 feature, and we currently use XSLT 1 (wider support).  Your best bet would be a custom XSLTExtensionBase function (source code required) to do the regex for you, then you'd call it with aspdnsf:YourFunctionName() like the other custom functions we ship with.
answered May 12, 2016 by Vortx ScottS (13,500 points)
Scott, I am a bit confused here. A custom XSLTExtensionBase is something I have to write from scratch? How is this implemented? Would you have some link of an example as how it could be done?

I think that a Regex function is not something simple to implement anyway...