Re: Attributes and entity references

Subject: Re: Attributes and entity references
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 8 Nov 2000 15:49:27 GMT
> 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.

    XSLT: <elt attr="&amp;MR;"/>
    the output is <elt attr="&amp;MR;" />

as you'd expect.

 2.) XSLT:
 <xsl:attribute name="attr">
  <xsl:text disable-output-escaping="yes">&amp;MR;</xsl:text>

  the output is  <elt attr="&amp;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.


This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit

 XSL-List info and archive:

Current Thread