You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Nau, Michael" <Mi...@pyxis.com> on 2003/01/17 04:31:47 UTC

Loading stylesheets from a jar file ( task)

Does anyone know of a way to load an xsl stylesheet from a jar file
rather than a path off the basedir?

I would like to repackage the javancss stuff to include the stylesheets
in the javancss.jar then load the stylesheet from the jar in ant. This
would ease the issues of having to keep track of both the stylesheets
and the jars separately.

Any ideas?

Thanks,
Mike.

sample code
===========
    <path id="javancss.cp">
      <pathelement location="${dev.lib.dir}/javancss-xslt.jar"/>
    </path>         
    
    <taskdef name="javancss" classname="javancss.JavancssAntTask"
classpathref="javancss.cp"/>

    <javancss 
      srcdir          = "${dev.src.dir}"
      packageMetrics  = "true"      
      classMetrics    = "false"     
      functionMetrics = "falase"    
      abortOnFail     = "false"     
      generateReport  = "true"
      outputfile      = "${build.lib.dir}/exception-javancss.xml"  
      format          = "xml"
      includes        = "**/*.java"
    />

    <xslt 
      in="${build.lib.dir}/exception-javancss.xml" 
      out="${build.lib.dir}/exception-javancss.html" 
      style="javancss2html.xsl" 
      classpathref="javancss.cp"
    />  

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


Re: Loading stylesheets from a jar file ( task)

Posted by Jacob Kjome <ho...@visi.com>.
Hello Michael,

You could make your task accept a package path such as...

javanccss/resources/exception-javancss.xml

Then, internally, you could load this as a stream.  I don't know if
that just makes things too non-standard compared to most other Ant
tasks, but it is certainly doable.

Jake

Thursday, January 16, 2003, 9:31:47 PM, you wrote:

NM> Does anyone know of a way to load an xsl stylesheet from a jar file
NM> rather than a path off the basedir?

NM> I would like to repackage the javancss stuff to include the stylesheets
NM> in the javancss.jar then load the stylesheet from the jar in ant. This
NM> would ease the issues of having to keep track of both the stylesheets
NM> and the jars separately.

NM> Any ideas?

NM> Thanks,
NM> Mike.

NM> sample code
NM> ===========
NM>     <path id="javancss.cp">
NM>       <pathelement location="${dev.lib.dir}/javancss-xslt.jar"/>
NM>     </path>         
    
NM>     <taskdef name="javancss" classname="javancss.JavancssAntTask"
NM> classpathref="javancss.cp"/>

NM>     <javancss 
NM>       srcdir          = "${dev.src.dir}"
NM>       packageMetrics  = "true"      
NM>       classMetrics    = "false"     
NM>       functionMetrics = "falase"    
NM>       abortOnFail     = "false"     
NM>       generateReport  = "true"
NM>       outputfile      = "${build.lib.dir}/exception-javancss.xml"  
NM>       format          = "xml"
NM>       includes        = "**/*.java"
NM>     />

NM>     <xslt 
NM>       in="${build.lib.dir}/exception-javancss.xml" 
NM>       out="${build.lib.dir}/exception-javancss.html" 
NM>       style="javancss2html.xsl" 
NM>       classpathref="javancss.cp"
NM>     />  

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



-- 
Best regards,
 Jacob                            mailto:hoju@visi.com


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


Re: Loading stylesheets from a jar file ( task)

Posted by Dwayne Schultz <dw...@schultz.net>.
On Thursday, Jan 16, 2003, at 19:31 US/Pacific, Nau, Michael wrote:

> Does anyone know of a way to load an xsl stylesheet from a jar file
> rather than a path off the basedir?

Here's what we do:

			<unjar src="jar_with_xsls.jar" dest="build/jar">
				<patternset>
					<include name="**/*.xsl"/>
				</patternset>
			</unjar>
>     <xslt
>       in="${build.lib.dir}/exception-javancss.xml"
>       out="${build.lib.dir}/exception-javancss.html"
>       style="build/jar/com/xyz/javancss2html.xsl"
>     />

Not exactly high tech but it gets the job done.  Can anyone comment if 
there will be a cleaner solution in a future ant release?

Dwayne


Use the right kind of glue
http://colle.sf.net


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