javascript - Passing xml node to xsl script -
I am trying to pass XML node on an XML script but it can not recognize it as XML node is. As a result, any operation done on that node is given below. My code sample is
Call in the stylesheet
xls script
function getDetail (node) {var idpl = 1; Var idmt = 2; Var Kiyan = 7 var racine = node.parentNode.parentNode.parentNode; Var nmois = racine.selectSingleNode ("root / pl / user [../../@ id = '" + idpl + "' and ../@id = '" + idmt + "' and @id = '" + Idmois + "'and @ki ='" + KYN + "']");
Below is a sample of XML and xsl
XML & Lt; / Book & gt; & Lt; Book & gt; & Lt; Name & gt; The life of a pie & lt; / Name & gt; & Lt; Qty value = "4" & gt; 5 & lt; / Qty> & Lt; / Book & gt; & Lt; / Books & gt;
xsl
& lt ;? XML version = "1.0" encoding = "ISO-885 9-1"? & Gt; & Lt; Xsl: stylesheet version = "1.0" xmlns: msxsl = "vase: schema-microsoft-com: xslt" xmlns: xsl = "http://www.w3.org/1999/XSL/Transform" xmlns: user = "com .nitish "& gt; & Lt; Msxsl: script applies the language = "javascript" - prefix = "user" & gt; Function getNode (node) {return node; } & Lt; / Msxsl: script & gt; & Lt; Xsl: template match = "/" & gt; & Lt; Html & gt; & Lt; Body & gt; & Lt; H2 & gt; Book Details & lt; / H2 & gt; & Lt; Table xmlns: h = "http://www.w3.org/TR/html4/" limit = "1px" cell exposure = "20px" & gt; & Lt; Xsl: variable name = "rootNode" = "Books" /> & Lt; Xsl: each selection = "// book" & gt; & Lt; Tr & gt; & Lt; Td> & Lt; Xsl: Select Value = "User: Match ($ Routode)" /> & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / XSL: for-each & gt; & Lt; / Table & gt; & Lt; / Body & gt; & Lt; / Html & gt; & Lt; / XSL: Templates & gt; & Lt; / XSL: stylesheet & gt;
And I expect the output to be XML in each cell, instead I get the node text. The selection of exploration to pass XML is to work through signal nodes and other JS functions because the node XML is not, therefore it fails.
If you want to copy the XML node into the result tree, then you and lt respectively; Xsl: Select Copy = "User: Millnode ($ Routode)" />
. xsl: value-of
always creates a text node with the string value of the selected node, it does not automatically copy the node into the output. And it is similar to a piece of tree of any node or result, even if it is a "normal" process that has just been processed with pure XSLT / XPath or one, or you sign the script and then XSLT / XPath Visit
Comments
Post a Comment