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: Printing out variables with escaped text.


At 00/04/13 15:22 +1200, Warren Hedley wrote:
>I'm having a problem printing out variables that contain text
>declared with disable-output-escaping="yes" (and yes, I'm doing
>dodgy stuff, trying to create start and end tags where I
>shouldn't, before anyone tells me I shouldn't be doing this.)
>
>Consider the following stylesheet - it surprised me that this
>didn't work.

According to 16.4, "It is an error for output escaping to be disabled for a 
text node that is used for something other than a text node in the result 
tree. " ... and it doesn't say that this particular error reporting is 
optional, thus, the processor should have not allowed the text node with 
the attribute to be used in the variable assignment and reported an error.

To do what you ask with a variable, use the following:

   <xsl:variable name="bob">
     <xsl:text>&lt;fake_element_no_escaping&gt;
     </xsl:text>
   </xsl:variable>
   <xsl:value-of select="$bob" disable-output-escaping="yes"/>

I hope this helps.

.................. Ken

--
G. Ken Holman                    mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.             http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999   (Fax:-0995)
Web site: XSL/XML/DSSSL/SGML services, training, libraries, products.
Practical Transformation Using XSLT and XPath      ISBN 1-894049-04-7
Next instructor-led training:    2000-05-02,2000-05-11/12,2000-05-15,
-                                    2000-06-12,2000-06-13,2001-01-27


 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]