Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Petr Snobelt 923 posts 1535 karma points
    Nov 18, 2009 @ 23:12
    Petr Snobelt
    0

    xslt in subfolder with xsl:include or xsl:import

    Some time ago, there are some help, how to use xsl from subfolders, but I can't find it...

    I have problem using xslt files from subfolder. If I use xslt file from subfolder it works fine, but when I add xsl:include or xsl:import directive it cause error on rendered page like this: Error reading XSLT file: \xslt\Basket/Basket.ConfirmationView.xslt
    It doesn't matter if included file is in same subfolder or in main xslt directory.

    Any tip are welcomed.

    Petr 

  • Christian Palm 278 posts 273 karma points
    Nov 19, 2009 @ 09:12
    Christian Palm
    0

    Cam you show how the files are located and your include tag

    This works for me:
    /xslt/Sitemap.xslt
    /xslt/Include.xslt

    Sitemap.xslt looks like this

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [<!ENTITY nbsp "&#x00A0;">]>
    <xsl:stylesheet ...>
        <xsl:output method="xml" omit-xml-declaration="yes" />
        <xsl:param name="currentPage"/>

        <xsl:include href="Include.xslt"/>

        <xsl:template match="/">

            <!-- Here I can call templates from include.xslt -->

        </xsl:template>

    </xsl:stylesheet>
  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Nov 19, 2009 @ 09:52
    Chriztian Steinmeier
    0

    Could just be that you include/import at the wrong point in the main file? Both instructions has to be direct children of the <xsl:stylesheet> element, and <xsl:import> must precede any other element in the namespace.

    /Chriztian

  • Petr Snobelt 923 posts 1535 karma points
    Nov 19, 2009 @ 12:12
    Petr Snobelt
    0

    @Christian Palm: This work for me too, but if I try put files into subfolder (basket in my case) it stop working (I also try change href parameter to "basket\include.xslt")

    @Christian Steinmeier: Umbraco perform check to path for href, and in main xslt folder it works.

    My structure is:

    \xslt
      \basket

    when I put both files into basket subfolder it stop working :-(

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Nov 19, 2009 @ 12:41
    Warren Buckley
    0

    Where is your xslt file living in the folder structure that refences the include.

    If you are putting them both in the basket folder the href needs to be as so "include.xslt"

  • Petr Snobelt 923 posts 1535 karma points
    Jan 21, 2010 @ 21:16
    Petr Snobelt
    0

    I create another test:

    folder structure:

    /xslt
      /subfolder
         test.xslt
         shared.xslt

    I must use this statement to work after publishing, it cause error when saving xslt, but work when I check skip testing

    <xsl:include href="../subfolder/shared.xslt" />

    when I use

    <xsl:include href="subfolder/shared.xslt" />

    It saves ok, but cause Error reading XSLT file: \xslt\subfolder/test.xslt at runtime.

    Petr

  • Torben Jensen 13 posts 35 karma points
    Aug 27, 2010 @ 12:46
    Torben Jensen
    0

    I just tried the same, where I use

    <xsl:include href="include/includefile.xsl" />

    This works as expected, with the following directory structure:

    /xslt
    /include
    includefile.xsl

     

    The ONLY issue I seem to have at the moment is that the backend "Developer" section shows the subfolder under XSLT, including an arrow. But as soon as I click the arrow, it disappears. So I can't in any way list the content of ../include. No big deal, I can access via FTP. But I guess this is a tiny bug somewhere in the tree function.

    Btw: do anyone know if it is necessary to declare namespaces etc in the included files as well ? I was thinking the could would be included then afterwards, the entire XSLT evaluated.

Please Sign in or register to post replies

Write your reply to:

Draft