xsl-list
[Top] [All Lists]

[xsl] Issue with Xalan nodeset

2010-11-25 10:33:36
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, but the line
<xsl:variable name="new_file" 
select="xalan:nodeset($secondFile)/*"></xsl:variable>
Is returning nothing.

Can anyone see what I am doing wrong?

Many thanks

Stephen


Stephen Etheridge | Managing Consultant, Information Management, Business 
Optimisation Team
250 Brook Drive, Green Park, Reading RG2 6UA | United Kingdom
M: +44 7796 336 567
stephen(_dot_)etheridge(_at_)logica(_dot_)com | www.logica.com
Registered in England & Wales (registered number 947968)   
Registered Office: 250 Brook Drive, Green Park, Reading RG2 6UA, United Kingdom


Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you.



--~------------------------------------------------------------------
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>