[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Outputting XML to hidden HTML form fields
> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|