You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Holger Rauch <ho...@heitec.de> on 2006/09/08 13:57:21 UTC

Adding variable no of elements to task

Hi,

I'm faced with the following situation:

- The stylesheet parameters supposed to be passed to the XSLT processor
  should be configurable from the "outside world", like this

<property name="transformer.xsl.stylesheet.params"
value="prop.base.name=internal-history,prop.languages=de en fr" />

- I want to provide a macro that creates a bunch of <param> elements
  with name and expression attributes based on the number of comma-separated
  key-value pairs set by the above property (shouldn't be a problem). (The
  number of key-value pairs depends on the stylesheet).

- Later on using the generated <param> elements inside the <xslt> task.
  That's my problem. How can I "copy&paste" the generated <params> in the
  <xslt> task? Is this possible using Ant itself (maybe there's some
  external task available) or do I have to extend the <xslt> task using
  BeanShell code? (In both cases, suggestions are highly appreciated).

I'm currently using Ant 1.6.2, but there probably won't be much difference
to Ant 1.6.5 with regard to the aforementioned item.

Thanks in advance for any info & have a nice weekend,

	Holger


Re: Invoking Ant XML fragments (Was:Re: Adding variable no of elements to task)

Posted by Brian Agnew <br...@oopsconsultancy.com>.
I've not followed this conversation in detail, but you can use XMLTask to
create a new build.xml and exec a new copy of Ant solely to execute this.

Brian

On Mon, September 11, 2006 11:08, Holger Rauch wrote:
> Hi Antoine,
>
> after googling a bit, I found this:
>
> http://www.oopsconsultancy.com/software/xmltask/#examples
>
> => It's possible to create an XML fragment describing the <xslt> task
>    (including the <param> elements for the stylesheet parameters)
>
> But that leads me to a totally different question: Is it possible to
> "invoke" such a dynamically created fragment (i.e. the <xslt> task is
> invoked in a way as if the fragment were already contained in the Ant
> file instead of being dynamically generated)?
>
> (Reason why I'm asking is that I want to avoid - if possible - style
> breaks
> by introducing beanshell code).
>
> Thanks in advance for any info!
>
> Kind regards,
>
> 	Holger
>
> On Sun, 10 Sep 2006, Antoine Levy-Lambert wrote:
>
>> [...]
>> I would extend the XSLTTask at your place.
>> [...]
>


-- 
Brian Agnew                  http://www.oopsconsultancy.com
OOPS Consultancy Ltd
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Invoking Ant XML fragments (Was:Re: Adding variable no of elements to task)

Posted by Antoine Levy-Lambert <an...@gmx.de>.
Hello Holger,

you can generate a XML file which will be basically a mini ant build file

<project name="generated">
   <target name="sometarget">
       <xslt ....
       </xslt>
   </target>
</project>

and get it started using the <ant/> task.

to generate the XML file you can use the XMLTask or use another stylesheet.

Regards,

Antoine
-------- Original-Nachricht --------
Datum: Mon, 11 Sep 2006 12:08:01 +0200
Von: Holger Rauch <ho...@heitec.de>
An: user@ant.apache.org
Betreff: Invoking Ant XML fragments (Was:Re: Adding variable no of <param> elements to <xslt> task)

> Hi Antoine,
> 
> after googling a bit, I found this:
> 
> http://www.oopsconsultancy.com/software/xmltask/#examples
> 
> => It's possible to create an XML fragment describing the <xslt> task
>    (including the <param> elements for the stylesheet parameters)
> 
> But that leads me to a totally different question: Is it possible to
> "invoke" such a dynamically created fragment (i.e. the <xslt> task is
> invoked in a way as if the fragment were already contained in the Ant
> file instead of being dynamically generated)?
> 
> (Reason why I'm asking is that I want to avoid - if possible - style
> breaks
> by introducing beanshell code).
> 
> Thanks in advance for any info!
> 
> Kind regards,
> 
> 	Holger
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Invoking Ant XML fragments (Was:Re: Adding variable no of elements to task)

Posted by Holger Rauch <ho...@heitec.de>.
Hi Antoine,

after googling a bit, I found this:

http://www.oopsconsultancy.com/software/xmltask/#examples

=> It's possible to create an XML fragment describing the <xslt> task
   (including the <param> elements for the stylesheet parameters)

But that leads me to a totally different question: Is it possible to
"invoke" such a dynamically created fragment (i.e. the <xslt> task is
invoked in a way as if the fragment were already contained in the Ant
file instead of being dynamically generated)?

(Reason why I'm asking is that I want to avoid - if possible - style breaks
by introducing beanshell code).

Thanks in advance for any info!

Kind regards,

	Holger

On Sun, 10 Sep 2006, Antoine Levy-Lambert wrote:

> [...] 
> I would extend the XSLTTask at your place.
> [...]

Re: Adding variable no of elements to task

Posted by Antoine Levy-Lambert <an...@gmx.de>.
Holger,
-------- Original-Nachricht --------
Datum: Fri, 8 Sep 2006 13:57:21 +0200
Von: Holger Rauch <ho...@heitec.de>
An: user@ant.apache.org
Betreff: Adding variable no of <param> elements to <xslt> task

> - The stylesheet parameters supposed to be passed to the XSLT processor
>   should be configurable from the "outside world", like this
> 
> <property name="transformer.xsl.stylesheet.params"
> value="prop.base.name=internal-history,prop.languages=de en fr" />
> 
> do I have to extend the <xslt> task using
>   BeanShell code? (In both cases, suggestions are highly appreciated).
> 
I would extend the XSLTTask at your place.

Regards,

Antoine

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org