Copied to clipboard

Flag this post as spam?

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


  • Lars Anundskas 1 post 21 karma points
    May 14, 2010 @ 13:40
    Lars Anundskas
    0

    ASP.Net tags

    Hello,

    I'm exploring XSLT and umbraco, in my XSLT i need to get my hand on a variable, a property of the usercontrol where i render the xslt macro.

    XSLT doesn't seem to like the use of asp tags; <%= GetPropertyX %>

    Like this:
    <xsl:variable name="mynode" select="$currentPage/ancestor-or-self::root//node[@nodeTypeAlias = 'StartingPoint' and string(./data [@alias = 'StartingPointIDName']) = '<%= GetStartingPointIDName() %>']"/> -- with our without 's

    by hardcoding it, the query works:
    <xsl:variable name="mynode" select="$currentPage/ancestor-or-self::root//node[@nodeTypeAlias = 'StartingPoint' and string(./data [@alias = 'StartingPointIDName']) = 'testidname']"/>

    Is what I'm trying to do here possible?

    Further on, i am selecting a page property of type "checkbox list" from the node from the previous query to generate a drop down select list:

    This works well:
    <xsl:variable name="items" select="umbraco.library:Split($mynode/data[@alias='menuElements'],',')" />
    <xsl:for-each select="$items//value">
    <option><xsl:value-of select="."/></option>
    </xsl:for-each>

    Trying to get meaningful text in the dropdown list like this (with asp tags), does not work:

    <xsl:variable name="items" select="umbraco.library:Split($mynode/data[@alias='menuElements'],',')" />
    <xsl:for-each select="$items//value">
    <option><%=GetTextCaption('<xsl:value-of select="."/>') %></option>
    </xsl:for-each>

    Does anyone know the way to go in this case?

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    May 14, 2010 @ 13:56
    Sebastiaan Janssen
    0

    XSLT is a templating language and doesn't handle server-side logic on it's own.

    That being said, there are XSLT extensions in Umbraco, like the split function that you've found. You could make your own if you need to do some server sided stuff. But remember, XSLT is really meant to transform an XML file (your umbraco.config file currently) into some other form of angle brackets (HTML in this case).

Please Sign in or register to post replies

Write your reply to:

Draft