Subject: RE: Is there a way to translate entities into their character equivalents? From: "Evan Lenz" <elenz@xxxxxxxxxxx> Date: Thu, 17 Aug 2000 10:38:57 -0700 |
The following may do the job, assuming your XSLT processor supports it: <xsl:if test="blahblahblah"> <xsl:text disable-output-escaping="yes"><a href="go away"></xsl:text> </xsl:if> <xsl:apply-templates/> <xsl:text disable-output-escaping="yes"></a></xsl:text> But I would strongly encourage you not to use this, as it basically breaks the XSLT model. You won't be able to subsequently transform the result tree, unless you first serialized it into a string and then parsed it again. There are only a few cases where the stylesheet may go outside its true domain of transforming trees, and this is one of them, but it is generally not needed. There have been many times when I thought I needed to use disable-output-escaping, but almost every time I discovered that I didn't need to use this hack. On pages 301-302, Kay points out a couple instances where you might need to use it. If your output is not XML or HTML, for example, you may wish to use it (although <xsl:output method="text"/> should do that job too, I would think). Or if you're trying to generate the literal "<" for a JavaScript snippet or for the "<%" delimiter for ASP or JSP, it could be handy. Otherwise, there should be a way to do what you want and still stay within the model of transforming trees. If you post a more detailed description of what you're trying to do, or at least explain why you think you need to output unescaped angle brackets, I'll see if I can't defend my claim. Hope this helps, Evan Lenz elenz@xxxxxxxxxxx http://www.xyzfind.com -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Steve Carton Sent: Thursday, August 17, 2000 8:51 AM To: XSL mailing-list Subject: Is there a way to translate entities into their character equivalents? I'd like to cheat in my style sheet and do something like this: <xsl:if test="blahblahblah"><a href="go away"></xsl:if> <xsl:apply-templates/> </a> My real world case is much more complex, but is there a way to have the HTML generated for this contain the <> symbols instead of the entities? XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Is there a way to translate entitie, Steve Carton | Thread | RE: Is there a way to translate ent, Chris Bayes |
Re: Hiding the XSL ?, G. Ken Holman | Date | RE: Generate Hierarchical Tree from, Ben Robb |
Month |