[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] insert subnodes?
Subject: RE: [xsl] insert subnodes? From: Américo Albuquerque <melinor@xxxxxxx> Date: Sat, 5 Jul 2003 23:15:15 +0100 |
Hi > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of > Martin Klaffenboeck > Sent: Saturday, July 05, 2003 7:33 PM > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] insert subnodes? > > > Hello, > > I have a xml file like: > > <formular name="register"> > <field type="text" name="user" size="8">User</field> > <field type="password" name="password" size="8">Password</field> > <submit>Register</submit> > </formular> > > Now I want to insert the following xml thing: > > <error> > <head>You had the following errors:</head> > <msg>Your username is to short (min. 4 characters).</msg> > <msg>Your password is to short (min. 4 characters).</msg> </error> > > > So that it looks like: > > <formular name="register"> > <error> > <head>You had the following errors:</head> > <msg>Your username is to short (min. 4 characters).</msg> > <msg>Your password is to short (min. 4 characters).</msg> > </error> > <field type="text" name="user" size="8">User</field> > <field type="password" name="password" size="8">Password</field> > <submit>Register</submit> > </formular> > The only thing you need is to write them there :) > > Ok, I have made the examle simple, there are many things in my xml > file.. > > I could use > > <xsl:template match="formular[@name='register']" <xsl:copy> <xsl:copy-of select="@*"/> <error> <head>You had the following errors:</head> <msg>Your username is to short (min. 4 characters).</msg> <msg>Your password is to short (min. 4 characters).</msg> </error> <xsl:copy-of select="*"/> </xsl:copy> > </xsl:template> > (...) Check the specs (http://www.w3.org/TR/xslt#section-Creating-the-Result-Tree) for more info on creating new elements and/or copying existing ones. Hope this helps. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] insert subnodes?, Martin Klaffenboeck | Thread | [xsl] Passing document fragments as, Simon Kelly |
Re: [xsl] [OT] Javascript help, Wendell Piez | Date | RE: Is XML a Language? (was RE: [xs, Michael Kay |
Month |
Keywords