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
1585 Views

Similar Articles

[PageSpeed] 20

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 (1777)
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:

Problem cut-n-paste function
I'm having a bizarre problem cut-n-pasting a very simple calculation (ie = A1 � B1) in C1 down the column (ie C2 to Cn). When I cut-n-paste the function in C1, value that displays is the same as the source cell. If I click on the target cell, the correct cells are highlighted and if I hit the enter button, the formula calculates as expected. What is going on? What do I have to do to force the formula to auto calculate? Turn on Automatic Calculation <g>. You do that at Tools/Options/Calculation. On 27 Sep 2004 18:56:34 -0700, jsausten@hotmail.com (Stephen Miller) wrote: >I'm...

access 2007 and custom toolbars in earlier version
Is there a way in Access 2007 (Enterprise) to modify a custom toolbar created in say Access 2002? In the help there are only topics about the quick access toolbar. I want to modify the action of a button, but right clicking and choosing customize, like used to be so easy (once you get used to it), is no longer possible. Does that mean no more custom toolbars and no backward compatibilty here? Help would be very welcome as the user friendliness of my user's experience is at stake here. ...

Quote for Customer can't find data source #3
I need assistance finding the data source for the quote mail merge in CRM 4.0. I get a error "mail_merge_64494[1].doc is a mail merge document. Word cannot open the data source, ." Here is the process I go through before I get the error: - I open a quote - click on menu bar button "Print Quote for Customer" - select organization mail merge, Quote for customer, and OK - when asked if I want to open or save, I select open - I pick yes, when it asks if it can put data on my document I then get message above. How do I find the datasource? Also is there a way to configure...

Custom reports 06-13-05
How can I make custom reports in MS CRM? Thanks, M Where can I find Crystal reports? "Mikkhail" wrote: > How can I make custom reports in MS CRM? > Thanks, M "Mikkhail" <Mikkhail@discussions.microsoft.com> wrote in message news:22C1DD57-5461-4924-8CA9-55810497D2D8@microsoft.com... > Where can I find Crystal reports? You need to buy Crystal Reports Developer or Professional Edition v9.2.2. to make custom reports in Microsoft CRM > > "Mikkhail" wrote: > >> How can I make custom reports in MS CRM? >> Thanks, M you may ...

Report Writer Dater Function
Hello: Does anyone know how to create a restriction in Report Writer to show the most recent date? I want to obtain the most recent date for the Apply to Document Date field in the body of my report. This field is in the Apply Open File (RM20201). Thanks. childofthe1980s ChildOfThe1980s, I would be more than glad to help if you could further explain what report in particular is this for, is it an aging? If so, would you like the most recent apply to date to display on a summary aging? Not sure I am following what you need. MG.- Mariano Gomez, MIS, MCP, PMP Maximum Global Busines...

Drill Down Function
I'm trying to create a function that will open a detail form based on a field value in a master form. I can do this using a private sub, but I hate replicating the same private sub over and over again each time I want to drill down from a different form or control. I also like being able to run a function directly from the On Double Click event of any given control and form without first having to go to a private sub. The function would have to be told the name of the detail form to open, the name of the key field in the detail form, and the value to search for. Here...

How do I enter the character '&' in a custom header?
Can anyone help me with this? Use two of them: && toolman wrote: > > Can anyone help me with this? -- Dave Peterson Try && Mike R. "toolman" wrote: > Can anyone help me with this? That works! Thanks for your help! "Mike R" wrote: > Try && > > Mike R. > > "toolman" wrote: > > > Can anyone help me with this? ...

SERIES function disappear
I can't use SERIES in Excel 2007 (err msg, input function not correct) even i cant find SERIES function at "Insert function" dialog i disable Marco in Excel 2007, is it related? Pls Help, Thank you What were you expecting SERIES to do for you as a worksheet function? In Excel 2003, SERIES didn't exist in a worksheet, but only in a chart. -- David Biddulph "Vimm" <Vimm@discussions.microsoft.com> wrote in message news:1FA6C85E-A9F2-471F-9629-8ED8B9901CB8@microsoft.com... >I can't use SERIES in Excel 2007 (err msg, input function not correc...

Data missing from enterprise custom task fields after migrating
We can see the enterprise task fields, but none of the data is displayed in files migrated from Project Server 2003 to 2007. Any ideas? -- michael Michael: What process did you follow for migration? -- Gary L. Chefetz, MVP, MCT, MCTIP Business: http://www.msprojectexperts.com FAQs: http://www.projectserverexperts.com BLOG: http://www.projectserverhelp.com "michaelj" <notreallyme.com> wrote in message news:4BD612D9-D1AD-4FF8-B103-699AB1B54D06@microsoft.com... > We can see the enterprise task fields, but none of the data is displayed > in > fil...

Custom Controls 10-16-04
Hi, I would like to create a custom control .ascx and I'd like to konow how can I put it on a standard CRM form (for example Accounts) Thanks in advance Zsolt There is not a supported way to do this on the standard forms themselves. The closest supported method wuld be to add a new Tab on the left of the page via teh ISV.Confi and have that display your control. Matt Parks MVP - Microsoft CRM ---------------------------------------- ---------------------------------------- On Sat, 16 Oct 2004 01:19:06 -0700, Zsolt Z�mbik <zombikzs@titanium-consulting.net> wrote: Hi, I would ...

Calling a checkbox control with VB
Hi Is there a way I can reference a checkbox item that I can manipulate in VBA. For instance... I have a series of check boxes that I would like to change the properties of with a loop So my checkboxes are called: CheckBox1 CheckBox2 CheckBox3 etc and I want to be able to reference them like so: For i = 1 to 20 "CheckBox" & i.Value = true next i Any ideas? By the format of the name, I assume that they are control toolbox checkboxes. Dim oOLE As Object For Each oOLE In ActiveSheet.OLEObjects If TypeName(oOLE.Object) = "CheckBox" Then ...

Custom total in PivotTable
How do you add a custom total in a PivotTable! For instance: Field1 Field2 Field3 DATA DATA DATA DATA DATA DATA DATA DATA DATA TOTAL (all DATA under Field3 column) I've tried it with grand total but it doesn't work. The only way was to insert new calculated field and grand total, but that gives me two same data columns at the end. Thanks for helping, Boris ...

Customized picklist fields are not showing up in the preview
hi, can you please help me out in the following situation: i have customized my crm 1.2 system in a huge manner. now all customized picklists do not show up in the preview of e.g. opportunity. opening such a related opportunity offers me the possibility to change the picklist field as wanted. note: all built-in picklist fields are showing up in the preview... tia -- Fritz Theiss Did you publish the customizations? And performed an IISReset? After those actions your changes should be visible. Hope this helps, -- Ronald Lemmen Avanade Netherlands "Fritz" wrote: > hi,...

Customizing the Report
Hi, I want to modify the Leads report-Lead List. Where can I find the .RPT file for this report.Can any one help me on this. Thanks in Advance. Regards, Raju Launch Crystal, Go to Enterprise Folders, Under the MSCRM 1.2 folder locate the directory similar tothe categories found on the CRM reports page >-----Original Message----- >Hi, > > I want to modify the Leads report-Lead List. >Where can I find the .RPT file for this report.Can any one help me on this. > >Thanks in Advance. > >Regards, >Raju > > >. > ...

Import custom namespace in XSLT
Hi, I wanted to use the <msxsl:script> tag in a XSLT and include a .Net defined namespace. For ex: System.Web It seems the framework 1.1 does not work in a manner mentioned in the documentation. The framework gives me a run-time exception and does not transform the input file Have you come across such situations and were able to implement the same? Any help would be appreciated. Thanks, Alok Alok Sathaye wrote: > I wanted to use the <msxsl:script> tag in a XSLT and include a .Net defined > namespace. For ex: System.Web Then when declaring and/or using object...

Gloabal Functions
There are many times that a "global" function would be nice instead of writing the code over and over on each "OnChange" event. Something as simple as setting Proper Case has to be added to so many places and any time a small change is needed it is an ordeal implementing due to the number of place this change has to be made. Using the Global.js is not a good solution because most of my users have the Laptop installation...I would have to find a way to push this out to the users every time a change is made. Currently this would have to be manually. --------------...

Problems with "find" function
I sort alot of email and use "find" alot. A few days ago it just stopped working i.e. when I do a find it just scans and scans and produces nothing. This just started. Any thoughts? Thanks Bill ...

Programmatically adding function to copy all incoming mail to public folder (based on sender domain)
Hi all. I would like to be able to (from any client) execute a script (vbs, exe, whatever) that creates a public folder. That's should be pretty easy. The tricky part is that I want the same script to create a rule (?) on the Exchange server that copies all incoming mail from a specific sender domain to that new public folder. Hmm... Let us assume that I have the sufficient credentials for this action hardcoded in the script.. does anyone have a good idea how to do that. I am creating an interface in our ERP software that should be able to see mail correspondance horizontically accross ...

Printing updated customer information on a Receipt
Hello all, I modified the receipt to print the customer's total number of visits and total amount spent (both from the customer record) at the bottom of the receipt. The problem is that it is always printing the values as they stand before the last transaction. Example: if I create a new customer, do a tranaction ($20) and print the receipt, the number of visits and amount spent will show as zero. When I do a second transaction the receipt will print the values (visits 1, amount spent $20) as they stand at the end of the first transaction. Does anyone know how I can force the receip...

Customer Experience Improvement Program
How do I get rid of this annoying reminder at start-up? Many thanks in advance. The easiest way that I have found to get rid of this window is to restrict it in GP security. It's either under the system or Company setting. -- Aaron "vanGP" wrote: > How do I get rid of this annoying reminder at start-up? Many thanks in > advance. > . > Please take a look at my recent blog post. I wrote it in response to your question because I can post pictures on the blog. http://dynamicsconfessions.blogspot.com/2010/07/goodbye-ceip-program.html Kind reg...

Fibonacci function/command in excel?...tia sal
Fibonacci function/command in excel?...tia sal Greetings all, Is thier a Fibonacci function or command built into excel? TIA Please don't post the same message in different newsgroups. It only tends to fragment your answers, and to potentially waste the time of someone answering a post that's already been answered. For tips on using these groups effectively, see http://cpearson.com/excel/newposte.htm In article <IVjpe.62542$lQ3.45092@bignews5.bellsouth.net>, <sal@spp.net> wrote: > Fibonacci function/command in excel?...tia sal > > Greetings all, &...

changing the default type of searching in the find function
When I try to search something in Excel 2003 the default LOOK IN type is FORMULAS. How do I set VALUE as default? Saved from a previous post: Excel tries to help by remembering the last settings you used--except for the first search in that session. You can use that to your advantage. You could make a dummy workbook and put it in your xlStart folder. Have a macro in that workbook that does a find (and sets all the stuff the way you like). Then closes and gets out of the way. Option Explicit Sub auto_open() Worksheets("sheet1").Cells.Find What:="", After:=A...

Internet mail and forwarding to a DL with all Custom Recipients
I have a mailbox that receives e-mails from the Internet. I want to deliver to that mailbox and also a distribution list made up of Custom Receipients (text messaging pagers and cell phones). If the originator of the message is internal, the distribution list gets the message. If the originator is from the Internet, the message cannot be delivered. Errors below with names changed... Sender receives: Friendly Name on Tue, 28 Sep 2004 18:48:16 -0500 A restriction in the system prevented delivery of the message. The MTS-ID of the original message is: c=us;a= ;p=our domain e;l=MAIL040928...

Custom or conditional format to highlight today's date?
Using Excel 2002, I have all 365 days of the year listed in column B, formatted as "03/14/01". When i open the workbook, I would like the current date to be bold and red. Can I do this with a conditional format? I have tried =Today with no success. Thanks Tonso "Tonso" <wthomasss@hotmail.com> wrote in message news:13885af2-777c-43ff-9684-1b5bda8d95d6@o6g2000yql.googlegroups.com... > Using Excel 2002, I have all 365 days of the year listed in column B, > formatted as "03/14/01". When i open the workbook, I would like the > current date to b...

Incremental IDs for custom entities
We have created several custom entities to fit the needs of our customer. For at least one of these entities, we would like to have a simple integer ID attribute that is auto-generated by the CRM application/platform that increments with each new record. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "...