Passing parameters to XSLT
-
Sorry I have to repeat the question I have a XSLT and I want to pass a parameter runtime with javascript. Here is my XSL <xsl:param name="surname" select="surname"/> <xsl:template match="customer"> <tr> <td><xsl:value-of select="$surname"/></td> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="DOB"/></td> </tr> </xsl:template> I need to populate the surname, I am using the DOM object in javascript Thanks in advance Tony
-
Sorry I have to repeat the question I have a XSLT and I want to pass a parameter runtime with javascript. Here is my XSL <xsl:param name="surname" select="surname"/> <xsl:template match="customer"> <tr> <td><xsl:value-of select="$surname"/></td> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="DOB"/></td> </tr> </xsl:template> I need to populate the surname, I am using the DOM object in javascript Thanks in advance Tony
var xslt = new ActiveXObject("Msxml2.XSLTemplate"); var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument"); var xslProc; xslDoc.async = false; xslDoc.resolveExternals = false; xslDoc.load("YourXsl.xsl"); xslt.stylesheet = xslDoc; var xmlDoc = new ActiveXObject("Msxml2.DOMDocument"); xmlDoc.async = false; xmlDoc.resolveExternals = false; xmlDoc.load(YourXmlString); xslProc = xslt.createProcessor(); xslProc.input = xmlDoc; xslProc.addParameter("surname",valueofSurname)
xslProc.output will give u desired table.. u just need to put it as innerHTML for ur page/form... -
var xslt = new ActiveXObject("Msxml2.XSLTemplate"); var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument"); var xslProc; xslDoc.async = false; xslDoc.resolveExternals = false; xslDoc.load("YourXsl.xsl"); xslt.stylesheet = xslDoc; var xmlDoc = new ActiveXObject("Msxml2.DOMDocument"); xmlDoc.async = false; xmlDoc.resolveExternals = false; xmlDoc.load(YourXmlString); xslProc = xslt.createProcessor(); xslProc.input = xmlDoc; xslProc.addParameter("surname",valueofSurname)
xslProc.output will give u desired table.. u just need to put it as innerHTML for ur page/form...Thanks for that, However it returns me a single value of the valueofSurname. For example if the surname is "Stevens" will populate every surname with "Stevens" in the column. What I need to do is to be able to change the value-of column and select firstname instead of surname. regards Tony
-
Thanks for that, However it returns me a single value of the valueofSurname. For example if the surname is "Stevens" will populate every surname with "Stevens" in the column. What I need to do is to be able to change the value-of column and select firstname instead of surname. regards Tony