Subject: RE: [xsl] passing a string as a node list From: "Tim" <xsl@xxxxxxxxxxxxxx> Date: 22 Jun 2001 08:08:20 -0000 |
Thanks, Maulik. I changed to 2.1.0 but it broke all my parameters! 2.0.1 is now working. I don't quite understand your example though. I gather that $chandoc is set externally to the template as a string of xml? How is $evalparam being set, I though xalan:evaluate() would produce node list from a string containing xml tags? I've been trying: .......snip....... <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:for-each select="xalan:evaluate($keywords)//*"> <xsl:value-of select="./text()"/> </xsl:for-each> .......snip....... where $keywords is a string containing: <keywords> <keyword> find </keyword> <keyword> me </keyword> </keywords> which I was hoping would convert the string in $keywords to a node list and give me all the text in each node. But it throws the exception: Unknown error in XPath SystemId Unknown Any hints would be great. Thanks again, Tim. > Hi, > > I know it works with Xalan-J 2_0_1 and I am using it successfully. Here is a > snippet of XSL code you may need to implement it. > > <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:template name="paramproc"> > <xsl:param name="evalparam"/> > <!-- change context node --> > <xsl:for-each select="$chandoc"> > '<xsl:value-of select="normalize-space(xalan:evaluate ($evalparam))" > />' > </xsl:for-each> > </xsl:template> > > </xsl:stylesheet> > > Saxon also has the same extension function called evaluate which in fact was > implemented earlier. Depends which processor you choose to use. Hope this > helps. > > Maulik Modi > mmodi@xxxxxxxxxx > > > -----Original Message----- > From: Tim [mailto:xsl@xxxxxxxxxxxxxx] > Sent: Thursday, June 21, 2001 11:35 AM > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: Re: [xsl] passing a string as a node list > > > Ta, Tom. > > I've found mention of the xalan:evaluate() extention a few times but > the xml.apache.org says it's not implemented yet. Anyone know if it's > been done in the CVS? > > Thanks, Tim. > > > Standard xslt does not let you convert a result-tree-fragment (or a > string) > > into a node-set. Some processors (like SAXON) have an extension > function > > that does let you do it. Xalan (which I think you meant instead of > Xerces) > > also has one (I think, someone else would know for sure). How you > invoke > > the extension function is different from one processor to another, so > you > > have to read Mike Kay's book, the docs for your processor, or search > in the > > FAQs. Actually, I'm not sure if you could convert a string anyway, > but you > > can probably change your stylesheet to make it work. > > > > Cheers, > > > > Tom P > > > > [Tim] > > > > > If I use the $keywords variable directly, Xerces throws the > exception > > > saying "Can not convert #STRING to a NodeList" so I've been trying > > > various methods of turning the string into the node list. > > > > > > > > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl- list > > > > > > > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] passing a string as a nod, Tim | Thread | [no subject], Alex Genis |
RE: [xsl] multiple test?, Michael Kay | Date | Re: [xsl] Inserting spaces in my FO, Rob Lugt |
Month |