Hello,
- I'm creating a component where I need to capture the user session and place it in a variable.
- The variable will be used to do a condition.
- When condition is matched, then replace the variable in the for-each selection to display the specific DCR.
- User session role should match the DATUM ID, and display content.
Issue: It doesn't display anything via the browser. Blank page.
Here's the code -
Appearance:
<xsl:template match="/">
<xsl:variable name="role">$CONTEXT{session.userProfile.Role}</xsl:variable>
<xsl:if test="$role = 'Manager'">
<xsl:variable name="selector">Manager</xsl:variable>
</xsl:if>
<xsl:if test="$role = 'Employee'">
<xsl:variable name="selector">Employee</xsl:variable>
</xsl:if>
<xsl:for-each select="/Properties/Data/Datum[@ID=$role]/DCR/container/items">
<xsl:value-of select="contents"/>
</xsl:for-each>
</div>
</xsl:template>
Content XML
<Datum ID="Employee" Name="Employee" Type="DCR">
<DCR Category="TestDir" Type="Item">templatedata/TestDir/Container/data/default</DCR>
</Datum>
<Datum ID="Manager" Name="Manager" Type="DCR">
<DCR Category="TestDir" Type="Item">templatedata/TestDir/Container/data/default</DCR>
</Datum>
------------
If I change the for-each selection to <xsl:for-each select="/Properties/Data/Datum[@ID='Manager']/DCR/container/items"> - then it will work.
Any help or advise will be appreciated.
Thanks.