XSLT: Disable output escaping in an entire document.
        Posted  
        
            by Kragen
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Kragen
        
        
        
        Published on 2010-05-07T12:16:03Z
        Indexed on 
            2010/05/07
            12:18 UTC
        
        
        Read the original article
        Hit count: 421
        
code-generation
|xslt
I'm trying to generate some C# code using xslt - its working great until I get to generics and need to output some text like this:
MyClass<Type>
In this case I've found that the only way to emit this is to do the following:
MyClass<xsl:text disable-output-escaping="yes"><</xsl:text>Type<xsl:text disable-output-escaping="yes">></xsl:text>
Where:
- Often it all needs to go on one line, otherwise you end up with line breaks in the generated code
- In the above example I technically could have used only 1 <xsl:text />, however usually the typeTypeis given by some other template, e.g:
<xsl:value-of select="@type" />
I don't mind having to write < a lot, but I would like to avoid writing <xsl:text disable-output-escaping="yes"><</xsl:text> for just a single character! 
Is there any way of doing disable-output-escaping="yes" for the entire document?
© Stack Overflow or respective owner