[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
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 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Problems creating a node-set from J, Super, Karen | Thread | XSL-List Digest is down, XSL-List Owner |
RE: Thanks; Ettiquette, Melle Zegel | Date | Intrekken: Thanks; Ettiquette, Melle Zegel |
Month |