Copy node and sub-node in HTML hidden field

I need to copy a XHTML node and subnode in an attribute.
EX:
    <tag>
        <p>example</p>
    </tag>


If I want to copy
    <p>example</p>
in an attribute, I receive an error from my XSLT parser:
    Cannot write an attribute when there is no open start tag.

I have try the following codes:
    <xsl:template match="tag">
        <xsl:variable name = "content" ><xsl:copy-of
select="node()|@*"/></xsl:variable>
        <input type="hidden" value="{$content}"/>
    </xsl:template>

or
    <xsl:template match="tag">
         <xsl:element name="input">
              <xsl:attribute name="type">hidden</xsl:attribute>
              <xsl:attribute name="name"><xsl:value-of
select="$id"/>_hidden</xsl:attribute>
              <xsl:attribute name="value"><xsl:copy-of
select="node()|@*"/></xsl:attribute>
         </xsl:element>
    </xsl:template>

But if I put the content in a textarea, I have any problem:

 <TEXTAREA  rows="{$lineNumber}" name="{$id}" style="width: 100%">
      <xsl:copy-of select="node()|@*"/>
 </TEXTAREA>

Can you help me?
Benoit

Received on Wednesday, 17 April 2002 11:36:33 UTC