Copied to clipboard

Flag this post as spam?

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


  • J 447 posts 864 karma points
    Nov 01, 2013 @ 16:37
    J
    0

    Add value to end of hyperlink

    I have a value that is displayed on a webpage using this line of code

    <xsl:value-of select="NameOfCountry" disable-output-escaping="yes"/>

    I would like to create a hyperlink which will have the above value at the end of the hyperlink

    <a href="/country?ct={@NameOfCountry}"> Country </a>

    but that doesnt work?

    How should i be getting the NameofCOuntry in my hyperlink?

    Thanks 

  • Ali Sheikh Taheri 470 posts 1648 karma points c-trib
    Nov 01, 2013 @ 16:49
    Ali Sheikh Taheri
    0

    It's been a while haven't written any XSLT but the below should be your answer:

    <a>
       <xsl:attribute name="href">
           /country?ct=<xsl:value-of select="NameOfCountry" disable-output-escaping="yes"/>country
        </xsl:attribute>country  
    </a>
    
  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Nov 01, 2013 @ 16:57
    Chriztian Steinmeier
    0

    Hi J,

    The @ is used to retrieve attributes from an XML node, but your value is a child element, so you can just get rid of the @ sign:

    <a href="/country?ct={NameOfCountry}"> Country </a>
    

    /Chriztian

  • Maritza 29 posts 49 karma points
    Nov 20, 2013 @ 18:56
    Maritza
    0

    I have this iframe:

    <iframe width="350" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://www.fastweb.com/displayed_widgets/6626?utm_source=scholarship_widget&utm_content=Guilford_Technical_CC_NC"></iframe>

    and I'm getting this error:

    Error occured

    System.Xml.XmlException: '=' is an unexpected token. The expected token is ';'. Line 19, position 190. 
    at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args) 
    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.Xsl.Xslt.XsltInput.ReadTextNodes() 
    at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling() 
    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)

     

    How can I make this to work?

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Nov 20, 2013 @ 19:11
    Dennis Aaen
    0

    Hi Maritza,

    The thing that gives you problems with your iframe is the & in the url. You can use &amp; to make the and sign.

    This should give you the iframe.

        <xsl:element name ="iframe">
            <xsl:attribute name="width">
              350
            </xsl:attribute>
            <xsl:attribute name="height">
              350
            </xsl:attribute>
            <xsl:attribute name="frameborder">
              0
            </xsl:attribute>
            <xsl:attribute name="src">
              http://www.fastweb.com/displayed_widgets/6626?utm_source=scholarship_widget&amp;utm_content=Guilford_Technical_CC_NC
            </xsl:attribute>
            <xsl:attribute name="scrolling">
             0
            </xsl:attribute>
            <xsl:attribute name="marginheight">
              0
            </xsl:attribute>
            <xsl:attribute name="marginwidth">
              0
            </xsl:attribute>
          </xsl:element>

    Hope this helps,

    /Dennis

  • Maritza 29 posts 49 karma points
    Nov 20, 2013 @ 20:15
    Maritza
    0

    Thank you Dennis !! :)

    I love knowdlege! 

  • Maritza 29 posts 49 karma points
    Dec 09, 2013 @ 18:17
    Maritza
    0

    I want to embed a google spreadsheet on my page - I'm creating an xslt file for my micro - 

     

    <xsl:element name ="iframe">
            <xsl:attribute name="width=">
              100%
            </xsl:attribute>
            <xsl:attribute name="height">
             700
            </xsl:attribute>
            <xsl:attribute name="frameborder">
              0
            </xsl:attribute>
            <xsl:attribute name="src">
              https://docs.google.com/spreadsheet/pub?key=0Aq_kuPyd0mV1dFhpeTZCcFZRdjdrbm9HUm10MWlvMmc&amp;output=html&amp;widget=true
            </xsl:attribute>
            <xsl:attribute name="scrolling">
             0
            </xsl:attribute>
            <xsl:attribute name="marginheight">
              0
            </xsl:attribute>
            <xsl:attribute name="marginwidth">
              0
            </xsl:attribute>
          </xsl:element>  

    This is the error:

    System.Xml.Xsl.XslLoadException: The '=' character, hexadecimal value 0x3D, cannot be included in a name. An error occurred at E:\inetpub\wwwroot\GTCC\gtcc.edu\xslt\635221875670388992_temp.xslt(21,9).
    at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver)
    at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)

    I need help

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Dec 09, 2013 @ 19:10
    Dennis Aaen
    0

    Hi Maritza,

    I have just spotted what gives your the error.

    Try this one instead that shoud give you an iFrame.

    <xsl:element name="iframe">
        <xsl:attribute name="width">
        100%
        </xsl:attribute>
        <xsl:attribute name="height">
        700
        </xsl:attribute>
        <xsl:attribute name="frameborder">   
        0
        </xsl:attribute>
        <xsl:attribute name="src">
            https://docs.google.com/spreadsheet/pub?key=0Aq_kuPyd0mV1dFhpeTZCcFZRdjdrbm9HUm10MWlvMmc&amp;output=html&amp;widget=tr
        </xsl:attribute>
        <xsl:attribute name="scrolling">
            0
        </xsl:attribute>
        <xsl:attribute name="marginheight">
            0
        </xsl:attribute>
        <xsl:attribute name="marginwidth">
        0
        </xsl:attribute>
    </xsl:element>

    The difference between your code and the code I have posted is in the width attribute. In your code you have an = inside the attribute name like this:

    <xsl:attribute name="width=">
        100%
    </xsl:attribute>

    Hope this will help you.

    /Dennis

  • Maritza 29 posts 49 karma points
    Dec 09, 2013 @ 19:22
    Maritza
    0

    Thank you Dennis

    HIGH FIVE!   :)

Please Sign in or register to post replies

Write your reply to:

Draft