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
http://www.saxonica.com/


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] 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.

-Netta

On 10/18/07, Michael Kay <mike@saxonica.com> 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
http://www.saxonica.com/


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Netta Doron
Sent: 18 October 2007 17:34
To: saxon-help@lists.sourceforge.net
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?

eg:

<xsl:stylesheet version="2.0"
xmlns:xsl=" http://www.w3.org/1999/XSL/Transform"
xmlns:lh="java:/saxonPlugin.ExtractorElementFactory"
xmlns:saxon="http://saxon.sf.net/"
extension-element-prefixes="saxon lh">

<lh:namespaces-to-pass-through ns="http:\\www.LightHtmlExtractors.com/wc/ns1"/>

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

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

</xsl:stylesheet>

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

-Netta

-------------------------------------------------------------------------
This SF.net 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 >> http://get.splunk.com/
_______________________________________________
saxon-help mailing list
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help