[xsl] java extension element and xsl variable problem

Subject: [xsl] java extension element and xsl variable problem
From: Keith Lynch <klynch@xxxxxxxxxxxx>
Date: Fri, 18 Feb 2005 16:24:10 +0100
Hi list

I've been fooling around with XSLT for the last two weeks and I hit a brick wall yesterday.

I'm trying to create a java extension element using xalan which takes an xsl variable as a parameter.

<configurator:setProperty key="lang" value="$Language"/>

However I just keep on receiving the literal string "$Language" as my value attribute

public Object setProperty(
XSLProcessorContext context,
ElemExtensionCall extElem)
{ System.out.println(extElem.getAttribute("key"));
return null;

Formerly I was using an extension function with an XPath string from a select="$variable" and this worked fine.

<xsl:variable name="chapter_number"
select="position() + configurator:getProperty($Whatever)"/>

This worked just fine and my function revieved the value of $Whatever and not the literal string "$Whatever"

However the function doesn't return anything and being obliged to insert an xsl:variable or xsl:value-of or any other senseless xsl:blahblah is
just annoying and basically creates redundant variables. i.e .. NOT CLEAN

My problem hinges around evaluating a variable. In an old snippet I found one could simply call
getVariableOrParam on the root StyleSheet element however the xalan processor uses newer standards with XPath etc. I'm not too sure here. I don't have a lot of xslt exp.

It doesn't seem to be a trivial task. I've also tried sending subelements

<extension:element blahblahblha>
  <xsl:value-of select"$var"/>

and parsing all childNodes. However when I call getNodeValue I just get an Exception.

Any help or pointers would be greatly appreciated TIA Keith Lynch

p.s I'm using the ant 1.6.2 stylesheet task... under windows XP sp3

/ \
& Keith Lynch Mail $ klynch [BT] genigraph.fr &
& &
& GENIGRAPH URL $ http://www.genigraph.fr &
& 104, rue Castagnary Tel $ +33 1 45 33 64 63 &
& F-75015 PARIS - FRANCE Fax $ +33 1 45 33 89 63 &
\ /

Current Thread