Copied to clipboard

Flag this post as spam?

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


  • Tristan 16 posts 36 karma points
    Apr 13, 2010 @ 18:53
    Tristan
    0

    Adding a JS file via a macro

    I'm trying to add Javascript code to a page via a macro, but keep getting the following error

    Error occured

    System.Xml.XmlException: '=' is an unexpected token. The expected token is ';'. Line 18, position 171.
    at System.Xml.XmlTextReaderImpl.Throw(Exception e)
    at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
    at System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(String expectedToken1, String expectedToken2)
    at System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(Int32 pos, String expectedToken1, String expectedToken2)
    at System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos)
    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.Xsl.Xslt.XsltInput.ReadNextSiblingHelper()
    at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling()
    at System.Xml.Xsl.Xslt.XsltInput.MoveToNextSibling()
    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)

     

    This is the JS file I'm trying to load... how do I stop XSLT from throwing up the error? I'm a bit of a noob when it comes to XSLT...


    <script type="text/javascript" language="JavaScript" src="https://emea2.recruitmentplatform.com/syndicated/lay/laydisplayrapido.cfm?ID=dffFK026203F3xyzB645479DP&component=lay9999_lst400a&mask=xyz&LG=UK">

    Thanks
    TM

  • Tommy Poulsen 514 posts 708 karma points
    Apr 13, 2010 @ 19:33
    Tommy Poulsen
    0

    Hi Tristan, you need to replace your &-characters with &amp; instead

    >Tommy

     

  • Tristan 16 posts 36 karma points
    Apr 13, 2010 @ 19:59
    Tristan
    0

    Thank you!

  • Jacob Phillips 34 posts 84 karma points
    Nov 03, 2010 @ 20:15
    Jacob Phillips
    0

    Thank you, thank you, thank you!

  • Eric Schrepel 161 posts 226 karma points
    Feb 27, 2013 @ 23:57
    Eric Schrepel
    0

    Quick note, as of Umbraco 6, I think the only place to replace those ampersands would be in the "src=" parameter.

    For example, I have Google Chart API code that looks kind of like this:

    <script type="text/javascript" src="//ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js">
    {"dataSourceUrl":"//docs.google.com/spreadsheet/tq?key=xxx&transpose=0&headers=1&range=A1%3AF30&gid=0&pub=1","options":{"blahblah"}
    </script>
    When I put that in a macro and then insert the macro into a RTE field, the above works just fine. But replacing & with &amp; causes a Google Chart error (and Umbraco accepts the above code just dandy).
Please Sign in or register to post replies

Write your reply to:

Draft