This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Attributes and entity references



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

as you'd expect.

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

  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.

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]