This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problems creating a node-set from Java method


I am having problems creating a node-set from my external function.  I am
trying to retrieve some XML data, call a template within my stylesheet to
format the returned data, and then continue parsing the XML document.  I am
getting an XSL exception of "cannot convert to node-set".  I am basically
trying to import an XML document into the current document.  My Java
function getFamilyTree() returns a String.  Here is a little more
information:

I am using XT.  My stylesheet looks like:

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' 
	xmlns:xt='http://www.jclark.com/xt'
	xmlns:ft='http://www.jclark.com/xt/java/com.wg.Myjava' >
<xsl:output method='xml' indent='yes'/>
<xsl:template match='/'>
	<PublicRec><xsl:apply-templates'/>
	</PublicRec>
</xsl:template>
<xsl:template match='record'>
	...
	<xsl:call-template name='FamilyTree'/>
	...
</xsl:template>
<xsl:template name='FamilyTree'>
	<xsl:variable name='toc' select='ft:getFamilyTree()'/>
	<xsl:call-template name='Tree'>
		<xsl:param name='data'><xsl:value-of
select='xt:node-set($toc)'/></xsl:param>
	</xsl:call-template>
	...
</xsl:template>
<xsl:template name='Tree'>
	<xsl:param name='data'/>
	<Content><xsl:value-of select='$data/document/title'/>
	<Head><xsl:value-of
select='$data/document/branch_headquarters@count'/> headquarters</Head>	
	<Branch><xsl:value-of
select='$data/document/branch_locations@count'/> branches</Branch>
	...
	</Content>
</xsl:template>
...
					
</xsl:stylesheet>


My XML document looks like:

<record>
<citation>001-01-0032</citation>
<CorpHier/>
<city>CONCORD</city>
<state>NH</state>
<zip.code>03301</zip.code>
</record>

The XML that the getFamilyTree() method is returning looks like:
<?xml version="1.0"?>

<document>
  <title>Corporate Family Hierarchy</title>
  <branches_headquarters count="1" />
  <direct_company_relationships count="2" />
  <all_company_relationships count="0" />
  <branch_locations count="0" />
</document>

Anyone have any ideas as to why my string is not being converted into a
node-set?  Any suggestions/comments as to how I might get this to work are
very appreciated.

Thanks,
Karen


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]