473,804 Members | 2,280 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 1653
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
3800
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
2380
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
9714
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
9594
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
10599
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
10346
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...
0
10090
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7635
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...
1
4308
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
2
3832
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.