You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Tom Amiro <To...@Sun.COM> on 2002/03/15 20:13:09 UTC

Re: XSLTC + Redirect

Hi Pavel,

Yes, you should be able to use a variable to supply the output file name.

The xalan-dev alias is the one you should be using.

The syntax for using static (we don't support nonstatic) external
java functions can be confusing. Try the followng, it should work.

<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:lxslt="http://xml.apache.org/xslt"
    xmlns:java="http://xml.apache.org/xslt/java"
    exclude-result-prefixes="java">

   <xsl:variable name="rootDir"
    select="concat($baseDir,java:vve.util.xsl.XslUtil.toUpper(string(@Name)))"/>

Tom

Pavel Tavoda wrote:

> Can I output to file with variable name e.g.:
>
> <xsl:variable name="aha" select="concat($rootDir,'enum/',@Name,'.java')"/>
> <xsltc:output file="$aha">package vve.enum ............
>
> Second problem is with external (java) functions e.g.:
> ----------------------------------------------------------------------------
> <xsl:stylesheet
>     version="1.0"
>     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>     xmlns:lxslt="http://xml.apache.org/xslt"
>     xmlns:xsltc="http://xml.apache.org/xalan/xsltc"
>     xmlns:js-util="vve.util.xsl.XslUtil"
>     extension-element-prefixes="js-util">
>
> <lxslt:component prefix="js-util" functions="toUpper firstToUpper
> getBaseDir">
>     <lxslt:script lang="javaclass" src="vve.util.xsl.XslUtil"/>
> </lxslt:component>
>
> <xsl:variable name="rootDir"
> select="concat($baseDir,js-util:toUpper(string(@Name)))"/>
> ----------------------------------------------------------------------------
>
> toUpper is java function. With Xalan is working fine. It's compiled with
> warning:
>
> Compiler warning(s):
>   file:/home/pavelt/Generator/genEnum.xsl: Unable to resolve call to
> function 'vve.util.xsl.XslUtil:toUpper'.
>
> Of course XslUtil is compiled and available on classpath. At runtime I got:
>
> java.lang.RuntimeException: External function
> 'vve.util.xsl.XslUtil:toUpper' not supported by XSLTC.
>     at
> org.apache.xalan.xsltc.runtime.BasisLibrary.runTimeError(BasisLibrary.java:999)
>     at
> org.apache.xalan.xsltc.runtime.BasisLibrary.runTimeError(BasisLibrary.java:1003)
>     at
> org.apache.xalan.xsltc.runtime.BasisLibrary.unresolved_externalF(BasisLibrary.java:413)
>     at genEnum.applyTemplates()
>     at genEnum.applyTemplates()
>     at genEnum.transform()
>     at
> org.apache.xalan.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:547)
>     at
> org.apache.xalan.xsltc.cmdline.Transform.doTransform(Transform.java:210)
>     at org.apache.xalan.xsltc.cmdline.Transform.main(Transform.java:329)
> Translet error(s): External function 'vve.util.xsl.XslUtil:toUpper' not
> supported by XSLTC.
>
> Who is maintaing todo list, or where is some info for developers
> (mailing lists, ...) ???
>
> TNX for help
>
> -----------------------------
> Pavel Tavoda
> tavoda@thr.sh
>
> Tom Amiro wrote:
>
> >Hi Pavel,
> >
> >XSLTC uses the <xsltc:output file="filename" > element to redirect
> >output to a file. For example.
> >
> ><xsl:stylesheet
> >     xmlns:xsl="http://www.w3.org/1999/Transform"
> >     xmlns:xsltc="http://xml.apache.org/xalan/xsltc"
> >     xsl:version="1.0">
> >
> ><xsl:template match="/">
> >  <xsltc:output file="myfile.xml">
> >    ... content to go in file ...
> >  </xsltc:output>
> ></xsl:template>
> >
> ></xsl:stylesheet>
> >
> >Hope this helps.
> >
> >Tom
> >
> >Pavel Tavoda wrote:
> >
> >>At begining excuse me for annoying you directly but I can't find any usefull
> >>information about XSLTC + Redirect.
> >>Do you have some working example ?!?
> >>Even if I try to compile standard Redirect example with XSLTC it doesn't
> >>work
> >>for me (IBM JDK 1.3/Linux).
> >>
> >>[pavelt@tp-linux as]$ java org.apache.xalan.xsltc.cmdline.Compile -x
> >>/opt/Xalan-j_2_3_1/samples/extensions/1-redir.xsl
> >>Compiler error(s):
> >>  line 29: Unrecognised XSLTC extension 'redirect:write'.
> >>
> >>If you can point me somewhere in source code I can help also with
> >>development.
> >>
> >>TNX for your time
> >>
> >>-----------------------------
> >>Pavel Tavoda
> >>tavoda@thr.sh
> >>
> >