What's the matter of using `& lt;` instead of just `<` for comparison in XSLT?
XSLT files are also XML files; The XML Spec says that you cannot use '<' and '&' in the literal sense, except in certain contexts . Thus, it is a matter of saving well-formed XML in your XSLT file.
Nothing to do with XSLT, except that XML and XML prohibit < (but not > ) attribute values:
$ cat > a.xml <elm a=">"/> $ xmllint a.xml <?xml version="1.0"?> <elm a=">"/> $ cat > b.xml <elm b="<"/> $ xmllint b.xml b.xml:1: parser error : Unescaped '<' not allowed in attributes values <elm b="<"/> ^ b.xml:1: parser error : attributes construct error <elm b="<"/> ^ b.xml:1: parser error : Couldn't find end of Start Tag elm line 1 <elm b="<"/> ^ b.xml:1: parser error : Extra content at the end of the document <elm b="<"/> ^ I mean, I changed it to
<xsl:if test="a < b">and it works. why not just use this?
If this is true, your so-called "XSLT processor" was not . Any XSLT stylesheet must be a well-formed XML document. Any well-formed XML document cannot contain the character "<" inside the attribute value.
Therefore, please correct the incorrect statement in your question.