Copied to clipboard

Flag this post as spam?

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


  • AlexR 39 posts 61 karma points
    May 05, 2010 @ 10:05
    AlexR
    0

    Whate is the best way to return node-set from template?

    I created template that return teaserImage XML and that is protected from empty numbers:

    xsl:template name="teaserImage">
     
    <xsl:param name="currentPage" />

     
    <xsl:if test="number($currentPage/data[@alias='teaserImage'])">
       
    <xsl:copy-of select="umbraco.library:GetMedia($currentPage/data[@alias='teaserImage'], 'false')" />
     
    </xsl:if>
    </xsl:template>

    <xsl:variable name="teaserImage_XML">
     
    <xsl:call-template name="teaserImage">
       
    <xsl:with-param name="currentPage" select="$currentPage" />
     
    </xsl:call-template>
    </xsl:variable>

    <xsl:variable
    name="teaserImage" select="msxml:node-set($teaserImage_XML)" />

     

    But I can not use template result directly in xpath. To conver result into node set, I store XML into template variable teaserImage_XML and then store converted node-set into variable teaserImage.

    Is there exist better way to return node-set from template? Without using template variable.

  • 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