  | |  | Newbie questions: How do I get to EXSLT functionality in XALAN? | Newbie questions: How do I get to EXSLT functionality in XALAN? 2003-04-06 - By Ashok Natesan
Two questions:
1) I'm using xalan-j_2_5_D1 on Win2K
I am trying to use the EXSLT functions - the str XSL functions in particular. I am not having much luck with XALAN recognizing any of the "exsl:xyz" or "str:xyz" references
After reading the doc on Extensions and Extension Libraray, I have in my CLASSPATH: xalan.jar; xml-apis.jar; xercesImpl.jar, bsf.jar (where is js.jar, btw?). Do I need anything else in the my classpath? or anything in some config area?
I wrote the xsl test script below.. The ONLY function that reports its available is "xalan:nodeset". None of the other functions below are found.
This is probably something really silly I'm overlooking. Any help would be appreciated.
2) Also, assuming I get past the above problem.. Reading through the xalan EXSLT support docs, it appears that str:replace in particular is not yet supported natively in xalan. I am planning on copying over str.replace.template.xsl from the EXSLT str.zip to the dir containing my other XSL scripts and importing it as follows.
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" extension-element-prefixes="str"> <xsl:import href="str/functions/replace/str.replace.template.xsl" />
<<< Use the str:replace function here >>>
Is this the right way? Or is there a better approach? Thx.
Ashok
============================================================== <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" xmlns:math="http://exslt.org/math" xmlns:exsl="http://exslt.org/common" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="xalan" extension-element-prefixes="str exsl"> <xsl:template match="/"> <xsl:if test="function-available('exsl:node-set')"> <xsl:message> Function Available ('exsl:node-set') </xsl:message> </xsl:if> <xsl:if test="function-available('xalan:nodeset')"> <xsl:message> Function Available ('xalan:nodeset') </xsl:message> </xsl:if> <xsl:if test="function-available('math:min')"> <xsl:message> Function Available ('math:min') </xsl:message> </xsl:if> <xsl:if test="function-available('str:split')"> <xsl:message> Function Available ('str:split') </xsl:message> </xsl:if> <xsl:if test="function-available('xalan:split')"> <xsl:message> Function Available ('str:replace') </xsl:message> </xsl:if> </xsl:template> </xsl:stylesheet>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12"> <TITLE>Newbie questions: How do I get to EXSLT functionality in XALAN?</TITLE> </HEAD> <BODY>
<P><FONT SIZE=2 FACE="Arial">Two questions:</FONT> </P>
<P><FONT SIZE=2 FACE="Arial">1) I'm using xalan-j_2_5_D1 on Win2K</FONT> </P>
<P><FONT SIZE=2 FACE="Arial">I am trying to use the EXSLT functions - the str XSL functions in particular. I am not having much luck with XALAN </FONT> <BR><FONT SIZE=2 FACE="Arial">recognizing any of the "exsl:xyz" or "str:xyz" references</FONT> </P>
<P><FONT SIZE=2 FACE="Arial">After reading the doc on Extensions and Extension Libraray, I have in my CLASSPATH: xalan.jar; xml-apis.jar; xercesImpl.jar, bsf .jar (where is js.jar, btw?). Do I need anything else in the my classpath? or anything in some config area?</FONT></P>
<P><FONT SIZE=2 FACE="Arial">I wrote the xsl test script below.. The ONLY function that reports its available is "xalan:nodeset". None of the other functions below are found. </FONT></P>
<P><FONT SIZE=2 FACE="Arial">This is probably something really silly I'm overlooking. Any help would be appreciated.</FONT> </P>
<P><FONT SIZE=2 FACE="Arial">2) Also, assuming I get past the above problem.. Reading through the xalan EXSLT support docs, it appears that str:replace in particular is not yet supported natively in xalan. I am planning on copying over str.replace.template.xsl from the EXSLT str.zip to the dir containing my other XSL scripts and importing it as follows.</FONT></P>
<P><FONT SIZE=2 FACE="Arial"><?xml version="1.0"?></FONT> <BR><FONT SIZE=2 FACE="Arial"><xsl:stylesheet version="1.0" </FONT> <BR><FONT SIZE=2 FACE="Arial"> xmlns:xsl="<A HREF="http://www.w3.org/1999/XSL/Transform" TARGET=" _blank">http://www.w3.org/1999/XSL/Transform</A>" </FONT> <BR><FONT SIZE=2 FACE="Arial"> xmlns:str="<A HREF="http://exslt.org/strings" TARGET="_blank">http:/ /exslt.org/strings</A>"</FONT> <BR><FONT SIZE=2 FACE="Arial"> extension-element-prefixes="str"></FONT> <BR><FONT SIZE=2 FACE="Arial"><xsl:import href="str/functions/replace /str.replace.template.xsl" /></FONT> </P>
<P><FONT SIZE=2 FACE="Arial"><<< Use the str:replace function here > ;>></FONT> </P>
<P><FONT SIZE=2 FACE="Arial">Is this the right way? Or is there a better approach? Thx.</FONT> </P>
<P><FONT SIZE=2 FACE="Arial">Ashok</FONT> </P> <BR>
<P><FONT SIZE=2 FACE="Arial">================================================== ============</FONT> <BR><FONT SIZE=2 FACE="Arial"><?xml version="1.0"?></FONT> <BR><FONT SIZE=2 FACE="Arial"><xsl:stylesheet version="1.0"</FONT> <BR><FONT SIZE=2 FACE="Arial"> xmlns:xsl="<A HREF="http://www .w3.org/1999/XSL/Transform" TARGET="_blank">http://www.w3.org/1999/XSL/Transform </A>"</FONT> <BR><FONT SIZE=2 FACE="Arial"> xmlns:str="<A HREF="http://exslt .org/strings" TARGET="_blank">http://exslt.org/strings</A>"</FONT> <BR><FONT SIZE=2 FACE="Arial"> xmlns:math="<A HREF="http:/ /exslt.org/math" TARGET="_blank">http://exslt.org/math</A>"</FONT> <BR><FONT SIZE=2 FACE="Arial"> xmlns:exsl="<A HREF="http:/ /exslt.org/common" TARGET="_blank">http://exslt.org/common</A>"</FONT> <BR><FONT SIZE=2 FACE="Arial"> xmlns:xalan="<A HREF="http://xml .apache.org/xalan" TARGET="_blank">http://xml.apache.org/xalan</A>"</FONT> <BR><FONT SIZE=2 FACE="Arial"> exclude-result-prefixes="xalan " </FONT> <BR><FONT SIZE=2 FACE="Arial"> extension-element-prefixes="str exsl"></FONT> <BR><FONT SIZE=2 FACE="Arial"> <xsl:template match="/ "></FONT> <BR><FONT SIZE=2 FACE="Arial"> <xsl:if test= "function-available('exsl:node-set')"></FONT> <BR><FONT SIZE=2 FACE="Arial"> <xsl:message></FONT> <BR><FONT SIZE=2 FACE="Arial"> Function Available ('exsl:node-set')</FONT> <BR><FONT SIZE=2 FACE="Arial"> </xsl:message></FONT> <BR><FONT SIZE=2 FACE="Arial"> </xsl:if>< /FONT> <BR><FONT SIZE=2 FACE="Arial"> <xsl:if test= "function-available('xalan:nodeset')"></FONT> <BR><FONT SIZE=2 FACE="Arial"> <xsl:message></FONT> <BR><FONT SIZE=2 FACE="Arial"> Function Available ('xalan:nodeset')</FONT> <BR><FONT SIZE=2 FACE="Arial"> </xsl:message></FONT> <BR><FONT SIZE=2 FACE="Arial"> </xsl:if>< /FONT> <BR><FONT SIZE=2 FACE="Arial"> <xsl:if test= "function-available('math:min')"></FONT> <BR><FONT SIZE=2 FACE="Arial"> <xsl:message></FONT> <BR><FONT SIZE=2 FACE="Arial"> Function Available ('math:min')</FONT> <BR><FONT SIZE=2 FACE="Arial"> </xsl:message></FONT> <BR><FONT SIZE=2 FACE="Arial"> </xsl:if>< /FONT> <BR><FONT SIZE=2 FACE="Arial"> <xsl:if test= "function-available('str:split')"></FONT> <BR><FONT SIZE=2 FACE="Arial"> <xsl:message></FONT> <BR><FONT SIZE=2 FACE="Arial"> Function Available ('str:split')</FONT> <BR><FONT SIZE=2 FACE="Arial"> </xsl:message></FONT> <BR><FONT SIZE=2 FACE="Arial"> </xsl:if>< /FONT> <BR><FONT SIZE=2 FACE="Arial"> <xsl:if test= "function-available('xalan:split')"></FONT> <BR><FONT SIZE=2 FACE="Arial"> <xsl:message></FONT> <BR><FONT SIZE=2 FACE="Arial"> Function Available ('str:replace')</FONT> <BR><FONT SIZE=2 FACE="Arial"> </xsl:message></FONT> <BR><FONT SIZE=2 FACE="Arial"> </xsl:if>< /FONT> <BR><FONT SIZE=2 FACE="Arial"> </xsl:template></FONT> <BR><FONT SIZE=2 FACE="Arial"></xsl:stylesheet></FONT> </P>
</BODY> </HTML>
|
|
 |