In his book XSLT Cookbook ( http://www.oreilly.com/catalog/xsltckbk/ ), Sal Mangano suggests that the preferred methods for optimizing a given transformation are usually selecting and then matching (as opposed to filtering via xsl:if or xsl:choose) in that order. He notes, however, that filtering turned out to be slightly faster than matching in Xalan (although I couldn't ever find where he specified which version of Xalan he had benchmarked).
I was wondering if there were a theoretical, specification, or developer recommendation as to which form of transformation would result in the most optimized stylesheet. Also, I'm curious whether one form scales better than another. Here's an example XML document: <?xml version="1.0" encoding="utf-8"?> <outer> <inner leaf="true" /> <inner leaf="false"> data </inner> ... </outer> So if I'm interested in transforming the inner elements differently (and possibly in a particular order) based on their attributes, I could do something like this: <xsl:template match="inner"> <xsl:choose> <xsl:when test="@leaf='false'"> <!-- something here --> </xsl:when> </xsl:choose> </xsl:template> Or this: <xsl:template match="[EMAIL PROTECTED]'false']"> <!-- something here --> </xsl:template> Or this: <xsl:template match="outer"> <xsl:apply-templates select="[EMAIL PROTECTED]'false']" /> </xsl:template> I guess another way to phrase my question is: Which is more efficient in Xalan: XPath structures or XSL logic? I'm particularly interested in examples that would be applied to XML documents containing at least 50,000 elements. -tfo