ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@yahoo.com>
Subject RE: One-to-one file mapping
Date Wed, 18 Feb 2004 21:20:14 GMT
--- "Holbrook, R Cody (Cody)" <rch7@avaya.com> wrote:
> What I don't understand how to do is how to change
> the create-xsd target to make it do perfect matches
> of the XSL identified in style and the XSD
> identified in includes.  Wildcards don't work (ie
> *.xsl, *.xsd) because each XSL runs against each XSD
> and it's a messy and long process!  Any ideas?

You may be able to use ant-contrib's <for> task to
iterate over the list of xsd files.  In this case, you
could probably do something like this (untested):

<!-- create a file listing xsd files -->
<pathconvert property="xsdfiles"
             pathsep="${line.separator}">
    <path>
        <fileset dir="${xsd}" includes="*.xsd" />
    </path>
</pathconvert>

<echo file="xsdlist">${xsdfiles}</echo>

<!-- load it back, filtering for just prefixes; this
 may need tweaking -->
<loadfile srcfile="xsdlist" property="xsd">
    <filterchain>
        <replaceregex replace="\1" flags="g"
            pattern=".*([^${file.separator}]*).xsd" />
    </filterchain>
</loadfile>

<!-- call xslt once per prefix -->
<for list="${xsd}" param="prefix"
     delimiter="${line.separator}">

    <sequential>
        <xslt basedir="${xsd}" destdir="${xsd.gen}"
              style="${xsl.gen}/@{prefix}.xsl"
              in="@{prefix}.xsd"
              out="@{prefix}.xsd" />
    </sequential>

</for>

The first steps will be easier in the coming weeks
when we commit some changes to allow nested <mapper>s
in <pathconvert>.  Again, this is all coming from my
understanding of ant-contrib's iterative tasks rather
than any xslt knowledge... ;)

-Matt

__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools

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


Mime
View raw message