473,796 Members | 2,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

loop thru collection and add "innerText" to nodes via XsltArgumentLis t

hiya,
I add new nodes to an xmlDoc.
I want to add "innerText" to every newly-created node.

current XML file
<code>
<rows>
<row>
<PRODUCT-TYPE>bike</PRODUCT-TYPE>
<PRODUCT-DATE>01/01/2004</PRODUCT-DATE>
<ADDED-NODE />
</row>
<PRODUCT-TYPE>Car</PRODUCT-TYPE>
<PRODUCT-DATE>01/01/2003</PRODUCT-DATE>
<ADDED-NODE />
</row>
</rows>
</code>

Ideally, after a successful transform, the XML file should be:
<code>
<rows>
<row>
<PRODUCT-TYPE>bike</PRODUCT-TYPE>
<PRODUCT-DATE>01/01/2004</PRODUCT-DATE>
<ADDED-NODE>1stCollect ionItemText<ADD ED-NODE />
</row>
<PRODUCT-TYPE>Car</PRODUCT-TYPE>
<PRODUCT-DATE>01/01/2003</PRODUCT-DATE>
<ADDED-NODE>2ndCollect ionItemText<ADD ED-NODE />
</row>
</rows>
</code>

I think I have to:
1) iterate thru my collection.
2)assign the ?current? element in the collection to the ?innerText? of the
newly created node.

<code>
For Each currNode In nodeList
Dim additionalNode As XmlElement = xmlDoc.CreateEl ement("<ADDED-
NODE>")
currNode.Insert After(additiona lNode, currNode.ChildN odes(5))
?So, I think that I should call my ?XsltArgumentLi st? code here
DoXsltArgStuff
Next
</code>

AT the moment, all my XsltArgumentLis t code does is read values from the
empty node

<code>
private sub DoXsltArgStuff

Dim xPathDoc As XPathDocument = New XPathDocument(A BB_FILE)

Dim myXslt As XslTransform = New XslTransform
myXslt.Load("xs ltArgList.xslt" )

Dim nav As XPathNavigator = xPathDoc.Create Navigator()

Dim arguments As XsltArgumentLis t = New XsltArgumentLis t

currCollection( )???
?I supect that I have to assign a value from my collection here.I somehow
have at ASSIGN this value to my newly-created node.
arguments.AddPa ram("argTransTy pe", "", nav.Select("row s/row"))

Dim memStream As MemoryStream = New MemoryStream
myXslt.Transfor m(nav, arguments, memStream, Nothing)

memStream.Seek( 0, SeekOrigin.Begi n)

Dim sReader As StreamReader = New StreamReader(me mStream)
MsgBox(sReader. ReadToEnd)
End Sub

<xslt>
<?xml version="1.0" ?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:param name="argTransT ype" />
<xsl:template match="/">
<xsl:for-each select="$argTra nsType">
<xsl:value-of select="ADDED-NODE" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
</xslt>

I?m stuck at this point.As I say, this is all new ground for me.If another
approach is better, then please let me know ;-)

Can anyone help?Can I clarify anything?
Many thanks,
yogi

--
Message posted via http://www.dotnetmonster.com
Nov 12 '05 #1
1 1652
silly me, I can just set the "innerText" property of the newly-added node,
just after I add it.

yogi

--
Message posted via http://www.dotnetmonster.com
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
3799
by: Julia Peterwitz | last post by:
I have a function that works with explorer but not with netscape. The problem is the function at line 5. 1 fSetSelectedDay(myElement){ 2 /* 3 ... 4 */ 5 var elementText = eval(myElement.children.innerText); 6 /*
6
2378
by: martin | last post by:
Hi, I would like to write the text of an element to an xml doc as that it look like this <Address>&quot;Marty Jones&quot; &lt;mj@mydomain.com&gt;</Address> however I can't seen to get the quote marks to come out correctly the innertext property will change
5
3450
by: martin | last post by:
Hi, I would be extremly grateful for some help on producing an xml fragemt. The fragment that I wish to produce should look like this <Addresses> <Address>&qout;Somebody's Name&quot; &lt;me@mydomain.com&gt;</Address> </Addresses>
0
821
by: prefersgolfing | last post by:
I'm using an XMLDataSource as a DataSource for a TreeView. In the XML data, I added "_" between words in order to create elements with them. I want to get rid of the "_" when the menu presents. How can I edit the TextField value below to get rid of the "_"? <asp:Treeview... <DataBindings>
0
9680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10455
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10228
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10173
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7547
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.