|
Subject: [xsl] 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 |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] XSLT 1.0 - are parentless, Andrew Welch | Thread | [xsl] Merging an dynamic set of XML, Jérôme Haguet |
| Re: [xsl] stylesheet expansion, Andrew Welch | Date | Re: [xsl] stylesheet expansion, Colin Adams |
| Month |