RE: Copy node and sub-node in HTML hidden field

Sorry, this list is for comments on the XSLT and XSL-FO specifications, it
is not for providing programming help. The place for that is the xsl-list at
www.mulberrytech.com, where you can usually get helpful answers.

Michael Kay

> -----Original Message-----
> From: Benoit Segaert [mailto:benoit.segaert@uniway.be]
> Sent: 17 April 2002 16:36
> To: xsl-editors@w3.org
> Subject: 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 13:41:31 UTC