Copied to clipboard

Flag this post as spam?

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


  • Alec Colebrook-Clark 134 posts 258 karma points
    Jul 01, 2009 @ 11:47
    Alec Colebrook-Clark
    0

    Simple XSLT Test

    Hi all

    This is making me feel like ive learnt nothing in the last year. Basically I'm wanting to test the nodetype against the string "Gallery", so i can filter out any gallery node types. Currently im using the line

     

    <xsl:when test="@nodeTypeAlias = 'Gallery'">

     

    But its not working.

    Thanks in advance

     

    Alec

  • dandrayne 1138 posts 2262 karma points
    Jul 01, 2009 @ 11:52
    dandrayne
    0

    If you're inside a for-each loop, try<xsl:when</span><span class="pln"> </span><span class="atn">test</span><span class="pun">=</span><span class="atv">"current()/@nodeTypeAlias = 'Gallery'"</span><span class="tag">></span>

    Although I have used the sytnax you've used above before

            <xsl:choose>
                    <xsl:when test="@nodeTypeAlias='Event'">

    and it worked.  I'd also check that capitalisation is correct, nodes all published etc

  • dandrayne 1138 posts 2262 karma points
    Jul 01, 2009 @ 11:55
    dandrayne
    101

    Urgh, forum ate my copy paste

    <xsl:when test="current()/@nodeTypeAlias='Event'">

    Although like I say, I have used your syntac before and it worked ok.

  • Alec Colebrook-Clark 134 posts 258 karma points
    Jul 01, 2009 @ 12:10
    Alec Colebrook-Clark
    0

    Ok solved it, the problem was i was writing in the wrong XSL script.

    thus proving I have learnt nothing!

     

    Thanks anyway!

  • Alec Colebrook-Clark 134 posts 258 karma points
    Jul 01, 2009 @ 12:11
    Alec Colebrook-Clark
    0

    Forgot to mention that the soultion provided by Rayne is perfectly correct,

    again thanks!

  • Roel 151 posts 305 karma points
    Jul 01, 2009 @ 12:12
    Roel
    0

    don't forget xml is case sensitive (check the attribute and check the value of the attribute) Also you might want to print the actual value of @nodeTypeAlias, to see what's in there.

  • Roel 151 posts 305 karma points
    Jul 01, 2009 @ 12:13
    Roel
    0
    <xsl:value-of select="@nodeTypeAlias"/>
Please Sign in or register to post replies

Write your reply to:

Draft