RE: AW: [xsl] Matching two consecutive <br><br>

Subject: RE: AW: [xsl] Matching two consecutive <br><br>
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Mon, 23 Aug 2004 13:14:42 +0100
>     When would such a condition occur? Wouldnt the association of
> namespace prefix to urn for any namespaces being used have to occur in
> the stylesheet for the XML to be processed correctly? Why would the
> the processor have to think up prefixes on the fly?

In practice if $n is a node in the source document, then name($n) will
almost invariably use the prefix that appeared in the source document: the
only situation in which it might be different is if the source document
assigns two different prefixes to the same namespace, in which case it might
use the wrong one.

However, when you start doing multi-phase transformations, or constructing
source documents programmatically, then prefixes start to become less
predictable, and it's as well not to rely on them.

Just as importantly, the test self::br is likely to be more efficient than
name()='br', because it doesn't involve searching for a prefix, constructing
the lexical QName, and then doing a string comparison.

Michael Kay

Current Thread