You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Christos Karras <ck...@sympatico.ca> on 2001/12/04 14:08:33 UTC

problems with XSLTC example code

I'm trying to use the example code for calling XSLTC with the native API 
(http://xml.apache.org/xalan-j/xsltc_usage.html).

Everything works without error messages or exceptions, but there seem to be something wrong with node
selection:

I have a simple stylesheet:
<xsl:template match="/">
  title: <xsl:value-of select="form/title"/>
  <xsl:apply-templates select="form"/>

  <xsl:for-each select="*">
     &lt;<xsl:value-of select="name(.)"/>&gt;
  </xsl:for-each> 
</xsl:template>

which is applied on this XML:
<form>
  <title>test</title>
</form>


The result I get is:
title:
<form>

So, the for-each select="*" worked as expected, which shows the <form> is really there in the DOM tree,
 but not the apply-templates and value-of. 

What could be wrong here?


Also, is there a way to force a class loader to unload a translet class when it is recompiled? When I recompile a stylesheet to a translet, the old translet keeps getting used until I restart the web server.
To "fix" that, I give each compiled translet a random name, but the problem with this is that I'll get hundreds of unused .class files with random names because they won't be automatically deleted. Would there be a better way?


Thanks

Re: problems with XSLTC example code

Posted by Raber Chris <cp...@yahoo.com>.
There is a good write-up on class unloading here:
http://www.javaworld.com/javaworld/javatips/jw-javatip52.html

The default class loader never unloaded classes after
JDK 1.2, so the behavior you have is as expected.

If you want classes to unload, you need to implement
your own class loader, and make sure you are not
holding on to any instances of the class. 

Here is a write-up on how to write a ClassLoader:
http://www.javaworld.com/javaworld/jw-03-2000/jw-03-classload.html

-Chris.

--- Christos Karras <ck...@sympatico.ca> wrote:
> I'm trying to use the example code for calling XSLTC
> with the native API 
> (http://xml.apache.org/xalan-j/xsltc_usage.html).
> 
> Everything works without error messages or
> exceptions, but there seem to be something wrong
> with node
> selection:
> 
> I have a simple stylesheet:
> <xsl:template match="/">
>   title: <xsl:value-of select="form/title"/>
>   <xsl:apply-templates select="form"/>
> 
>   <xsl:for-each select="*">
>      &lt;<xsl:value-of select="name(.)"/>&gt;
>   </xsl:for-each> 
> </xsl:template>
> 
> which is applied on this XML:
> <form>
>   <title>test</title>
> </form>
> 
> 
> The result I get is:
> title:
> <form>
> 
> So, the for-each select="*" worked as expected,
> which shows the <form> is really there in the DOM
> tree,
>  but not the apply-templates and value-of. 
> 
> What could be wrong here?
> 
> 
> Also, is there a way to force a class loader to
> unload a translet class when it is recompiled? When
> I recompile a stylesheet to a translet, the old
> translet keeps getting used until I restart the web
> server.
> To "fix" that, I give each compiled translet a
> random name, but the problem with this is that I'll
> get hundreds of unused .class files with random
> names because they won't be automatically deleted.
> Would there be a better way?
> 
> 
> Thanks
> 


__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com