|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Returning the file name of the input file
Hi Ismael,
> That would be a possibility if I only have to transform one file.
> But what I use now is an xml file that refers to other xml files.
> With the document() function I traverse all these xml files. By
> passing a parameter to the source file I have only the name of one
> file. What I want is the name for each xml file I traverse ... I
> don't think I can do this with passing parameters ...
You should be able to do it by passing parameters *between templates*
in that case, or even that might not be necessary. If you've got the
name of the file because you're opening it through the document()
function then surely you've got the name of the file in order to
create it in the output. (I'm assuming you're using an extension
element such as saxon:output to create the output files.) Something
like:
<xsl:template match="file">
<xsl:variable name="href" select="@href" />
<saxon:output href="{$href}">
<xsl:apply-templates select="document($href, .)" mode="process" />
</saxon:output>
</xsl:template>
I'll note that it's probably a bad idea to read and write to/from the
same file -- if something goes wrong during the transformation you'll
probably end up losing all your data...
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








