[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Problems creating a node-set from Java method

Subject: Re: Problems creating a node-set from Java method
From: Eric van der Vlist <vdv@xxxxxxxxxxxx>
Date: Thu, 12 Oct 2000 09:00:53 +0200
java xsl node set
Karen,

The xt:node-set function converts a result tree fragment into a nodeset
while you tell us that your Java function returns a string....

If (as I'd guess) this string contains tagged contain, you cannot
convert it into a nodeset...

Instead, your function should return a "ResultTreeFragment" meaning that
it should implement the XT ResultTreeFragment interface.

This interface is quite easy to implement (it's a SAX parser...) and I
have written some documentation about it on 4xt:

http://4xt.org/docs/000421-0001.xml

Hope this helps.

Eric

"Super, Karen" wrote:
> 
> 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

-- 
------------------------------------------------------------------------
Eric van der Vlist       Dyomedea                    http://dyomedea.com
http://xmlfr.org         http://4xt.org              http://ducotede.com
------------------------------------------------------------------------


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.