Re: [xsl] Adding element to xml snippet using xslt

Subject: Re: [xsl] Adding element to xml snippet using xslt
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 24 Feb 2005 20:32:55 GMT
> I tried
It'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>

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>


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:

Current Thread