<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2655.72">
<TITLE>XSL question</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2 FACE="Arial">OK, I don't think this is really possible but I wanted to toss it out just in case I'm wrong.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Does anybody know if you can, in a single stylesheet, take the results of a template (named) and pipe that template's output into another template?</FONT></P>

<P><FONT SIZE=2 FACE="Arial">I want to run an XSLT file against other XSLT files and extract information from them. I also want to separate the processing from the display, so in effect I want a pre-processor that extracts the information, and then another processor which applies the format.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Something like this is what I'm looking for:</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">&lt;xsl:template name=&quot;preprocess&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">&lt;xsl:for-each select=&quot;/&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">&lt;doc&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">&lt;foo&gt;&lt;xsl:value-of select=&quot;/xsl:stylesheet/foo&quot;/&gt;&lt;/foo&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">&lt;bar&gt;&lt;xsl:value-of select=&quot;/xsl:stylesheet/bar&quot;/&gt;&lt;/bar&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">&lt;/xsl:for-each&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">&lt;/xsl:template&gt;</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">&lt;xsl:template name=&quot;display&quot;&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">&lt;p&gt;&lt;var&gt;Foo&lt;/var&gt; = &lt;xsl:value-of select=&quot;/doc/foo&quot;/&gt;&lt;/p&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">&lt;p&gt;&lt;var&gt;Bar&lt;/bar&gt; = &lt;xsl:value-of select=&quot;/doc/bar&quot;/&gt;&lt;/p&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">&lt;/xsl:template&gt;</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">What I'm missing is the way to tie the &quot;preprocess&quot; template's results into the &quot;display&quot; template's input. I don't think you can do that, because I believe the XSL functions such that each template writes to a single output stream. Would be nice if you could control that somehow though...</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Basically this is reflection on a stylesheet. If I have to break the two up into separate stylesheets and &lt;xsl:import&gt; the pre-processor in, that's fine, but I really (really really really) want to keep the actual transformation contained so I can look at an XSL file in Internet Explorer and it will do the transform for me automatically. If I have to write any code to do this, it really defeats the purpose of this whole approach.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Maybe there's a better way to do this?</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Thanks!</FONT>
<BR><FONT SIZE=2 FACE="Arial">-dave</FONT>
</P>

</BODY>
</HTML>