[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Adding element to xml snippet using xslt

Subject: Re: Adding element to xml snippet using xslt
From: Nishi Bhonsle <nishi.bhonsle@xxxxxxxxxx>
Date: Thu, 24 Feb 2005 12:48:18 -0800
xslt add node
David Carlisle wrote:

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>
</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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.