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.
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.
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
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:
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
is working on a reply...