aspose file tools*
The moose likes XML and Related Technologies and the fly likes xslt -- disable-output-escaping= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xslt -- disable-output-escaping="yes" question" Watch "xslt -- disable-output-escaping="yes" question" New topic
Author

xslt -- disable-output-escaping="yes" question

Veronica Damian
Ranch Hand

Joined: Feb 04, 2006
Posts: 61
I need to know all <xsl:...> elements where it's ok to put
disable-output-escaping="yes".. found out this morning can put it inside <xsl:value-of select....> but where else?

and converesely, would like to know all stuff that can be put inside <xsl:text>...</xsl:text>
because if I do <xsl:text disable-output-escaping="yes">and try to put other stuff in there like,

<xsl:call-template name="str-replace">
<xsl:with-param name="input" select="/Presentation/@DisclaimerText"/>
<xsl:with-param name="search-string" select='$NEWLINE'/>
<xsl:with-param name="replace-string" select="<br/>" />
</xsl:call-template>
</xsl:text>

it doesn't work

I need to replace whitespace that is a linebreak with '<br>' but also need to escape the "<" and ">" how do I do this pls... tried:

<xsl:call-template name="str-replace" disable-output-escaping="yes"/>

and

<xsl:with-param name="replace-string" select="<br/>" disable-output-escaping="yes"/>

but neither one worked.. (when I say didn't work I mean get errors when doing the transformation)

this char-escaping-thing is proving to be most complicated thing for me in xslt..

thank you very much...

-v
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18643
    
    8

It only makes sense to have a disable-output-escaping attribute on elements that are actually doing output of text. As far as I can see that's only xsl:value-of and xsl:text, but I would encourage you to look at one of the many sites on the Internet that provide XSLT tutorials and XSLT documentation, if you want to look through all of the xsl: elements.

If you are saying thatcauses errors, that's because you didn't escape the < and > characters in the "select" attribute correctly. You have to write this instead:Then, your best bet is to have some code like this:(Edited to disable output escaping in examples of how to escape < and >)
[ April 12, 2006: Message edited by: Paul Clapham ]
Dave Lenton
Ranch Hand

Joined: Jan 20, 2005
Posts: 1241
This PDF has a list of when it is possible to use it:

http://www.mulberrytech.com/quickref/XSLT_1quickref-v2.pdf

I have it print out of this on my desk, and its probably worth its weight in gold - you won't find a higher concentration of useful XSL stuff on two sheets of paper!
[ April 13, 2006: Message edited by: Dave Lenton ]

There will be glitches in my transition from being a saloon bar sage to a world statesman. - Tony Banks
Veronica Damian
Ranch Hand

Joined: Feb 04, 2006
Posts: 61
thank you very much... (yes I had made mistake when printed <br> in my post, of course I meant

<xsl:with-param name="replace-string" select="<br/>"/>

so now have:

<xsl:variable name="replaced">
<xsl:call-template name="str-replace">
<xsl:with-param name="input" select="/Presentation/@DisclaimerText"/>
<xsl:with-param name="search-string" select='$NEWLINE'/>
<xsl:with-param name="replace-string" select="<br/>"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$replaced" disable-output-escaping="yes"/>

however, now I get following error:

Error occurred while compiling stylesheet '<fileName>.xslt'.

Code: 0x80004005
Expression expected.

--><<--br/>

I can't find this string (or even just "--br" in xslt or xml.. compiler does not say on what line error occurs, this is a bit of a pain.. I know issue about which I posted my orig post is causing this, b/c if for testing purposes I do

<xsl:with-param name="replace-string" select="aaa"/>

instead of

<xsl:with-param name="replace-string" select="<br/>"/>

don't get error anymore.. would appreciate any suggestions.. thank you very much..

(thank you very much Dave, for that PDF...)

-v
Veronica Damian
Ranch Hand

Joined: Feb 04, 2006
Posts: 61
Originally posted by Veronica Damian:
[QB]thank you very much... (yes I had made mistake when printed <br> in my post, of course I meant

<xsl:with-param name="replace-string" select="<br/>"/>

my gosh I see what happens here.. this prints wrong in this mesasge...
meant:

<xsl:with-param name="replace-string" select="& l t ; br / & g t ; "/>

(I thought it was weird, I knew I had copied it ok..)

ok, you get my drift.... I hope.. thanks again..

-v
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: xslt -- disable-output-escaping="yes" question