[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
David Carlisle wrote:
Hi:
Thanks.
Re: [xsl] Adding element to xml snippet using xslt
Subject: Re: [xsl] Adding element to xml snippet using xslt From: Nishi Bhonsle <nishi.bhonsle@xxxxxxxxxx> Date: Thu, 24 Feb 2005 12:48:18 -0800 |
David Carlisle wrote:
I triedIt's the same error every time.
<xsl:template match="abc:configuration"> so here the current node is a configuration element
<xsl:for-each select="abc:configuration/started"> so this is iterating over the started children of the configuration element children of the current node, but the current node has no confguration children. so this is empty and nothing inside the for-each is executed.
You could make it
<xsl:for-each select="started">
but that will put thet text after the started element not inside it as you have already copied the element. so you need to get rid of the xsl:copy and instead have
<xsl:for-each select="started"> <started>This application was stopped by administrator.</started> </xsl:for-each>
Hi:
In this case, if I get rid of the copy, then the 'status' attribute of the 'started' element is not copied. I would like to copy the 'started' element with 'status' attribute from the source doc and then add text to it. as in the following <started status="true">This application was stopped by administrator.</started>
Thanks.
although I am not sure that the for-each is really doing much here, it means you get as many started elements in the result (behaps 0) as there are in the input, each of teh ones in the result getting the same text, if that's what yoy want then fine, but if you always just want one started element with this text get rid of the for-each and just have
<started>This application was stopped by administrator.</started>
<xsl:apply-templates> </xsl:template>
David
________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Adding element to xml sni, David Carlisle | Thread | Re: [xsl] Adding element to xml sni, David Carlisle |
Re: [xsl] Adding element to xml sni, David Carlisle | Date | Re: [xsl] Using attributes and elem, Wendell Piez |
Month |