Subject: RE: [xsl] Add file name+path to processed document From: "Robert Soesemann" <rsoesemann@xxxxxxxxxxx> Date: Mon, 29 Nov 2004 12:07:42 +0100 |
Thanks for your reply. Could give an example of how to extract the path and name of the currently processed document inside the xslt path. By the way: I tried to iterate over the folders with ant-contribs foreach task and the pass the current file to the xslt via its paramater feature. But finnally I could not come over the fact that foreachs file path was absolute and the xslt task could not work with this.See the following example: <!-- ================ Target 6: AddUniqueIds ================ --> <target name="6_AddUniqueIds" depends="5_Validate" > <!-- Iterate over all xml files and include path as id via xslt --> <foreach target="7_sub" param="file-path" > <path> <fileset dir="${kiwi-xs_dir}" includes="**/*.xml"/> <<-- ABSOLUTE PATH </path> </foreach> </target> <!-- Internal subtask call by foreach iterator in target 8 --> <target name="7_sub" > <echo message="${file-path}"/> <xslt in="${file-path}" out="????" style="add-unique-id.xsl" extension=".xml"> <include name="**/*.xml"/> <param name="path" expression="${file-path}"/> </xslt> </target> -----Original Message----- From: Emmanouil Batsis [mailto:Emmanouil.Batsis@xxxxxxxxxxx] Sent: Montag, 29. November 2004 12:01 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Add file name+path to processed document Robert Soesemann wrote: >Hello, > >in my ANT processing pipeline I process a folder structure full of XML >documents. One task is to add the file name and path to each processed >file via XSL. Is there a way to extract the name and path of the >currently processed file from the processor and write it to the output >document. It does not need to be standard XSLT becaused inside ANT I am >able to switch processors. > > The style/xslt task accepts parameters via nested elements (see documentation). Just pass the base file path to each transformation. I cannot think of a way to actually pass the file name being processed when dealing with a fileset, but maybe you can get away with the path (after all you probably only change the extention of the file, right?). hth, MAnos
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Add file name+path to pro, Emmanouil Batsis | Thread | RE: [xsl] Add file name+path to pro, Robert Soesemann |
Re: [xsl] Add file name+path to pro, Emmanouil Batsis | Date | RE: [xsl] Add file name+path to pro, Robert Soesemann |
Month |