Hi.
We use d-o-e extensively for the use case Michael describes, namely we
format the last stage of output from a Gordian publishing system. The XML
instance that gets built for us quite often contains text nodes that
consist of escaped HTML blobs.
We also use it for two other less common cases. One is where because of
some browser vagary we want to generate and output HTML that's not valid
XHTML. We can't embed it in the XSL because it would cause the XSL file
to be ill-formed. Neither can we use xsl:element to construct it.
The last use case is where we do (or could) have a well formed output doc
but because of the way it is constructed the XSL becomes badly formed.
Most obviously this occurs where the start and end tag are generated in
different xsl:templates. I've had good luck getting rid of most of these
so I don't have an example on hand but I'm not quite willing to rule it
out as logically impossible.
I think in all cases character maps can replace d-oe but I had some
questions about the approach you outline below:
On Fri, 11 Mar 2005 10:18:54 GMT, David Carlisle
<davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:
In 2.0 you can always replace this by
<xsl:value-of select="'<br>'"/>
<xsl:value-of
select="translate('<br>','<>&',''"/>
I read this (with the addition of the closing parenthesis) as replacing
less than greater than and ampersand with three unfamiliar character
entities.
Together with a character mao that maps back:
<xsl:output-character character=" string="<"/>
<xsl:output-character character=" string=">"/>
<xsl:output-character character=" string="&"/>
I read this as defining instructions for the serializer to replace the
unfamiliar charcters above with the appropriate output characters (<> and
& in final output).
The way I read the w3c spec, it looked like you'd have to enclose those
three output-character definitions in a named character map and make the
serializer aware of that map by specifying the name in the
use-character-map attribute of xsl:output. Did you assume that or am I
missing something?
Overall I think this is really neat. For the first case (escaped html in
input) we run the translate you provide above on the node. For the second
two, we simply use  in place of < as needed. Is this correct?
Thanks in advance!
----------->Nathan
This works the same way except that now the information is stored in the
result tree using a mechanism that is actually allowed by the
specification of the datamodel (just three otherwise unused characters).
Of course the other problems with d-o-e remain, that this still only
works if serialisation is tightly controlled by the XSLT engine and that
in nine times out of ten it is only being used by mistake, when the
stylesheet could have gone
<br/>
and used an element node directly.
David
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--
.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:.
Nathan Young
A: ncy1717
E: natyoung(_at_)cisco(_dot_)com
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--