ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <zod...@holoweb.net>
Subject Re: Help with <style> please
Date Mon, 16 Sep 2002 23:56:05 GMT
I don't know about the redirect extension, but this line explains the
missing output:

> <xsl:template name="project">

You want 'match' instead of 'name' there...

L.

On 9/16/02 7:02 PM, "Dominique Devienne" <DDevienne@lgc.com> wrote:

> Might be a little off-topic, but I hope someone can help me here...
> 
>> From a single XML file, I'm trying to generate several build.xml files, each
> in its own directory, one per <project> sub-element of the document root
> element. I'm trying to use the redirect extension of xalan, also used by
> <junitreport>s own frames stylesheet (that's where I learned of it
> actually). The XSL transformation of <junitreport> happens under the cover,
> so I'm not sure what it does to enable the redirect extension... When I try
> to style my document using the stylesheet and target below, I get the single
> XML file specified in the 'out' attribute, which contains only the lines of
> the 'depend' templates (with lots of whitespace around them), but no
> */build.xml files.
> 
> <junitreport> can output several files from a single XML document, so why
> can't I? Any help would be greatly appreciated. Thanks, --DD
> 
> // STYLE TASK
>   <style in="dependencies.xml"
>          out="dependencies-out.xml"
>          style="dependencies2build.xsl"
>          processor="trax" />
> 
> // INPUT XML
> <module name="tahoe">
> 
> <project name="lgc-mosaic">
>   <jar name="jar/com_lgc_mosaic.jar"/>
>   <nodependencies/>
> </project>
> 
> <project name="lgc-graphics2d">
>   <jar name="jar/com_lgc_graphics2d.jar"/>
>   <depend project="lgc-mosaic"/>
>   <depend project="lgc-color"/>
> </project>
> 
> <project name="lgc-color">
>   <jar name="jar/com_lgc_color.jar"/>
>   <depend project="lgc-mosaic"/>
> </project>
> 
> </module>
> 
> // INPUT XSL
> <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:output method="xml" indent="yes" encoding="UTF-8"/>
> <xsl:decimal-format decimal-separator="." grouping-separator=","/>
> <xsl:param name="output.dir" select="'.'"/>
> 
> <xsl:template match="module">
>   <xsl:apply-templates select="project"/>
> </xsl:template>
> 
> <xsl:template name="project">
>   <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
> 
>   <redirect:write file="{$output.dir}/{$name}/build.xml">
>     <project>
>       <xsl:attribute name="name"><xsl:value-of
> select="@name"/></xsl:attribute>
>       <xsl:attribute name="default">compile</xsl:attribute>
> 
>       <fileset id="sources"
>                dir="${ds.home}/src">
>         <xsl:copy-of select="sources/*"/>
>       </fileset>
> 
>       <path id="dependent-modules">
>         <xsl:apply-templates select="depend"/>
>       </path>
>     </project>
>   </redirect:write>
> </xsl:template>
> 
> <xsl:template match="depend">
>   <pathelement>
>     <xsl:attribute name="location">../<xsl:value-of
> select="@name"/>/build/classes</xsl:attribute>
>   </pathelement>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> // SAMPLE OUTPUT
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <DD:snip message="many other empty lines"/>
>  
>   <pathelement location="..//build/classes"/>
>   <pathelement location="..//build/classes"/>
> 
>   
>   <pathelement location="..//build/classes"/>
> 
> <DD:snip message="many other empty lines"/>
> 
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
> 


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


Mime
View raw message