Skip to main content
4everJang
Legend
December 14, 2014
Answered

xsl:result-document not working ?

  • December 14, 2014
  • 1 reply
  • 1285 views

Hello all,

I am developing a structured app in which I need to split my FM file into a number of separate XML output files. Using xsl:result-document works fine outside of FM, but when using the same XSL from inside FM there are no result documents. I tried to run this on a network drive and on a local drive, but that does not seem to make a difference. I did switch the default XSLT processor in the maker.ini file to use the Saxon XSL 2 processor, so that cannot be the problem. I am guessing it has something to do with the Windows privileges in creating new files but how can those be different for the program when it creates a new file and the same program running an XSLT processor that creates a new file.

If anyone has used xsl:result-document succesfully in the postprocessing of FM, let me know what the trick was.

Jang

This topic has been closed for replies.
Correct answer 4everJang

OK, I found the cause of the problem. xsl:result-document is in fact working but the crappy Windows convention of using backslash instead of forward slashes (and drive letters instead of volume names) used in the real computer world causes problems in setting the correct path. At least I know where to look for a solution now. Thanks anyway.

1 reply

4everJang
4everJangAuthorCorrect answer
Legend
December 14, 2014

OK, I found the cause of the problem. xsl:result-document is in fact working but the crappy Windows convention of using backslash instead of forward slashes (and drive letters instead of volume names) used in the real computer world causes problems in setting the correct path. At least I know where to look for a solution now. Thanks anyway.

4everJang
4everJangAuthor
Legend
December 14, 2014

Sorry for the Windows-bashing - but working on a Mac with Windows on a virtual machine means I am constantly running into compatibility problems. Everything works fine from <oXygen/> on the Mac and then does not work at all from FrameMaker on Windows. Instead of using any external or fixed references to files I have now found the way to reference the current XML file that is being processed. But then I need the directory name of that file, and this requires a little bit of XSL that I found on Stack Overflow. If others are running into similar problems, use this piece of code:

    <xsl:variable name="basepath">
        
<xsl:call-template name="getURL">
            
<xsl:with-param name="path" select="base-uri()"/>
        
</xsl:call-template>
    
</xsl:variable>
    
    
<xsl:template name="getURL">
        
<xsl:param name="path"/>
            
<xsl:choose>
                
<xsl:when test="contains($path,'/')">
                    
<xsl:value-of select="substring-before($path,'/')"/>
                    
<xsl:text>/</xsl:text>
                    
<xsl:call-template name="getURL">
                        
<xsl:with-param name="path" select="substring-after($path,'/')"/>
                    
</xsl:call-template>
                
</xsl:when>
                
<xsl:otherwise/>
            
</xsl:choose>
    
</xsl:template>


After this, your $basepath will point to the directory of the XML file that is being processed by the XSL. No more dependence on drive letters and forward or backward slashes.

Ciao

Jang