You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Michael J. Hudson" <mh...@blueprinttech.com> on 2001/08/08 00:43:09 UTC

Ant/Trax/Redirect problem

This could just be a TRAX issue... but, it's ANT's use of TRAX that's
causing the problem... so, I'll state my problem here.

In my ANT build.xml file, I switched all my <style> elements so that
the attribute 'processor' equalled "trax" instead of "xalan".  This
seemed to work for most XSLT files except one's with the redirect
extension.  

Now, I'm on a PC, and a friend is on a Linux-box... and his seems to
work, and mine doesn't for some reason.  I look through all the docs
on Apache on XALAN... and it reads as if REDIRECT should work with the
Xalan 2 stuff...  the only exception is if in conjunction with XSLTC...
however, I can't for the life of me see that ANT or anything else is
using XSLTC.  Is ANT doing something under the cover???

I don't know?  Has anyone else hit upon this problem?

When I run ANT on an XML file with REDIRECT... I get:

    [style] Transforming into G:\Working\main\echo\temp
file:G:/Working/main/echo/meta/xslt/XML2ENUM.xslt; Line 25; Column
42;     [styl
e] Failed to process
G:\Working\main\echo\meta\xml\IIMS_INTERNAL_META.xml

So, it seems to print out the line and column where the REDIRECT is
found, and then just fails.

Any clues?

-------------------------------------
Michael J. Hudson
Software/Framework Engineer
mhudson@blueprinttech.com

cell-phone: 703.362.8039
voice-mail: 703.827.0638 ext. 4786
fax: 703.734.0987

Blueprint Technologies
"Great software starts with great architecture"
http://www.blueprinttech.com

Re: Ant/Trax/Redirect problem

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 08 Aug 2001, Michael J. Hudson <mh...@blueprinttech.com>
wrote:

>> file:G:/Working/main/echo/meta/xslt/XML2ENUM.xslt isn't a valid
>> file url it should be file:///G:/Working...
> 
> That "file:G:/Working..." is not a value being passed in... it's
> something generated by either ANT or the XSLT processor... that's
> stating the file where the exception is being caused.

I think it is Ant's TraXLiaison class, should be fixed in CVS - could
you please recheck with the upcoming beta release of 1.4 (as soon as
it is available)?

Stefan

Re: Ant/Trax/Redirect problem

Posted by "Michael J. Hudson" <mh...@blueprinttech.com>.
> You might want to include the target and the relevant fragment from the stylesheet.

> I'm not sure where the error message is generated but if that is a value that's being passed as a file url then it shouldn't work.
> 
> file:G:/Working/main/echo/meta/xslt/XML2ENUM.xslt isn't a valid file url
> it should be file:///G:/Working...

That "file:G:/Working..." is not a value being passed in... it's
something generated by either ANT or the XSLT processor... that's
stating the file where the exception is being caused.

I have had this all work, when I use the command line
org.apache.xalan.xslt.Process class.

I don't know if this will help much... but
a swath of my Ant target is this:

	<target name="xml2enum" depends="init">
                <delete dir="${temp.dir}"/>
		<style basedir="meta" 
                       destdir="${temp.dir}" 
                       extension=".enum" 
                       processor="trax" 
                       style="xslt/XML2ENUM.xslt" 
                       includes="xml/*.xml"/>
	</target>


the section in my xslt where it fails is this:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0"
    xmlns:lxslt="http://xml.apache.org/xslt"
    xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
    extension-element-prefixes="redirect"> 

......

<xsl:template match="ServiceSystemSpecification">
  <xsl:for-each select="DataType/Enumeration">
      <xsl:variable name="fileName" select="concat(./@name,  '.java')"/>
      <xsl:variable name="fullpath" select="concat($outputDir,
'/Java/Enumeration/', $fileName)"/>
      <xsl:text>Created </xsl:text><xsl:value-of
select="$fullpath"/><xsl:text>
</xsl:text>
      <redirect:write select="$fullpath">
	<xsl:text>Something </xsl:text><xsl:value-of select="$fullpath"/>
        <xsl:call-template
name="JAVAGeneratedFileHeader"></xsl:call-template>  
        <xsl:call-template name="XML2ENUM"/>
      </redirect:write>
  </xsl:for-each>
</xsl:template>

The XML file is a big file... and probably not needed to figure out what
is wrong... because the actual
execution against the XML is working fine...  it's when it hits that
<redirect:write> that it coughs
up on.


I can switch the processor attribute in the ANT file from "trax" to
"xalan" and everything works fine.

When it is in "trax" mode... this is the error I get after it tries to
apply the stylesheet:

xml2enum:
   [delete] Deleting directory G:\Working\main\echo\temp
    [style] Transforming into G:\Working\main\echo\temp
    [style] Loading stylesheet
G:\Working\main\echo\meta\xslt\XML2ENUM.xslt
    [style] Transforming into G:\Working\main\echo\temp
file:G:/Working/main/echo/meta/xslt/XML2ENUM.xslt; Line 25; Column
42;     [styl
e] Failed to process
G:\Working\main\echo\meta\xml\IIMS_INTERNAL_META.xml

BUILD FAILED

G:\WORKING\main\echo\build.xml:391:
javax.xml.transform.TransformerException


The Line 25; Column 42; is the end of the line where the REDIRECT
command is found.  The IIMS_INTERNAL_META.xml is the XML file that is
being processed.


Now... I know the new XALAN 2.x also has XSLTC stuff inside of it. 
However, theoretically... you need to somehow explicitly state that you
want to use it for your transformations for the TRaX stuff to use it. 
And I know from the Release Notes... XSLTC doesn't support REDIRECT. 
But TRaX IS SUPPOSE to support it.
Is somehow XSLTC being used for the transformations instead of just pure
TRaX???

All this stuff isn't working on my and another colleague's PC machine. 
However, another guy has it running fine on a Linux-box.


Thanks!
-----------------
Michael J. Hudson
Software/Framework Engineer
mhudson@blueprinttech.com

cell-phone: 703.362.8039
voice-mail: 703.827.0638 ext. 4786
fax: 703.734.0987

Blueprint Technologies
"Great software starts with great architecture"
http://www.blueprinttech.com


--------------------Brett Knights wrote:
> 
> You might want to include the target and the relevant fragment from the stylesheet.
> 
> I'm not sure where the error message is generated but if that is a value that's being passed as a file url then it shouldn't work.
> 
> file:G:/Working/main/echo/meta/xslt/XML2ENUM.xslt isn't a valid file url
> it should be file:///G:/Working...
> 
> > -----Original Message-----
> > From: Michael J. Hudson [mailto:mhudson@blueprinttech.com]
> > Sent: Tuesday, August 07, 2001 3:43 PM
> > To: ant-user@jakarta.apache.org
> > Subject: Ant/Trax/Redirect problem
> >
> >
> >
> > This could just be a TRAX issue... but, it's ANT's use of TRAX that's
> > causing the problem... so, I'll state my problem here.
> >
> > In my ANT build.xml file, I switched all my <style> elements so that
> > the attribute 'processor' equalled "trax" instead of "xalan".  This
> > seemed to work for most XSLT files except one's with the redirect
> > extension.
> >
> > Now, I'm on a PC, and a friend is on a Linux-box... and his seems to
> > work, and mine doesn't for some reason.  I look through all the docs
> > on Apache on XALAN... and it reads as if REDIRECT should work with the
> > Xalan 2 stuff...  the only exception is if in conjunction
> > with XSLTC...
> > however, I can't for the life of me see that ANT or anything else is
> > using XSLTC.  Is ANT doing something under the cover???
> >
> > I don't know?  Has anyone else hit upon this problem?
> >
> > When I run ANT on an XML file with REDIRECT... I get:
> >
> >     [style] Transforming into G:\Working\main\echo\temp
> > file:G:/Working/main/echo/meta/xslt/XML2ENUM.xslt; Line 25; Column
> > 42;     [styl
> > e] Failed to process
> > G:\Working\main\echo\meta\xml\IIMS_INTERNAL_META.xml
> >
> > So, it seems to print out the line and column where the REDIRECT is
> > found, and then just fails.
> >
> > Any clues?
> >
> > -------------------------------------
> > Michael J. Hudson
> > Software/Framework Engineer
> > mhudson@blueprinttech.com
> >
> > cell-phone: 703.362.8039
> > voice-mail: 703.827.0638 ext. 4786
> > fax: 703.734.0987
> >
> > Blueprint Technologies
> > "Great software starts with great architecture"
> > http://www.blueprinttech.com
> >

RE: Ant/Trax/Redirect problem

Posted by Brett Knights <br...@knightsofthenet.com>.
You might want to include the target and the relevant fragment from the stylesheet.

I'm not sure where the error message is generated but if that is a value that's being passed as a file url then it shouldn't work.

file:G:/Working/main/echo/meta/xslt/XML2ENUM.xslt isn't a valid file url
it should be file:///G:/Working...



> -----Original Message-----
> From: Michael J. Hudson [mailto:mhudson@blueprinttech.com]
> Sent: Tuesday, August 07, 2001 3:43 PM
> To: ant-user@jakarta.apache.org
> Subject: Ant/Trax/Redirect problem
> 
> 
> 
> This could just be a TRAX issue... but, it's ANT's use of TRAX that's
> causing the problem... so, I'll state my problem here.
> 
> In my ANT build.xml file, I switched all my <style> elements so that
> the attribute 'processor' equalled "trax" instead of "xalan".  This
> seemed to work for most XSLT files except one's with the redirect
> extension.  
> 
> Now, I'm on a PC, and a friend is on a Linux-box... and his seems to
> work, and mine doesn't for some reason.  I look through all the docs
> on Apache on XALAN... and it reads as if REDIRECT should work with the
> Xalan 2 stuff...  the only exception is if in conjunction 
> with XSLTC...
> however, I can't for the life of me see that ANT or anything else is
> using XSLTC.  Is ANT doing something under the cover???
> 
> I don't know?  Has anyone else hit upon this problem?
> 
> When I run ANT on an XML file with REDIRECT... I get:
> 
>     [style] Transforming into G:\Working\main\echo\temp
> file:G:/Working/main/echo/meta/xslt/XML2ENUM.xslt; Line 25; Column
> 42;     [styl
> e] Failed to process
> G:\Working\main\echo\meta\xml\IIMS_INTERNAL_META.xml
> 
> So, it seems to print out the line and column where the REDIRECT is
> found, and then just fails.
> 
> Any clues?
> 
> -------------------------------------
> Michael J. Hudson
> Software/Framework Engineer
> mhudson@blueprinttech.com
> 
> cell-phone: 703.362.8039
> voice-mail: 703.827.0638 ext. 4786
> fax: 703.734.0987
> 
> Blueprint Technologies
> "Great software starts with great architecture"
> http://www.blueprinttech.com
>