Copied to clipboard

Flag this post as spam?

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


  • Rachel Skuse 88 posts 118 karma points
    Sep 21, 2011 @ 10:39
    Rachel Skuse
    0

    Problems Updating XSLT from New Schema to Old Schema

    Hi,

    I'm using XSLT and JQuery to create an accordian menu using child pages of a node.

    The code has previously worked in Umbraco 4.5.2 but I am now trying to get it to work in 4.0.3 but not having much luck!

    I have updated the code for the old schema but I think there may be something wrong with my value-of select as it is throwing an error!

    Here is my xslt...

        <ul id="accordion">
    <xsl:for-each select="$currentPage/node [@nodeTypeAlias='AccordionItem']">
    <li class="acItemTitle">
    <a href="#" class="acItemTitleA">
    <span class="acItemSpan"><xsl:value-of select="@nodeName" /></span>
    <span class="acItemTitleASpan">
    Read more
    </span>
    <span class="clear"><xsl:comment>1</xsl:comment></span>
    </a>
    <div class="acItemContent"><xsl:value-of select="$currentPage/data [@alias=$itemContent] /></div>
    <div class="clear"><xsl:comment>1</xsl:comment></div>
    </li>
    </xsl:for-each>
    </ul>

     Any help appreciated!

    Thanks,

    Rachel

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 21, 2011 @ 10:45
    Dirk De Grave
    0

    Rachel,

    Currently don't see an issue, except for the 2nd $currentPage, which you should replace with ./data [@alias = $itemContent], (if $itemContent has been defined before of course, can't find it in above snippet)

    And more specifically, what error do you get?

     

    Looking forward to your info.

    Cheers,

    /Dirk

  • Rachel Skuse 88 posts 118 karma points
    Sep 21, 2011 @ 10:55
    Rachel Skuse
    0

    Hi Dirk,

    I have updated the 2nd $CurrentPage as suggested. Do I need to define $itemContent as a variable?

    The error I'm getting is this...

    System.Xml.Xsl.XslLoadException:
     XSLT compile error. An error occurred at (40,89). ---> 
    System.Xml.XmlException: '<', hexadecimal value 0x3C, is an invalid 
    attribute character. Line 40, position 89.
       at System.Xml.XmlTextReaderImpl.Throw(Exception e)
       at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
       at System.Xml.XmlTextReaderImpl.Throw(Int32 pos, String res, String[]
     args)
       at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos,
     Char quoteChar, NodeData attr)
       at System.Xml.XmlTextReaderImpl.ParseAttributes()
       at System.Xml.XmlTextReaderImpl.ParseElement()
       at System.Xml.XmlTextReaderImpl.ParseElementContent()
       at System.Xml.XmlTextReaderImpl.Read()
       at System.Xml.XmlTextReader.Read()
       at System.Xml.Xsl.Xslt.XsltInput.ReadNextSiblingHelper()
       at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling()
       at System.Xml.Xsl.Xslt.XsltInput.MoveToFirstChildAny()
       at System.Xml.Xsl.Xslt.XsltInput.MoveToFirstChild()
       at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, 
    InstructionFlags flags)
       at System.Xml.Xsl.Xslt.XsltLoader.LoadLiteralResultElement(Boolean 
    asStylesheet)
       at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, 
    InstructionFlags flags)
       at System.Xml.Xsl.Xslt.XsltLoader.LoadLiteralResultElement(Boolean 
    asStylesheet)
       at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, 
    InstructionFlags flags)
       at System.Xml.Xsl.Xslt.XsltLoader.XslForEach()
       at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, 
    InstructionFlags flags)
       at System.Xml.Xsl.Xslt.XsltLoader.LoadLiteralResultElement(Boolean 
    asStylesheet)
       at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, 
    InstructionFlags flags)
       at System.Xml.Xsl.Xslt.XsltLoader.LoadTemplate(NsDecl 
    stylesheetNsList)
       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(Compiler compiler, Object 
    stylesheet, XmlResolver xmlResolver)
       at System.Xml.Xsl.Xslt.Compiler.Compile(Object stylesheet, 
    XmlResolver xmlResolver, QilExpression& qil)
       at System.Xml.Xsl.XslCompiledTransform.CompileXsltToQil(Object 
    stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
       at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object 
    stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
       at System.Xml.Xsl.XslCompiledTransform.Load(XmlReader 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)

    Thanks,

    Rachel

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 21, 2011 @ 11:04
    Dirk De Grave
    0

    Answer to 1st question: Depends, if you *know* the propertyAlias and it will be static, use that one, otherwise if $itemContent is to be dynamic, use a variable.

    Just seen that you've not closed the

    <xsl:value-ofselect="$currentPage/data [@alias=$itemContent] />

    the select attribute, maybe that's the issue. Can you try adding a closing double quote for the select attribute?

     

    Cheers,

    /Dirk

  • Rachel Skuse 88 posts 118 karma points
    Sep 21, 2011 @ 11:19
    Rachel Skuse
    0

    Hi,

    I've added the double quote and it's cleared the error but now I'm getting 'The variable or parameter 'itemContent' is either not defined or it is out of scope'

    I assume this is because I haven't defined $itemContent?

    I have 2 aliases that I need to display - itemContent and itemContentImage - each are populated in the child pages that will form the accordian.

    Sorry, I'm a bit confused as to what I need to define and where!

    Thanks,

    Rachel

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 21, 2011 @ 11:33
    Dirk De Grave
    0

    yes, indeed, if you haven't defined that one, you need to, unless you can set it static, (which i assume here), so above snippet would be

    <xsl:value-of select="./data [@alias='itemContent'] />

    Cheers,

    /Dirk

  • Rachel Skuse 88 posts 118 karma points
    Sep 21, 2011 @ 11:39
    Rachel Skuse
    0

    Thank you! I now don't get any errors but the xslt isn't generating any output :(

    When I use the visualize xslt I get nothing and encode/ decode result just returns <ul id="accordion"></ul>

    I've also tried defining a specific node but still no result returned.

    Thanks,

    Rachel

Please Sign in or register to post replies

Write your reply to:

Draft