Copied to clipboard

Flag this post as spam?

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


  • Sony 20 posts 40 karma points
    Dec 11, 2010 @ 14:04
    Sony
    0

    retrieve specific nodes using xslt search

    hello folks.,

    i am doing a search functionality in which i want to retrieve specific nodes alone(not all nodes).

    for example,

    parameters i have are documentType and location(it is a propertyType.i have location value as london). I can retrieve nodes of specific documentType using following script
    <xsl:for-each select="umbraco.library:GetXmlNodeById($category)//node[@nodeTypeAlias = $docType]">

    </xsl:for-each>

    further i need to retrieve nodes based on location as well.

    please let me know if i am not clear.

    thank you

  • Kim Andersen 1447 posts 2196 karma points MVP
    Dec 11, 2010 @ 15:00
    Kim Andersen
    0

    Hi Sony

    Maybe you should take a look at the XSLT Search package. This package allows you to quickly implement a search functionality to your site. If you prefer to use your own and continue what you are already working with you can do that. Let's say you want to continue working with the code you provided above.

    You only want to iterate through the nodes that has a location set to London. then you should be able to do this:

    <xsl:for-each select="umbraco.library:GetXmlNodeById($category)//node[@nodeTypeAlias = $docType and string(data [@alias='location']) = 'London']">

    Now you should only run through the nodes that has a document type = $docType and a location=London. Does that make sense?

    If you want to store the location value in a variable you can change the 'London' to $selectedLocation where $selectedLocation contains the value of the property with an alias of location.

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft