473,396 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to transform escaped xml contents in xmlnode

Hi,
I have an XML document, created from ADO DataSet, which contains XML data in
some nodes shown below:
<NewDataSet>
<Table>
<field_name>My Selection</field_name>
<field_type>dropdown</field_type>
<field_choice_text>
&lt;Choices&gt;&lt;Choice choice_text=\"xxx\" /&gt;&lt;Choice
choice_text=\"yyy\" /&gt;&lt;Choice choice_text=\"zzz\"
/&gt;&lt;/Choices&gt;
</field_choice_text>
<field_answer>
xxx
</field_answer>
</Table>
</NewDataSet>

How can I get the value from field_choice_text node as "unescaped" xml
contents as:
<Choices>
<Choice choice_text="xxx"/>
<Choice field_choice_text="yyy"/>
<Choice field_choice_text="zzz"/>
</Choices>

and pass this contents to xsl template so I can apply the xslt to render
this as a dropdown list box
....
<option ...>xxx</option>
<option
Thanks

ILN
Nov 11 '05 #1
4 3698
I read the msxsl:node-set function can be used in .NET
from the sdk document
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/cpguide/html/cpconsupportformsxslnode-
setfunction.asp

This might be the answer i am looking for =) I will give
it a try.

-----Original Message-----
Hi,
I have an XML document, created from ADO DataSet, which contains XML data insome nodes shown below:
<NewDataSet>
<Table>
<field_name>My Selection</field_name>
<field_type>dropdown</field_type>
<field_choice_text>
<Choices><Choice choice_text=\"xxx\" /><Choice
choice_text=\"yyy\" /><Choice choice_text=\"zzz\"
/></Choices>
</field_choice_text>
<field_answer>
xxx
</field_answer>
</Table>
</NewDataSet>

How can I get the value from field_choice_text node as "unescaped" xmlcontents as:
<Choices>
<Choice choice_text="xxx"/>
<Choice field_choice_text="yyy"/>
<Choice field_choice_text="zzz"/>
</Choices>

and pass this contents to xsl template so I can apply the xslt to renderthis as a dropdown list box
....
<option ...>xxx</option>
<option
Thanks

ILN
.

Nov 11 '05 #2
You may consider DOM as well. For example, we can select a "choice" node
and modify its attribute's innertext, to change field_choice_text node as
"unescaped". And then perform the XSLT Transform.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 11 '05 #3
Invalidlastname wrote:
I read the msxsl:node-set function can be used in .NET
from the sdk document
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/cpguide/html/cpconsupportformsxslnode-
setfunction.asp

This might be the answer i am looking for =) I will give
it a try.


Not really. Maximul msxsl:node-set function can do for you is to convert
escaped fragment as string into a single text node.
You have to parse escaped fragment as XML if you want to process it in
XSLT. As Luke pointed out DOM allows that easily via InnerXml property.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #4
Thank both of you for the helps. I replaced the InnerXML with InnerText of
that node in DOM and worked very well =)

ILN
"Oleg Tkachenko" <oleg@NO_SPAM_PLEASEtkachenko.com> wrote in message
news:#w*************@TK2MSFTNGP10.phx.gbl...
Invalidlastname wrote:
I read the msxsl:node-set function can be used in .NET
from the sdk document
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/cpguide/html/cpconsupportformsxslnode-
setfunction.asp

This might be the answer i am looking for =) I will give
it a try.


Not really. Maximul msxsl:node-set function can do for you is to convert
escaped fragment as string into a single text node.
You have to parse escaped fragment as XML if you want to process it in
XSLT. As Luke pointed out DOM allows that easily via InnerXml property.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #5

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

Similar topics

5
by: KathyB | last post by:
If someone could just explain this to me...I just don't get it! I have an aspx page where I retrieve several session variables and use xmlDocument to transform xml file with xsl file into an...
2
by: suzy | last post by:
i have a method which is return xml from a dataset. can someone please post some example code of how i can transform this xml using an xsl stylesheet? i am only interested in the c# part of...
4
by: JoBean | last post by:
I think this is a simple Q but I cannot get the syntax right. I want to specify the node name and get its contents. I do not want to loop through and grab the contents of all child nodes - which...
2
by: K riley | last post by:
Hi. I am using the transform method to create an HTML file using an existing XML Document and an XLST. I need to use XPath to extract a node from my XML Document and my XLST document will format...
4
by: Web Team | last post by:
Hi All, I'm trying to update the contents of an XML node. My original code: Dim loXMLDoc As XmlDocument = New XmlDocument Dim loNode As XmlNode...
2
by: bg | last post by:
Hi all, I need to get from an XmlNode the XML in an escaped form i.e. the angly bits as &lt; and &gt; And I also need to do the reverse, put escaped text back into an XMlNode, is this posible?
1
by: the_dog_gabby | last post by:
Hello, I have a stylesheet that contains C# functions to generate XML. When I apply the stylesheet to my document, everything works perfectly except the data I get back is escaped like so: ...
6
by: Pete Verdon | last post by:
Summary: Can I do an XSLT transform, in the client, of a tree of nodes taken from the displayed page DOM in IE? This works in Firefox. Hi, I'm just starting the process of rewriting part of a...
12
by: InvalidLastName | last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example: // javascript if (a &gt; b)...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...
0
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,...

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.