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.AddExtensionObject(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.
0
12/31/2004 9:19:06 AM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
980 Views

Similar Articles

[PageSpeed] 56

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.AddExtensionObject(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.
0
12/31/2004 9:55:01 AM
Reply:

Similar Artilces:

Insert Function Wizard agrument descriptions.
I have written several functions in VBA, then saved the sheet as an .xla which I use as an add-in. The functions appear in the Insert Function Wizard, as expected - almost. I have not found a way to display the arguments' descriptive text. I know this is available in in .XLL's through a call to xlfRegister, but how does one accomplish this through VBA? Dan You can add a brief description of your UDF by going to Tools>Macro>Macros. Type in the name of your UDF and "Options". Add a description and hit OK then Cancel. To actually add the arguments you will need...

Is It Possible To Pass Parameters to A Pass Through Query
My assumption is that's it's not. At work I use ODBC to connect to our oracle database with Access 2003. There are cases where using a pass through query runs much much faster and I then use it in a make table query to make a local table. In access you can use brackets [] to have it ask for input. May I assume there is no way to do anything like that in a pass through query? Create a PassThrough query and use code to assign the SQL to this query filtering it with a parameter, and then run it e.g Dim MyVariable As Integer MyVariable = InputBox("Please select a Number&quo...

file with udf extension
Hi I have a file with a udf extension. When I searched the several sites said that it was related to excel, so I opened it with excel. When opened, it is incomprehensible letters and symbols. Is there a way to convert it so that it is readabl? -- Thank-you! Ruth http://www.google.com/#hl=en&source=hp&q=*.udf&aq=f&aqi=g3g-s1g3&aql=&oq=&gs_rfai=C_KkU1f8HTKKKAYXUM8vi_dAKAAAAqgQFT9AdQ5A&fp=7ea2d229f2f9fbeb -- Don Guillett Microsoft MVP Excel SalesAid Software dguillett@gmail.com "Ruth" <Ruth@discussions.microsoft.com> wrote...

Org Chart Function -- Static or Dynamic?
This is a multi-part message in MIME format. ------=_NextPart_000_00C6_01C6C517.67BB36C0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, It seems to me that if I create an Org Chart using the wizard in the = system and get the data from a database, then the created chart is = static in nature with no way to automatically update the structure as = items in the database change. Is this correct? If not, how do I get it to do a refresh? If so, is there anyway to create a dynamics Org Chart that can be = refreshed as the data in the un...

Pass multiple selected values from list box to table
How do I pass multiple selected values from a list box to a table? I've found code to use the values as criteria in a query but would now like to store the values in a table (at least temporarily) thanks in advance. jack Pass selected values from a list box to a table? I don't really think you want to do this. Can you describe more about what you are trying to accomplish? You just store raw data in a table. You don't store manipulated data in a table. Maybe you need a query to do what you want to do... -- Ryan--- If this information was helpful, please indi...

Help with Date Function
I have tried, and I can't figure out if this is possible. I'm trying to have dates autofill into a row of columns (C5 to V5 to be specific). I don't want week-end days to be a part of the autofill, and I can't figure out the formula. Any suggestions? Hi, Enter the first date in C5 which must be a weekday then put the formula below in D5 and drag right =C5+CHOOSE(WEEKDAY(C5),0,1,1,1,1,3) -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the questio...

Filter Treeview using XmlDatasource.xpath
Hi, I have this xmldoc linked to a xmldatasource in .Net 2.0 <MENUROOT title="Home" visible="true"> <MENU title="subnode_1" visible="true"> <MENUITEM title="leafnode_1" visible="true" /> <MENUITEM title="leafnode_2" visible="false" /> </MENU> <MENU title="subnode_2" visible="false"> <MENUITEM title="leafnode_3" visible="true" /> <MENUITEM title="leafnode_4" visible="...

How to pass an object from C++
Hello! We have a C# asp.net web application that is using a COM dll We use the tlbimp to be able to use the COM dll from C# asp.net web application The method InitRules shown below is located in the COM dll. It can be seen below the text Original. Method InitRules below is called from C# but we want to pass an object of type Handle_DS in addition to all the other parameters. You can see the modified InitRules below marked Modified Note the object of type Handle_DS is a C++ object that is created from C# asp.net application and pass into the InitRules I have also copied the whole idl fil...

Junk Email function suddenly stop working
Suddenly from today, the Junk Email function sudenly stops working to block those junk mails. 99% of those junk mails used to be automatically put into Junk Email box now are received in my Inbox! The setting in Junkmail Option is not changed. I set it at "High". What should I do with it? BTW, I use Outlooks 2003, part of MS Office Professional Edition with SP2 Thanks a lot in advance. I am having the exact same problem, and it started about the exact same time. I've even cleaned out the "blocked senders" list, thinking that it being full might have caused the...

xpath help
I have an xml doc <sections> <section> <title>entry image</title> </section> <section> <title>22'2</title> </section> </sections> I want to check for duplicate nodes before I add I'm using this vb.net code (The code is fine but the xpath isn't working with titles with single quotes in) Private Function nodeExists(ByVal sectionTitle As String) As Boolean Dim xmldoc As New XmlDocument xmldoc.Load(_xmlPath) Dim xn As XmlNode = xmldoc.SelectSingleNode("//section[title='&qu...

100% Passing Guaranteed in All I.T. Exams/Certifications at 1st Attempt Hi Friends, To pass all types of I.T Exams/Certifications with mind blowing results in 1st attempt just visit http://www.itreal
100% Passing Guaranteed in All I.T. Exams/Certifications at 1st Attempt Hi Friends, To pass all types of I.T Exams/Certifications with mind blowing results in 1st attempt just visit http://www.itrealexams.com/ and get real time Q&As, Brain Dumps, Real Exams, Study material, E-Books, Video Exams and Labs for your all type of I.T Certification Exams. ...

Function Error IF Statement
The follow work fine in seperate cells. =IF(AND(R7>0,O7="M"),(R7*I19+50)*0.093,(0)) =IF(AND(R7>0,O7="Q"),(R7*I19+50)*0.27,(0)) =IF(AND(R7>0,O7="S"),(R7*I19+50)*0.53,(0)) =IF(AND(R7>0,O7="A"),(R7*I19+50),(0)) What I want to do is combine the 4 above in 1 cell so the results show in a single cell. I can't get it to work. Any help will be appreciated. Thanks. Bob Z Not sure which order the functions should be, but this combination should help you; =IF(AND(R7>0,O7="M"),(R7*I19+50)*0.093, IF(AND(R7...

rewind function
Hi all Anyone can explain to me the function of rewind() in VC++, how does it work or give me a simple example if possible. Thanks nmp, Copied and pasted from MSDN: FILE *stream; int data1, data2; data1 = 1; data2 = -37; if( (stream = fopen( "rewind.out", "w+" )) != NULL ) { fprintf( stream, "%d %d", data1, data2 ); printf( "The values written are: %d and %d\n", data1, data2 ); rewind( stream ); fscanf( stream, "%d %d", &data1, &data2 ); printf( "The values read are: %d and %d\n...

Passing data between forms
Hi I am working on a project someone else started, and he has this code: If STR_FormName = "FMS_ToDo" Then Page47.SetFocus He obviously expects the name of the last form to be here, but it is not. In fact, when I put Option Explicit at the top - this field was undefined. How is this supposed to work? Stapes ...

IT CertificationzzzZ.....100% GUARANTEED PASS.......!!!@!!!
IT CertificationzzzZ.....100% GUARANTEED PASS.......!!!@!!! Hi guys, If you are serious about your professional career and pass IT Certification exam in first attempt then Visit http://www.FreeExamKing.com and get latest Questions And Answers Dumps for Microsoft, Oracle, Cisco, CompTIA and many more, i have used and found it very helpful. ...

Can You Use SQL Max() Function Based on Variable From Form
Hello, I'm wondering if it is possible to execute a SQL query at runtime, from a Form, and to alter the query programmatically based on a value (variable) passed from the Form to the query. I am looking to obtain a max value of a number based that is related to the variable that will (hopefully) be passed from the Form to the query at runtime. Thanks, Cindy -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200711/1 There are a number of ways this can be accomplished using VBA. One is to build the query programmatically. Another i...

VBA Function #3
I have a main program in VBA and it calls another program=Blend several times. "Blend" depends on two array inputs that change in the Main program. Is there anyway to specify the inputs when I "Call Blend" like "Call Blend(x,y)" where I set x=Array1 and y=Array2 ? Thanks Yes, but your sub has to use them Sub Blend(ary1, ary2) 'do something with ary1 and ary2 End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Jeff" <Jeff@discussions.microsoft.com> wrote in message news:CC4FE65F-8B3C-4BB4-93BF-DF737DCFC...

Which function do I need to do this
Hey peeps, I have setup 2 worksheets within the same workbook when I enter values in cells in worksheet 1 I have chosen certain cells to be displayed in worksheet 2also. Now I want excel to realise that in worksheet 2 all cells are full for lets call it that query so return the value in a new row.... Which function would I use? I hope I have explained this clearly enough? Anyhelp would be appreciated...... Thanks in advance.... -- xirokx ------------------------------------------------------------------------ xirokx's Profile: http://www.excelforum.com/member.php?action=getinfo&a...

function keys
Hello, Is there a site where I can get a recap of RMS function keys? Not that I know of, but F1 - Help is a really good place to start! Glenn Adams Tiber Creek Consulting http://www.tibercreek.com glenn@tibercreek.com ---------------------------------------------- Please DO NOT respond to me directly but post all responses here in the newsgroup so that all can share the information. newbie wrote: > Hello, > Is there a site where I can get a recap of RMS function keys? This is a multi-part message in MIME format. ------=_NextPart_000_02DF_01C6B6FC.B3481FA0 Content-Type: text/plain; ...

Passing arguments to procedures
There is something fundamental that I have failed to grasp about passing arguments to procedures. I have a form featuring a set of unbound controls displaying dates and the corresponding days of the week. (For some reason, the long-date format, on my computer, does not include the latter, as the documentation suggests it might, so it has to be separately calculated and displayed.) A default date is displayed in each control, on Form_Open. This can then be manually adjusted by a pair of ‘up’ and ‘down’ buttons associated with each day/date control pair. In the case of the control ‘St...

Gridlines missing onscreen in worksheets saved in XLW extension and from QuattroPro
In Excel 2002 in opening worksheets from earlier versions of Excel as well as from QuattroPro, a user in our office finds that gridlines cannot be shown even when going into the Tools, Options,View, Windows Options, checks Gridlines. In addition, no gridlines print when that option is checked on the print settings sheet. Same problem with a QuattroPro converted worksheet. Is this just an impossibility due to formatting differences in the programs? ...

Separators in Cross Functional Diagrams
I created a swim diagram and added a fill. How do I keep the separators in front? I sent the band to the back, brought the separators forward, and it looks great until I close the document and reopen. Then, the separators don't show up. I changed the translucency of the fill to be able to see them, but I'd like to have them in front. ...

Pass Parameter to stored procedure in pass thru query
How do I pass a parameter to a stored procedure in a pass thru query? I'd like to enter the parameter in a control on a form and then run the pass thru query and pass the parameter to it. I've tried this, but haven't been successful. Any ideas? Thanks. On Sun, 8 Jul 2007 18:04:26 -0500, "SAC" <sac@somewhere.com> wrote: >How do I pass a parameter to a stored procedure in a pass thru query? > >I'd like to enter the parameter in a control on a form and then run the pass >thru query and pass the parameter to it. > >I've tried this, b...

COUNTBLANK function
Happy New Year Everyone, Using Excel XP. I have 3 columns of data, A1:C10. I want to count the blanks in C1:C10 ONLY if there is data in A1:A10. Example: A B C ---------------------------------------------- 1 20 6 5 2 4 1 3 8 6 2 4 4 2 5 8 1 1 6 7 2 7 3 2 ...

function help!
Is there a way I can switch a last name, first name to first name an last name? i.e... Smith, John to John Smith I'd greatly appreciate some assistance -- Message posted from http://www.ExcelForum.com Hi if they are always divided by a coma use the following formula: =TRIM(MID(A1,FIND(",",A1)+1,255)) & " " & TRIM(LEFT(A1,FIND (",",A1)-1)) >-----Original Message----- >Is there a way I can switch a last name, first name to first name and >last name? i.e... Smith, John to John Smith > >I'd greatly appreciate some assista...