[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
xslt outputting 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.