This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Outputting XML to hidden HTML form fields


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]