Aren't variables only evaluated when they are referenced in a later xpath expression?

You would choose the ones to evaluate by only selecting constructs that use these variables.

This way, you could set up any number of boilerplate variables and only the ones that are actually used in the stylesheet execution will be evaluation.

That could be by including the constructs that reference the variables in:





Hoping that's useful


De :        Andrew Welch <>
A :        Mailing list for the SAXON XSLT and XQuery processor <>
Date :        02/19/2014 04:57 PM
Objet :        [saxon] Selectively evaluate variables at runtime


Given some variables in an xslt:

<xsl:variable name="one" select="....."/>
<xsl:variable name="two" select="......."/>
<xsl:variable name="three" select="......."/>

Is there a way to selectively evaluate some of them at runtime, for
example somehow say "one and three, but not two" ?

The ultimate aim is to have very large store of xpaths in the xslt (or
xquery), and then choose which ones to run at transform time.

I'm trying to avoid parsing the xpaths out and running them
externally... but that's looking like the only option at moment.

Of course if anyone knows of a better place to store several hundred
xpaths, please let me know.

Andrew Welch

Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
saxon-help mailing list archived at

Ensemble adoptons des gestes responsables : N'imprimez ce mail que si necessaire. Les informations contenues dans ce message et les pieces jointes (ci-apres denomme le message) sont confidentielles et peuvent etre couvertes par le secret professionnel. Si vous n'etes pas le destinataire de ce message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez recu ce message par erreur, nous vous remercions de le supprimer de votre systeme, ainsi que toutes ses copies, et d'en avertir immediatement HSBC France et ses filiales par message de retour. Il est impossible de garantir que les communications par messagerie electronique arrivent en temps utile, sont securisees ou denuees de toute erreur, alteration, falsification ou virus. En consequence, HSBC France et ses filiales declinent toute responsabilite du fait des erreurs, alterations, falsifications ou omissions qui pourraient en resulter. Consider the environment before printing this mail. The information contained in this e-mail is confidential. It may also be legally privileged. If you are not the addressee you may not copy, forward, disclose or use any part of it. If you have received this message by error, please delete it and all copies from your system and notify the sender immediately by return e-mail. E-mail communications cannot be guaranteed to be timely secure, error or virus-free. The sender does not accept liability for any errors or omissions which arise as a result.