Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XSLT current template mode?

Tags:

xml

xslt

I have one simple question in xslt 2.0. Is there any way of obtaining the mode inside a template. I want to read the mode and compare with a value. This is because i require to use same template for different computations. There is a variable whose value is depending on mode.

Currently i am passing to solve this problem. If there is a way we can get the current mode of template, it will be useful.

like image 523
Mittal Anshul Avatar asked Jul 04 '26 07:07

Mittal Anshul


1 Answers

No, XSLT 2.0 doesn't provide a function to find out the current mode name. You can however use e.g. <xsl:apply-templates mode="#current"/> to apply templates in the current mode.

If you want the mode as a name, then Saxon 9 provides it with an extension function http://saxonica.com/html/documentation/functions/saxon/current-mode-name.html.

like image 61
Martin Honnen Avatar answered Jul 06 '26 00:07

Martin Honnen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!