Subject: Re: [xsl] java extension element and xsl variable problem From: Keith Lynch <klynch@xxxxxxxxxxxx> Date: Tue, 22 Feb 2005 10:01:35 +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) { try { System.out.println(extElem.getAttribute("key")); System.out.println(extElem.getAttribute("value")); } 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> <value> <xsl:value-of select"$var"/> <value> /<extension:element>
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] java extension element and xs, Keith Lynch | Thread | [xsl] using variables in xsl value , Prasad Akella |
Re: [xsl] Result still indented des, Mukul Gandhi | Date | Re: [xsl] Result still indented des, David Carlisle |
Month |