<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="utf-8" indent="yes" method="xml"/>


<xsl:template match="/">
  <resource>
    <xsl:apply-templates/>
    
    <files>
      <xsl:for-each select="system-data-structure/file">
        <file>
           <xsl:text>[system-asset:page]</xsl:text>
           <xsl:value-of select="./path"/>
           <xsl:text>[/system-asset:page]</xsl:text>
        </file>
        <cms_file>
        <xsl:value-of select="./path"/>
        </cms_file>
      </xsl:for-each>
    </files>
  </resource>
</xsl:template>


<xsl:template match="/system-data-structure/frame_file" priority="10">
 <frame_file>
   <xsl:text>[system-asset:page:target=/knowledge-base]</xsl:text>
   <xsl:value-of select="./path"/>
   <xsl:text>[/system-asset:page]</xsl:text>
 </frame_file>
</xsl:template>


<xsl:template match="/system-data-structure/*">
  <xsl:copy-of select="."/>
</xsl:template>

<xsl:template match="/system-data-structure/file"/>

<xsl:template match="/system-data-structure/log_file" priority="10">
 <synced-files>
  <file>
   <id>log</id>
   <path>
     <xsl:text>[system-asset:page:target=/knowledge-base]</xsl:text>
     <xsl:value-of select="./path"/>
     <xsl:text>[/system-asset:page]</xsl:text>
   </path>
   <cms_path>
    <xsl:value-of select="./path"/>
   </cms_path>
  </file>
 </synced-files>
</xsl:template>

</xsl:stylesheet>