Subjects
Home
Xalan extension functions
Fomatting question serializing DOM with pretty print
xalan with pull parser
Cannot find the declaration
Apache Xalan drop support to run on JRE 1 1 x
Why does Doctype change processing of a document
Node set to XML string via Java extensions in Xalan J: possible?
Templates/Transformers + thread safety???
Problem evaluating xpath with muliple prefix with different namespace
remove an arbitrary attribute from xsl output
Xalan3 XSLT 2 0 XPath 2 0 support?
Problem using compiled translets with Xalan !!
Xalan and jstl 1 1 problem with transform tag
NullPointer in DOM2DTM getLocalName
URIResolvers base parameter with xsltc and cascaded imports
Performance problem for Xalan J on intel dual core
Standard libraries in JAXP?
Serializing a DOM tree to XML file, customize entities replacement
Library Conflict Involving BCEL Library
A question on how users are using <xsl:message >
Kevin Cormier as a new Apache Xalan J committer
Struggling to iterate over tokenized string
Xalan count() trouble
Problem with recursive xpath
Error when switching to java 1 5
document( ' ')
Problem with Xalan2 7 0 transformation
cr/lf options
entity encoded XML
can xalan transform 2 xml using one xslt?
Xalan J JIRA defect review Monday October 16, 2006 from 2:00 to 3:30 pm ED
xsl transform with cdata section elements
xslt parameters not expanded
Weird behavior of XPath evaluate()
How to avoid <xsl:message > instruction prints stylesheet file informations ?
Cannot find SimpleTransform subdirectory after installing Xalan J
recover from document not found exceptions
jdk1 5 and Xalan jar differences?
Performance Issue
Error/Bug adding floating point numbers
XPathAPI: eval exp using nodes with default namespace
modifying xalan to output invalid XML
NullPointerException
mege two separate xml nodes into one
Is this a XALAN document identification bug?
is StylesheetRoot really java io Serializable ?
transform() fails for DOMSource but succeeds for StreamSource
Thoughts on Transformer parameter passing
HELP, Xalan and jstl 1 1 problem with transformer
Problem with XPath namespace axis?
string utils:replace deleting search string if replacement string is an HTML
help with enumeration values pls
xalan 2 5 1 vs 2 7 performance question
How to insert/update in XML document
HTML Serialization and Handling of Ampersands in HREF Attributes
XHTML link tag stripping
SystemId Unknown; Line #24; Column #49; java lang NullPointerException
xpath text() help
Apostrophe problem with xalan 2 7 0
How to set variables in XML document?
Links
Home
Oracle database error code ...
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
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
Reply:     1     2  

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.&nbsp; I am not having much luck with XALAN </FONT>
<BR><FONT SIZE=2 FACE="Arial">recognizing any of the &quot;exsl:xyz&quot; or
&quot;str:xyz&quot; 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?).&nbsp; 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 &quot;xalan:nodeset&quot;.&nbsp; 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.&nbsp; Any help would be appreciated.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">2) Also,&nbsp; assuming I get past the above
problem.. Reading through the xalan EXSLT support docs,&nbsp; it appears that
str:replace in particular is not yet supported natively in xalan.&nbsp; 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">&lt;?xml version=&quot;1.0&quot;?&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&lt;xsl:stylesheet version=&quot;1.0&quot; </FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp; xmlns:xsl=&quot;<A HREF="http://www.w3.org/1999/XSL/Transform" TARGET="
_blank">http://www.w3.org/1999/XSL/Transform</A>&quot; </FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp; xmlns:str=&quot;<A HREF="http://exslt.org/strings" TARGET="_blank">http:/
/exslt.org/strings</A>&quot;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp; extension-element-prefixes=&quot;str&quot;&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&lt;xsl:import href=&quot;str/functions/replace
/str.replace.template.xsl&quot; /&gt;</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">&lt;&lt;&lt; Use the str:replace function here &gt
;&gt;&gt;</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Is this the right way? Or is there a better
approach?&nbsp; 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">&lt;?xml version=&quot;1.0&quot;?&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&lt;xsl:stylesheet version=&quot;1.0&quot;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlns:xsl=&quot;<A HREF="http://www
.w3.org/1999/XSL/Transform" TARGET="_blank">http://www.w3.org/1999/XSL/Transform
</A>&quot;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlns:str=&quot;<A HREF="http://exslt
.org/strings" TARGET="_blank">http://exslt.org/strings</A>&quot;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlns:math=&quot;<A HREF="http:/
/exslt.org/math" TARGET="_blank">http://exslt.org/math</A>&quot;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlns:exsl=&quot;<A HREF="http:/
/exslt.org/common" TARGET="_blank">http://exslt.org/common</A>&quot;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlns:xalan=&quot;<A HREF="http://xml
.apache.org/xalan" TARGET="_blank">http://xml.apache.org/xalan</A>&quot;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exclude-result-prefixes=&quot;xalan
&quot; </FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; extension-element-prefixes=&quot;str
exsl&quot;&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; &lt;xsl:template match=&quot;/
&quot;&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsl:if test=
&quot;function-available('exsl:node-set')&quot;&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;xsl:message&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; Function Available ('exsl:node-set')</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/xsl:message&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsl:if&gt;<
/FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsl:if test=
&quot;function-available('xalan:nodeset')&quot;&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;xsl:message&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; Function Available ('xalan:nodeset')</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/xsl:message&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsl:if&gt;<
/FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsl:if test=
&quot;function-available('math:min')&quot;&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;xsl:message&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; Function Available ('math:min')</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/xsl:message&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsl:if&gt;<
/FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsl:if test=
&quot;function-available('str:split')&quot;&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;xsl:message&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; Function Available ('str:split')</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/xsl:message&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsl:if&gt;<
/FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;xsl:if test=
&quot;function-available('xalan:split')&quot;&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;xsl:message&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; Function Available ('str:replace')</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/xsl:message&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/xsl:if&gt;<
/FONT>
<BR><FONT SIZE=2 FACE="Arial">&nbsp; &lt;/xsl:template&gt;</FONT>
<BR><FONT SIZE=2 FACE="Arial">&lt;/xsl:stylesheet&gt;</FONT>
</P>

</BODY>
</HTML>