Copied to clipboard

Flag this post as spam?

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


  • Seena 14 posts 34 karma points
    Mar 11, 2013 @ 17:23
    Seena
    0

    Umbraco - Getting Textstring value

    I'm trying to get the value of a text string of page, assign a url to it, and then display the result on a different page using xslt. I'm not sure how to get the value of the textstring.

    Here is my macro:

         <xsl:variable name="parent" select="umbraco.library:GetXmlNodeById(1122)" />
         
        <!-- Input the related links property alias here -->
        <xsl:variable name="fieldName" select="/macro/fieldName"/>
        <xsl:template match="/">
       
        <xsl:if test="$fieldName != ''">
        <!-- The fun starts here -->
        <xsl:for-each select="$parent/* [name() = $fieldName ]/Textstring/value">
       
        <xsl:element name="a">
        <xsl:if test="./new-window[. = 'True']">
        <xsl:attribute name="target">_blank</xsl:attribute>
        </xsl:if>
       
        <xsl:attribute name="href">
        <xsl:value-of select="/myUrl.aspx"/>
        </xsl:attribute>
       
        <xsl:value-of select="./@title"/>
        </xsl:element>
       
        </xsl:for-each>
        </xsl:if>
        </xsl:template>
       
        </xsl:stylesheet>

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Mar 11, 2013 @ 17:44
    Lee Kelleher
    1

    Hi Seena,

    Can you confirm if you are using a Textstring data-type for your field? (As there are parts of the XSLT that look like you might be wanting to use something different, e.g. new window & title).

    If you are using the Textstring, then try this XSLT snippet:

    <xsl:value-of select="$parent/*[name() = $fieldName]" />

    Let us know how you get on.

    Thanks, Lee.

  • Seena 14 posts 34 karma points
    Mar 11, 2013 @ 17:59
    Seena
    0

    Thanks. That worked!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies