Subject: RE: [xsl] Dumb questions from a newbie From: "Chris Bayes" <chris@xxxxxxxxxxx> Date: Wed, 12 Dec 2001 15:04:58 -0000 |
Steve, What is on line 29? I just wrote it off the top of my head I didn't test it. This is a bit of code from the exslt tokenize function that works in a similar way var tdom = new ActiveXObject("MSXML2.FreeThreadedDOMDocument"); var od = tdom.createNode(1, 'myRE', ''); var mp = (re!=null?re:'\n\r\t '); var s = 0; for (var i=0; i < ipString.length; i++){ for (var j=0; j < mp.length; j++){ if (ipString.substr(i, 1) == mp.substr(j, 1)){ var mn = tdom.createNode(1, 'token', ''); var tn = tdom.createTextNode(ipString.substr(s, i-s)); mn = od.appendChild(mn); tn = mn.appendChild(tn); s = i+1; } } } var tn = tdom.createTextNode(ipString.substr(s)); var mn = tdom.createNode(1, 'token', ''); mn = od.appendChild(mn); tn = mn.appendChild(tn); return od.selectNodes("*"); it is creating text nodes which is what I think you were doing with your text version. You should be able to change it around a bit. 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 > Steve Renshaw > Sent: 12 December 2001 11:17 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: RE: [xsl] Dumb questions from a newbie > > > Is ths what you intended? I get error > > "Microsoft JScript runtime error Type mismatch line = 29, col > = 12 (line is > offset from the start of the script block). Error returned > from property or > method call.'" > > > function GetRecords(connection, tablename) > { > var output; > var conn = new ActiveXObject("ADODB.Connection"); > var cmd = new ActiveXObject("ADODB.Command"); > var rs = new ActiveXObject("ADODB.Recordset"); > var Err, ErrCount, fPos; > var tdom = new ActiveXObject("MSXML2.FreeThreadedDOMDocument"); > var od = tdom.createNode(1, 'myDAO', ''); > > conn.Open(connection); > cmd.CommandText = "SELECT * FROM " + tablename; > cmd.ActiveConnection = conn; > rs = cmd.Execute(); > ErrCount = conn.errors.count; > if(ErrCount > 0){ > for(Err = 0; Err < ErrCount; Err++){ > output += conn.errors.item(Err); > } > } > else{ > output += "\n"; > while (!rs.EOF) { > var row = tdom.createNode(1, 'row', ''); > row = od.appendChild(row); > > for (var fPos = 0; fPos < rs.fields.count; fPos++) { > > row.setAttribute(rs.fields(fPos).name,rs.fields(fPos).value); > } > rs.MoveNext; > } > return od.selectNodes("*"); > } > } > > > > >From: "Chris Bayes" <chris@xxxxxxxxxxx> > >Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > >To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> > >Subject: RE: [xsl] Dumb questions from a newbie > >Date: Wed, 12 Dec 2001 01:04:25 -0000 > > > >Ivan, > >You can get around the d-o-e if you return a node-set i.e. > >{ > >var tdom = new ActiveXObject("MSXML2.FreeThreadedDOMDocument"); > >var od = tdom.createNode(1, 'myDAO', ''); > >... > > while (!rs.EOF){ > > var row = tdom.createNode(1, 'row', ''); > > row = od.appendChild(row); > > for (var fPos = 0; fPos < rs.fields.count; fPos++){ > > row.setAttribute(rs.fields(fPos).name, > >rs.fields(fPos).value); > > } > > rs.MoveNext; > > } > > return od.selectNodes("*"); > >} > >It also means that you can use the result of a query as a full xslt > >node-set in a variable/apply-templates/for-each et al. > > > >Ciao Chris > > > >XML/XSL Portal > >http://www.bayes.co.uk/xml > > > > > > XSL-List info and archive: > http://www.mulberrytech.com/xsl/xsl-list > > > > > > _________________________________________________________________ > Get your FREE download of MSN Explorer at > http://explorer.msn.com/intl.asp. > > > 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] Dumb questions from a new, Steve Renshaw | Thread | RE: [xsl] Keep it simple S..., Jarno . Elovirta |
RE: [xsl] XPath: all elements with , Hunsberger, Peter | Date | RE: [xsl] Dumb questions from a new, Chris Bayes |
Month |