473,395 Members | 1,653 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,395 software developers and data experts.

How to pass a Nodeset to an XPath extension function?

I am using the .NET framework v2.0.40607 with Visual C# Express and I would
like to create some custom XPath functions to use directly in a XSLT
stylesheet.

I called System.Xml.Query.XmlArgumentList.AddExtensionObjec t(string, object)
to register the functions I've written.

The functions that take a String, Boolean or Number parameter work
perfectly. However, I do not know how to create a function that will accept a
Nodeset as a parameter.

I tried writting a function taking a XPathNavigator object, but it does not
work for all XPath queries that return a Nodeset: I get an error "Xml type
'item' does not support a conversion from a Clr
'MS.Internal.Xml.XmlQuerySequence', which contains multiple items, to a
single item."

Is this a bug or the normal, expected behavior? If it is normal, then how to
write a function that will accept a Nodeset parameter?

Any help will be appreciated. Thanks.
Nov 12 '05 #1
1 2445
I think I've figured out the solution.

I've written a function that takes an ARRAY of XPathNavigator, and it seems
to work. Each XPathNavigator object represents one of the node present in the
Nodeset.

"Damien Goutte-Gattat" wrote:
I am using the .NET framework v2.0.40607 with Visual C# Express and I would
like to create some custom XPath functions to use directly in a XSLT
stylesheet.

I called System.Xml.Query.XmlArgumentList.AddExtensionObjec t(string, object)
to register the functions I've written.

The functions that take a String, Boolean or Number parameter work
perfectly. However, I do not know how to create a function that will accept a
Nodeset as a parameter.

I tried writting a function taking a XPathNavigator object, but it does not
work for all XPath queries that return a Nodeset: I get an error "Xml type
'item' does not support a conversion from a Clr
'MS.Internal.Xml.XmlQuerySequence', which contains multiple items, to a
single item."

Is this a bug or the normal, expected behavior? If it is normal, then how to
write a function that will accept a Nodeset parameter?

Any help will be appreciated. Thanks.

Nov 12 '05 #2

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

Similar topics

7
by: Sebastian Petzelberger | last post by:
Hi group, please give me an example of a xpath with regex or better a link with examples. Thanks in advance, Sebastian
4
by: Brad | last post by:
Help, I have a really complicated XPATH request I can't wrap my head around I have an XML nodeset like this: <a> <a1 attr="key">Use</a1> <a1 attr="val">Value1</a2> </a> <a> <a1...
2
by: Bryan Galvin | last post by:
Hi all, I posted a message on this topic before, but now I have a request for help. Previously "A. Bolmarcich" answered this query for me, but the problem has changed slightly... I have two...
1
by: ssvendsen | last post by:
Hi, In my XML dialect I got elements on the form of XPath expressions, which refer to nodesets located in other fragments in the same document. Is there a way to validate that the XPath...
0
by: Hoi-Polloi | last post by:
Hi all I want to use an xpath query to get a set of xmlNodePtr , but I don't want to keep the xmlXPathObject around. See the function below. I want to: * make xpath query and get an...
2
by: bignass04 | last post by:
Hi all, I'm a newbie to XSLT working on my first project with it and I'm stuck on a particular thing. I want to create a document that will write the PCDATA from a given <Lineelement, then, in...
2
by: Yarik | last post by:
Hello, I am not sure the subject of my post adequately describes the problem I am trying to solve, so I think a specific example would be helpful. Let's say there are XML descriptions of...
14
by: eric.goforth | last post by:
Hello, Is there any way to directly access an element in a nodeset? For example, if working with: <blahs rec_count="16"> <blah> <yada>abc</yada> </blah>
4
by: vaibhavp | last post by:
Hi, I am new to coding in Xslt and am stuck up on a problem for a very long time. I have to convert an xml file to html using xslt. I am using javax.xml.transform API for this. The xml file i...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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,...
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
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...

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.