You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Prakash Sridharan <PS...@selectica.com> on 2002/09/02 07:36:53 UTC

How to compile an xsl with static method call into an xsltc trans let?

How do I compile an xsl file, which contains a call to a static method of a
class with package name in to a translet?
	Eg.
	<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:java=" http://xml.apache.org/xslt/java" >
	<xsl:output method="xml" indent="yes"/>

<xsl:variable name="agevar" select="java: com.abc.DateFunctions.today()"/>

	</xsl:stylesheet>

DateFunctions is a class under the package com.abc and today() is a static
method in DateFunctions.  When the above xsl is tried to compile in to
translet, it thows the following exception.

ERROR: Cannot find class 'com'.
javax.xml.transform.TransformerConfigurationException: Could not compile
stylesh
eet
        at
org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTemplates(Trans
formerFactoryImpl.java:515)
        at
org.apache.xalan.xsltc.trax.SmartTransformerFactoryImpl.newTemplates(
SmartTransformerFactoryImpl.java:304)
        at JAXPTransletTransformers.main(JAXPTransletTransformers.java:64)

Can anybody have the answer for this?  Thanks for your answer in advance.

Re: How to compile an xsl with static method call into an xsltc trans let?

Posted by Kai Ojansuu <cl...@pori.tut.fi>.
I don't know if this is the issue, but there's a whitespace in java
namespace URI?


On Mon, 2 Sep 2002, Prakash Sridharan wrote:

> How do I compile an xsl file, which contains a call to a static method of a
> class with package name in to a translet?
> 	Eg.
> 	<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0" xmlns:java=" http://xml.apache.org/xslt/java" >
> 	<xsl:output method="xml" indent="yes"/>
> 
> <xsl:variable name="agevar" select="java: com.abc.DateFunctions.today()"/>
> 
> 	</xsl:stylesheet>
> 
> DateFunctions is a class under the package com.abc and today() is a static
> method in DateFunctions.  When the above xsl is tried to compile in to
> translet, it thows the following exception.
> 
> ERROR: Cannot find class 'com'.
> javax.xml.transform.TransformerConfigurationException: Could not compile
> stylesh
> eet
>         at
> org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTemplates(Trans
> formerFactoryImpl.java:515)
>         at
> org.apache.xalan.xsltc.trax.SmartTransformerFactoryImpl.newTemplates(
> SmartTransformerFactoryImpl.java:304)
>         at JAXPTransletTransformers.main(JAXPTransletTransformers.java:64)
> 
> Can anybody have the answer for this?  Thanks for your answer in advance.
> 


Re: How to compile an xsl with static method call into an xsltc trans let?

Posted by Evgeniy Strokin <ev...@yahoo.com>.
try:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xalan/xsltc/java"
exclude-result-prefixes="java">
......
<xsl:variable name="agevar"
select="java:com.abc.DateFunctions.today()"/>

or 
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xalan/xsltc/java/com.abc.DateFunctions"
exclude-result-prefixes="java">
.....
<xsl:variable name="agevar" select="java:today()"/>

both should work))


--- Prakash Sridharan <PS...@selectica.com>
wrote:
> How do I compile an xsl file, which contains a call
> to a static method of a
> class with package name in to a translet?
> 	Eg.
> 	<xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0" xmlns:java="
> http://xml.apache.org/xslt/java" >
> 	<xsl:output method="xml" indent="yes"/>
> 
> <xsl:variable name="agevar" select="java:
> com.abc.DateFunctions.today()"/>
> 
> 	</xsl:stylesheet>
> 
> DateFunctions is a class under the package com.abc
> and today() is a static
> method in DateFunctions.  When the above xsl is
> tried to compile in to
> translet, it thows the following exception.
> 
> ERROR: Cannot find class 'com'.
>
javax.xml.transform.TransformerConfigurationException:
> Could not compile
> stylesh
> eet
>         at
>
org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTemplates(Trans
> formerFactoryImpl.java:515)
>         at
>
org.apache.xalan.xsltc.trax.SmartTransformerFactoryImpl.newTemplates(
> SmartTransformerFactoryImpl.java:304)
>         at
>
JAXPTransletTransformers.main(JAXPTransletTransformers.java:64)
> 
> Can anybody have the answer for this?  Thanks for
> your answer in advance.
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com