Copied to clipboard

Flag this post as spam?

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


  • Brian Olsen 143 posts 424 karma points
    Apr 15, 2013 @ 21:48
    Brian Olsen
    0

    get url from xml in xslt

    umbraco 4.11.5

    xml

            <kort>
              <Items>
                <Item id="1" sortId="1">
                  <testulr><![CDATA[https://maps.google.dk/maps/ms?msa=0&amp;msid=203493267795344003156.0004d714ba2031c8039a8&amp;hl=da&amp;ie=UTF8&amp;t=h&amp;ll=55.258288,8.431174&amp;spn=0.731262,0.880451&amp;output=embed]]></testulr>
                </Item>
              </Items>
            </kort>

    xslt

    <xsl:value-of select="$currentPage/kort/Items/Item/testulr"/>

    I get

    https://maps.google.dk/maps/ms?msa=0&amp;amp;msid=203493267795344003156.0004d714ba2031c8039a8&amp;amp;hl=da&amp;amp;ie=UTF8&amp;amp;t=h&amp;amp;ll=55.258288,8.431174&amp;amp;spn=0.731262,0.880451&amp;amp;output=embed

    how can I get url out without changing the url

  • Charles Afford 1163 posts 1709 karma points
    Apr 15, 2013 @ 22:05
    Charles Afford
    0

    Hi, i am not sure what you mean?  You are getting the url without changeing the url?  Charlie :)

  • Rich Green 2246 posts 4008 karma points
    Apr 15, 2013 @ 22:18
    Rich Green
    0

    Think this might have been lost in formatting, I can only guess you might need to add 

    <xsl:value-ofselect="$currentPage/kort/Items/Item/testulr" disable-output-escaping="yes"/>
  • Brian Olsen 143 posts 424 karma points
    Apr 15, 2013 @ 22:34
    Brian Olsen
    0

    not really

    this is the url from the xml

    https://maps.google.dk/maps/ms?msa=0&amp;msid=203493267795344003156.0004d714ba2031c8039a8&amp;hl=da&amp;ie=UTF8&amp;t=h&amp;ll=55.258288,8.431174&amp;spn=0.731262,0.880451&amp;output=embed

    and this is the url i get with xslt

    https://maps.google.dk/maps/ms?msa=0&amp;amp;msid=203493267795344003156.0004d714ba2031c8039a8&amp;amp;hl=da&amp;amp;ie=UTF8&amp;amp;t=h&amp;amp;ll=55.258288,8.431174&amp;amp;spn=0.731262,0.880451&amp;amp;output=embed

    with the disable-output-escaping="yes" i get

    https://maps.google.dk/maps/ms?msa=0&msid=203493267795344003156.0004d714ba2031c8039a8&hl=da&ie=UTF8&t=h&ll=55.258288,8.431174&spn=0.731262,0.880451&output=embed

     

  • Charles Afford 1163 posts 1709 karma points
    Apr 15, 2013 @ 22:49
    Charles Afford
    0

    Hang on.  Could you tell me what you are actually expecting the url to be :)

  • Brian Olsen 143 posts 424 karma points
    Apr 15, 2013 @ 22:53
    Brian Olsen
    0

    I need the url to an iframe to show a google map

  • Rich Green 2246 posts 4008 karma points
    Apr 15, 2013 @ 23:04
    Rich Green
    0

    I can't see what's wrong with the URL's however, you could use a Razor script to get the URL out, or just a Umbraco Field directly in the page if XSLT is causing you hassle.

    Rich

  • Comment author was deleted

    Apr 16, 2013 @ 00:44

    Brian, your last link works.  Is it not working for you?  It loads in a tab for me.

     

    https://maps.google.dk/maps/ms?msa=0&msid=203493267795344003156.0004d714ba2031c8039a8&hl=da&ie=UTF8&t=h&ll=55.258288,8.431174&spn=0.731262,0.880451&output=embed
  • Brian Olsen 143 posts 424 karma points
    Apr 16, 2013 @ 08:42
    Brian Olsen
    0

    hi kevin 

    if I copy this link into the browser then it works, but if I copy it into xslt script in an iframe then i get a xslt script error

     

    <iframe width="448" height="231" class="iframe" frameborder="1" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.dk/maps/ms?msa=0&msid=203493267795344003156.0004d714ba2031c8039a8&hl=da&ie=UTF8&t=h&ll=55.258288,8.431174&spn=0.731262,0.880451&output=embed"></iframe>

    Error occured

    System.Xml.XmlException: '=' is an unexpected token. The expected token is ';'. Line 49, position 159. 
    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.ReadTextNodes() 
    at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling() 
    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.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)

     

  • Brian Olsen 143 posts 424 karma points
    Apr 16, 2013 @ 09:10
    Brian Olsen
    0

    I got it to work with razor script where I use @Html.Raw is ther a function in xslt which do the same?

    or can I call a Razor macro in the xslt script??

  • Charles Afford 1163 posts 1709 karma points
    Apr 16, 2013 @ 09:53
    Charles Afford
    0

    Yuo could try putting the url in to a variable using disable-output-escaping="yes"

    so some var = <xsl:value-ofselect="$currentPage/kort/Items/Item/testulr"disable-output-escaping="yes"/>

    and then passing that into your iframe.

  • Brian Olsen 143 posts 424 karma points
    Apr 16, 2013 @ 10:02
    Brian Olsen
    0

    yes i just call the Razor macro in the xslt and i works :-)

  • Brian Olsen 143 posts 424 karma points
    Apr 16, 2013 @ 10:03
    Brian Olsen
    0

    Hi Charles 

    I have tried it but it does not work

Please Sign in or register to post replies

Write your reply to:

Draft