xsl-list
[Top] [All Lists]

Re: [xsl] Issue with Xalan nodeset

2010-11-25 10:53:21
On 25/11/2010 16:33, Etheridge, Stephen wrote:
Hi all

I am trying to do a transformation from Xalan in java.  I seem to be having a 
nodeset() problem and need some help.  I have simplified things as follows:
I have the following simple main class.

public class doComp{
        public static void main(String[] args)
        {
                System.out.println("Hello World!");
                String infile1 = "<root>This is infile1</root>";
                String infile2 = "<root>This is infile2</root>";
                ComparatorService cs = new ComparatorService();
                String bob = cs.compareFiles(infile1,infile2);
                System.out.println(bob);

        }
}

This calls ComparatorService which works fine and sets a parameter called 
secondFile

I have the following xslt:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:xalan="http://xml.apache.org/xalan";
exclude-result-prefixes = "xalan">

<xsl:output method="text" indent="yes" />
<xsl:variable name="old_file" select="/*"></xsl:variable>
<xsl:param name="secondFile"></xsl:param>
<xsl:variable name="new_file" 
select="xalan:nodeset($secondFile)/*"></xsl:variable>

        <xsl:template match="/">
                Parameter secondFile is set as
                <xsl:value-of select="$secondFile"/>
                #### Old File #####
                <xsl:value-of select="$old_file"/>
                #### New File #####
                <xsl:value-of select="$new_file"/>
                ###################
        </xsl:template>
</xsl:stylesheet>


This produces the following results print out:

Hello World!

                Parameter secondFile is set as
                
javax(_dot_)xml(_dot_)transform(_dot_)dom(_dot_)DOMSource(_at_)152544e
                #### Old File #####
                This is infile1
                #### New File #####
                
                ###################

Obviously the parameter secondFile is set to a DOMSource,


is it? the output would suggest that it was being set to the string javax(_dot_)xml(_dot_)transform(_dot_)dom(_dot_)DOMSource(_at_)152544e
 but the line
<xsl:variable name="new_file" 
select="xalan:nodeset($secondFile)/*"></xsl:variable>

which waould be consistent with the path of /* not selecting anything,
Is returning nothing.

Can anyone see what I am doing wrong?

Many thanks

Stephen

David



________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>