Copied to clipboard

Flag this post as spam?

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


  • jacob phillips 130 posts 372 karma points
    May 10, 2013 @ 23:06
    jacob phillips
    0

    getting a specfic value while looping through a node set

    I'm looping through a nodeset.

    If I print out the value of each node inside the for loop, it looks like this:

     

    <relation typeId="7" typeName="AllPrograms" createDate="5/8/2013 10:22:20 PM" parentId="1146" childId="1267"><comment/><node id="1267" parentID="1137" level="3" writerID="2" sortOrder="1" createDate="2012-12-01T01:21:35" nodeName="Acid Jazz" path="-1,1087,1137,1267" />

     

    While inside this loop, all that I want to do is check the value of "typeName"

    For some reason, I can't get to it.

    I've tried:

     

    <xsl:copy-of select="./relation/@typeName" />
    <xsl:copy-of select="//@typeName" />
    <xsl:copy-of select="./@typeName" />

     

    But either I get blanks or the page errors on rendering (not during .xslt save)

     

    It puzzles me because if I can do this:

    select="umbraco.library:GetXmlNodeById(@childId)

    and I can get the node represented by childid 1267 above.

    However, when I do this:

    <xsl:copy-of select="@childId" />

    I just get an error upon rendering in the page (not during save)

    What am I doing wrong?

     

     

     


  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 11, 2013 @ 09:18
    Jan Skovgaard
    0

    Hi Jacob

    Could you please post the entire XSLT code you're currently fiddling with? And could you also let us know what XSLT error you get on the frontend?

    Sounds like you're using the xslt editor in Umbraco. I'll recommend that you use an external editor like visual studio or sublime text instead.

    If you add ?umbdebugshowtrace=1 to the url when you visit the page where your rendering is failing you will perhaps get a more detailed explanation of the error. It would be nice if you would post that as well.

    Looking forward to hearing from you.

    /Jan

  • jacob phillips 130 posts 372 karma points
    May 11, 2013 @ 09:57
    jacob phillips
    1

    Thx, I figured it out.

    Thanks for the external editor suggestions.

    Also, I forgot about the umbdebugshowtrace, I will use that.

    Even though I solved my own problem, part of the problem was my not understanding the difference between xsl:copy-of vs. xsl:value-of. 

    This reference quickly set me straight and might be helpful for someone else:

    http://dev.ektron.com/blogs.aspx?id=10472

Please Sign in or register to post replies

Write your reply to:

Draft