Re: Emulating <xsl:copy-of> with MSXML (was : Passing parameters to X SL...)

Subject: Re: Emulating <xsl:copy-of> with MSXML (was : Passing parameters to X SL...)
From: Bill Martschenko <billmartschenko@xxxxxxxxx>
Date: Wed, 29 Sep 1999 13:15:01 -0700 (PDT)

How about the following for IE5? 

Different approach, but I do produce the following output.  I think that was your goal.

<xsl:stylesheet xmlns="http://www.w3.org/TR/WD-xsl">
blah blah
</xsl:stylesheet>

Here is the XML.

<?xml-stylesheet type="text/xsl" href="" ?>
<Template>
    <Parameter></Parameter>
</Template>

Here is the XSL.  The key part is using xsl:entity-ref.

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">

<xsl:template match="/">
     <xsl:apply-templates />
</xsl:template>

<xsl:template match="Template">
     <xsl:entity-ref name="lt"/>xsl:stylesheet xmlns=<xsl:entity-ref name="quot"/>http://www.w3.org/TR/WD-xsl<xsl:entity-ref name="quot"/><xsl:entity-ref name="gt"/>
     <br/>
     <xsl:apply-templates />
     <br/>
     <xsl:entity-ref name="lt"/>/xsl:stylesheet<xsl:entity-ref name="gt"/>
</xsl:template>

<xsl:template match="Parameter">
     blah blah
    <xsl:apply-templates/>
</xsl:template>

</xsl:stylesheet>

Bill

 

BOUCHET_Sébastien <sebastien.bouchet@xxxxxxx> wrote:

Chuck white wrote :
>Valid MS XSL elements are:
>xsl:stylesheet, xsl:attribute,  xsl:choose, xsl:comment, xsl:copy, xsl:element, xsl:for-each,  >xsl:if, xsl:eval,  xsl:otherwise,  xsl:pi (xsl:processing-instruction in current draft),  xsl:script  >(for global variables and extensions),  xsl:stylesheet, xsl:template,  xsl:value-of, xsl:when

Aargh, it means that <xsl:copy-of> is not supported ! What I'm trying to do is something like XSL code generation (workaround for the absence of support of <xsl:param>... :

<Template><![CDATA[<xsl:stylesheet><xsl:template match="]]><Parameter/><!CDATA[[<xsl...]]></Template>

is transformed with something like :

<xsl:template match="text()"><xsl:copy-of select="."/></xsl:template>
<xsl:template match="Parameter">My value<xsl:apply-templates/></xsl:template>

which, I thought, would output :
<xsl:stylesheet xmlns="...">... blah ...</xsl:stylesheet> that I could re-feed the processor with.

Actually, it works BUT escapes the "<,>" and what I feed the processor with is then :
&lt;xsl:stylesheet&gt; ... Which of course is not understood

This is apparently the right beahviour (see the XSL specs : xsl:value-of converts to strings). Therefore xsl:copy-of would fulfill my needs, but it is not implemented in MSXML.

I tried using <xsl:copy> instead of <xsl:value-of> but then the <![CDATA[ and ]]> are not stripped.

Has anyone got any ideas ?

Cheers,

Sebastien



Do You Yahoo!?
Bid and sell for free at Yahoo! Auctions.
Current Thread