Custom xpath function, ResolveFunction called but not Invoke...

Hi...

We have an XsltContext object on our code to support some custom functions.  
I just went to add one and oddly I find XsltContext.ResolveFunction() is 
being called but Invoke() isn't.

ResolveFunction returns
return new XPathExtensionFunction(name, 2, 4, new XPathResultType[] { 
XPathResultType.String, XPathResultType.String, XPathResultType.String, 
XPathResultType.Boolean }, XPathResultType.Boolean);

where class XPathExtensionFunction : IXsltContextFunction.

From what's returned, I see that the ReturnType property is called a couple 
times but it's never followed up with an Invoke() and I haven't figured out 
why.

We have other functions in the same object that are getting invoked, but for 
some reason this new one never quite gets there.  No exceptions are thrown.

XPathUtil Ctx = new XPathUtil(new XmlNamespaceManager(confDoc.NameTable));
Ctx.AddNamespace("ptx", "urn:prospero.xpath");  // and our special helpers

confSection = confDoc.DocumentElement.SelectSingleNode(
"/configuration/types[@name=/choices/choice[ptx:myfunc(string(@appliesTo), 
string('myType'))]/@type]", Ctx);

Is how I'm trying to invoke it.

Any ideas?

Thanks
Mark

0
mmodrall1 (25)
9/30/2009 5:56:01 PM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
579 Views

Similar Articles

[PageSpeed] 44

Mark wrote:
> Hi...
> 
> We have an XsltContext object on our code to support some custom functions.  
> I just went to add one and oddly I find XsltContext.ResolveFunction() is 
> being called but Invoke() isn't.
> 
> ResolveFunction returns
> return new XPathExtensionFunction(name, 2, 4, new XPathResultType[] { 
> XPathResultType.String, XPathResultType.String, XPathResultType.String, 
> XPathResultType.Boolean }, XPathResultType.Boolean);
> 
> where class XPathExtensionFunction : IXsltContextFunction.
> 
> From what's returned, I see that the ReturnType property is called a couple 
> times but it's never followed up with an Invoke() and I haven't figured out 
> why.
> 
> We have other functions in the same object that are getting invoked, but for 
> some reason this new one never quite gets there.  No exceptions are thrown.
> 
> XPathUtil Ctx = new XPathUtil(new XmlNamespaceManager(confDoc.NameTable));
> Ctx.AddNamespace("ptx", "urn:prospero.xpath");  // and our special helpers
> 
> confSection = confDoc.DocumentElement.SelectSingleNode(
> "/configuration/types[@name=/choices/choice[ptx:myfunc(string(@appliesTo), 
> string('myType'))]/@type]", Ctx);
> 
> Is how I'm trying to invoke it.

Consider to post a minimal but complete code sample that allows us to 
reproduce the problem.
The only odd thing I see is your XPath, you have two absolute paths:
   /configuration/types
and then inside the predicate
   /choices/choice
If you use XmlDocument then there is only one root node and one root 
element meaning you can either have
   /configuration
select an element or
   /choices
select an element in the same document but not both in the same document.


-- 

	Martin Honnen --- MVP XML
	http://msmvps.com/blogs/martin_honnen/
0
mahotrash (1778)
9/30/2009 6:07:47 PM
Thanks Martin...

As you noted, it was the bad pathing on the argument to the function; when I 
add /configuration to /choices/... it works.

so
1) the original invocation wouldn't have found anything and would have 
returned null.

2) ResolveFunction was probably called in the parsing of the expression but 
not invoked because there was no nodelist to work on to start with...

Mark


"Martin Honnen" wrote:

> Mark wrote:
> > Hi...
> > 
> > We have an XsltContext object on our code to support some custom functions.  
> > I just went to add one and oddly I find XsltContext.ResolveFunction() is 
> > being called but Invoke() isn't.
> > 
> > ResolveFunction returns
> > return new XPathExtensionFunction(name, 2, 4, new XPathResultType[] { 
> > XPathResultType.String, XPathResultType.String, XPathResultType.String, 
> > XPathResultType.Boolean }, XPathResultType.Boolean);
> > 
> > where class XPathExtensionFunction : IXsltContextFunction.
> > 
> > From what's returned, I see that the ReturnType property is called a couple 
> > times but it's never followed up with an Invoke() and I haven't figured out 
> > why.
> > 
> > We have other functions in the same object that are getting invoked, but for 
> > some reason this new one never quite gets there.  No exceptions are thrown.
> > 
> > XPathUtil Ctx = new XPathUtil(new XmlNamespaceManager(confDoc.NameTable));
> > Ctx.AddNamespace("ptx", "urn:prospero.xpath");  // and our special helpers
> > 
> > confSection = confDoc.DocumentElement.SelectSingleNode(
> > "/configuration/types[@name=/choices/choice[ptx:myfunc(string(@appliesTo), 
> > string('myType'))]/@type]", Ctx);
> > 
> > Is how I'm trying to invoke it.
> 
> Consider to post a minimal but complete code sample that allows us to 
> reproduce the problem.
> The only odd thing I see is your XPath, you have two absolute paths:
>    /configuration/types
> and then inside the predicate
>    /choices/choice
> If you use XmlDocument then there is only one root node and one root 
> element meaning you can either have
>    /configuration
> select an element or
>    /choices
> select an element in the same document but not both in the same document.
> 
> 
> -- 
> 
> 	Martin Honnen --- MVP XML
> 	http://msmvps.com/blogs/martin_honnen/
> 
0
mmodrall1 (25)
9/30/2009 7:15:01 PM
Reply:

Similar Artilces:

Access 2007: Report>OnNoData Function
In access 2000, I was able to use "docmd.cancel" after a message box in the OnNoData function to get a message box to display, but otherwise return to the calling form. In Access 2007, however, this displays the message box, and then gives me an error message on top of it. I've also tried "Cancel=True". I'm new to this version of Access. Has something Changed, here? Thanks in Advance bh Using the CancelEvent action in a macro, or setting the Cancel argument to True in code - both approaches should work in A2007. -- Allen Browne - Microsoft MVP. Pert...

Custom Entity Relationship CRM 3.0
I have created a new custom entity (A) for which I need to create two referential relationships to other custom entities (B) & (C). (A) is the primary entity in both cases. The relationship between (A) and (B) acts normally. The relationship between (A) and (C) doesn't. When I try to add a (C) record from (A), (A) displays two records in the (C) lookup. One "record" displays data from system fields (created on and status). The second "record" displys data from the primary field. I am not able to access (C) record from the associated view in (A), but I can a...

Word Form Send To function dropping activeX controls
Hey all...new to the forum but i have a question i hope can be answere here. I work in a large Telecom/IP/Voice network managment center and we hav recently implemented a "network report" that needs to be completed b each shift telling the next shift what the overall health of th network, and alerting the next crew to any potential issues. Problem is this. I have 3 checkboxes at the top of the form t indicate what shift the form is for. We edit the form in Word and the file>send to mail recipient, and the text shows up but the check boxe are gone. If i send as attachment the...

Custom toolbar and macros
I am moving a user from Windows 2000 to XP and he has a worksheet with many custom Macros as well as the custon toolbar with it. We can move the worksheet and the macros will move with it. The problem is moving the custom toolbar with it. How do I get the toolbar to move along with the worksheet. One way: With the custom workbook active, choose Tools/Customize/Toolbars. Click Attach. Attach your custom toolbar to the workbook. In article <F0FC2885-07CB-4706-BC67-DEB7B664BACF@microsoft.com>, "MD" <MD@discussions.microsoft.com> wrote: > I am moving a user fro...

toolbar customization
533 MHz Power PC G4 384 MB SDRAM MAC OS X 10.3.3=20 Office X: Excel 10.1.5 (Service Release 1) When I drag command buttons to Excel's Standard Toolbar I get grayed-out = icons as follows: Hide Detail Show Detail Insert Rows Ironically the following buttons, dragged in precisely the same = fashionto the=20 Standard Toolbar, work satisfactorily: Insert Columns Delete Column Delete Row Any suggestions? Has MS discoveed and repaired these bugs for the May=20 2004 updates? While they're not bugs, they are confusing. You probably dragged the Insert Rows button from the Edit categ...

CRM Customization: Display Contact Info on Service Activity Form
We'd like to be able to open a service activity, and display all of the associated contacts' information (name, phone, address) on the same form. We have attempted to use IFRAMEs to load this information, but have so far been unsuccessful in achieving the desired effect. What is the best approach to take here? I am trying to do the same... What I really want is: 1) Service activity calendar view to show the customer name, number and address in the mouseover 2) When a service calendar item is clicked on, I would like the contact name, address and telephone listed in the main fo...

Tracking customer orders when receiving stock
With our current POS system we can place items on order for a particular customer (whether we are holding the stock or not) and when we generate purchase orders the system automatically pops up letting us know we have pending orders for customers. We can then generate a purchase order based on this information. When we receive the stock, we can print out a report for that order that lists what stock needs to be allocated to which customers. Is there a way with RMS that we can do this? Unfortunately it is a regular occurance that our stock levels can be incorrect, for instance we may have a 0 ...

Customize Does not WOrk
When I clip the customize outlook today button, it does not respond. Anyone have an idea of what the problem might be? Posted several times a day here: OL2000: You Cannot Customize Outlook Today After You Install Critical Update 813489 for Internet Explorer: http://support.microsoft.com/default.aspx?scid=kb;EN-US;820575 -- Russ Valentine [MVP-Outlook] "Glenn" <anonymous@discussions.microsoft.com> wrote in message news:05cb01c3cc7b$467a26c0$a101280a@phx.gbl... > When I clip the customize outlook today button, it does > not respond. Anyone have an idea of what the pr...

How to display HTML in Custom Task Pane
Does anyone know if it is possible to program a custom task pane in Office 2007 (using VSTO) to display hosted web content (i.e. HTML). How about locally stored HTML? My team is looking at ways of providing modest on-screen assistance to support our custom Add-in that docks nicely within the application and can be coupled with a few controls. If it's not possible, we're stuck using CHM. Thanks in advance. ...

XY Scatter with Custom Labels
I have a list of products, each with an X (a dollar amount) and a value (a percentage). Is it possible to have each point labeled with custom value i.e.: Printer, or Digital Camera, rather than it bein labeled with just the values being plotted ($1,000, 2% or $500, 7%)? Any ideas are appreciated. Thanks, Keit -- hatzipe ----------------------------------------------------------------------- hatzipet's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2789 View this thread: http://www.excelforum.com/showthread.php?threadid=47392 You can edit the text of a labe...

How to Customize Business Portal to show custom objects?
Hi, I need to Customize Business Portal to show my custom objects in "Primary Publishing List ResultViewer Web Part","Rich List ResultViewer Web Part","Form ResultViewer Web Part"? I need to create pages similar to Customer Summary page in sales center with my custom objects. How can i do that? Thanks, Mohan ...

Customer Report
Hello, I am hoping someone might assist me with a problem. I am trying to customize a customer report to show the Notes from the customer file. It has been suggested to me to run a query on this to pull the info I want. This is great, but not ideally what I am looking for. I want anyone in the office to be able to run the report and filter it to their specifications. For example: we have an anual catalogue and we do not send it to everyone on our mailing list. We want to send it to local customers who have spent money with us or who specifically request a catalogue. We have used up all ...

EOMonth function
Is there an equivalent function to EOMonth in xl2003 or a formula that will get me the same result? Hi Where it would have been =EOMONTH(start_date,months) use =DATE(YEAR(start_date),MONTH(start_date)+months+1,0) -- Regards Roger Govier Ayo wrote: > Is there an equivalent function to EOMonth in xl2003 or a formula that will > get me the same result? Hi, If you load the analysis toolpak you have EOMONTH in e2003 but here's an alternative non ATP method. Chane the 1 after the month to change the month =DATE(YEAR(A1),MONTH(A1)+1,0) -- Mike When competi...

Change dates to a custom format via formula ... how to?
Hello, A2 has formula =NOW() which makes date today in this format: Tue.Apr.26.2011 How can I get my custom date formats so that the above date shows up as Tu.Apr.26.2011. In another sheet, I was kindly given this to make these types of changes: =IF($A$2<>"",TEXT($A$2,"yymmdd.")&CHOOSE(WEEKDAY($A$2),"Sn","Mn","Tu","Wd","Th","Fr","Sa"),"") I tried this, =NOW()&CHOOSE(WEEKDAY($A$2),"Sn","Mn","Tu","Wd","Th","Fr","Sa&...

change local customer to global customer
I am trying to change the local customers that i have in my store database to global customers in hq I ran this querie in store administrator UPDATE Customer SET GlobalCustomer = 1 Then ran worksheet 401 in hq, but the customers did not update, then worksheet 350. Can someone help? Had the same issue ... this worked for me - need to set globalcustomer = 1; need to set lastupdated = getdate(*); need to set storeid = 'xxxx' (whatever is appropriate for you). Go into SO Manager and configure ENABLE GLOBAL CUSTOMERS and NEW CUSTOMERS DEFAULT AS GLOBAL. Need to run 401 TWICE (once...

GPS Customization Query
Hi All, Is there a way to avoid/remove "Quick Links" and "Help" links from the Business Portal Site for the end users? Any help on this would be very handy. Regards, Kuldeep ...

Custom X-axis
Hi everyone. I need to create a custom x-axis in which the values double at each interval. i.e. At the first interval the value must be 20, the next 25, 31.5, 40, 50, 62 ...20,000. Even though the numbers do not have an similar differences (e.g. 25-20 is not equal to 62-5) I will still need these values to be equally spaced. Thanks for any help you give, it's greatly appreciated! Fred. PS. If you want to know what I'm doing, I'm plotting an amplitude:frequency graph, where each spacing between each frequency is 1/3 of an octave. Fred - Two options. Make a Line chart,...

How to customize column width in Ressource Usage report ?
Hi, When printing the Workload, Ressource Usage report, some of the durations are stated as #####.##. I tried to make the font smaller but it did'ent help. How do I make the report readable? I am using MS Project 2007 SP2. Br Bertrand If you goto Reports, Custom you can see all of the built-in reports and you can see what they are made of and you will see that they use a filter and a table (and other settings and stuff). The column width of each field is a property of the table. Find the report that you are interested in, then find the table that it uses, then e...

User Defined Function returning #Value!
I have a function that I created. When I test it in the Intermediate Window, ? Kountifs("Registered Nurse"), it returns a 12 which is correct. I want to be able to use this function a my datasheet. I have included basically the same function =Kountifs("Registered Nurse"). But, ont the datasheet I receive a #Value! rather than the 12. Does anyone have ideas why? Why dont you post the UDF.. If this post helps click Yes --------------- Jacob Skaria "DogLover" wrote: > I have a function that I created. When I test it in the Intermed...

customize public folder
Hi, I have exchange server 2003, on a windows 2003 server environment. 1) I want to remove or hide the "favorites" folder under the public folder tree? 2) May I not to use the existing public folder tree structure? Public folder --> All Public folders --> (Company contacts) Public folder --> (Company contacts) Thanks, On Tue, 30 May 2006 15:32:25 +0800, "Classmate" <NoEmailAddress@abc.com.hk> wrote: >Hi, > > > > I have exchange server 2003, on a windows 2003 server environment. > > > >1)...

Custom ActiveX control fails on release build
Some time ago I created simple custom control (.ocx) using Visual Basic 6. Recently I decided to also use my control in VC++ apps. VB: Using the ActiveX Control Interface Wizard and the Property Page Wizard I added the appropriate handlers and a simple property page to change the appearance, border, colors, and fonts. Nothing special there. VC: The control was installed and registered on the test machine through the installer and is located in the system folder. On the development machine the application runs fine and the new control works great. On the test machine the dialog box fail...

Custom colors
I hope someone can help me out on this one please! I mixed a few new colors using RGB that I want applied to certain cells on a spreadsheet that will be shared among many users. The problem is, I noticed that setting RGB only changes the color pallette and if the user resets or changes their color pallette, then my colors are all reset on the spreadsheet (and they look bad!). Apparently its all linked by the color index? i.e. If the user changes their color index, that change updates the spreadsheet color. Is there is foolproof (or at least better) way of applying custom shading t...

auto fill in customer when contact selected
Hello, I hope Bertil reads this :) or someone with the same knowledge :) In a case when a user selects a contact is it possible to auto fill in the customer related to the contact?? Any help mucho appreciated. You can do this using javascript. onchange function of the field. -- Regards, MS CRM Certified Professional http://microsoftcrm3.blogspot.com Chat with me on MSN / Gmail / Skype : ID Is :.. mscrmexpert@gmail.com "Ian" wrote: > Hello, > > I hope Bertil reads this :) or someone with the same knowledge :) > > In a case when a user selects a contact...

Factorial function...whaaaaaa?
I have the following equation in my code: TotalCalc = Fact(n + 4) / (Fact(4) * Fact(n)) When I compile, it highlights the first Fact and tells me "Sub or Function not defined". TIA FACT() is a worksheetfunction. So you can try something like the below TotalCalc = WorksheetFunction.Fact(n + 4) / (WorksheetFunction.Fact(4) * _ WorksheetFunction.Fact(n)) -- Jacob "Geoff" wrote: > I have the following equation in my code: > > TotalCalc = Fact(n + 4) / (Fact(4) * Fact(n)) > > When I compile, it highlights the first Fact and tell...

How do I create the correct size/type custom icon for custom entit
Can any one tell me what exactly do I need to do to create a custom entity icon. I know how to upload the file but how do I create the file in the first place. I have done this using Paint but it always appears as truncated or clipped around the side or far too small. Thanks for your help You can use paint to create icons - but MS recommends that the files cannot be bigger the 10 Kb and should have transparency for best resuls. To draw a transparent image in MS Paint, on the Image menu, click Draw Opaque and make sure the check mark does not appear next to it. Hope this helps. I...