RE: [xsl] Output XML doc with XSL doc name in comment

Subject: RE: [xsl] Output XML doc with XSL doc name in comment
From: Mike Ferrando <mikeferrando@xxxxxxxxx>
Date: Wed, 8 May 2002 08:19:36 -0700 (PDT)
Dear T. Schutzer W. and Michael Kay,
After looking over your suggestions (I don't have the latest version
of Saxon so that means [aka Tom W.] I can't really do it properly) I
devised a little cheat way of doing it.

My clip in Note Tab Pro that runs Saxon repeats the xsl file name for
the bat file as such:

clip:
^!dos c:\workshop\batch\sax.bat ^%directory% ^%htmlfile%  ^%xmlfile%
^%xslfile% "replace=^%xslname%"

Bat:
c:\workshop\saxoninstant\saxon.exe -w0 -o  ..\%1\%2 ..\%1\%3
..\shared\styles\%4  %5
pause

XSL:
<xsl:param name="replace"/>
<xsl:template match="/">
<xsl:comment>
	<xsl:value-of select="concat(' Transformed with ', $replace, '.xsl
')"/>
</xsl:comment>
	<LLL>
		<xsl:apply-templates select="//*"/>
	</LLL>
</xsl:template>

Output:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!--Transformed with Mytools26.xsl-->

This is cheating of course.

Thanks,
Mike Ferrando
Washington, DC


--- TSchutzerWeissmann@xxxxxxxxxxxxxxxx wrote:
> Mike Ferrando wrote:
> 
> Dear Friends,
> I am attempting to output the xsl document in a comment field when
> I
> generate the new xml document.
> 
> I am not getting anywhere.
> 
> Anyone have a suggestion?
> 
> Sincerely,
> Mike F.
> [...]
> <xsl:template match="/">
>   <xsl:comment>
>     <xsl:variable name="rr" select="document('')"/>
>     <xsl:value-of select="concat('xyz', $rr)"/>
>   </xsl:comment>
>   <LLL>
>    <xsl:apply-templates select="//*"/>
>   </LLL>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> --------------------------------------------------------
> Hello Mike,
> 
> xsl:value-of will give you the text nodes in your xsl - that's
> unlikely to
> be very much. To copy of the whole lot, one would use <xsl:copy-of
> select="document('')"/>, but inside a comment this does even less.
> So it
> looks like you can only put text inside comments.
> 
> In that case you will need something that turns xml into text. You
> could do
> this with templates, I've included an example below.
> 
> There's no template for processing instructions, and I can't work
> out how to
> include the namespace declarations, which is a problem, as is the
> fact that
> the &lt; and &gt; in the stylesheet come out as < and >. 
> 
> Hope this is some use, 
> Tom Weissmann


__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread