Kevin --

I don't have JDOM installed at the moment and I'm too lazy to try at
this hour.  Please try to substitute the following program, which works
for me just fine:

--------------------------------------------------------------------
import java.io.*;
import java.net.*;
import java.util.*;

import org.apache.xalan.extensions.*;
import org.apache.xalan.templates.*;
import org.apache.xpath.*;
import org.apache.xerces.dom.*;
import org.w3c.dom.*;

public class TestProperties {

    /**
     * 
     *
     * @author <a href="mailto:[EMAIL PROTECTED]";>burtonator</a>
     * @version $Id: JVMProperties.java,v 1.1 2001/08/08 01:07:16 burton
Exp $
     */
  public org.w3c.dom.NodeList properties( XSLProcessorContext context,
                                            ElemExtensionCall elem ) {

    NodeSet resultSet = new NodeSet();
    Document lDoc =
DOMImplementationImpl.getDOMImplementation().createDocument(null, "foo",
null);

    Element props = lDoc.createElementNS("namespaceURI", "properties");

    //get properties as an enumeration

    Properties properties = System.getProperties();

    //remove properties which are too long
    properties.remove( "java.class.path" );
    properties.remove( "sun.boot.class.path" );
    properties.remove( "java.library.path" );
    
    Enumeration keys = properties.keys();

    while ( keys.hasMoreElements() ) {
        String name = (String)keys.nextElement();
        String value = System.getProperty( name );
        Element myEntry = lDoc.createElementNS("namespaceURI", "entry");
        myEntry.setAttributeNS(null, "name", name);
        myEntry.setAttributeNS(null, "value", value);
        props.appendChild(myEntry);
    } 

    try { 
        return props.getChildNodes();
    } catch ( Throwable t ) {
        // Log.error( t );
        t.printStackTrace();
        return null;            
    }
  }
}
------------------------------------------------------------------------
Here is the stylesheet:

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

    <xsl:output indent="yes" 
                omit-xml-declaration="yes"/>                

    <xsl:template match="/">


            <!-- fill in properties -->
            <pe:properties/>


    </xsl:template>

</xsl:stylesheet>

I just transformed this from the command line.  If this works, then we
know that there is a problem somewhere with the nodes returned by JDOM. 
If it doesn't, then XalanJ is the prime suspect.

What version of XalanJ are you using?

Gary

burtonator wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Gary L Peskin <[EMAIL PROTECTED]> writes:
> 
> > We'd have to see your extension code to diagnose/correct the problem.
> 
> Sure... now problem.  See the below:
> 
> 
>http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/~checkout~/reptile/src/java/org/openprivacy/reptile/extensions/JVMProperties.java?rev=1.1&content-type=text/plain
> 
> <snip>
> 
> - --
> Kevin A. Burton ( [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] )
>         Cell: 408-910-6145 URL: http://relativity.yi.org ICQ: 73488596
> 
> Learn from other people's mistakes, you don't have time to make your own.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.4 (GNU/Linux)
> Comment: Get my public key at: http://relativity.yi.org/pgpkey.txt
> 
> iD8DBQE7cI8zAwM6xb2dfE0RAkB1AKC6HQmQJqsRAM04OZ45GRVNalHMvACgg/Of
> ylwNqmGyJ3ohW3rn1Sxk66c=
> =mRNl
> -----END PGP SIGNATURE-----

Reply via email to