This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: BUG?? - please help (JavaScript inside CDATA)


juggy@gmx.net wrote:
> 
> Hi there,
> 
> I just discovered something that appears to be a nasty bug. I am
> using the MSXMLDOM in a ASP to convert XML + XSl to HTML.

First, thanks for reminding me what an issue it can be learning a third
language by way of a second!

I've noticed the high number of German (and Italian, and...)
contributors to this group and XML resources in general before.
Sometimes I've wondered how hard this can be, but decided that it's the
syntax of the code in question that we're both looking at, and the
language shouldn't be an issue.

Your code showed that there's a LOT of context in the variable names
(and content) used in examples which is very important. By this I mean I
had to think a lot harder about what you were doing than usual.
Luckily my German is still good enough to hold up a conversation
(although I can't spell)...


SO.. Language issues aside, what you're trying looks OK. 
We assume you're using the updated MSXML. (RIGHT?!)

My suspicions would fall upon the & characters that appear once or twice
in your CDATA. 
I know CDATA is supposed to be safe from parsing, but in many
implimentations, it's NOT.

The attitude I've seen here is that "&" IS, to all intents and purposes
the same thing as & and (the numerical version which I can never
remember). This means that parsers are a bit too keen to escape it for
internal representation. 
As a keen client-side scripter, I disagree, but just work around it.
Often I write code that writes code that writes code (jumping through
three languages on the way). I prefer to do my own escaping.
There are some output-method settings which I believe help.

SO, see if you get better results if your content strings have no &
characters in them.

Also try
  <xsl:script language="JavaScript">
    <xsl:comment>
      <![CDATA[
        ... ..

As it's 
  A: more correct. 
  B: safer from the parser.

If not, what was the view-source output when you did it client-side?
Paste that page into a syntax-coulouring editor and it may throw some
light on things.

.dan.


:=====================:====================:
: Dan Morrison        : The Web Limited    :
:  http://here.is/dan :  http://web.co.nz  :
:  dman@es.co.nz      :  danm@web.co.nz    :
:  04 384 1472        :  04 495 8250       :
:  025 207 1140       :                    :
:.....................:....................:
: If ignorance is bliss, why aren't more people happy?
:.........................................:


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]