On Sunday, 01. January 2006 04:10, Lars Skjærlund wrote: > <xsl:apply-templates select="document('menu.xml')"/> > > it doesn't work: Using Sablotron, the browser just hangs (and, it > seems, AxKit starts eating host memory), using LibXSLT, I get a server > error and the log files yells about a possible loop. > > What goes on here? Isn't the above syntax correct XPath? The document > is there and can be loaded in other ways, and you can see from the > logfile that it is indeed the correct document it's trying to parse.
It is correct XPath, but as far as I understand, document() returns a nodeset of _all_ document nodes. So what you did is to apply your templates to all nodes at once. What you probably want is to apply your templates to the root node only. Example: <node> <foo>bar</foo> <bar><frob/></bar> </node> document() returns something like "<node>...</node>" AND "<foo>bar</foo>" AND "<bar><frob/></bar>" AND "<frob/>" AND "bar". Applying templates means processing each node multiple times. In big documents, that could well lead to what you see, much memory used and recursion limits reached. Solution: <apply-templates select="document('menu.xml')/*" />, this will start off at the root. -- CU Joerg --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]