473,493 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Question about XSLTransform and extensions

I have the following class and function:

class MathExtension{
public double max(double a,double b){
Console.WriteLine("math:max("+a.ToString()+","+b.T oString()+")");
return Math.Max(a,b);
}
}

public void Transform(XmlDocument xml,XmlDocument xsl){
XPathDocument xp_doc;
XslTransform xsl_trans;
XsltArgumentList xslArg = new XsltArgumentList();
MathExtension ex=new MathExtension();
// add extension
xslArg.AddExtensionObject("xalan://java.lang.Math",ex);
// create and load objects
xp_doc=new XPathDocument(new XmlNodeReader(xml));
xsl_trans=new XslTransform();
xsl_trans.Load(
new XmlNodeReader(xsl),null,Assembly.GetCallingAssembl y().Evidence
);
// do transformation
xsl_trans.Transform(xp_doc,xslArg,new XmlNodeWriter(FDoc,true),null);
}

when I do a transformation and use something like:

<xsl:value-of select="my_obj:max(number(@an_attribute),0.01)"/>

The first parameter always says "NaN", what am I doing wrong? Is there
a problem with the number() function? is there another way to do it?

Nov 12 '05 #1
1 1086


fa**********@gmail.com wrote:

when I do a transformation and use something like:

<xsl:value-of select="my_obj:max(number(@an_attribute),0.01)"/>

The first parameter always says "NaN", what am I doing wrong?


What is the context node in that xsl:value-of select expression, does it
have an attribute named @an_attribute, which value does the attribute have?

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 12 '05 #2

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

Similar topics

5
611
by: Victor Fees | last post by:
I have an XML string in a database that I would like to display using XSLT. All of that works like a champ, but I can't figure out how to embed the XML inside an ASPX page. For example, I have...
2
5800
by: Anthony Bouch | last post by:
Can anyone tell me why I receive the following compiler warning after having recently upgraded to VS.Net 2003 and .Net 1.1? Warning CS0618: 'System.Xml.Xsl(System.Xml.XPath.IXPathNavigable,...
1
1859
by: Rodger McNab | last post by:
While parsing xpath expressions within an XSLT document the .NET XslTransform class seems to delete the first "/" after a "]" within an expression containing a "|". This problem can be demonstrated...
1
1940
by: NicoAgenci | last post by:
Hello, I have a page in .net (DEFAULT.ASPX), i load a XmlDocument, and a XslTransform to Add a XsltArgumentList (with the param : urlPage), and send all to a <asp:xml> in the page. The...
2
6003
by: Graham Pengelly | last post by:
Hi I am trying to transform on System.Xml.XmlDocument into another using XslTransform without writing the object out to a file. I am guessing it should work something like this... public...
3
2258
by: Steve | last post by:
Is there any way of specifying the startMode when using the xslTransform class? We are updating code which used msxml to the system.xml classes but can find no way to specify the startMode. We...
1
1121
by: shell shell via .NET 247 | last post by:
How do you get the underlying Xslt stylesheet content from an XslTransform object that has been created and loaded with a stylesheet file or some text? Assume a method will create an XslTransform...
1
2770
by: manlio | last post by:
how can I load a XSL string (not an xsl file!!) with XslTransform ??? If I use the code: // Create a new XslTransform class and load the stylesheet XslTransform myXslTransform = new...
0
223
by: Mike | last post by:
Hello, I am using XML webcontrol on my form to display my transformed xml as html. I am having a warning about using XslTransform (being obsolete). The warning told me to use the new class...
0
7157
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
7195
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...
1
6873
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...
0
7367
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4889
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1400
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
285
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.