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

Similar Articles

[PageSpeed] 55

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:

How to create a CustomerID field for custom entities
Hi, The customerid field is used in opportunity and case and it allows you to select an account or contact, Great. I want to create this field in a form for a new entity i have made, but i cant work out how. Please help. Hi Michael, Customer is special composite type which is not available for custom entities in CRM 3. You will need to add two separete lookup fields for account and contact. -- uMar Khan :: MS CRM MVP CRM Freelance Consultant Email :: imumar at gmail dot com Blog :: http://umarkhan.wordpress.com MVP :: https://mvp.support.microsoft.com/default.aspx/profile/umar.khan &...

Using crm:5555 rather than a custom hostheader
All I would just like to know what's the recommended solution for a CRM (v3) deployment:- use the standard crm:5555 or a custom hostheader e.g. crm.mycompany.net. Will the custom hostheader cause me any problems? Will external users be able to logon remotely using this host header? Many thanks, Nick. ...

SUMIF function not calculating from closed worksheet
We recently upgraded from Microsoft Office 2000 to 2007. Prior to the upgrade each department would access a spreadsheet that would load data from a common lookup spreadsheet The loading process was performed as follows: The lookup file and each department file would be opened to update the link for that month and then saved and closed. When the department head would open the department file, a question would appear asking if they wanted to update the link, if they answered no the spreadsheet would open and display the calculated data. If they answered yes, the file would o...

Custom Item Movement Report
Anyone out there have a custom item movement report and item movement history report that includes extended description that they would be willing to share? Thanks! -JIM That was a pretty tricky request but I was able to make the change. Download the reports here: http://www.newestech.com/downloads/itemmovement.zip If you cannot download from there shoort me an email and I will send over. Check out our RMS add-ons website in exchange.. http://www.newestech.com/POS/extensions.htm Casey Hanson New West Technologies chanson@newestech.com Hi, Can you do one with "Transferred To"...

newbie question
Excel help says it should be a tab under tools, but I can't see it in my version. I would appreciate any help. Thanks. You must first load the Solver Add-in through Tools>Add-ins. Gord Dibben MS Excel MVP On Sat, 03 Nov 2007 07:46:34 -0700, analyst41@hotmail.com wrote: >Excel help says it should be a tab under tools, but I can't see it in >my version. > >I would appreciate any help. > >Thanks. On Nov 3, 10:56 am, Gord Dibben <gorddibbATshawDOTca> wrote: > You must first load the Solver Add-in through Tools>Add-ins. > > Gord Dibben MS E...

Custom cell formatting
I need to create a custom format for a series of cells that will begin like this. I can't figure out what the code character is fora volitile potentially alpha character. Can anyone help me?? -Monica, Dallas 000000 000001 000002 .... 000009 00000A 00000B 000010 000011 ...... Monica something like this might work for you but you'll need to put all the leading digits in for the entry with the alpha character Regards Trevor "MDavison" <davison@fr.com> wrote in message news:#SD0tUzTEHA.1652@TK2MSFTNGP09.phx.gbl... > I need to create a custom format for a series ...

custom address list for EXTERNAL email addresses
I know it is possible to create a custom address list in Exchange 2003 for internal use but how about for external email addresses outside of a company? Is this possible?? Any help would be appreciated. Thanks in advance. Create contacts for each of the external mail addresses and add them to the distribution list. If add a valid internet email address to the distribution list external people can also send to it. Glen "Steven Peters" <Steven Peters@discussions.microsoft.com> wrote in message news:CBF2F2AE-ABF4-491C-836C-59611375F9F1@microsoft.com... > I know it is pos...

Missing destructor calls on exit
Sorry if this is well covered ground, but many of the tactics I tried to employ from other threads didn't pan out (and most importantly allow me to understand _why_ this is happening). I have a doc/view mdi app. My runtime library is multi-threaded debug DLL. On exit of the application (via file..exit or the X button), I get a bunch of memory leaks. Some from a modeless dialog (whose destructor is not called), the CMainFrame itself (all 2K), the CDocManager, CMultiDocTemplate, and a CCmdTarget (these are created by the CWinApp I believe). A breakpoint gets hit in my CMainFrame (which ...

Can I create sub-functions in a cross-functional flowchart?
Trying to create a template for my organization to map processes to. Goal is to map the organization to the 'function bars' in Visio's cross-function flowcharts. However, I would like to create some 'sub-functions' for lower organizational elements (i.e. divisions under a department). Is this possible?? ...

Can I set my custom views on Pivot table
I want to get Pivot table data on my invoice, is it possible to set custom views so that I can get Pivot table results on invoice format, I've tried views that offer excel but it doesn't offer custom views please help Thanks ...

Z Report Customer Count vs Hourly Sales
My Z report shows customer count of 380 and hourly sales total of 384. Why the difference? This happens all the time. Thanks Your glass is: Half-Empty : Do folks at register forget to ask "Is there anything else I can help you with?" Half-Full: Your impulse items at POS are working -- better late than never! sammy wrote: > My Z report shows customer count of 380 and hourly sales total of > 384. Why the difference? This happens all the time. > Thanks -- ______________________________________________________ Larry Leveen OlyBikes Locally-Owned B...

More than 7 If Functions Example is IF(A2="Bongaigaon", B2*40, ..
i want to use if Command in which 19 times If Function to be used for Example of the Function is =IF(A2="Bongaigaon", B2*40, IF(A2="Dhemaji", B2*100, IF(A2="Dhubri", B2*50, IF(A2="Dibrugarh", B2*65, IF(A2="Golaghat", B2*50, IF(A2="Guwahati", B2*20, IF(A2="hojai", B2*50, IF(A2="Jorhat", B2*60, If(A2="Kharupetia", B2*50, up to 19 times Hi - You really need to create a table with the 19 names in one column and, in the column to the right, the vaues associated with each name. That would ...

Custom CRect Question
I have a custom rectangle class that inherits from CRect: class CCustomRect : public CRect { private: CPoint m_maxPt; COLORREF m_color; TCHAR text[50]; public: CCustomRect(RECT* source, CPoint pt, COLORREF rgb); RECT* RectBase(); void Update(RECT* r); } Inheritance has worked well until I found myself needing to create the RectBase function (above) to return the rectangle dimensions. CRect does not seem to have any methods that can be called to return the base class's RECT value. I could take CRect::Size and construct a rectangle to return, but this seems a bit much. My...

Installing Outlook 2003 using Custom Wizard
I am installing Outlook 2003 using the custom installation wizard. This was working fine for some time. Now, someone in my group must have modified the settings because when I install Office using this MST file the local Outlook Contacts are not showing in the GAL. When I go to the properties and try to add it the check box for "Show this folder as an email address book" is greyed out. I have to go in and manually add the Outlook Address book. Can anyone tell me what setting I can change in my Outlook custom install settings for the MST to make this available by default? ...

Incomplete Escaping Functionality??
Hello All... I am in an app that needs to write out an XML document for transmittal to an outside organization. All good and fine... I create the XmlDocument object, append all my nodes, and values etc etc... and it all works. Now I go to save the file... I tried two methods... MyXmlDocument.Save(filename) and My.Computer.FileSystem.WriteAllText(filename, MyXmlDoc.OuterXml, False) The problem comes in with XmlDocument.OuterXml. According to XML, there are 5 characters which need to be escaped... Ampersand, LessThan, GreaterThan, Apostrophe and DoubleQuote. XmlDocument.OuterXml, esca...

custom controls
Last time I checked VS 2002, MFC didn't support as many custom controls as you could use with .NET. (Not sure of VS2005 added more support.) I was wondering if there was a site that sold unmanaged MFC controls. I know you can find some for free on codeguru and such, and I have been looking there too, but I am also looking to see what else is avaliable that might save me some time. Thanks. Depends on what kind of control you want? Try http://www.codejock.com http://www.roguewave.com/products/stingray/ AliR. "quat" <spam@void.com> wrote in message news:pVDUf.94...

How do you access custom entities with javascript?
I'm about to pull my hair out. I have no problem accessing system attributes, but the second I try to get or set a value for a custom attribute, I get an error (null or not an object). My problem is I am checking the changed input to a field, and if it fails a certain criteria, I need to reset the original value. The best way I could think to do this was to store this value in a new attribute and then restore it if needed. Any help would be greatly appreciated. jsankovitch@gmail.com wrote: > I'm about to pull my hair out. I have no problem accessing system > attributes, b...

Custom control with use resource file
Hello, How can I create (and display on CDialog or CFormView) custom control which consist of rc file. I want do it "dialog in dialog" For example I have dialog in resource file (with has some buttons, text, checkbox etc.). I would like create this dialog as custom control. And display this custom control (which look as same as dialog it is mean has buttons, text, checkbox etc) in another CDialog or CFormView. Thank you, Mariusz MariuszK wrote: > Hello, > How can I create (and display on CDialog or CFormView) custom control > which consist of rc file. I want do it "...

Olutlook 2002
I've used the customize settings feature in Outlook Today to use "Summer Theme" but each time I start up it comes up in the standard theme. I can open the customize settings and close it and "Summer Theme" is there, but then I switch to mail and back to Outlook Today, I'm back to the standard theme. I've checked the registry and the setting is supposed to yield Summer Theme. Anyone know what's causing this problem? I really like the Summer Theme better than standard. Any help would be appreciated. Thanks, Don ...

Why does Letter Merge not work with custom fields in template ?
Hi , when I do a letter merge with my own template(which has its own fields), Letter Merge doesn't work properly. I did some investigation and found that I need to go to Data Fields and select the fields that I have added in my template (apart from the ones selected by default). If I do that it works properly. Ideally, when we share a template, it should work for others without having to select data fields. Users can't be expected to open the template everytime, see the fields there and select it in Data Fields. Can anyone tell me why it behaves like this? Is there an alternative? Th...

ROUND Function with other function
Hi, I have this formula: =IF(R8>0,CONCATENATE("+",R8),R8) and the results shows me for example: +11.6 but what I really want t show is +12. I've been trying to put the "Round" function at a few places in th formula but it doesn't work. The closest I got was with this formula: =ROUND(IF(R8>0,CONCATENATE("+",R8),R8),0) where it showed me 12, without the "+" sign before.... Can anyone help me ? Thank -- Outapi ----------------------------------------------------------------------- Outapin's Profile: http://www.excelforum.com/member...

Math Function from Field Before Update
Have any of you written a function that you would be willing to share that performs math on text entered into a field before it is stored in the table? For instance, it would be helpful for a user to enter quantities of inventory into a field like 45+56+48 or 14+2*15. Then the function would calculate the total to be returned to the field to be saved. I'm sure I could come up with something, but I'm equally sure that someone has already invented this "wheel" before. Thanks in advance. Doctor wrote: > Have any of you written a function that you would be...

Calling a DLL
Hi All, I'm trying to call a dll from within Excel 2000. This is what I�m doing:in cell B1 I include this code: =CALL("MyDll";"Mult";"JJJ!";C1;D1) in C1 and C2 there are any integers. what I get is the FALSE word in cell B1. Inside the DLL there is only one function (Mult) that multiplies two integers and returns another integer. It works ok out of excel.Any comments are welcome.Augusto. http://support.microsoft.com/default.aspx?scid=kb;en-us;213554 may have some useful information. Your DLL must use _stdcall calling convention, or you cannot use it. ...

TLS to 1 customer
We have 2 2000 servers and 1 5.5 server. On the 2000 servers I was able to add in a connector, specify the address space for the specific domain I want to send to and specify the TLS encryption. I am not familiar with 5.5 enough to find how to do this. What is the best way? On Fri, 30 Jun 2006 06:08:02 -0700, Ryan <Ryan@discussions.microsoft.com> wrote: >We have 2 2000 servers and 1 5.5 server. On the 2000 servers I was able to >add in a connector, specify the address space for the specific domain I want >to send to and specify the TLS encryption. > >I am not fa...

GP10.0 Customization
I have heard that Dexterity Certification is no more avalible and in GP10.0 it will be completly replaced.. Can any one tell me what is that reality behind that. The CSE (Certified Software Engineer) and CID (Certified Integration Developer) for Dexterity Certifications were discontinued a few years ago. Microsoft Dynamics GP 10.0 will still have its core Dexterity based and this will probably remain so for the current generation of Great Plains. The current generation will be supported until at least 2013. Dexterity is still the best language for seamless, tight integrations with Gre...