This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Attributes and entity references
- To: xsl-list at mulberrytech dot com
- Subject: Re: Attributes and entity references
- From: David Carlisle <davidc at nag dot co dot uk>
- Date: Wed, 8 Nov 2000 15:49:27 GMT
- References: <3A0972ED.32119CB5@mch20.sbs.de>
- Reply-To: xsl-list at mulberrytech dot com
> How can I generate an entity reference as value of
> an output attribute?
You can't, in general, basically because entity references don't exist
in the xpath tree model of an XML document.
1.)
XSLT: <elt attr="&MR;"/>
the output is <elt attr="&MR;" />
as you'd expect.
2.) XSLT:
<elt>
<xsl:attribute name="attr">
<xsl:text disable-output-escaping="yes">&MR;</xsl:text>
</xsl:attribute>
</elt>
the output is <elt attr="&MR;" />
disable-output encoding is
a) evil and
b) only a hint that the processor is explictly allowed to ignore.
The first question is why do you need to the entity reference in the
output (as opposed to just putting the value of the MR entity there).
If you do need to do that, then if disable-output-escaping doesn't work
for you then there is always the option of outputting [entity-ref]MR;
and then applying
sed -e "s/[entity-ref]/&/g"
to your output.
David
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list