Re: [xsl] mystery #3: rendering embedded HTML

Subject: Re: [xsl] mystery #3: rendering embedded HTML
From: Gary Lawrence Murphy <garym@xxxxxxxxxx>
Date: 14 Apr 2002 13:45:36 -0400
>>>>> "D" == David Carlisle <davidc@xxxxxxxxx> writes:

    >> <envelope>&lt;p&gt;My mal-formed HTML
    >> escaped.&lt;br&gt;</envelope>

    D> so you have an xslt processor that doesn't support
    D> dissable-output-encoding.  That's what happens with optional
    D> features.

I've replaced it with one that does, and discovered this is perhaps
not what I wanted anyway.  

The new error says the contents of that <envelope> is invalid:

  org.xml.sax.SAXException: Ill-formed XML document (multiple root
  elements detected)

which is true if value-of is parsing the string.  

This is what I meant earlier when I said that what I really wanted was
an "eval" function to resolve the entities back into the literal
chars: value-of/doe is doing this, but also parses the result, so
it only works if the markup is legal, and if the markup /was/ legal,
I wouldn't have needed to escape it in the first place ;)

I haven't actually tried this on the above 'envelope' example, but
this is the error I get from my posted example file when I d-o-e the
value-of select=//highlight -- value-of will fail because that element
contains valid HTML, but invalid XML.

When d-o-e is not enabled, the contents of that element is a single
text string.  When d-o-e is enabled, value-of is (probably correctly)
returning a node-set built from parsing the de-escaped element
contents.

Does this suggest that "value-of" is an inappropriate way to extract
markup-like strings from an element (because it parses what it reads)
and/or that d-o-e is an inapropriate way to "un-escape" an entity
escaped but otherwise literal string?  

Is 'x-www-form-urlencoding' at the source and display the only way to
do this?

-- 
Gary Lawrence Murphy <garym@xxxxxxxxxxx> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless.  They can only give you answers."(Pablo Picasso)


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


Current Thread