You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Oliver Graf <og...@rhein-zeitung.de> on 2001/01/11 08:17:36 UTC
basic extension element question
Hi!
Just fooling a bit around with extension elements, but I can't find a basic
method I need:
if I have something like:
<value name="test">10</value>
and the stylesheet template for this does:
<myext:stuff param="./@name"/>
how can I eval the XPath expression in my extension element method?
I thought this is the way (this is python, but any other language example will
do also):
element.getAttribute('param',context.getContextNode(),context.getTransformer())
but it does not work. This returns the same as getAttribute with one param
does: ./@name, the string.
A small hint please, before I browse my self to death in the apidocs ;)
Oliver.
RE: basic extension element question
Posted by Philippe Vijghen <Ph...@forem.be>.
Hi Oliver,
You should call the extension like this
<myext:stuff param="{./@name}"/>
in your XSL (like in attributes).
Then, in your java code for implementing the extension tag
you can resolve it like this:
public String stuff(
org.apache.xalan.xslt.XSLProcessorContext context,
org.apache.xalan.xslt.ElemExtensionCall extElem)
{
try
{ String paramvalue = extElem.getAttribute("param", context.sourceNode,
context.processor);
...
Best regards,
Philippe
---
Philippe Vijghen (phv@acse.be)
Project Manager
Software AG Belgium - ACSE, Professional Services Division
Bd Général Wahis 29. B-1030 Bruxelles. Belgium
Tel: +32 (2) 705.70.21
> -----Original Message-----
> From: Oliver Graf [mailto:ograf@rhein-zeitung.de]
> Sent: jeudi 11 janvier 2001 08:18
> To: xalan-dev@xml.apache.org
> Subject: basic extension element question
>
>
> Hi!
>
> Just fooling a bit around with extension elements, but I can't
> find a basic
> method I need:
>
> if I have something like:
> <value name="test">10</value>
>
> and the stylesheet template for this does:
> <myext:stuff param="./@name"/>
>
> how can I eval the XPath expression in my extension element method?
>
> I thought this is the way (this is python, but any other language
> example will
> do also):
> element.getAttribute('param',context.getContextNode(),context.getT
> ransformer())
>
> but it does not work. This returns the same as getAttribute with one param
> does: ./@name, the string.
>
> A small hint please, before I browse my self to death in the apidocs ;)
>
> Oliver.