| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- exclude-result-prefixes="xs"
- version="2.0">
-
-
- <xsl:param name="csv2xml" required="yes"/>
- <xsl:param name="input" required="yes"/>
- <xsl:param name="output" required="yes"/>
- <xsl:param name="basedir" required="yes"/>
-
- <xsl:output indent="yes"/>
- <xsl:strip-space elements="*"/>
-
- <xsl:template match="csv2xml_dir">
- <project basedir="{$basedir}" name="csv2xml_dir.child" default="csv2xml_dir.child.run">
- <target name="csv2xml_dir.child.run">
- <xsl:for-each select="tokenize(.,';')">
- <xsl:variable name="file" select="replace(.,' ','\\ ')"/>
- <xsl:variable name="file_out" select="replace(replace(.,' ','_'),'.csv','.xml')"/>
- <exec executable="bash" >
- <!--<env key="PATH" path="$PATH:${PATH_ADD}"/>-->
- <arg value="-c"/>
- <arg value="{$csv2xml} < {$input}/{$file} > {$output}/{$file_out}"/>
- </exec>
- </xsl:for-each>
- </target>
- </project>
- </xsl:template>
-
- <xsl:template match="any2xml_dir">
- <project basedir="{$basedir}" name="csv2xml_dir.child" default="csv2xml_dir.child.run">
- <target name="csv2xml_dir.child.run">
- <xsl:for-each select="tokenize(.,';')">
- <xsl:variable name="file" select="replace(.,' ',' ')"/>
- <xsl:variable name="file_out" select="concat(replace(.,' ','_'),'.xml')"/>
-
- <xsl:choose>
- <xsl:when test=" contains($file,'.xml')">
- <mkdir dir="{$output}/{$file_out}"/>
- <delete dir="{$output}/{$file_out}"/>
- <copy file="{$input}/{$file}" tofile="{$output}/{$file}"/>
- </xsl:when>
- <!--<xsl:when test="1 = 2"/>-->
- <xsl:otherwise>
- <loadfile property="{$file}" srcfile="{$input}/{$file}"/>
- <mkdir dir="{$output}/{$file_out}"/>
- <delete dir="{$output}/{$file_out}"/>
-
- <echoxml file="{$output}/{$file_out}" >
- <any2xml>
- ${<xsl:value-of select="$file"/>}
- </any2xml>
- </echoxml>
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:for-each>
- </target>
- </project>
- </xsl:template>
-
-
-
-
-
-
- </xsl:stylesheet>
|