XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Mike SappSubject: input & outputdir question
Author: Mike Sapp
Date: 15 Jun 2007 09:55 AM
Hello all at Stylus,

Im doing a batch transformation and would like to ouput the renamed files to the input files directory. My xsl looks like this:
<?xml version='1.0' ?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="outputdir" select="'file:///c:/temp'"/>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:result-document href="{$outputdir}/{feed/release/label/name}.xml" method="xml">
<document>

I would like to have the ouputdir to be the same as all of the input files which i am batch transforming... It is a simple input folder structure with one parent directory with over 1500 direct sub directories so a simple file:///c:/temp wont work... Any tips?

Best and thank you for your help in advance!

Mike

Postnext
Alberto MassariSubject: input & outputdir question
Author: Alberto Massari
Date: 15 Jun 2007 11:51 AM
Hi Mike,
it's not clear which directory (the input or the output one) has the sub-directories; however, if you want to generate one file per label, you must use a for-each, otherwise you are just generating a single output file...

Alberto

Postnext
Mike SappSubject: input & outputdir question
Author: Mike Sapp
Date: 16 Jun 2007 02:01 AM
Originally Posted: 16 Jun 2007 01:00 AM
Hello Alberto,

The input would be from a master directory(Release) and all sub directory folders. Ie: ://Release/01, ://Release/02, ://Release/03

I would like the output file to be saved in the same sub-folder as the input file was located... How would i do that if the output specified is file:///c:/temp currently-. Is it possible?



Another option that could work for us is to use the current file name with the addition of the various href parameters we have specified...
<xsl:result-document href="{$outputdir}/{feed/release/label/name}_{CURRENT FILE NAME HERE}.xml" method="xml"> but am not sure how to insert the current file name... What would i use to have the current filename included in the href output dir?

Posttop
Alberto MassariSubject: input & outputdir question
Author: Alberto Massari
Date: 18 Jun 2007 08:04 AM
Hi Mike,
you can get the file name of a source document by using fn:base-uri(/); then, use fn:tokenize to split into filename and directories.

Hope this helps,
Alberto

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.