[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Issue with Xalan nodeset
Subject: Re: Issue with Xalan nodeset
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 25 Nov 2010 16:53:09 +0000
|
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.xml.transform.dom.DOMSource@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.xml.transform.dom.DOMSource@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.
________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|