This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: •
Greg,
At 10:33 AM 6/8/2002, you wrote:
Thanks guys, this is helpful; but as for using disable-output-escaping, I
was not able to use it for this character (yes, Wendell, I tried). When I
tried to define either #8226 or 8226 as the entity reference in my
stylesheet, I got a message that the file was not well-formed. However,
when I changed the entity reference to anything that starts with a letter
"<!ENTITY bull" instead of "<!ENTITY #8226" or "<!ENTITY 8226" I was able
to save the file without incident. I use XML spy over Xalan-Java, or
MSXML4 so maybe what I am seeing is caused by XML SPY? Doesn't seem likely.
Oh, it wasn't clear this was what you were trying to do.
You can't have an entity named '#8226' or '8226' since those are not legal
names in XML.
The parser recognizes • as a character not because there is somewhere
an entity named '#8826' declared, but because entities of this form are
hard-wired to be character entities.
Anyway, when I was unable to save the file, I leaped to the (wrong)
conclusion that somehow defining an entity that doesn't start with a
letter of the alphabet is illegal in XML, at least in an XSL stylesheet.
No, it's correct, anywhere in XML including an XSL stylesheet.
Any guesses as to why I get the message telling me that this can be saved:
<?xml version ="1.0"?>
<!DOCTYPE stylesheet [
<!ENTITY ntilde
"<xsl:text disable-output-escaping>&ntilde;</xsl:text>">
]>
<xsl:stylesheet . . .
It's well-formed, and allowed.
and this:
<?xml version ="1.0"?>
<!DOCTYPE stylesheet [
<!ENTITY #8226
"<xsl:text disable-output-escaping>&8226;</xsl:text>">
]>
<xsl:stylesheet . . .
It's not, since the name isn't legal.
Basically you're trying to trick the parser into serializing your character
as a string of characters that will look like an entity when the file is
parsed again. You could also do this:
<?xml version ="1.0"?>
<!DOCTYPE stylesheet [
<!ENTITY ntilde
"<xsl:text disable-output-escaping>&8226;</xsl:text>">
]>
<xsl:stylesheet . . .
Then any ñ entities in your stylesheet would refer to the string
'•'.
But what use is that? Such an entity in your stylesheet means only that you
can write out the characters '•' when you want. Why is this so
important, instead of just using the character itself?
Declaring such entities in your stylesheet is quite a different thing from
handling them in your input -- the classic version of the problem being
jiggering your input so that entities come out, not characters. But you're
jiggering your stylesheet, not your input document.
Cheers,
Wendell
cannot because it's not well-formed?
Why doesn't this XML content: &#8226;
produce this output: •
Why do you think it should? The first is 6 characters in the stylesheet.
6 non white space characters in character data always just produce 6
characters in the output. Your required output is one character
reference. To get that character put • into the stylesheet.
It's bloody nigh impossible to get my XML parser (Xalan-Java) NOT to
recognize entities except for this one case where recognizing it
It does recognise it. & means an ampersand as character not as
markup, so that's what appears in the result tree. But that ampersamd
character in teh result tree has to be linearised as & otherwise
parsing teh result wouldn't reproduce that character.
You haven't said why you think just putting • into the stylesheet
does not work.
David
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
--
Thanks,
gregm
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
======================================================================
Wendell Piez mailto:wapiez@mulberrytech.com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list