Subject: Re: Complex XSL Application (I think) From: "Wendy Cameron" <wendy.cameron@xxxxxxxxx> Date: Thu, 25 Feb 1999 08:27:17 +1000 |
> [Mark Birbeck] > I think I'm missing something Wendy. It seems to me that the XSL should > always be the same - you just want a stylesheet that renders an > employee's information as HTML (and start with a wild card, not the name > of your employee document, so that the same stylesheet can display more > than one employee if need be). From how you've described it the dynamic > stuff should be on the XML side. A simple query on your database using > the 'service number', and then converting the returned data to an XML > document should be fine. I don't want to accuse you doing something > you're not - so don't take offence here(!) - but you wouldn't be trying > to run the query from the XSL side, would you? In other words you're not > taking a massive XML document and then finding the employee with an XSL > filter? [Wendy] Sheepish look Yes thats what im trying to do I realise it will have performance problems. But we dont have a database the 160,000 records comes from a decommisioned Hierarchical database which is a legacy system costing the company 100,000s of dollars per year. We are archiving the data into a flat XML file format and wanting to provide query access to that data archive. Pretty minimal access. Maybe 1 or 2 hits a week. We want to use off the shelf stuff rather than in house develop searching tools. We have to archive strategies 1) store each employee in a Separate File and generate an over all index containing the search entries. 2) store all employees in one large file and generate and index file [Mark Birbeck] Had to ask! [Wendy] Tis Ok im used to looking foolish >The following function could go in an > ASP file on the server, or be in a page running on the browser. It takes > either a URL to an XML source in sXML, or a path to an ADs object. In > your system just replace the latter with your database query, and > replace XMLExport() with a function that does the query and converts it > to XML. I'm sure you have a similar function, but the reason I'm > spelling it out is to draw attention to the fact that the source for the > 'file' as used by the DOM, can be any URL, which means we can do things > like > > "stylesheets/employee.asp?order=1" > > and > > "stylesheets/employee.asp?order=2" > > employee.asp would your current XSL file, but there'd be a small bit of > script in there to decide what order to display the results in. (Might > be as simple as testing 'order' and writing a minus instead of a plus at > the key point.) If TransformXML was in the browser page then these > different pages would be cached locally, so switching between the > different views of the same XML data would be pretty fast. > > Here's the function: > > Function TransformXML(bAttributes, sADsPath, sXSL, sXML) > ' > ' Function only really needs one of sADsPath and sXML. We could just > test for a URI > ' > On Error Resume Next > Dim slXML > Dim sResult > ' > ' Create an instance of the parser > ' > Dim oData : set oData = Server.CreateObject("Microsoft.XMLDOM") > > If Err <> 0 Then > sResult = L_FailedToCreateXMLDOM > Else > If bAttributes <> 1 Then > bAttributes = 0 > End If > > ' > ' Load the XML into the parser > ' > oData.async = False > If sADsPath <> "" Then > ' > ' If we have a pointer to an ADSI object then we > extract the object as > ' XML as our source for the parser > ' > slXML = XMLExport(False, False, sADsPath, > bAttributes) > oData.loadXML(slXML) > Else > ' > ' Otherwise we have a URL > ' > oData.load(sXML) > End If > If (oData.parseError.errorCode <> 0) Then > sResult = ReportError(oData.parseError) > Else > ' > ' Create another parser instance, and load the > stylesheet into it > ' > Dim oStyle : set oStyle = > Server.CreateObject("Microsoft.XMLDOM") > If Err <> 0 Then > sResult = L_FailedToCreateXSLDOM > Else > oStyle.async = False > oStyle.load("http://yourserver/" & sXSL) > if (oStyle.parseError.errorCode <> 0) > Then > sResult = > ReportError(style.parseError) > else > ' > ' Transform the XML on the basis > of the stylesheet > ' > sResult = > oData.transformNode(oStyle) > If Err Then > sResult = "<font > face=Verdana size=2><font size=4>XSL Runtime Error</font>" _ > & "<P><B>" + > err.description + "</B></P></font>" > End If > End If > End If > End If > End If > Set oData = Nothing > Set oStyle = Nothing > TransformXML = sResult > End Function > > > Regards, > > Mark > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: Complex XSL Application (I thin, Mark Birbeck | Thread | RE: Complex XSL Application (I thin, Vun Kannon, David |
RE: Complex XSL Application (I thin, Michael . Kay | Date | Re: Complex XSL Application (I thin, James Robertson |
Month |