I have a directory of people. Each person in that directory has various standardized pieces of information. For example, phone #, email, department, etc...
What I need is a way to filter out specific results based on values that each person may have. In this specific case I need logic like this:
If a person works in "Department 1" AND has any "Research Interests" listed THEN display them in a list on nodeID 1234.
I have been able to do something close so far by using this line:
But as you can see this only pulls people that work in the Technology Department and displays them on a page with a nodeID of 6623.
Here is an example of my XML data.
<FacultyProfile id="6828" parentID="6394" level="3" writerID="21" creatorID="11" nodeType="6392" template="6397" sortOrder="147" createDate="2013-05-29T09:59:29" updateDate="2013-09-12T08:58:48" nodeName="Alice Noblin" urlName="alice-noblin" writerName="dj" creatorName="ABell" path="-1,1100,6394,6828" isDoc="">
<facultyResearchInterests><![CDATA[personal health records (PHR),electronic health records (EHR),health information exchange (HIE),patient engagement,health literacy]]></facultyResearchInterests>
<facultyDepartment><![CDATA[Health Management]]></facultyDepartment>
</FacultyProfile>
As you can see my root node for the Directory is 6394. How do I create a XSLT script to pull people based on multiple factors and display NodeName and Research Interests of each person that applies within that Department's page?
I used this XSLT file in a Macro and then placed the Macro on a testing page for my site and wasn't able to generate any results. However as I am going to need to use this kind of script more than just one (example on a different department page) is there a way to include...
Filter XML by multiple variables
I have a directory of people. Each person in that directory has various standardized pieces of information. For example, phone #, email, department, etc...
What I need is a way to filter out specific results based on values that each person may have. In this specific case I need logic like this:
If a person works in "Department 1" AND has any "Research Interests" listed THEN display them in a list on nodeID 1234.
I have been able to do something close so far by using this line:
But as you can see this only pulls people that work in the Technology Department and displays them on a page with a nodeID of 6623.
Here is an example of my XML data.
As you can see my root node for the Directory is 6394. How do I create a XSLT script to pull people based on multiple factors and display NodeName and Research Interests of each person that applies within that Department's page?
Thank you everyone in advance!
What does your xslt look like?
Ismial
What you want is an XPath query that will select all FacultyProfile nodes under node 6394, which are in a given department and have interests listed?
<xsl:for-each select="//* [@id=6394]/FacultyProfile [facultyDepartment='Health Management' and string(facultyResearchInterest) != '']">
<div>Name: <xsl:value-of select="./@name" />
</xsl:for-each>
?
Hello Stephen,
Thank you for your response. I didn't include this before but I'm using umbraco v 4.8.1 just in case that matters.
I tried your code:
I used this XSLT file in a Macro and then placed the Macro on a testing page for my site and wasn't able to generate any results. However as I am going to need to use this kind of script more than just one (example on a different department page) is there a way to include...
IF nodeID = 1234 THEN
IF nodeID = 2234 THEN
ETC.....
That would allow me to just create one XSLT file to manage for all of the various pages that need this kind of result listing.
OK.. I figured it out a little bit..
It works if I take out the
Could this be because "facultyResearchInterest" is using the TAGS datatype? I know tags seems to cause me problems sometimes.
Progress... this script works:
Now I just need a quick way to auto substitute the "Department" out depending on the current nodeID. (or something similar)
is working on a reply...