You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Caleb Blanton <Ca...@trx.com> on 2001/08/31 01:15:18 UTC

Disable-output-escaping Question

I hear that this is the place to ask about disable-output-escaping in XSL.
If I am correct, I would like to ask a minute of your time to help me with a
problem I'm trying to solve.

I'm currently porting our product and I am forced to use a new
implementation of XML parsing/transforming.  In this implementation, they
have documented that the new parser does *not* support the
disable-output-escaping attribute.  I use this tag quite often; to create
non-breaking spaces, to start HTML tags without finishing them so the parser
doesn't blow up, etc.  Is there a different and/or better way to do this?
An example of what I'm doing now is this; every page includes a global.xsl
that has a HEADERBUILD template in it - this template does alot, but
essentially it starts the <html> tag, while the FOOTERBUILD template is
responsible for ending that tag.  So, from a bird's-eye level, the code
looks a little like this:

	<xsl:template name="HEADERBUILD>
		<xsl:text disable-output-escaping="yes">
			&lt;html&gt;
		</xsl:text>
	</xsl:template>

	<xsl:template name="FOOTERBUILD">
		<xsl:text disable-output-escaping="yes">
			&lt;/html&gt;
		</xsl:text>		
	</xsl:template>

This used to build the <html> tag with it's respective closing </html> tag
just fine with the old parser.  Now it just transforms into "&lt;html&gt;"
and "&lt;/html&gt;" as the output.  If you know of a way to accomplish this
without disable-output-escaping, please enlighten me!  I've been searching
all over the internet for an answer but cannot find one..

Thanks!
Caleb Blanton

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: Disable-output-escaping Question

Posted by Jörg Heinicke <jh...@virbus.de>.
Sorry, but your "way of thinking" is completely wrong. You must change your 
code, you don't need such things like &lt;htmlgt; !!!

For example:

XML:

<page>
   <title>Test</title>
   <text>test test test test</text>
   <text>test2 test2 test2 test2</text>
   <image src="image.jpg"/>
</page>

XSL:

<xsl:stylesheet ....>
<xsl:output method="html"/>

<xsl:template match="page">
   <html>
     <head><title><xsl:value-of select="title/></title></head>
     <body>
       <xsl:apply-templates/>
     </body>
   </html>
</xsl:template>

<xsl:template match="text">
   <p><xsl:value-of select="."/></p>
</xsl:template>

<xsl:template match="image">
   <img src="{@src}"/>
</xsl:template>

</xsl:stylesheet>

For building your HTML in your way, you don't need XSL, there would be 
easier ways. But with using XSL in the "correct" way, you get a powerful 
technology! I hope I could set you thinking about it. If you want more help 
or information about XSL, ask a XSL-list like

http://www.mulberrytech.com/xsl/xsl-list/

or

http://groups.yahoo.com/group/XSLTalk

or read such a tutorial like Norman Walsh's

http://www.nwalsh.com/docs/tutorials/xsl/xsl/slides.html

Hope this helps,

Joerg


Caleb Blanton wrote:
> I hear that this is the place to ask about disable-output-escaping in XSL.
> If I am correct, I would like to ask a minute of your time to help me with a
> problem I'm trying to solve.
> 
> I'm currently porting our product and I am forced to use a new
> implementation of XML parsing/transforming.  In this implementation, they
> have documented that the new parser does *not* support the
> disable-output-escaping attribute.  I use this tag quite often; to create
> non-breaking spaces, to start HTML tags without finishing them so the parser
> doesn't blow up, etc.  Is there a different and/or better way to do this?
> An example of what I'm doing now is this; every page includes a global.xsl
> that has a HEADERBUILD template in it - this template does alot, but
> essentially it starts the <html> tag, while the FOOTERBUILD template is
> responsible for ending that tag.  So, from a bird's-eye level, the code
> looks a little like this:
> 
> 	<xsl:template name="HEADERBUILD>
> 		<xsl:text disable-output-escaping="yes">
> 			&lt;html&gt;
> 		</xsl:text>
> 	</xsl:template>
> 
> 	<xsl:template name="FOOTERBUILD">
> 		<xsl:text disable-output-escaping="yes">
> 			&lt;/html&gt;
> 		</xsl:text>		
> 	</xsl:template>
> 
> This used to build the <html> tag with it's respective closing </html> tag
> just fine with the old parser.  Now it just transforms into "&lt;html&gt;"
> and "&lt;/html&gt;" as the output.  If you know of a way to accomplish this
> without disable-output-escaping, please enlighten me!  I've been searching
> all over the internet for an answer but cannot find one..
> 
> Thanks!
> Caleb Blanton


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>