Copied to clipboard

Flag this post as spam?

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


  • sun 403 posts 395 karma points
    Jan 20, 2011 @ 15:43
    sun
    0

    this must be a bug. sometimes xslt can't be rendered if it include another xslt.

    The following message shows after I use <xsl:include href="FormatName.xslt"/> to include FormatName.xslt in some xslt files. When I use Visualize XSLT tool to see what these xslt will show, it gives me following error message:

    Error parsing the XSLT:
    System.Xml.Xsl.XslLoadException: XSLT compile error. An error occurred at (11,42). ---> System.IO.FileNotFoundException: Could not find file 'f:\windows\system32\inetsrv\FormatName.xslt'. File name: 'f:\windows\system32\inetsrv\FormatName.xslt' at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy) at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) at System.Xml.Xsl.Xslt.XsltLoader.CreateReader(Uri uri, XmlResolver xmlResolver) at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(Uri uri, Boolean include) at System.Xml.Xsl.Xslt.XsltLoader.LoadInclude() at System.Xml.Xsl.Xslt.XsltLoader.LoadRealStylesheet() at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument() at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include) --- End of inner exception stack trace --- at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include) at System.Xml.Xsl.Xslt.XsltLoader.Load(XmlReader reader) at System.Xml.Xsl.Xslt.XsltLoader.Load(Compiler compiler, Object stylesheet, XmlResolver xmlResolver) at System.Xml.Xsl.Xslt.Compiler.Compile(Object stylesheet, XmlResolver xmlResolver, QilExpression& qil) at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver) at umbraco.macro.CreateXsltTransform(XmlTextReader xslReader, Boolean debugMode) at umbraco.presentation.umbraco.developer.Xslt.xsltVisualize.visualizeDo_Click(Object sender, EventArgs e)


    I can assure you that in both backoffice and xslt folder, there is FormatName.xslt file.

    http://umbraco.codeplex.com/workitem/29923

    this must be a bug. it's very confusing me now.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 20, 2011 @ 16:08
    Jan Skovgaard
    1

    Hi Sun

    I don't think that a bug. It's probably because you need to touch the web.config so the application is restarted and your XSLT is aware that there has been included another XSLT file in it.

    Perhaps you should have a look at the XSLTtouch package so you don't need to do it manually.

    /Jan

  • sun 403 posts 395 karma points
    Jan 21, 2011 @ 01:08
    sun
    0

    Can you advise me more? I don't know how to resolve it.

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Jan 21, 2011 @ 02:08
    Chriztian Steinmeier
    1

    Hi sun,

    If you check the path where .NET is trying to load the "FormatName.xslt" file, you'll see that it tries to load it from a very different location than where it actually is (that directory is not even within the Umbraco install) - my first clue: You're seeing this in the XSLT Visualizer, right? Unfortunately that doesn't work (unless you temporarily specify the local path to the actual file in the Umbraco install - e.g. something like "F:\Websites\UmbracoSite\xslt\FormatName.xslt").

    It'll work just fine (if the XSLT is ok, of course) on the site, you just can't use the Visualizer with include/import, because the Visualizer runs in its own sandbox.

    /Chriztian


  • sun 403 posts 395 karma points
    Jan 21, 2011 @ 08:20
    sun
    0

    actually, it can't work when I browser my site. This is why I must need help.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 21, 2011 @ 08:22
    Jan Skovgaard
    0

    Hi Sun

    Can you please show us the code from your XSLT then?

    /Jan

  • sun 403 posts 395 karma points
    Jan 21, 2011 @ 14:37
    sun
    0

    I have uploaded whole project to http://umbraco.codeplex.com/workitem/29935

    I really wish someone can help me if this is my fault.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 21, 2011 @ 18:56
    Jan Skovgaard
    0

    Hi Sun

    Uploading the project to codeplex was really not what I meant.

    I was asking you to post some XSLT code in this forum - Codeplex should not be used to review people's code. I think the HQ has enough work to do already. Our is meant for us to help each other out. Codeplex is meant for bugs.

    Since you have not posted any code in here it's not easy for others to throw an eye at it and help you to determine if it's actually a bug.

    I will still urge you to post some code in here :-)

    Cheers

    /Jan

  • sun 403 posts 395 karma points
    Jan 22, 2011 @ 03:23
    sun
    0

    Now, I upload two xslt, if you can't find the error, you can rename FormatName.xslt in backoffice, then change href at <xsl:include href="renamed_FormatName.xslt"/> in Suntem/ListSomePages.xslt, for example: SuntemFormatName.xslt, Suntem/FormatName.xslt

    this error can easily happen when I do it by this way.

    Suntem/ListSomePages.xslt

    version="1.0" encoding="UTF-8"?>
    DOCTYPE xsl:stylesheet [
        ENTITY nbsp " ">
    ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:umbraco.library="urn:umbraco.library"
      exclude-result-prefixes="umbraco.library">

        <xsl:include href="FormatName.xslt"/>
        <xsl:output method="html" omit-xml-declaration="yes"/>

        <xsl:param name="currentPage"/>
        <xsl:variable name="title" select="translate(/macro/title,' ','')"/>
        <xsl:variable name="more" select="translate(/macro/more,' ','')"/>
        <xsl:variable name="nodeId" select="translate(/macro/nodeId,' ','')"/>
        <xsl:variable name="order">
            
            <xsl:variable name="tempOrder" select="string(/macro/order)"/>
            <xsl:choose>
                <xsl:when test="$tempOrder='ascending'">
                    <xsl:value-of select="$tempOrder"/>
                xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="'descending'"/>
                xsl:otherwise>
            xsl:choose>
        xsl:variable>

        <xsl:variable name="number">
            
            <xsl:variable name="tempNumber" select="number(/macro/number)"/>
            <xsl:choose>
                <xsl:when test="$tempNumber>0">
                    <xsl:value-of select="$tempNumber"/>
                xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="8"/>
                xsl:otherwise>
            xsl:choose>
        xsl:variable>


        <xsl:template match="/">

            <div class="art-Block">
                <div class="art-Block-tl">
                div>
                <div class="art-Block-tr">
                div>
                <div class="art-Block-bl">
                div>
                <div class="art-Block-br">
                div>
                <div class="art-Block-tc">
                div>
                <div class="art-Block-bc">
                div>
                <div class="art-Block-cl">
                div>
                <div class="art-Block-cr">
                div>
                <div class="art-Block-cc">
                div>
                <div class="art-Block-body">
                    <xsl:if test="string-length($title)>0">
                        <div class="art-BlockHeader">
                            <div class="l">
                            div>
                            <div class="r">
                            div>
                            <div class="art-header-tag-icon">
                                <div class="t">
                                    <xsl:value-of select="$title"/>
                                div>
                            div>
                        div>
                    xsl:if>
                    <div class="art-BlockContent">
                        <div class="art-BlockContent-tl">
                        div>
                        <div class="art-BlockContent-tr">
                        div>
                        <div class="art-BlockContent-bl">
                        div>
                        <div class="art-BlockContent-br">
                        div>
                        <div class="art-BlockContent-tc">
                        div>
                        <div class="art-BlockContent-bc">
                        div>
                        <div class="art-BlockContent-cl">
                        div>
                        <div class="art-BlockContent-cr">
                        div>
                        <div class="art-BlockContent-cc">
                        div>
                        <div class="art-BlockContent-body">
                            <div>
                                <xsl:call-template name="formatList">
                                    <xsl:with-param name="nodes" select="$currentPage/ancestor-or-self::*[@isDoc and @level='1']//*[@isDoc and @id=$nodeId]//*[navigator!=1]"/>
                                xsl:call-template>
                            div>
                            <xsl:if test="string-length($more)>0">
                                <span class="art-button-wrapper ">
                                    <span class="l">span>
                                    <span class="r">span>
                                    <class="art-button" href="{concat($nodeId,'.aspx')}" target="_black">
                                        <xsl:value-of select="$more"/>
                                    a>
                                span>
                            xsl:if>
                            <div class="cleared">
                            div>
                        div>
                    div>
                    <div class="cleared">
                    div>
                div>
            div>
        xsl:template>

        <xsl:template name="formatList">
            <xsl:param name="nodes"/>
            <xsl:if test="count($nodes)>0">
                <ul>
                    <xsl:for-each select="$nodes">
                        <xsl:sort select="date" order="{$order}"/>
                        <xsl:sort select="@sortOrder" order="ascending"/>
                        <xsl:if test="position()<=$number">
                            <li>
                                <href="{concat(@id,'.aspx')}" target="_black">
                                    <xsl:call-template name="formatName">
                                        <xsl:with-param name="nodeName" select="@nodeName"/>
                                    xsl:call-template>
                                a>
                                <xsl:if test="translate(date,' ','')!=''">
                                    [<xsl:value-of select="umbraco.library:FormatDateTime(date,'M-d')"/>]
                                xsl:if>
                            li>
                        xsl:if>
                    xsl:for-each>
                ul>
            xsl:if>
        xsl:template>

    xsl:stylesheet>


    FormatName.xslt

    version="1.0" encoding="UTF-8"?>
    DOCTYPE xsl:stylesheet [
        ENTITY nbsp " ">
    ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

        <xsl:variable name="nameLength" select="number(/macro/nameLength)"/>

        <xsl:template name="formatName">
            <xsl:param name="nodeName"/>
            <xsl:variable name="tempName">
                <xsl:choose>
                    <xsl:when test="contains($nodeName,' (') and substring($nodeName,string-length($nodeName))=')'">
                        <xsl:value-of select="substring-before($nodeName,' (')"/>
                    xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="$nodeName"/>
                    xsl:otherwise>
                xsl:choose>
            xsl:variable>
            <xsl:choose>
                <xsl:when test="$nameLength>0">
                    <xsl:value-of select="substring($tempName,1,$nameLength)"/>
                xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$tempName"/>
                xsl:otherwise>
            xsl:choose>
        xsl:template>

    xsl:stylesheet>

Please Sign in or register to post replies

Write your reply to:

Draft