I’ve a file with xml data. And I want to generate a report out of it. I tried to integrate xsl with java script, but can I get a handle of individual data elements in xsl and pass it on to a java script function.
Lets say <value>true</value> is in the xml and I want to pass it on to a javascript function while doing something like this in xsl.
<xsl:for-each select="/valgroup">
<xsl:value-of select="value"/>
</xsl:for-each>
The alternative is to parse the xml in java script and get the values, I’ve got little idea of how to integrate it with xsl.
Are there any java script libraries. I’ve seen my libraries that run on servers(AJAXSLT), but I need something that runs locally.
I’m a new to xslt, so consider this a worthy question.
Most browsers have built in XSL functionality, here is a code snippet
//This bit creates an XSLT processor from a http request (you have to download it first)
You can then perform the transform like so
xmlDoc is the XML file you wish to transform
xslProc is the previously created XSLT Processor
output is the result
Hope this helps