[xsl] placing XML inside node attribute

Subject: [xsl] placing XML inside node attribute
From: lpmlabs9@xxxxxxxxxxxx
Date: Tue, 19 Nov 2002 11:47:32 -0500
I'm trying to place XML into the attribute of a tag as follows:

xml
<stock><ticker>ibm</ticker><high>100</high><low>95</low></ticker></stock>

desired result
<object code="tickerplot.class">
<param name="xml" value="<stock><ticker>ibm</ticker><high>100</high><low>95</low></ticker></stock>"/>
</object>

Here is my version of xsl:copy that works for the above case.  Is there a better solution?
  <xsl:template match="*" mode="xslcopy">
    <<xsl:value-of select="name()"/>
    <xsl:text> </xsl:text>
      <xsl:for-each select="@*">
        <xsl:value-of select="name()"/>='<xsl:value-of select="."/>'
      </xsl:for-each>
      >
      <xsl:if test="count(child::node()) < 2">
        <xsl:value-of select="."/>
      </xsl:if>
      <xsl:apply-templates select="*" mode="xslcopy"/>
    </<xsl:value-of select="name()"/>>
  </xsl:template>

TIA,
Larry Mason

__________________________________________________________________
The NEW Netscape 7.0 browser is now available. Upgrade now! http://channels.netscape.com/ns/browsers/download.jsp 

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

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


Current Thread