xsl-list
[Top] [All Lists]

Using variables in extension elements

2005-01-31 10:36:22
Hi folks,

   <xsl:variable name="parameter-list">
<xsl:for-each select="../*[position()&gt;1]"><xsl:call-template name="set-argument">
                   <xsl:with-param name="current-variable">
                   <xsl:apply-templates select="." mode="parameter">
                   <xsl:with-param name="argument" select="true"/>
                   </xsl:apply-templates>
                   </xsl:with-param>
<xsl:with-param name="current-type" select="translate(@type,' ','')"/> </xsl:call-template><xsl:if test="position()&lt;last()"><xsl:text>, </xsl:text></xsl:if>
           </xsl:for-each>
       </xsl:variable>
       <mathmlx:put key="type-parameter-list" value="$parameter-list"/>

....
   public void put(org.apache.xalan.extensions.XSLProcessorContext context,
org.apache.xalan.templates.ElemExtensionCall extElem) throws javax.xml.transform.TransformerException
   {
       String key = extElem.getAttribute("key");
       String value = extElem.getAttribute("value");
       if(value.startsWith("$"))
       {
           ;
           //extElem.
org.apache.xml.utils.QName qname=new org.apache.xml.utils.QName(value.substring(1));
           //qname.
org.apache.xpath.VariableStack vs=context.getTransformer().getXPathContext().getVarStack();
           for(int i=0;i<vs.size();i++)
           {
               //vs
               System.out.println(vs.elementAt(i));
           }
value=vs.getVariableOrParam(context.getTransformer().getXPathContext(), qname).toString();
           System.out.println(value+" "+value.substring(1)+" "+value);
           //value=extElem.getAttribute(value.substring(1));
       }
       table.put(key, value);
   }
Trying to use the getVariableOrParam function to get the value of the variable to store for global use. Keep getting not resolvable. QName construction too simplistic? Name space issue? The for loop shows the last element has the value of 'parameter-list' so a suspect it is there.

Curiousity question: is anyone extending toward xslt 2.0 and xpath 2.0?

-Roger


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>