Subject: RE: Lotus XSL extensions From: "Kevin Jones" <kevinj@xxxxxxxxxxx> Date: Fri, 19 Nov 1999 15:57:17 -0000 |
Scott, thanks for the posts - I discovered my problem (which may be a feature of the XSL parser) I had this <xsl:stylesheet ... xmlns:lxslt="http://xsl.lotus.com" as my namespace definition - I should have had this <xsl:stylesheet ... xmlns:lxslt="http://xsl.lotus.com/" Spot the difference - it took me a while! You need the trailing / to get script to work (everything else works fine). Now another question - how do I get at a node value I have some XML which looks like this <weather> <city> <name>London</name> <temperature>55</temperature> </city> ... and xsl - <xsl:template match="temperature"> <td> <xsl:value-of select="temp:convert(.)"/> </td> </xsl:template> <lxslt:component prefix="temp" functions="convert"> <lxslt:script lang="javascript"> CDATA[ function convert (nodes) { if (nodes.getLength() > 0) { node = nodes.item(0); returnVal = ''+node.getNodeValue(); } else { returnVal = "4242"; } return returnVal; } ]]> </lxslt:script> </lxslt:component> but node.getValue returns null. Any idea? Scott? Sorry for the long post - Kevin -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Scott Boag Sent: 18 November 1999 16:50 To: xsl-list@xxxxxxxxxxxxxxxx Subject: Re: Lotus XSL extensions Kevin, here is an example: ==== input xml ==== <?xml version="1.0"?> <doc> <?a-pi some data?> </doc> === xsl === <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0" xmlns:lxslt="http://xsl.lotus.com/" xmlns:extn1="http://foo.com" extension-element-prefixes="extn1"> <lxslt:component prefix="extn1" functions="getPIData"> <lxslt:script lang="javascript"> <![CDATA[ function getPIData(nodes) { if (nodes.getLength() > 0) { node = nodes.item(0); returnVal = node.getData(); } else { returnVal = ""; } return returnVal; } ]]> </lxslt:script> </lxslt:component> <xsl:template match="/"> <out> <xsl:value-of select="extn1:getPIData(doc/processing-instruction('a-pi'))"/> </out> </xsl:template> </xsl:stylesheet> The type passed into the function is a com.lotus.xpath.MutableNodeListImpl, which implements the NodeList interface (but which is not a true NodeList since the nodes it holds are not reparented, and it is not owned by an element). -scott Kevin Jones wrote: > I'm using the Lotus XSL parser (0_18_5) and have been trying to get > Javascript extensions to work. Does anybody here have any experience with > this - and/or any examples they could share? > > Thanks, > > Kevin Jones > > 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: Lotus XSL extensions, Scott Boag | Thread | Whitespace stripping, Paul Prescod |
RE: Proposal for bootstrapable DOM , Vun Kannon, David | Date | RE: Proposal for bootstrapable DOM , Bill dehOra |
Month |