[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Efficient Stylesheets for reordering
Jose, > Am I completely wrong on my understanding of XSLT? Almost ;) The big gap seems to be that you think that the XSLT processor is working on a stream of information that comes into it from the XML, and is writing out a stream of information concurrently. This is inaccurate. What actually happens is that the XSLT processor parses the XML document and creates from it a tree representation of the document (the Document Object Model or DOM). It stores this DOM in memory and operates over it to create another DOM (the result). Then it (usually) serialises this DOM into an output file. One of the points about XSLT is that processors don't *have* to do all the processing sequentially: there is nothing in the language that prevents them from applying templates to s1 nodes, s2 nodes, s3 nodes and so on, all concurrently, and then constructing the result from that directly. Some processors allow asynchronous and partial transformation. You could have a look at MSXSL (XSLProcessor) and Saxon (saxon:preview) which may be helpful. In your case, where you're just copying nodes across from one tree into a different structure, you can use xsl:copy-of rather than xsl:apply-templates: <xsl:template match="doc1" > <xsl:copy-of select="s1[1]" /> <xsl:copy-of select="s3" /> <xsl:copy-of select="s4[1]" /> <xsl:copy-of select="s2[1]" /> <xsl:copy-of select="s5" /> </xsl:template> I'm not sure whether the position predicates will make much difference, but they certainly won't hurt unless you change your DTD. I hope that helps somewhat, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|