Subject: RE: [xsl] Adding HTML Data Into XSL File From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Wed, 3 Jul 2002 15:24:30 +0100 |
> I have been directed to add a <img src="/somepathtoanimage"> > to the xsl. But the path needs to be dynamic (coming from a > servlet parameter). So I created a <xsl:param name="image" > select="'/defaultpath'" /> And when I do the transform, I try > and put in a valid generated path, but it does not work. When > I source the page, the browser shows the following: > > </table><img src="/somepaththat/isvalid/a.gif"></form> > > So it prints the above to the screen and not <img > src="/somepaththat/isvalid/a.gif"> which would show the a.gif. > > Any ideas how to get around this? > You are passing in a string that contains markup. The XSLT processor doesn't know that you want the "<" and ">" characters treated as markup, so it escapes them. There are two solutions. (a) pass in a parsed XML document (e.g. a DOM) instead of a string. (b) tell Xalan not to escape the special characters in the string by using disable-output-escaping. We usually discourage disable-output-escaping on this list, because it can be greatly abused, but this is exactly the situation it is useful for, when you want to include unparsed HTML directly into your serialized output. Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Adding HTML Data Into XSL Fil, Scott Purcell | Thread | Re: [xsl] Adding HTML Data Into XSL, Wendell Piez |
RE: [xsl] encoding issues, Michael Kay | Date | Re: [xsl] Grouping and filtering, Steve Muench |
Month |