W3C home > Mailing lists > Public > xsl-editors@w3.org > April to June 2002

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

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Wed, 17 Apr 2002 19:41:25 +0200
Message-ID: <DFF2AC9E3583D511A21F0008C7E6210602679D3D@daemsg02.software-ag.de>
To: "'Benoit Segaert'" <benoit.segaert@uniway.be>, xsl-editors@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:53 GMT