I need help please.
I have javacript defined in an xslt file called file_a.xsl.
I have also a second xslt file called file_b.xslt. I pass the two xsl files as a parameter to an html file(called Ajax_display.html)which is to call the XSLT for some XSLT processing. Unfortunately I get an error which states that the xsl data is not read correctly.
Her is the html file Ajax_display.html:
Her is file_a.xsl:
Her is file_b.xsl:
I have been struggling to call the sayHello() function defined in file_a.xsl from file_b.xsl.
I will be happy for a help in solving this problem
The usual way to use a template from one XSLT document in another XSLT document is via the <xsl:include> or <xsl:import> elements.
Edit: um... I see you already did that:
But not surprisingly, this won't include anything from file_a.xsl. You used the wrong file name.
Joined: Jun 13, 2011
Thanks for the help. I have corrected the file name by using file_a.xsl as the included file instead of helloXSL.xsl.
I later found out that the Ajax_display.html cannot run in the browser when I embed some ajax code in file_b.xsl.
If this can be done, I will be happy for some hints about how that can be done
Your overall layout of xsl documents and functionality as such use msxsl extension function. It will be operative in msxml2 technology. It won't be working if you now happen to execute the transformation in application written in java, rather than as asp application, using probably, but not necessary, xalan xslt processor. You cannot change a bit this or a bit that to make it work. You can look into xalan extension function for the same functionality. If it is only "hello xsl" type of call, it should not be that complicated.
 Write a public class (X, say) with a static member (say sayHello()) that return string "hello xsl".
 Bind an extension namespace "http://xml.apache.org/xslt/java" with prefix (arbitrary, say, java) in the xslt document (your file_b.xsl) in the root element xsl:stylesheet.
 Instead of foo:sayHello(), you put java:X.sayHello() instead.
 If there involve some package as well, the path pointing to the class X should be adjusted.
That is about it.