473,513 Members | 4,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Transforming part of the XML

fix
Hi all,

I am trying to transform part of the XML in a file using XSLT. I select
my node by a XPathNavigator and pass it to an XslTranform to Transform
that. But unfortunately it transforms the whole XML document instead of
part of it. Is there any way that I can transform only the part selected
by XPathNavigator?

Thanks.
fix.

Nov 12 '05 #1
4 909
fix wrote:
I am trying to transform part of the XML in a file using XSLT. I select
my node by a XPathNavigator and pass it to an XslTranform to Transform
that. But unfortunately it transforms the whole XML document instead of
part of it. Is there any way that I can transform only the part selected
by XPathNavigator?


SubtreeXPathNavigator class of Mvp.Xml library can do it. See
http://mvp-xml.sourceforge.net

--
Oleg Tkachenko [XML MVP, MCP]
http://blog.tkachenko.com
Nov 12 '05 #2
fix
Is there any way to do it without 3rd-party libraries?

Oleg Tkachenko [MVP] wrote:
fix wrote:
I am trying to transform part of the XML in a file using XSLT. I
select my node by a XPathNavigator and pass it to an XslTranform to
Transform that. But unfortunately it transforms the whole XML document
instead of part of it. Is there any way that I can transform only the
part selected by XPathNavigator?

SubtreeXPathNavigator class of Mvp.Xml library can do it. See
http://mvp-xml.sourceforge.net


Nov 12 '05 #3
fix
Oh well, I didn't know it is such an easy way to do that, I just have to
wrap my XPathNavigator, it doesn't even cost me a line of code.

Thanks Oleg and all who have written this library!
fix.

fix wrote:
Is there any way to do it without 3rd-party libraries?

Oleg Tkachenko [MVP] wrote:
fix wrote:
I am trying to transform part of the XML in a file using XSLT. I
select my node by a XPathNavigator and pass it to an XslTranform to
Transform that. But unfortunately it transforms the whole XML
document instead of part of it. Is there any way that I can transform
only the part selected by XPathNavigator?


SubtreeXPathNavigator class of Mvp.Xml library can do it. See
http://mvp-xml.sourceforge.net


Nov 12 '05 #4
fix wrote:
Is there any way to do it without 3rd-party libraries?


Actually yes, there is another way. You can pass your node (not as
XPathNavigator though, but as XPathNodeIterator, which you can get via
nav.Select(".") call) as a parameter to XSLT and then in your stylesheet
start with processing passed node, not source document:

<xsl:stylesheet ...>
<xsl:param name="node"/>
<xsl:template match="/">
<xsl:apply-templates select="$node"/>
<xsl:template>
...
--
Oleg Tkachenko [XML MVP, MCP]
http://blog.tkachenko.com
Nov 12 '05 #5

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

Similar topics

0
4107
by: David Furey | last post by:
Hi, I am using the XSLT document to filter records from an XML document The XSL is shown below: I have a parameter named "search-for" that is used to bring back a list of Vendor Names that start with this parameter. The list works as I want for alpabetical letters. Setting the parameter to 'a' brings back a list of vendors beginning
0
1237
by: Yves Forkl | last post by:
I need to transform a directed cyclic graph into a DTD. My approach is to have one element Pn for each "production" number n, with the content model comprising the starting vertex number n and the subsequent productions. For e.g., for vertex V1 and its edges leading to V4 and V7, I would get: <!ELEMENT P1 (V1, (P4 | P7)) > For the...
2
1928
by: Ferd Biffle | last post by:
Hello! I have an Excel XML feed from an Enterprise PDM system that is basically a flat text file with XML tags: <?xml version="1.0" encoding="UTF-8"?> <Import> <Row> <ID>1</ID> <Level>0</Level>
5
1754
by: Daniel Crespo | last post by:
Is there a built-in method for transforming (1,None,"Hello!") to 1,None,"Hello!"? Thanks
4
1916
by: Showjumper | last post by:
I am using the NITF DTD for my xml files and i need to use 2 xsl files to do the transform: one for the <body.head> and the second for the <body.content>. I've got this so far for transforming using 1 xsl file: Dim doc As New XmlDocument doc.LoadXml(xmlText) Dim xslDoc As New XslTransform xslDoc.Load(xslpath) Dim sw As New StringWriter...
3
4864
by: Sergio Otoya | last post by:
Hi all, I need to transform an xml document, using xsl to a HTML output. I can do this successfully using the XslTransform class as below: Dim oTrans As New XslTransform oTrans.Load(sXSLPath) oTrans.Transform(sXMLPath, "c:\trans.htm")
4
2008
by: Cathie | last post by:
Hi All, I am trying to get my style sheet to work. It works fine in IE but I can't get it to work in .net. Below is the function I use for transforming, where advancedOptionsFile is the path to the file containing an XML document required by the transformation, and xmlSimplified is the XML document to trasform....
4
2209
by: John Bowman | last post by:
Hi, I'm not certain this is the best place to post this, but here it goes. I'm trying to get spaces to work correctly when using the WebBrowser control. Basically, I've got a valid XML document and valid XSL file that I transform into an HTML file using .NET's XmlTransform object. This is all fine except for 1 thing. The XSL has a string...
2
2099
by: Tobias Froehlich | last post by:
Hello! I have a short question. I have a TextBox in which the user can enter a number, which then has to be saved into a double variable. The line I have looks like this: gpm.Configuration.LearnRate = TextBox1.Text;
0
7270
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...
0
7397
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. ...
0
7543
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...
0
5703
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...
1
5102
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...
0
4757
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...
0
3252
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3239
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.