RE: [xsl] placing XML inside node attribute

Subject: RE: [xsl] placing XML inside node attribute
From: "Ben Robb" <Ben@xxxxxxxxxx>
Date: Tue, 19 Nov 2002 17:01:26 -0000
I'm afraid that this is invalid XML; you cannot put the < character
within an attribute.

-----Original Message-----
From: lpmlabs9@xxxxxxxxxxxx [mailto:lpmlabs9@xxxxxxxxxxxx] 
Sent: 19 November 2002 16:48
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] placing XML inside node attribute


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


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


Current Thread