Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Using SAX with XSL to load XML >Thread Next - RE: Using SAX with XSL to load XML RE: Using SAX with XSL to load XMLTo: NULL Date: 11/9/2004 4:10:00 AM Hi TI Even if you were using SAX to read the XML, the XSLT processor would still need to build an internal tree representation of the source document. You could investigate the newParser property in your MSXML help file. This may improve your performance... Nigel "TI" wrote: > My current program loads xml with DOM. I have a very large XML file that > takes forever to open WEB page. How do I program SAX to load xml file and > still keep XSL to display data into HTML. I hope I said that right. > > ---HTML--- > <html xmlns:v="urn:schemas-microsoft-com:vml" > xmlns:o="urn:schemas-microsoft-com:office:office" > xmlns="http://www.w3.org/TR/REC-html40"> > > <head> > <meta http-equiv="Content-Language" content="en-us"> > <meta name="GENERATOR" content="Microsoft FrontPage 6.0"> > <meta name="ProgId" content="FrontPage.Editor.Document"> > <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> > <link rel="File-List" href="DOLWMDDREQ_files/filelist.xml"> > > <title>DOL-W, MDD Requisition Tracking Program</title> > <SCRIPT language="jscript"> > var objSrcTree, ObjXSLT, objCache; > > function init(){ > > // Check client for Msxm12 version > try { > objSrcTree = new ActiveXObject("Msxml2.DOMDocument.4.0"); > } > catch (err) { > // Can't create Automation object, must pop up a window to load MSXML 4 SP2 > msxml4Pop(); > } > // Load xml and xsl files > objSrcTree = new ActiveXObject("Msxml2.DOMDocument.4.0"); > objSrcTree.async = false; > objSrcTree.validateOnParse = false; > objSrcTree.resolveExternals = false > objSrcTree.preserveWhiteSpace = false; > objSrcTree.load('DOLXMLWEBOUT.xml'); > > // Check for errors in loading xml > > if (objSrcTree.parseError != 0) { > output.innerHTML = objSrcTree.parseError.reason + "<BR>" > output.innerHTML += objSrcTree.parseError.url + "<BR>" > output.innerHTML += objSrcTree.parseError.errorCode + "<BR>" > output.innerHTML += objSrcTree.parseError.filepos + "<BR>" > output.innerHTML += objSrcTree.parseError.line + "<BR>" > output.innerHTML += objSrcTree.parseError.linepos + "<BR>" > } > > objXSLT=new ActiveXObject('MSXML2.FreeThreadedDOMDocument.4.0'); > objXSLT.async = false; > objXSLT.load('DOLWMDDXSL.xsl'); > > objCache = new ActiveXObject("Msxml2.XSLTemplate.4.0"); > objCache.stylesheet = objXSLT; > > } > > function search() > { > // Search the value of the entryfield > var objXSLTProc = objCache.createProcessor(); > objXSLTProc.input = objSrcTree; > // Pass the entryfield value to the xsl file > objXSLTProc.addParameter("nameSearchValue", ORDER.value); > > > //result=objSrcTree.selectSingleNode("/ORDERREQUISITION/REQUISITION/ORDNBR[.='"+ORDER.value+"']") > // if (result.length != null) { > // The results count of the search > // doPopupcnt(); > objXSLTProc.transform(); > output.innerHTML = objXSLTProc.output; > // } else { > // Pop up letting the user know that the search didn't find anything > // doPopup(); > // objXSLTProc.transform(); > //output.innerHTML = objXSLTProc.output; > > // } > > } > > </SCRIPT> > > <script LANGUAGE="JavaScript"> > <!-- Original: Ronnie T. Moore, Editor --> > <!-- Web Site: The JavaScript Source --> > > <!-- This script and many more are available free online at --> > <!-- The JavaScript Source!! http://javascript.internet.com --> > > <!-- Begin > closetime = 5; // Close window after __ number of seconds? > // 0 = do not close, anything else = number of seconds > > function Start(URL, WIDTH, HEIGHT) { > windowprops = "left=1,top=1,width=" + WIDTH + ",height=" + HEIGHT; > preview = window.open(URL, "preview", windowprops); > if (closetime) setTimeout("preview.close();", closetime*1000); > } > > function doPopup() { > url = "NOTFOUNDORDNBR.htm"; > width = 280; // width of window in pixels > height = 200; // height of window in pixels > delay = 0; // time in seconds before popup opens > timer = setTimeout("Start(url, width, height)", delay*1000); > } > > function msxml4Pop() { > url = "download-msxml4.htm"; > width = 200; > height = 300; > delay = 0; // time in seconds before popup opens > timer = setTimeout("Start(url, width, height)", delay*1000); > } > > // End --> > </script> > > > <script LANGUAGE="JavaScript"> > function doPopupcnt(){ > var > generator=window.open('POPUPCNT.htm','name','height=5,width=425,left=1, > top=1'); > var cntresult="Search Returned" + " " + result.length + " " + > "Records" + " " + "for Requisition Nbr" + " " + ORDER.value; > generator.document.write(cntresult); > generator.document.write('<p><a > href="javascript:self.close()">Close</a> the popup.</p>'); > generator.document.close(); > } > </SCRIPT> > > <!--[if !mso]> > <style> > v\:* { behavior: url(#default#VML) } > o\:* { behavior: url(#default#VML) } > .shape { behavior: url(#default#VML) } > </style> > <![endif]--> > <meta name="Microsoft Theme" content="ricepapr 0011"> > <!--[if gte mso 9]> > <xml><o:shapedefaults v:ext="edit" spidmax="1027"/> > </xml><![endif]--> > </head> > <body onload="init()"> > <HTML> > > <head> > > </head> > > <body> > > <!-- BEGIN JavaScript DisableRightClick (Msg Box Ver.) --> > <!-- (C)2003 USINGIT.COM, All rights reserved. --> > <!-- <script language="JavaScript1.2" > src="js_disable_right_click_cfg.js"></script> > <script language="JavaScript1.2" src="js_disable_right_click.js"></script> --> > <!-- END JavaScript DisableRightClick (Msg Box Ver.) --> > <SCRIPT LANGUAGE="JavaScript"> > > <!-- This script and many more are available free online at --> > <!-- The JavaScript Source!! http://javascript.internet.com --> > > <!-- Begin > var osd = " " > osd +="Welcome, this is a DoD web site. The security accreditation level of > this site is Unclassified FOUO and below. Do not process, store, or transmit > information "; > osd +="classified above the accreditation level of this system. DoD web > sites may be monitored for all lawful purposes, including to ensure their use > is "; > osd +="authorized, for management of the system, to facilitate protection > against unauthorized access, and to verify security procedures, > survivability, "; > osd +="and operational security. Monitoring includes, but is not limited to, > active attacks by authorized DoD entities to test or verify the security of > this "; > osd +="system. During monitoring, information may be examined, recorded, > copied and used for authorized purposes. All information, including "; > osd +="personal information, placed on or sent over this system may be > monitored. Use of this DoD web site, authorized or unauthorized, constitutes > "; > osd +="consent to monitoring. Unauthorized use of this DoD web site may > subject you to criminal prosecution. Evidence of unauthorized use collected "; > osd +="during monitoring may be used for administrative, criminal or other > adverse action. "; > osd +="Use of this system constitutes consent to monitoring for all lawful > purposes."; > var timer; > var msg = ""; > function scrollMaster () { > msg = customDateSpring(new Date()) > clearTimeout(timer) > msg += " " + showtime() + " " + osd > for (var i= 0; i < 100; i++){ > msg = " " + msg; > } > scrollMe() > } > function scrollMe(){ > window.status = msg; > msg = msg.substring(1, msg.length) + msg.substring(0,1); > timer = setTimeout("scrollMe()", 200); > } > function showtime (){ > var now = new Date(); > var hours= now.getHours(); > var minutes= now.getMinutes(); > var seconds= now.getSeconds(); > var months= now.getMonth(); > var dates= now.getDate(); > var years= now.getYear(); > var timeValue = "" > timeValue += ((months >9) ? "" : " ") > timeValue += ((dates >9) ? "" : " ") > timeValue = ( months +1) > timeValue +="/"+ dates > timeValue +="/"+ years > var ap="A.M." > if (hours == 12) { > ap = "P.M." > } > if (hours == 0) { > hours = 12 > } > if(hours >= 13){ > hours -= 12; > ap="P.M." > } > var timeValue2 = " " + hours > timeValue2 += ((minutes < 10) ? ":0":":") + minutes + " " + ap > return timeValue2; > } > function MakeArray(n) { > this.length = n > return this > } > monthNames = new MakeArray(12) > monthNames[1] = "Janurary" > monthNames[2] = "February" > monthNames[3] = "March" > monthNames[4] = "April" > monthNames[5] = "May" > monthNames[6] = "June" > monthNames[7] = "July" > monthNames[8] = "August" > monthNames[9] = "Sept." > monthNames[10] = "Oct." > monthNames[11] = "Nov." > monthNames[12] = "Dec." > daysNames = new MakeArray(7) > daysNames[1] = "Sunday" > daysNames[2] = "Monday" > daysNames[3] = "Tuesday" > daysNames[4] = "Wednesday" > daysNames[5] = "Thursday" > daysNames[6] = "Friday" > daysNames[7] = "Saturday" > function customDateSpring(oneDate) { > var theDay = daysNames[oneDate.getDay() +1] > var theDate =oneDate.getDate() > var theMonth = monthNames[oneDate.getMonth() +1] > var dayth="th" > if ((theDate == 1) || (theDate == 21) || (theDate == 31)) { > dayth="st"; > } > if ((theDate == 2) || (theDate ==22)) { > dayth="nd"; > } > if ((theDate== 3) || (theDate == 23)) { > dayth="rd"; > } > return theDay + ", " + theMonth + " " + theDate + dayth + "," > } > scrollMaster(); > // End --> > </SCRIPT> > > > </body> > > </HTML> > > <p> > > <font size="6"><b><span style="font-family: Times New > Roman"> </span></b></font><div style="position: absolute; width: 141px; > height: 10px; z-index: 3; left: 17px; top: 190px" id="layer3"> > <b><font size="3"> > <a href="mailto:CustomerService@u...?subject=Requisition > Inquiry">Customer Service:</a> </font></b></div> > <p> > > <span style="font-size: 12.0pt; font-family: Times New Roman"><!--[if gte > vml 1]><v:shapetype id="_x0000_t75" > coordsize="21600,21600" o:spt="75" o:preferrelative="t" > path="m@4@5l@4@11@9@11@9@5xe" > filled="f" stroked="f"> > <v:stroke joinstyle="miter"/> > <v:formulas> > <v:f eqn="if lineDrawn pixelLineWidth 0"/> > <v:f eqn="sum @0 1 0"/> > <v:f eqn="sum 0 0 @1"/> > <v:f eqn="prod @2 1 2"/> > <v:f eqn="prod @3 21600 pixelWidth"/> > <v:f eqn="prod @3 21600 pixelHeight"/> > <v:f eqn="sum @0 0 1"/> > <v:f eqn="prod @6 1 2"/> > <v:f eqn="prod @7 21600 pixelWidth"/> > <v:f eqn="sum @8 21600 0"/> > <v:f eqn="prod @7 21600 pixelHeight"/> > <v:f eqn="sum @10 21600 0"/> > </v:formulas> > <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/> > <o:lock v:ext="edit" aspectratio="t"/> > </v:shapetype><v:shape id="_x0000_s1025" type="#_x0000_t75" alt="" > style='position:absolute; > left:9pt;top:7.5pt;width:74.25pt;height:72.75pt;z-index:0; > mso-position-horizontal-relative:char;mso-position-vertical:absolute; > mso-position-vertical-relative:line' stroked="t" strokecolor="white"> > <v:imagedata src="DOLWMDDREQ31_files/image001.jpg" o:title="AasaSeal" > chromakey="#fdfdfd"/> > </v:shape><![endif]--><![if !vml]><span style='mso-ignore:vglayout;position: > absolute;z-index:0;left:11px;top:9px;width:101px;height:99px'><img width=101 > height=99 src="DOLWMDDREQ31_files/image002.gif" > v:shapes="_x0000_s1025"></span><![endif]></span><font size="6"><b><span > style="font-family: Times New Roman"> </span> > </b></font> > <p> > > <b> > <DIV> > <SPAN style="FONT-FAMILY: 'Times New Roman'"><font size="6"> > </font></SPAN></b><font size="6"><b><span style="font-family: Times New > Roman"> > </span></b></font> > > <b><SPAN style="FONT-FAMILY: 'Times New Roman'"><font size="5"> > </font></SPAN></b><div style="position: absolute; width: 732px; height: > 46px; z-index: 2; left: 119px; top: 46px" id="layer2"> > > <img border="0" src="MAIL80A0.GIF" width="32" height="32"><font > size="6"><b><span style="font-family: Times New Roman"> > </span></b></font> > > <b> > > <SPAN style="FONT-FAMILY: 'Times New Roman'"><font size="6">DOL-W, MDD > Requisition Tracking Program </font></SPAN></b> > > <img border="0" src="MAIL9232.GIF" width="32" height="32"></div> > </p> > </DIV > <P> > > > </p> <br> > <i><font > size="-1"> > </font></i> > <div style="position: absolute; width: 100px; height: 10px; z-index: 11; > left: 403px; top: 142px" id="layer11"> > <!--webbot bot="Validation" s-display-name="Requisition Number" > s-data-type="String" b-value-required="TRUE" i-minimum-length="1" > i-maximum-length="20" --><input type="text" name="ORDNBR" ID="ORDER" > size="20" maxlength="20"></div> > <p> </p> > <p> > <input type="button" > value="Search" name="B1" > onclick=javascript:search(this.form)> <input type="reset" > value="Reset" name="B2" > onclick="ORDER.value=''"></p> > > > <div style="position: absolute; width: 729px; height: 10px; z-index: 12; > left: 116px; top: 95px" id="layer12" align="center"> > <a href="http://www.usapa.army.mil/usapa_home.asp">USAPA Home</a> > <a href="http://docs.usapa.belvoir.army.mil/ordering/store.asp">USAPA > Ordering </a> > <a href="http://www.usapa.army.mil/usapa_pub_search_p.asp">USAPA > Publications</a> > <a href="http://www.usapa.army.mil/usapa_pub_search_f.asp">USAPA Forms</a> > <a href="http://www.usapa.army.mil/usapa_officialSite.htm">Official Pub > Sites</a> > <a href="http://www.usapa.army.mil/usapa_externallinks.htm">Other External > Links</a></div> > > > <DIV ID="output" style="position: absolute; width: 977px; height: 40px; > z-index: 5; left: 10px; top: 283px" ></DIV> > > <b> </b><div style="position: absolute; > width: 277px; height: 24px; z-index: 4; left: 347px; top: 128px" id="layer4"> > <b>Enter Document or Requisition Number</b> </div> > <p><b> </b></p> > <div style="position: absolute; width: 173px; height:10px; z-index: 8; left: > 796px; top: 193px" id="layer8"> > <b> > <a > href="http://www.fedex.com/Tracking?ascend_header=1&clienttype=dotcom&cntry_code=us&language=english&tracknumbers=">FedEx Tracking</a></b></div> > <p><b> > </b> > </p> > <div style="position: absolute; width: 400px; height: 34px; z-index: 5; > left: 312px; top: 185px" id="layer5"> > <i><font size="-1">Place the cursor in the text box, and type in the > Document Number.</font></i> > <br> > </div> > <p><b> </b></p> > <div style="position: absolute; width: 100px; height: 10px; z-index: 9; > left: 795px; top: 212px" id="layer9"> > <b> > <a > href="http://wwwapps.ups.com/WebTracking/processInputRequest?HTMLVersion=5.0">UPS Tracking</a></b></div> > <p><b> </b> </p> > <div style="position: absolute; width: 119px; height: 10px; z-index: 7; > left: 17px; top: 226px" id="layer7"> > <b><font size="3">DSN: 892-0910</font></b> > </div> > <div style="position: absolute; width: 148px; height: 10px; z-index: 6; > left: 17px; top: 209px" id="layer6"> > <b><font size="3">COM: 314-592-0910 </font></b></div> > <div style="position: absolute; width: 112px; height: 10px; z-index: 10; > left: 795px; top: 233px" id="layer10"> > <b> > <a > href="http://www.usps.com/shipping/trackandconfirm.htm?from=home&page=0035trackandconfirm">USPS Tracking</a></b></div> > <p> </p> > <p> </p> > > </body> > > </html> > > > ----XSL---- > > <?xml version="1.0"?> > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > <xsl:param name="nameSearchValue">HP00004262</xsl:param> > <xsl:param > name="UPSLINK1">http://wwwapps.ups.com/WebTracking/processInputRequest?HTMLVersion=5.0&sort_by=status&tracknums_displayed=5&TypeOfInquiryNumber=T&loc=en_US&InquiryNumber1=</xsl:param> > <xsl:param > name="UPSLINK2">&InquiryNumber2=&InquiryNumber3=&InquiryNumber4=&InquiryNumber5=&AgreeToTermsAndConditions=yes&track.x=36&track.y=5</xsl:param> > <xsl:param > name="USPSLINK1">http://www.usps.com/shipping/trackandconfirm.htm?from=home&page=0035trackandconfirm</xsl:param> > <xsl:param > name="FEDEXLINK1">http://www.fedex.com/Tracking?ascend_header=1&clienttype=dotcom&cntry_code=us&language=english&tracknumbers=</xsl:param> > > <xsl:template match="/"> > <HTML> > <BODY> > <TABLE border="10" align="left"> > <xsl:apply-templates select="/ORDERREQUISITION/REQUISITION"> > <xsl:sort select="ORDNBR"/> > </xsl:apply-templates> > </TABLE> > </BODY> > </HTML> > </xsl:template> > > <xsl:template match="REQUISITION"> > <xsl:if test="ORDNBR=$nameSearchValue"> > > <TR> > <TD style="font-weight:bold" bgcolor="lightblue">Received</TD> > <TD bgcolor="white" style="font-weight:bold"> <xsl:apply-templates > select="DATECRE" /></TD> > > <TD style="font-weight:bold" bgcolor="lightblue">Req Nbr</TD> > <TD style="font-weight:bold" bgcolor="white" fgcolor="blue"> > <xsl:apply-templates select="ORDNBR" /></TD> > > <TD style="font-weight:bold" bgcolor="lightblue">Cust ID</TD> > <TD bgcolor="white" style="font-weight:bold"><xsl:apply-templates > select="CUSTID" /></TD> > > <TD style="font-weight:bold" bgcolor="lightblue">Ord Qty</TD> > <TD bgcolor="white" style="font-weight:bold"><xsl:apply-templates > select="ORDQTY" /> </TD> > > <TD style="font-weight:bold" bgcolor="lightblue">Qty Denied</TD> > <TD bgcolor="white" style="font-weight:bold"><xsl:apply-templates > select="QTYDENIED" /></TD> > > <TD style="font-weight:bold" bgcolor="lightblue">Status</TD> > <TD bgcolor="white" style="font-weight:bold"><xsl:apply-templates > select="STATUS" /></TD> > </TR> > <TR> > <TD style="font-weight:bold" bgcolor="lightblue">Depot</TD> > <TD bgcolor="white" style="font-weight:bold"><xsl:apply-templates > select="DEPOT" /></TD> > <TD style="font-weight:bold" bgcolor="lightblue">Carrier ID</TD> > <TD bgcolor="white" style="font-weight:bold"><xsl:apply-templates > select="CARRIERID" /></TD> > <TD style="font-weight:bold" bgcolor="lightblue">Carrier Mode</TD> > <TD bgcolor="white" style="font-weight:bold"><xsl:apply-templates > select="CARRIERMODE" /></TD> > <TD style="font-weight:bold" bgcolor="lightblue">Ship Qty</TD> > <TD bgcolor="white" style="font-weight:bold"><xsl:apply-templates > select="SHIPQTY" /></TD> > <TD style="font-weight:bold" bgcolor="lightblue">Ship Date</TD> > <TD bgcolor="white" style="font-weight:bold"><xsl:apply-templates > select="SHIPDATE" /></TD> > <TD style="font-weight:bold" bgcolor="lightblue">Trk Code</TD> > <TD style="font-weight:bold" bgcolor="white"><xsl:apply-templates > select="TRKCODE" /></TD> > </TR> > <TR> > </TR> > <TR> > </TR> > </xsl:if> > > </xsl:template> > > <xsl:template match="DATECRE"> > <SPAN><xsl:value-of select="."/></SPAN> > > </xsl:template> > > <xsl:template match="SHIPQTY"> > <SPAN><xsl:value-of select="."/></SPAN> > </xsl:template> > > <xsl:template match="ORDNBR"> > <SPAN><xsl:value-of select="."/></SPAN> > </xsl:template> > > <xsl:template match="SHIPDATE"> > <SPAN><xsl:value-of select="."/></SPAN> > </xsl:template> > > <xsl:template match="CUSTID"> > <SPAN><xsl:value-of select="."/></SPAN> > </xsl:template> > > <xsl:template match="DEPOT"> > <SPAN><xsl:value-of select="."/></SPAN> > </xsl:template> > > <xsl:template match="ORDQTY"> > <SPAN><xsl:value-of select="."/></SPAN> > </xsl:template> > > <xsl:template match="CARRIERID"> > <SPAN><xsl:value-of select="."/></SPAN> > </xsl:template> > > <xsl:template match="QTYDENIED"> > <SPAN><xsl:value-of select="."/></SPAN> > </xsl:template> > > <xsl:template match="CARRIERMODE"> > <SPAN><xsl:value-of select="."/></SPAN> > </xsl:template> > > <xsl:template match="STATUS"> > <SPAN><xsl:value-of select="."/></SPAN> > </xsl:template> > > <xsl:template match="TRKCODE"> > <xsl:if test="starts-with(text(), '1Z')"> > <SPAN><a> > <xsl:attribute name="href"> > <xsl:value-of select="$UPSLINK1"/><xsl:value-of > select="text()"/><xsl:value-of select="$UPSLINK2"/> > </xsl:attribute> > <xsl:value-of select="." /> > </a> </SPAN> > > </xsl:if> > > <xsl:if test="starts-with(text(), '000')"> > <SPAN><a> > <xsl:attribute name="href"> > <xsl:value-of select="$USPSLINK1"/> > </xsl:attribute> > <xsl:value-of select="." /> > </a> </SPAN> > </xsl:if> > > <xsl:if test="starts-with(text(), '79')"> > <SPAN><a> > <xsl:attribute name="href"> > <xsl:value-of select="$FEDEXLINK1"/><xsl:value-of select="text()"/> > </xsl:attribute> > <xsl:value-of select="." /> > </a> </SPAN> > </xsl:if> > </xsl:template> > > </xsl:stylesheet> > > > ----XML--_ > > <?xml version="1.0"?> > <ORDERREQUISITION> > <REQUISITION> > <DATECRE>10/26/04</DATECRE> > <ORDNBR>2004196002663</ORDNBR> > <CUSTID>A0016</CUSTID> > <ORDQTY>1</ORDQTY> > <QTYDENIED>0</QTYDENIED> > <STATUS>SHIPPED!</STATUS> > <SHIPQTY>1</SHIPQTY> > <SHIPDATE>10/29/04</SHIPDATE> > <DEPOT>STLMO</DEPOT> > <CARRIERID>4SP</CARRIERID> > <CARRIERMODE>Special Std (Media Mail)</CARRIERMODE> > <TRKCODE>00082923329#</TRKCODE> > </REQUISITION> > </ORDERREQUISITION> > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
