You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Mark A. Belonga" <ma...@i2.com> on 2000/12/29 15:57:25 UTC

extension question

Hi!

I've been working on creating an extension library.  For the most part,
things have been going well.

I've hit a brick wall that I could use some help in.  I can't seem to figure
out exactly how I can have the extension element feed its results back into
a parent tag.  For example,

  From header...

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:lxslt="http://xml.apache.org/xslt"
  xmlns:converter="com.i2.xsl.converter.XalanXSLExtension"
  extension-element-prefixes="converter"
  result-ns=""
  version="1.0">


  And in a template...

  <xsl:variable name="deleteText">
      <converter:convertText>Delete</converter:convertText>
  </xsl:variable>
  <input type="submit"><xsl:attribute name="value"
select="$deleteText"/></input>

When I do the above template, I can't seem to get the value into the
variable "deleteText".  I've tried the following:

- context.outputToResultTree( context.getStylesheet(), convertedText );
(when I do this, the value is written to the result tree and not fed back
into the variable)
- appending a child to the source tree  (nothing seems to happen)
- appending a text node child to the source node's parent  (nothing seems to
happen)
- removing the source node from its parent and then appending a text node
child (removeChild isn't supported by the source node's parent)

Is what I'm trying to do possible?  Is it easily supported by the current
API?  If so, please let me know how.

Thanks very much!
-Mark


Re: extension question

Posted by Gary L Peskin <ga...@firstech.com>.
"Mark A. Belonga" wrote:
> 
> Hi!
> 
> I've been working on creating an extension library.  For the most part,
> things have been going well.
> 
> I've hit a brick wall that I could use some help in.  I can't seem to figure
> out exactly how I can have the extension element feed its results back into
> a parent tag.  For example,
> 
>   From header...
> 
> <xsl:stylesheet
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>   xmlns:lxslt="http://xml.apache.org/xslt"
>   xmlns:converter="com.i2.xsl.converter.XalanXSLExtension"
>   extension-element-prefixes="converter"
>   result-ns=""
>   version="1.0">
> 
>   And in a template...
> 
>   <xsl:variable name="deleteText">
>       <converter:convertText>Delete</converter:convertText>
>   </xsl:variable>
>   <input type="submit"><xsl:attribute name="value"
> select="$deleteText"/></input>
> 
> When I do the above template, I can't seem to get the value into the
> variable "deleteText".  I've tried the following:
> 
> - context.outputToResultTree( context.getStylesheet(), convertedText );
> (when I do this, the value is written to the result tree and not fed back
> into the variable)
> - appending a child to the source tree  (nothing seems to happen)
> - appending a text node child to the source node's parent  (nothing seems to
> happen)
> - removing the source node from its parent and then appending a text node
> child (removeChild isn't supported by the source node's parent)
> 
> Is what I'm trying to do possible?  Is it easily supported by the current
> API?  If so, please let me know how.

Mark --

I think you just need to return a String from your extension element
convertText method.

Gary