xsl-list
[Top] [All Lists]

java extension element and xsl variable problem

2005-02-18 08:24:10
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

--
 ______________________________________________________________
/                                                              \
¦  Keith Lynch             Mail  ¤   klynch [ÂT] 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         ¦
\                                                              /
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯


--~------------------------------------------------------------------
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>