Hello folks!

I'm experiencing what appears to be a limit in the size of an attribute
when using extension functions.

I've attached the Java source (stripped down to expose the problem) as
well as the XSL document I'm using.

I've created files of size ~32K and ~33K (not attached -- I left them
out for now to spare the alias) to test with.  The ~32K file passes fine
through the extension element, but the ~33K file does not.  It throws a
wrapped exception with the following message:
java.lang.StringIndexOutOfBoundsException: String index out of range:
-32533

In the XSL, if I comment out the call to the extension element, and use
the <xsl:value-of ... /> instead, it works fine for very large files
(tested up to 1.3MB).

So I'm not sure if there is a problem with the ElementExtensionCall
class or perhaps in the AVT where the attribute is evaluated for
AVTParts.  Most likely problem: I messed up and just need a pointer in
the right direction.

Any help would be very appreciated...

--jah
 

 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      \\\|///                 Jason Heddings             ((
     \\ ~ ~ //                303.272.5166 (x75166)    C|~~|
     (/ @ @ /)                [EMAIL PROTECTED]    `__'
 ~~oOOo~(_)~oOOo~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
 xmlns:test="ExtensionTest"
 extension-element-prefixes="test"
>

<xsl:output method="text" encoding="ISO-8859-1" />

<xsl:template match="/">
  <xsl:apply-templates />
</xsl:template>

<xsl:template match="content">
  <xsl:variable name="foo" select="." />
  content:

  <xsl:value-of select="$foo" />
  <!--<test:test attr="{$foo}" />-->
</xsl:template>

</xsl:stylesheet>
import org.apache.xalan.templates.ElemExtensionCall ;
import org.apache.xalan.extensions.XSLProcessorContext ;
import org.apache.xalan.transformer.TransformerImpl ;

import org.w3c.dom.Element ;

public class ExtensionTest {

    public String test( XSLProcessorContext context , Element element )
      throws javax.xml.transform.TransformerException {
        TransformerImpl trans = context.getTransformer( ) ;
        ElemExtensionCall elem = (ElemExtensionCall) element ;
        return elem.getAttribute( "attr" , elem , trans ) ;
    }
}

Reply via email to