Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8435765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:00:09+00:00 2026-06-10T07:00:09+00:00

I have an ant properties file that looks like this (although I can adjust

  • 0

I have an ant “properties” file that looks like this (although I can adjust the format if needed – I can make it an XML file if that’s more appropriate):

libraries.properties

name 1
http://www.url1.com?a=b
name 2
http://www.url2.com?c=d
name 3
http://www.url3.com?e=f

NOTE: I know this is not a valid properties format because it’s not in the form a=b. I can change it to anything that’s appropriate, as long as it’s easy to add entries in future.

I want ant to take a file that is checked-in as follows:

options.html (source)

<select>
    <option value="@URL@">@NAME@</option>
</select>

… and do a search and replace on the tokens as many times as there are name/value entries in libraries.properties, so the resulting options.html file would look like this:

options.html (after build)

<select>
    <option value="http://www.url1.com?a=b">name 1</option>
    <option value="http://www.url2.com?c=d">name 2</option>
    <option value="http://www.url3.com?3=f">name 3</option>
</select>

As with the properties file, the options.html source can be a different format. I just need some way of defining what I copy from/to.

What’s the cleanest way to do this?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T07:00:14+00:00Added an answer on June 10, 2026 at 7:00 am

    What you need is a templating engine to generate your HTML file.

    The closest thing to this that ANT directly supports is an XSLT transformation.

    Example

    The following project

    |-- build.xml
    `-- src
        |-- options.xsl
        `-- properties.xml
    

    When run generates a single HTML file

    |-- build
    |   `-- options.html
    

    Note, this is not a properly formatted HTML file. Your specification looks more like a fragment designed to be imported into another file.

    properties.xml

    <properties>
        <property>
            <name>name 1</name>
            <value>http://www.url1.com?a=b</value>
        </property>
        <property>
            <name>name 2</name>
            <value>http://www.url2.com?c=d</value>
        </property>
        <property>
            <name>name 3</name>
            <value>http://www.url3.com?e=f</value>
        </property>
    </properties>
    

    options.xsl

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
        <xsl:output method="html"/>
    
        <xsl:template match="/">
            <select>
                <xsl:apply-templates select="properties/property"/>
            </select>
        </xsl:template>
    
        <xsl:template match="property">
            <option value="{value}"><xsl:value-of select="name"/></option>
        </xsl:template>
    
    </xsl:stylesheet>
    

    build.xml

    <project name="demo" default="generate">
    
        <target name="init">
            <mkdir dir="build"/>
        </target>
    
        <target name="generate" depends="init">
            <xslt style="src/options.xsl" in="src/properties.xml" out="build/options.html"/>
        </target>
    
        <target name="clean">
            <delete dir="build"/>
        </target>
    
    </project>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML file that looks like this... <foo> <bar>$VALUE$</bar> </foo> Is there
I have a ant build script that uses a build.properties file. There I have
I have an ant target that echo's the content of an eclipse .project file,
I have a project that contains xml files. I also have an Ant build
So ... I have build.xml that loads property file from basedir. Then, as the
I have the following ant file that is not running the targets prepForDeployment and
I have a buildr script that first loads a java properties file, then creates
I was looking at an Ant build.xml file this morning and noticed an XML
I am writing an Ant script that removes content from a properties file. Say
I'm following this tutorial to create my ant build file that java compiles, than

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.