By "static variable", I assume you mean that you want the code for your extension instruction to look for this element at compile time? I think you can actually do this. Your class that subclasses ExtensionInstruction is actually an element node on the stylesheet tree, and you can navigate from there to other nodes on the tree. As a matter of convention, I would avoid doing this from the prepareAttributes() method, but it's perfectly OK to do it from the validate() method. Also as a matter of good practice, try to avoid retaining any references to nodes on the stylesheet tree at run-time: it's best to allow it to be garbage-collected away once your instruction is compiled. Having said that, it's your choice, the only harm that will come of it is that you use more memory.
Michael Kay

From: [] On Behalf Of Netta Doron
Sent: 18 October 2007 18:31
To: Mailing list for SAXON XSLT queries
Subject: Re: [saxon] XSLT extension non-instruction

I want to take the attribute value passed into it and store it in a static variable for use with the over xsl extension instructions I have defined.   I wanted to avoid passing these attributes (of which there could be many) to the over xsl extension functions because then I would need to pass them to every call I make to these functions in the stylesheet.  It is much cleaner and nicer to have them as independent variables "floating" at the top of the stylesheet.


On 10/18/07, Michael Kay <> wrote:
No, there's no way to influence the way such elements are handled (other that in a filter applied to the stylesheet on its way into the system, of course). You don't really explain what you want to do with such elements, you only say that you don't want them to be ignored. Could you explain what you would like to achieve?
Michael Kay

From: [] On Behalf Of Netta Doron
Sent: 18 October 2007 17:34
Subject: [saxon] XSLT extension non-instruction

Is there a way to write an XSLT extension non-instruction i.e. an element that will not be ignored outside a template block?


<xsl:stylesheet version="2.0"
extension-element-prefixes="saxon lh">

<lh:namespaces-to-pass-through ns="http:\\"/>

<xsl:template match="/">
    <xsl:apply-templates select="node()"/>

<xsl:template match="extract">
<lh:to-lhtml select="markup"/>


I would like for "<lh:namespaces-to-pass-through ns="http:\\"/>" not to be skipped as an element.


This email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>
saxon-help mailing list