Subject: Re: [xsl] Outputting XML to hidden HTML form fields From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 15 Jan 2001 17:55:27 GMT |
> I need to output a raw XML node to a hidden HTML form field. There are two things to note here. Firstly in the XPath tree model of an XML document (and most other models) Attributes do not contain element nodes, only text. Also in the linearisation of an XML file in XML syntax, an attribute value may not contain an unescaped < you have to use <. <input type="hidden"> <xsl:attribute name="name"> _desc_<xsl:value-of select="id"/> </xsl:attribute> <!-- the above works fine. --> The above is OK, but could more easily have been written <input type="hidden" name="_desc_{id}"> (assuming you didn't really want the white space before _desc_) <xsl:attribute name="value"> <xsl:copy> You haven't shown your full template so I don't know for sure what is the current node at this point, but probably it's the item node. copying any element node into an attribute value is not going to work for the reasons above. What I think you want is <xsl:attribute name="value"> <xsl:text><item></xsl:text> <xsl:for-each select="*"> <xsl:text><</xsl:text> <xsl:value-of select="name(.)"/> <xsl:text>></xsl:text> <xsl:value-of select="."/> <xsl:text></</xsl:text> <xsl:value-of select="name(.)"/> <xsl:text>></xsl:text> </xsl:for-each> <xsl:text></item></xsl:text> </xsl:attribute> David _____________________________________________________________________ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Control Centre. For further information visit http://www.star.net.uk/stats.asp XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Outputting XML to hidden , Paul Brown | Thread | [xsl] the nearest ancestor with the, guai ya |
RE: [xsl] Outputting XML to hidden , Paul Brown | Date | Re: [xsl] Presentation vs content., Tangi Vass |
Month |