xsl-list
[Top] [All Lists]

RE: Need exactly 23 rows of output before next page

2004-08-13 14:01:48
From: J.Pietschmann [mailto:j3322ptm(_at_)yahoo(_dot_)de]

Clay Leeds wrote:
There's one error in there... I think '<' should be '&lt;':

No, only ">" needs to be escaped in attribute values.


Oops, no, it's "<" that needs escaping, not ">" :-)

From the xml 1.0 Rec -

"The ampersand character (&) and the left angle bracket (<) MUST NOT
appear in their literal form, except when used as markup delimiters, or
within a comment, a processing instruction, or a CDATA section. If they
are needed elsewhere, they MUST be escaped using either numeric
character references or the strings "&amp;" and "&lt;" respectively. The
right angle bracket (>) MAY be represented using the string "&gt;", and
MUST, for compatibility, be escaped using either "&gt;" or a character
reference when it appears in the string "]]>" in content, when that
string is not marking the end of a CDATA section."

And this -

[14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)

In tests, I usually reverse the sense of a comparison so I can use an
unescaped ">", for better readability.  For example,

<xsl:if test='@parm > 2'>...

instead of this -

<xsl:if test='2 &lt; @parm'>...

Try it, you'll like it!

Cheers,

Tom P