[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Merging an dynamic set of XML files into 1 with ANT /

Subject: Merging an dynamic set of XML files into 1 with ANT / XSLT ?
From: Jérôme Haguet <j.haguet@xxxxxxxxxx>
Date: Tue, 11 Dec 2007 11:51:25 +0100
 Merging an dynamic set of XML files into 1 with ANT /
Hello

I have to extract XML elements from a set of XML files, and to gather these
elements into one XML file.
(Let's imagine each XML file is a chapter, and I want to extract Title element
to build the Table Of Contents)
I have to do this using an ANT target.

My main problem is that is must be DYNAMIC : I have to scan the contents of a
folder, sort files alphabetically, and build the TOC according to that.

I already wrote something STATIC (list of file hardcoded in the ANT file) :
I have one XSLT task which add a new chapter title to the TOC, passing the XML
file as an XSLT parameter.

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output method="xml"  encoding="utf-8" indent="yes"/>

  <xsl:param name="P_moduleFile"/>

  <xsl:variable name="modDoc"   select="document($P_moduleFile)"/>

  <!-- identity template -->
  <xsl:template match="@* | node()">
    <xsl:copy><xsl:apply-templates select="@* | node()"/></xsl:copy>
  </xsl:template>

  <xsl:template match="/*">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
      <module>
        <xsl:attribute name="name"><xsl:value-of
select="$modDoc/STR-module/@name"/></xsl:attribute>
        <xsl:apply-templates select="$modDoc/STR-module/text"/>
        <xsl:apply-templates select="$modDoc/STR-module/description"/>
      </module>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>


Any idea how to make a DYNAMIC version of this ?

Regards

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.