Subject: Re: [xsl] processing improvements questions regarding document, parameters From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Wed, 17 Apr 2002 09:42:32 +0100 |
Hi Bryan, With all performance questions, the best answer is "try it and see" -- there might sometimes be general guidelines but the majority of the time the differences are so miniscule you should be choosing whatever gives you the easiest maintenance and extensibility rather than the approach that's ever so slightly faster. > okay first a general question, should there be any improvement in > processing between the model of loading an external document using > the document() function and doing things with it, applying templates > etc. or if one copies the document into a global parameter and uses > a node-set function against it. Less general does anyone know if > there would be any difference in processing using these methods with > either saxon or msxml 4. If you mean the difference between: <xsl:variable name="document-rtf"> <xsl:copy-of select="document($filename)" /> </xsl:variable> <xsl:variable name="document" select="msxsl:node-set($document-rtf)" /> and: <xsl:variable name="document" select="document($filename)" /> then the latter is better -- it gives you exactly the same thing but without the processor having the burden of creating an extra node tree (which is generally a fairly expensive process). > A question about adding parameters to an xsl processor in asp: > > I've got the traditional xml/asp page, I load in two xml pages, one > for the menu the other for content, apply xslts against them to get > output. In doing so I pass in some parameters, am thinking about > passing in nodesets extracted from a dom document, would there be > any gain in doing it this way or would it be better to load in a > document from the xslt and then pass a parameter telling the xslt > which info it should be getting. For example $browser is used to get > the setting info for msxsl:node-set($settings)/browser[@type = > $browser]. This is less clear cut, and to be honest I doubt that there's much in it, especially when you're dealing with MSXML which seems to treat every node tree in the same way (whether it's being used as a DOM or in XSLT). There are times when passing in a node set as a parameter is the best way to achieve a certain goal, for example when the document is generated in memory rather than being accessible via URL or when it's easiest to do the search that you want to do by constructing the XPath to do it as a string (in other words, to get dynamic evaluation of XPaths, which isn't supported in XSLT). Your case doesn't seem to fall into either of these categories. If performance is an issue, try them both out and see whether one is significantly faster than the other. If performance isn't an issue, then think about how you're likely to reuse both the ASP code and the stylesheet. If you're likely to reuse the stylesheet with different ASP code, then it would be best to have the stylesheet get the document. If you're likely to use a different stylesheet that accepts the same parameters, then it would be slightly better to have the ASP code get the document. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] processing improvements quest, Bryan Rasmussen | Thread | RE: [xsl] processing improvements q, Bryan Rasmussen |
[xsl] processing improvements quest, Bryan Rasmussen | Date | RE: [xsl] Performance Issue using c, Michael Kay |
Month |