This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Outputting XML to hidden HTML form fields
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] Outputting XML to hidden HTML form fields
- From: Lorenzo De Sio <l dot desio at w4b dot it>
- Date: Mon, 15 Jan 2001 18:16:45 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi,
I need to output a raw XML node to a hidden HTML form field.
The following code used to work on MSXML 1.0 :-) (whitespace/CR added for
clarity) :
<input type="hidden">
<xsl:attribute name="name">
_desc_<xsl:value-of select="id"/>
</xsl:attribute>
<!-- the above works fine. -->
<xsl:attribute name="value">
<xsl:copy>
<xsl:for-each select="*">
<xsl:copy>
<xsl:value-of select="."/>
</xsl:copy>
</xsl:for-each>
</xsl:copy>
</xsl:attribute>
</input>
The strange thing is that:
1) If you try to put the whole <xsl:copy> loop outside of the
<xsl:attribute> (before or after the </input>, no difference), everything
works fine.
2) As you put the copy loop in the <xsl:attribute> tag (like above), MSXML3
outputs nothing, while Xalan outputs the nodes' text only, with no tags.
Is this a known or designed behavior? Is there a solution on MSXML3 ?
Thanks in advance to anyone who can help,
L.
P.S.
XML source is:
<cart>
<item>
<id>70028</id>
<art>70028</art>
<desc>Article 70028</desc>
<price>4.8</price>
<qty>5</qty>
</item>
<item>
<id>70010</id>
<art>70010</art>
<desc>Article 70010</desc>
<price>17.6</price>
<qty>23</qty>
</item>
</cart>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list