You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Philip Mark DONAGHY <Ph...@thales-is.com> on 2004/09/06 14:36:20 UTC

Simple question about #include

Hello velocity,

I would like to include a file to handle some special cases. My
implementation is,

#set ( $includeFile = "includeCreate${feature.aixmElementName}.vm" )
#include( $includeFile )

There are 100 aixmElementName names and there are only a few special
cases. My current solution requires empty files for all the other cases.

How would you configure this to include only the include files that
exist?

Thanks,

Phil


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


Re: Simple question about #include

Posted by Philip Mark DONAGHY <Ph...@thales-is.com>.
Ok I wrote a new implementation, but this costs 5 lines. That's life with
Velocity!

#set( $includeList = [ "Ana", "Fqy", "Ser", "Spa" ] )
#if ( $includeList.contains( ${feature.aixmElementName} ) )
    #set ( $includeFile = "includeCreate${feature.aixmElementName}.vm" )
    #include( $includeFile )
#end

Thanks for the help,

Phil

Shinobu Kawai a écrit :

> Hi Phil,
>
> > I would like to include a file to handle some special cases. My
> > implementation is,
> >
> > #set ( $includeFile = "includeCreate${feature.aixmElementName}.vm" )
> > #include( $includeFile )
> >
> > There are 100 aixmElementName names and there are only a few special
> > cases. My current solution requires empty files for all the other cases.
> >
> > How would you configure this to include only the include files that
> > exist?
> I'm not sure if I understand your intentions correctly, but why not
> create another list?  One that holds only the aixmElementName names of
> the files that exist.
>
> Best regards,
> -- Shinobu Kawai
>
> --
> Shinobu Kawai(shinobu.kawai@gmail.com)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org


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


Re: Simple question about #include

Posted by Shinobu Kawai <sh...@gmail.com>.
Hi Phil,

> I would like to include a file to handle some special cases. My
> implementation is,
> 
> #set ( $includeFile = "includeCreate${feature.aixmElementName}.vm" )
> #include( $includeFile )
> 
> There are 100 aixmElementName names and there are only a few special
> cases. My current solution requires empty files for all the other cases.
> 
> How would you configure this to include only the include files that
> exist?
I'm not sure if I understand your intentions correctly, but why not
create another list?  One that holds only the aixmElementName names of
the files that exist.

Best regards,
-- Shinobu Kawai

-- 
Shinobu Kawai(shinobu.kawai@gmail.com)

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