[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Using variables in extension elements


Subject: [xsl] Using variables in extension elements
From: Roger I Martin PhD <hypernexdev@xxxxxxxxxxxxxxx>
Date: Mon, 31 Jan 2005 12:36:22 -0500

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


Current Thread
Keywords