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

RE: Add file name+path to processed document

Subject: RE: Add file name+path to processed document
From: "Robert Soesemann" <rsoesemann@xxxxxxxxxxx>
Date: Mon, 29 Nov 2004 12:07:42 +0100
xslt file name
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:  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

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.