Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 87530

Re: xsl:result-document not working ?

$
0
0

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


Viewing all articles
Browse latest Browse all 87530

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>