This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: template output as text
- To: xsl-list at mulberrytech dot com
- Subject: Re: template output as text
- From: Oliver Becker <obecker at informatik dot hu-berlin dot de>
- Date: Thu, 7 Sep 2000 12:28:20 +0200 (MET DST)
- Reply-To: xsl-list at mulberrytech dot com
> <xsl:template match="/">
> <table><tr><td>
> <xsl:call-template name="example"/>
> </td><td>
> <xsl:call-template name="example"/>
> </td></tr></table>
> </xsl:template>
>
> The template "example" generates HTML tags. In the first column, I need to
> print the outcome of the template "example" as a source code
> (un-interpeted). While, I want it to be interpeted in the second column. How
> can I do that?
You want to process the outcome of a template, i.e. you want to process
a "result tree fragment". With XSLT 1.0 this is not possible.
However - most processors offers a node-set extension function.
A possible approach would be
<xsl:template match="/">
<table><tr><td>
<xsl:variable name="outcome">
<xsl:call-template name="example"/>
</xsl:variable>
<xsl:apply-templates select="xxx:node-set($outcome)" mode="verbatim" />
</td><td>
<xsl:call-template name="example"/>
</td></tr></table>
</xsl:template>
Where xxx must be bound to a processor specific namespace.
Displaying the generated HTML uninterpreted has to be done step by step
in XSLT (with templates in mode "verbatim"). I think there are examples
in the archives or the XSL FAQ.
If you want a more sophisticated solution, look at the implementation
of my xmlverbatim formatter:
http://www.informatik.hu-berlin.de/~obecker/XSLT/xmlverbatim/xmlverbatim.xsl
Hope that helps,
Oliver
/-------------------------------------------------------------------\
| ob|do Dipl.Inf. Oliver Becker |
| --+-- E-Mail: obecker@informatik.hu-berlin.de |
| op|qo WWW: http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list