Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invoking error function in XSLT 2.0 [closed]

I want to invoke error function in xslt 2.0 on a specific condition but i don't know the syntax to do this .

Please explain with an example.

Please check this code in the XSLT :

<xsl:if test="string-length(normalize-space($vehicle/VIN)) != 17"> error(QName('Invalid VIN')) </xsl:if>
like image 460
Sapan Avatar asked May 07 '26 11:05

Sapan


1 Answers

Use e.g. <xsl:sequence select="if (string-length(normalize-space($vehicle/VIN)) != 17) then error(QName('http://example.com/', 'some-error-code'), 'Invalid VIN') else ()"/>.

like image 81
Martin Honnen Avatar answered May 11 '26 14:05

Martin Honnen