Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am having a problem getting some data (xmlPathNodeIterator) from my XLST-document to a c# webmethod.How can that be done?
Let me try to explain in more details;My XSLT document loads and display the data from an external library, which returns the data as an XPathNodeIterator (that works flawlessly).The idea is, that when the user click a button, the data is sent to a WebMethod, which handles further processing of the data.But I don't know how to get the XML-data from my XSLT-variable to jQuery - It seems that I only receive a string with all the data - not the XML-'tree'.
I am working on a Umbraco 4.5 system.
Anty help, that could point me in the right direction is apprecieated.
When you get the string with all the data is that still in xml format (so <somedata><somechild>.....</somechild></somedata>) ?
if so - when you are in the WebMethod you will need to load the string into an XML object. there are a couple of ways to do this.
depending on what you are doing.
you can load it into an XmlDocument
XmlDocument xmlDoc = new xmlDoc();
from there you can manipulate the xml, do xpath ect https://msdn.microsoft.com/en-us/library/azsy1tw2(v=vs.110).aspx
for looping through XML i prefere to use XElement, which is in System.Xml.Linq - and lets you do linq style things
XElement element = XElement.Parse(xmlString);
To be honest,I don't know in which format, the data I get, is - but I can use it in my XSLT-document to show data, so I would expect it to be XML.
I am fairly new to XSLT, Umbraco and the whole environment, so bear with me, if I am clueless :)
But when I try to display it with <xsl:value-of ..> it only shows me the data, not the keys/nodes.
That is probably normal behavier :)
My data-'provieder' is formatted like this;
public static XPathNavigator getSingleDataRecord(double customerCampaignID, double clientid)
XmlDocument xmlDoc = new XmlDocument();
NameValueCollection icCustomer = .... get data
XmlNode stamDataNode = xmlDoc.CreateElement("basedata");
foreach (String key in icCustomer)
XmlNode keyNode = xmlDoc.CreateElement(key);
In my XSLT file, I store the data in a variable, which I then use to display the data;
<xsl:variable name="custData" select="ExternalLibrary:getSingleDataRecord(9996496, 669)" />
My problem is, that I want to use the data in jQuery, which is calling a WebMethod to store the data on another storage.
But I don't know how I can convert/transter the above to eg. json.
Any pointers are apprecieated.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted