473,385 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

XSLT extension function fails when not running under aspnet_wp.

Greetings

I have an object that I use with an XSLT. I add the object to the XSLT
using addExtensionObject on the XsltArgumentList.

I built a test aspx to test it. It works great. Then I tried using it
via NUnit, and it always fails. (I've tried starting NUnit within the
project, and also just running it direct. Also, I think the fact that
it's NUnit is inconsequential... I'm guessing that this would probably
happen with any program trying to run it.)

-- Exceptions ---
Outer Exception: System.Xml.Xsl.XsltException: Function
'xsltgenerator:RegularExpressionTest()' has failed.

Inner Exception: System.ArgumentException: Object type cannot be
converted to target type.

I don't understand why it can be converted to the proper target type
when instantiated from an aspx, but not from NUnit.

-- RegularExpressionTest method --
Public Function RegularExpressionTest(ByVal nodes As
System.Xml.XPath.XPathNodeIterator, ByVal sExpression As String) As
String
Return "crap"
nodes.MoveNext()
Return nodes.Current.Value + "[validator:RegExMatch('" +
sExpression + "', .)=0]"
End Function

The "return crap" is a test. It didn't help.

Any ideas? Could it be security related, and if so, what do I need to
know? I didn't have any luck searching MSDN for it.

Thank you.


--- Partial Test Code ---
docData is my source System.Xml.XmlDocument.
GetRulesXSLT() returns a System.Xml.Xsl.XslTransform()

Dim xtRuleXSLT As XslTransform
Dim docResponseXML as New XmlDocument()

xtRuleXSLT = GetRuleXSLT()

Dim args As New XsltArgumentList()
args.AddExtensionObject("urn:validator", New XMLValidator())
docResponseXML.Load(xtRuleXSLT.Transform(New XPathDocument(New
XmlNodeReader(docData)), args))

--- Full Exception ---
System.Xml.Xsl.XsltException: Function
'xsltgenerator:RegularExpressionTest()' has failed. --->
System.ArgumentException: Object type cannot be converted to target
type.
at System.Reflection.RuntimeMethodInfo.InternalInvoke (Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean
verifyAccess)
at System.Reflection.RuntimeMethodInfo.InternalInvoke (Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture, Boolean verifyAccess)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters,
CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[]
parameters)
at System.Xml.Xsl.FuncExtension.Invoke(XsltContext xsltContext,
Object[] args, XPathNavigator docContext)
at System.Xml.XPath.XsltFunction.InvokeFunction(XPath Navigator qy)
--- End of inner exception stack trace ---
at System.Xml.XPath.XsltFunction.InvokeFunction(XPath Navigator qy)
at System.Xml.XPath.XsltFunction.getValue(XPathNaviga tor qy,
XPathNodeIterator iterator)
at System.Xml.XPath.StringFunctions.toString(XPathNav igator
qyContext, XPathNodeIterator iterator)
at System.Xml.XPath.StringFunctions.getValue(XPathNav igator qy,
XPathNodeIterator iterator)
at System.Xml.XPath.StringFunctions.Concat(XPathNavig ator qy,
XPathNodeIterator iterator)
at System.Xml.XPath.StringFunctions.getValue(XPathNav igator qy,
XPathNodeIterator iterator)
at System.Xml.XPath.XPathNavigator.Evaluate(XPathExpr ession expr,
XPathNodeIterator context)
at System.Xml.Xsl.Processor.ValueOf(ActionFrame context, Int32 key)
at System.Xml.Xsl.ValueOfAction.Execute(Processor processor,
ActionFrame frame)
at System.Xml.Xsl.ActionFrame.Execute(Processor processor)
at System.Xml.Xsl.Processor.Execute()
at System.Xml.Xsl.ReaderOutput.Read()
at System.Xml.XPath.XPathDocument.ReadChildNodes(XPat hContainer
parent, String parentBaseUri, XmlReader reader, PositionInfo
positionInfo)
at System.Xml.XPath.XPathDocument.ReadChildNodes(XPat hContainer
parent, String parentBaseUri, XmlReader reader, PositionInfo
positionInfo)
at System.Xml.XPath.XPathDocument.ReadChildNodes(XPat hContainer
parent, String parentBaseUri, XmlReader reader, PositionInfo
positionInfo)
at System.Xml.XPath.XPathDocument.ReadChildNodes(XPat hContainer
parent, String parentBaseUri, XmlReader reader, PositionInfo
positionInfo)
at System.Xml.XPath.XPathDocument.ReadChildNodes(XPat hContainer
parent, String parentBaseUri, XmlReader reader, PositionInfo
positionInfo)
at System.Xml.XPath.XPathDocument.Load(XmlReader reader)
at System.Xml.XPath.XPathDocument..ctor(XmlReader reader, XmlSpace
space)
at System.Xml.Xsl.XslTransform.Load(XmlReader stylesheet,
XmlResolver resolver)
at System.Xml.Xsl.XslTransform.Load(XmlReader stylesheet)
at Lydian.Framework.Validator.Validator.BuildRuleXSLT () in
C:\Development\VB Components\MiniComp\Validator\Validator.vb:line 142
Nov 20 '05 #1
0 880

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

Similar topics

1
by: Gordan | last post by:
I'm running Apache/1.3.33 (Win32) PHP/5.0.4 on WinXP in my php.ini I uncommented the extension=php_xsl.dll line. When running phpinfo() I have the following section on XSL xsl XSL enabled...
3
by: Peter Sparago | last post by:
(Sorry in advance for the long post.) Hi, I'm having a great deal of difficulty buiding a Python COM extension. I am using the MSHTML ActiveX control in my application but I need to interact...
3
by: Justine Hlista | last post by:
I'm using xalan-j_2_6_0 and trying to get an example from Michael Kay's book to work: <xsl:template match="/"> <xsl:variable name="rainbow"> <color>red</color> <color>blue</color>...
7
by: RC | last post by:
First, let me say I couldn't find a group discuss XML/XSLT. So I only choose the closest groups to post this message. Here is part of my *.xsl file <xsl:stylesheet...
0
by: Jay Allard | last post by:
Hello I posted this in the vb.net group on the 2/25/2004, but didn't get any response. Here's attempt 2. Does anyone know of a more appropriate place to post this? One new piece of...
14
by: David Blickstein | last post by:
I have some XML documents that I want to open in a web browser and be automatically translated to HTML via XSLT. I'm using an xml-stylesheet processing command in a file called "girml.xml". ...
6
by: Jain, Pranay Kumar | last post by:
Hi All, We have created a simple application that takes a dataset and generates the data in Excel schema format. It uses an xslt file to do the transformation for excel 2002 and so on. We are...
2
by: David Laub | last post by:
A transform that works fine in XMLSPy fails when I run it under dot net. I've run many other transforms successfully in dot net so there is something "special" about this transform I just...
0
by: daniele.balducci | last post by:
Hi All, I'm experiencing troubles in a simple .net web application. The applicatione is made up by a single form looping to move some files to a different folder . the main loop is as follows...
1
by: Peran | last post by:
If I create a simple xslt stylesheet I can quickly test this in VS2005 by pressing the "Show XSLT Output" button rather than running the whole solution. If I then create a xslt stylesheet with...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.