Tony Graham <[EMAIL PROTECTED] escreveu:
[EMAIL PROTECTED] wrote at 27 Sep 2002 16:44:32 -0300:
> Out of the XML recomendation,section 2.2:
>
>         A character is an atomic unit of text as specified by ISO/IEC
> 10646 [ISO10646]. Legal characters are tab,
> carriage return, line feed, and the legal graphic characters of Unicode
> and ISO/IEC 10646.

XML 1.0 Second Edition removed "graphic" (which I always found
confusing but which is good ISO-speak).

> or, more clearly:
>
>         Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] |
> [#x10000-#x10FFFF]
>         /* any Unicode character, excluding the surrogate blocks, FFFE,
> and FFFF. */
>
>
> That means  "-", "#12235" , etc are characters, while "'1'" is not.

&#12235; is a character reference.  '#12235' is how you talk about a
character's code point, although the hexadecimal representation is
usually preferable.

In XSL terms, "'1'" is a one-character string literal, but while you
could claim that it is one character, there's no XSL conversion from a
string to a character, so <fo:character character="'1'"/> should fail.



You are correct. What I tried to poit out is that "'1'" IS a string string that HAS one character. He who "claim[s] it is one character" is IMHO seriouly misled. "1" , on the other hand, IS a character. The concept of a character, in the XML syntax definition, is that of the symbols allowed in the grammar, the most elementary piece of the lexical. The term string is not formally defined in the recommendation (sadly), but it is used throughout the text meaning "sequence of characters". A string _type_ is defined for attributes, and consists of a quoted literal string (i.e. a sequence of characters delimited by quotes).  In the XML point of view, "'1'" is nothing but a three-character string. And a three-character string is not a character.

The XSL recommendation defines a string datatype that has a rather different scope of the 'literal string' and 'string attribute type' defined in the XML spec. But defines no 'character' datatype, so I think there is no other option but to assume it means the XML definition of a character.  So, <fo:character character="1"/>  is correct, while, as you said, <fo:character character="'1'"/> should fail.

This leaves us with a problem, however, because since the character datatype is not defined, there is also no conversion rule which results in a character. You cannot store a character in a xsl:variable because there is no way to specify or retrieve it -- variables know only about strings. I find that very disturbing, because it hampers stylesheet coding, in that we cannot specify characters indirectly or do any work with them.  I think this should be reported to the editors of XSLT 2.0 so they can provide a clear way out.


=============================================
Marcelo Jaccoud Amaral
Petrobrás (http://www.petrobras.com.br)
mailto:[EMAIL PROTECTED]
voice: +55 21 2534-3485
fax: +55 21 2534-1809
=============================================

Reply via email to