[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Keeping result-document() from writing to a file more
I'm processing some DITA xml files with XSLT. I'm reading these files and where they have a conref into some other content (think xinclude) that is included in the current file. There may be multiple things shared out from one large file (topic). I want to make a new file for each of the shared pieces. B B More than one file can reference exactly the same content, so after processing all these files I want a single file representing the shared content. It is this multiple references to the same content that causes the duplication of the file that the result-document() function doesn't like. this is the code that I have for detecting this situation: B B <xsl:variable name="newFile" select="concat($srcFile, '-', $target, '-output.dita')" /> B B B B NEW FILE <xsl:value-of select="$newFile"/>B B B Doc available: <xsl:value-of select="doc-available($newFile)"/>B B B B <xsl:if test="not(doc-available($newFile))"B B B CREATE FILE NOWB B B <xsl:result-document method="xml" href="{$newFile}" indent="yes"> B <referable-content id="ikj1555615661716" xml:lang="en-us"> B <titler>efereable test</title> B <rcbody> B <xsl:copy-of select="document($srcFile)//*[@id = $target]"/> B </rcbody> B </referable-content> B </xsl:result-document> B B </xsl:if> B B B B B B Here are a series of messages created as i process the files. Notice that the first message correctly identifies the file "conref-para_content.dita-simpletable_nohead-output.dita" as not existing and produces output. If you then look at the last one you will see the same file being referenced and tries to write to the file again. But in other places you see the test working properly and not creating a new file: B B B B B B file 'conref-para_content.dita'B B NEW FILE /Users/danvint/pubsrc-other/formatting-sample/conref-para_content.dita-simple table_nohead-output.dita B Doc available: false' B B CREATE FILE NOW B B file 'conref-para_content.dita'B B NEW FILE /Users/danvint/pubsrc-other/formatting-sample/conref-para_content.dita-simple table_head-output.dita B Doc available: true' B B file 'conref-para_content.dita'B B NEW FILE /Users/danvint/pubsrc-other/formatting-sample/conref-para_content.dita-table_ head-output.dita B Doc available: true' B B file 'conref-para_content.dita'B B NEW FILE /Users/danvint/pubsrc-other/formatting-sample/conref-para_content.dita-table_ nohead-output.dita B Doc available: true' B B file 'conref-para_content.dita'B B NEW FILE /Users/danvint/pubsrc-other/formatting-sample/conref-para_content.dita-simple table_nohead-output.dita B Doc available: false' B B CREATE FILE NOW B B B I believe the doc-available() reads the file to be XML. So when the script stops there is a file in the OS but it is empty due to the second write failing. Running this in oXygen I get the results of what should have been written showing up in a window. I cut and pasted that content into the empty file and reran it. Processing got further along and stopped on a second file with the same message. I did the same thing, with the new content in this second file and it now runs to completion if all the files exist. If I delete all the files that were generated, I'm back to the same problem. Is there some delay in writing the output that I shouldB be accounting for? Is there a sleep() function in XSLT or something to cause a delay or flush the buffer? B B Any ideas on what I can check? B B B B ..dan
|
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
|