Subject: RE: [xsl] creating an rtf/node-set from <script> function From: "Gary Tyree" <nonamemeil@xxxxxxxxxxx> Date: Fri, 01 Aug 2003 12:16:23 -0400 |
From: Jeff Beadle <Jbeadle@xxxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] creating an rtf/node-set from <script> function Date: Fri, 1 Aug 2003 09:47:00 -0400
Hey Gary,
Not natively within xsl 1.0 or via msxsl extension functions ... I'm not familiar with XSLT 2.0, but since you're using msxml, that's a bit off on the otherside of the horizon.
You'd have to roll your own node-list factory from within a custom msxsl script extension.
Something like this:
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:jscript="jscript"> <msxsl:script implements-prefix="jscript" language="JScript"><![CDATA[ var xml = new ActiveXObject("MSXML2.DOMDocument.4.0"); xml.async=false; function create_nodelist(sxml) { if(xml){ if(xml.loadXML(sxml)){ var x = xml.documentElement; if(x) return x.selectNodes("/"); else return x; } else return xml.documentElement; } else return 0; } function pData(){ return create_nodelist("<name id='3'>Rum and Coke</name>"); } ]]></msxsl:script> <xsl:template match="/"> <out> <xsl:copy-of select="jscript:pData()"/> </out> </xsl:template> </xsl:stylesheet>
Cheers, Jeff
-----Original Message----- From: Gary Tyree [mailto:nonamemeil@xxxxxxxxxxx] Sent: Friday, August 01, 2003 9:08 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] creating an rtf/node-set from <script> function
ultimately, I'm trying to create a node-set (via node-set()) from a string
returned from script. below is a snippet of my code. variable $dt works
like a great <xsl:value-of select="msxsl:node-set($dt)/name"/>. however,
variable $st doesn't. is there a way to convert a string, say returned from
script, into an rtf or node-set? . . . <msxsl:script language="JavaScript" implements-prefix="myScript"> <![CDATA[ function pData() pData = "<name id='3'>Rum and Coke</name>" end function ]]> </msxsl:script> . . . <xsl:variable name="dt"> <name id='7'>Harvey Wallbanger</name> </xsl:variable>
<xsl:variable name="st"> <xsl:value-of select="myScript:pData()"/> </xsl:variable>
Thanks
_________________________________________________________________ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail
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] creating an rtf/node-set , Jeff Beadle | Thread | Re: AW: [xsl] '<' and '>' in the va, Ming Yu |
Re: [xsl] How to speed up parsing ?, Mike Brown | Date | AW: [xsl] for-each, Markus Abt |
Month |