You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jonathan Shipley <js...@nomensa.com> on 2002/08/16 18:52:09 UTC

style / passing in filename

I would appreciate an answer on how to pass in the current filename as a
param to the stylesheet in a batch style task; even if, as I suspect, it
is not possible.

Is there really no-one involved with the presentation layer?

Thanks in advance,

--
Jonathan Shipley



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: style / passing in filename

Posted by Matt Benson <gu...@yahoo.com>.
You should be able to do this with <foreach> from
ant-contrib.

-Matt

--- Jonathan Shipley <js...@nomensa.com> wrote:
> No, sorry. ${ant.file} gives the name of the build
> file. What I am after
> is the name of the current file being processed.
> E.g.
> 
>  <style extension=".html" basedir="xml"
> style="style/page.xsl"
> 	destdir="build" includes="*.xml"
> excludes="nav.xml">
> 	<param name="srcXml" expression="${current.file}"/>
>  </style>
> 
> The style task is operating on a whole directory of
> xml files. Each file
> is being transformed by the same stylesheet. My
> made-up idea is that
> $current.file would be the name of the current file
> in the directory,
> and could be passed in to the stylesheet. I could
> then do something with
> it in the XSLT. As of yet I have no idea how to do
> this from a build
> file.
> 
> I have considered storing the filename in the xml,
> but this seems like a
> redundant step, and one that I am reluctant to take.
> 
> You can also extend the functionality using
> javascript, but then you get
> into having to handle your own file/directory
> parsing and ant already
> does this brilliantly.
> 
> If it is not possible to do something like this (at
> least easily anyway)
> why should ant not automatically pass the current
> filename in (from the
> style task) using a reserved variable name? e.g.
> srcXml. Developers
> could then use it or not as they needed. It would
> only be a single line
> of code to add this feature in...
> 
> Thanks anyway,
> 
> --
> Jonathan Shipley
> 
> 
> -----Original Message-----
> From: Matt Benson [mailto:gudnabrsam@yahoo.com]
> Sent: 16 August 2002 18:08
> To: Ant Users List
> Subject: Re: style / passing in filename
> 
> 
> I'm not sure what you are after, but will the
> built-in
> Ant property ${ant.file} help you accomplish what
> you
> want?
> 
> -Matt
> 
> --- Jonathan Shipley <js...@nomensa.com> wrote:
> > I would appreciate an answer on how to pass in the
> > current filename as a
> > param to the stylesheet in a batch style task;
> even
> > if, as I suspect, it
> > is not possible.
> >
> > Is there really no-one involved with the
> > presentation layer?
> >
> > Thanks in advance,
> >
> > --
> > Jonathan Shipley
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> 
> 
> __________________________________________________
> Do You Yahoo!?
> HotJobs - Search Thousands of New Jobs
> http://www.hotjobs.com
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: style / passing in filename

Posted by Jonathan Shipley <js...@nomensa.com>.
No, sorry. ${ant.file} gives the name of the build file. What I am after
is the name of the current file being processed. E.g.

 <style extension=".html" basedir="xml" style="style/page.xsl"
	destdir="build" includes="*.xml" excludes="nav.xml">
	<param name="srcXml" expression="${current.file}"/>
 </style>

The style task is operating on a whole directory of xml files. Each file
is being transformed by the same stylesheet. My made-up idea is that
$current.file would be the name of the current file in the directory,
and could be passed in to the stylesheet. I could then do something with
it in the XSLT. As of yet I have no idea how to do this from a build
file.

I have considered storing the filename in the xml, but this seems like a
redundant step, and one that I am reluctant to take.

You can also extend the functionality using javascript, but then you get
into having to handle your own file/directory parsing and ant already
does this brilliantly.

If it is not possible to do something like this (at least easily anyway)
why should ant not automatically pass the current filename in (from the
style task) using a reserved variable name? e.g. srcXml. Developers
could then use it or not as they needed. It would only be a single line
of code to add this feature in...

Thanks anyway,

--
Jonathan Shipley


-----Original Message-----
From: Matt Benson [mailto:gudnabrsam@yahoo.com]
Sent: 16 August 2002 18:08
To: Ant Users List
Subject: Re: style / passing in filename


I'm not sure what you are after, but will the built-in
Ant property ${ant.file} help you accomplish what you
want?

-Matt

--- Jonathan Shipley <js...@nomensa.com> wrote:
> I would appreciate an answer on how to pass in the
> current filename as a
> param to the stylesheet in a batch style task; even
> if, as I suspect, it
> is not possible.
>
> Is there really no-one involved with the
> presentation layer?
>
> Thanks in advance,
>
> --
> Jonathan Shipley
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: style / passing in filename

Posted by Matt Benson <gu...@yahoo.com>.
I'm not sure what you are after, but will the built-in
Ant property ${ant.file} help you accomplish what you
want?

-Matt

--- Jonathan Shipley <js...@nomensa.com> wrote:
> I would appreciate an answer on how to pass in the
> current filename as a
> param to the stylesheet in a batch style task; even
> if, as I suspect, it
> is not possible.
> 
> Is there really no-one involved with the
> presentation layer?
> 
> Thanks in advance,
> 
> --
> Jonathan Shipley
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>