Copied to clipboard

Flag this post as spam?

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


  • Jared Seeders 2 posts 22 karma points
    Feb 23, 2010 @ 23:47
    Jared Seeders
    0

    Problem traversing nodes

    I have a simple tree:

    -Properties

    - - Property1

    - - - UnitType1

    - - - UnitType2

    - - Property2

    - - - UnitType1

    - - - UnitType2

    Here is my XSLT file (problem area is bolded, nothing outputs here):

    <xsl:for-each select="$currentPage/node [@nodeTypeAlias='property']">
    <div class="property">
    <span class="propertyTrigger">
    Property Name: <xsl:value-of select="data [@alias = 'propertyName']" />
    </span>
    <ul class="propertyInfo">
    <li>
    Property Owner: <xsl:value-of select="data [@alias = 'propertyOwner']" />
    </li>
    <li>
    <xsl:value-of select="data [@alias = 'propertyInfo']" />
    </li>
    <li>
    <xsl:for-each select="./node [@nodeTypeAlias='unitType']">
    <ul>
    <li>
    Bedrooms: <xsl:value-of select="./data [@alias = 'bedrooms']" />
    </li>
    <li>
    Bathrooms: <xsl:value-of select="./data [@alias = 'bathrooms']" />
    </li>
    </ul>
    </xsl:for-each>

    </li>
    </ul>
    </div>
    </xsl:for-each>


    Im a complete XSL noob, so that for-each select line might not even make any sense.  Basically, for each property, I want to list each unit type and a few of the properties for each.  The property loop is working fine, so it does output 'propertyInfo' and 'propertyOwner', but I cant get it to traverse to unit types and units under the property.

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Feb 24, 2010 @ 00:02
    Thomas Höhler
    0

    On the first view it seems to be ok, so please check for typos (xslt is case sensitive).

    a trick to get the results of an xslt is to use copy-of in an textarea:

    <textarea><xsl:copy-of select="node" /></textarea>

    try using this to ourput the xml under the properties

    hth, Thomas

  • Jared Seeders 2 posts 22 karma points
    Feb 24, 2010 @ 00:16
    Jared Seeders
    0

    Thanks for the textarea tip, i figured out my problem.

    Apparently 'nodeTypeAlias' draws from the 'Name' field on the document type page, NOT the 'alias' field....for whatever reason.

  • Neil Campbell 58 posts 182 karma points
    Feb 24, 2010 @ 01:00
    Neil Campbell
    1

    Hi Jared,
    The nodeTypeAlias is not read from the Name field on the documentType. The documentType alias is used.

    I think what you may have done is changed the alias after you created the documentType, which will cause issues as umbraco is still referencing the old alias.

    I am not sure how to get the new alias to be picked up by umbraco though. I just make sure i use the alias i want when creating the documentType, and then just update the name.

    Hope this helps.

    Neil

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Feb 24, 2010 @ 09:06
    Thomas Höhler
    3

    I am changing the alias of the document types regulary, the changes are reflected if you republish the nodes of this document type.

    hth, Thomas

  • Neil Campbell 58 posts 182 karma points
    Feb 24, 2010 @ 09:16
    Neil Campbell
    0

    Thanks Thomas, that's really good to know!
    I thought you could do it, but I couldn't remember how.

    Cheers,
    Neil

Please Sign in or register to post replies

Write your reply to:

Draft