Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 07:10 AM
news.hunterlink.net.au
Guest
 
Posts: n/a
Default character reference encoding confusion, please help.

(* note the escaped ampersand and the character reference have extra spaces
to avoid being converted when viewed)

I have a job that requires the following

<ThisElement>Here is some text & a m p ; here is a & # x E 2 ;
character</ThisElement>

to end up as

<ThisElement>Here is some text & a m p ; here is a & # x E 2 ;
character</ThisElement>

after it has been transformed using MSXSL3.0. There will be other parts of
the source XML that get changed but the heart of my problem is I want to
keep the escaped ampersand and the character reference as they are.

currently the escaped ampersand remains as is and the character reference
changes to
& a m p ; # E 2 ; with the single the first character getting escaped. If I
disable output escaping it remains intact but then the &amp; character gets
converted to a single ampersand and create bad resulting XML.

I need some XSL code that will keep any currently escaped characters but not
escape any character references.

Any help would be great, I have read through the spec but not found the any
answers.

Thanks


  #2  
Old July 20th, 2005, 07:10 AM
Klaus Johannes Rusch
Guest
 
Posts: n/a
Default Re: character reference encoding confusion, please help.

"news.hunterlink.net.au" wrote:
[color=blue]
> I need some XSL code that will keep any currently escaped characters but not
> escape any character references.[/color]

There is no way in XSLT to distinguish between &#E2; and the actual character in
the input, so the only solution would be parsing the string and replacing any
characters which you need expressed as numeric entities with output-escaped
text.

Note that this will also convert occurances of the character with codepoint E2,
not just the numeric entities.

PS. No need to escape entities with extra spaces when posting to the newsgroup,
since the content type is text/plain the entities will not be resolved (at least
not by any reasonably standards compliant newsreader).

--
Klaus Johannes Rusch
KlausRusch@atmedia.net
http://www.atmedia.net/KlausRusch/


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles