XSLT name() function is evil and should be avoided just like GoTo.
For example, it is very bad to write
<xsl:apply-templates select="*[name()!='a:b']"/>
because it will exclude both of
<a:b/> <a:b xmlns:a="totallyDifferentNamespace"/>
the correct way to write above apply-templates is
<xsl:apply-templates select="*[not(self::a:b)]"/>
or in XSLT 2.0
<xsl:apply-templates select="* exclude a:b"/>
assuming xmlns:a="someSpecificNamespace"
Test code is attached below.
| Attachment | Size |
|---|---|
| xslt-evil-name.zip | 2.58 KB |
Comments
Post new comment