[xsl] 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