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

Checking if a file exists

Subject: Checking if a file exists
From: "dvint@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 18 Apr 2024 22:27:03 -0000
 Checking if a file exists
I need to take a list of XML files and rename them based upon values provided by the writer. I know that my list has duplicate name tokens for different files in the list. I do get duplicate names when generated.

I'm trying to trap this situation and handle this while creating the files, I have a template with this:

...

'<xsl:value-of select="$newFile"/>' found '<xsl:value-of select="doc-available($newFile)"/>'

<xsl:choose>
<xsl:when test="doc-available($newFile)">
<xsl:message>[ERROR] Renaming <xsl:value-of select="$base-filename"/> to Duplicate id= <xsl:value-of select="$newName"/></xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:result-document
href="{$rename-outPath}/{$newName}.dita"
method="xml">
<doc>
<p>new file</p>
</doc>
</xsl:result-document>
</xsl:otherwise>
</xsl:choose>


...

I get this output
'file:/Users/danvint/pubsrc/_src-data-files/asciidoc-processing/Ixia-Source/dita-files/test4/dita/rename/fs-concept-nest5.dita' found 'false'


and then the xslt fails because the file actually exists. I can look back at these messages and I see many files earlier I already created a fs-concept-nest5.dita file. So it did exist in this new folder.

What am I missing?

..dan

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.