Subject: [xsl] MSWOrd MSExcel & PDF From: P Vikram <vikram_good_boy@xxxxxxxxx> Date: Fri, 26 Oct 2001 09:13:35 -0700 (PDT) |
Hi all I have the following requirements to be done thru XSL. 1) Open MS WOrd Doc.(Static) 2) Open PDF Files.(Static) 3) Open MS excel files(Dynamic parameters passed to them). any pointers/material location on web will be very helpfull. Thanks Vikram --- Chris Bayes <chris@xxxxxxxxxxx> wrote: > Or even just do something that would work > function Fun(ctx) { > var ipString = ""; > if (typeof(ctx) == "object"){ > if (ctx.length){ > ipString = ctx.nextNode.text; > }else{ > return ''; > } > }else{ > ipString = ctx; > } > var xml = new ActiveXObject("msxml2.domdocument"); > xml.loadXML(ipString); > return xml.selectSingleNode("/"); > } > > Ciao Chris > > XML/XSL Portal > http://www.bayes.co.uk/xml > > > > -----Original Message----- > > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On > Behalf Of > > Chris Bayes > > Sent: 26 October 2001 15:38 > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > > Subject: RE: [xsl] escaping from CDATA > > > > > > > Within XPath and XSLT, a node-set consisting of > a single text > > > node can be used anywhere that a string is > expected. But not > > > when you call JavaScript; your JavaScript > function is > > > expecting a string, and it doesn't know what to > do if you > > > give it a node-set instead. > > > > But that can easily be fixed in all cases with > something like this. > > > > function Fun(ctx) { > > vat ipString = ""; > > if (typeof(ctx) == "object"){ > > if (ctx.length){ > > for (var i=0; i < 1; i++){ > > ctxN = ctx.item(i); > > if (ctxN.nodeType == 1) > > ipString += _wander(ctxN); > > if (ctxN.nodeType == 2) > > ipString += ctxN.nodeValue; > > } > > }else{ > > return ''; > > } > > }else{ > > ipString = ctx; > > } > > var xml = new > ActiveXObject("msxml2.domdocument"); > > xml.loadXML(ipString); > > return xml.selectSingleNode("/"); > > } > > function _wander(ctx){ > > var retStr = ""; > > for (var i=0; i < ctx.childNodes.length; i++){ > > ctxN = ctx.childNodes[i]; > > switch(ctxN.nodeType){ > > case 1: > > retStr += _wander(ctxN); > > break; > > case 3: > > retStr += ctxN.nodeValue; > > break; > > default: > > break; > > } > > } > > return retStr; > > } > > > > Which says if the argument is type object then it > is either > > an attribute node so use that value or an > element/nodelist so > > wander the subtree getting the string value, else > the > > argument is a string so use that. The _wander > function > > probably isn't needed in this case and you could > just use > > ipString += ctxN.nodeValue; but it allows > situation like > > > > <parts><![CDATA[<element>]]> > > <part1> > > <![CDATA[<element > attr="100"><a>100</a><b>200</b></element>]]> > > </part1> > > <part2> > > <![CDATA[<element > attr="100"><a>100</a><b>200</b></element>]]> > > </part2> > > <![CDATA[</element>]]></parts> > > > > If anyone is perverse enough to want to do that. > > If you are limiting to one cdata then you could > just do > > > > function Fun(ctx) { > > var ipString = ""; > > if (typeof(ctx) == "object"){ > > if (ctx.length){ > > ipString = ctxN.nodeValue; > > }else{ > > return ''; > > } > > }else{ > > ipString = ctx; > > } > > var xml = new > ActiveXObject("msxml2.domdocument"); > > xml.loadXML(ipString); > > return xml.selectSingleNode("/"); > > } > > > > That way you can pass any type and not have to > worry about > > converting it to a string first. > > > > Ciao Chris > > > > XML/XSL Portal > > http://www.bayes.co.uk/xml > > > > > > XSL-List info and archive: > http://www.mulberrytech.com/xsl/xsl-list > > > > > > > XSL-List info and archive: > http://www.mulberrytech.com/xsl/xsl-list > __________________________________________________ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Solved -accessing Charact, Julian Reschke | Thread | [xsl] Please check !!, kalpana rawat |
Re: [xsl] escaping from CDATA, David Carlisle | Date | RE: [xsl] rendering marginal XML, Chris Bayes |
Month |