I have some issues while checking for a document type in my XSLT. What i need to do is check where am using a specific document type and if so i will will display the nodeName and all the child nodes from this documentType.
My Structure is something like
Default
Doc 1 --- Sub Doc1 --- Sub Doc 2 --- Sub Doc 3 (documentType 'SuDoc') ---- Sub Sub Doc 1 ---- Sub Sub Doc 2
<xsl:if test="count(./*[@isDoc and string(umbracoNaviHide) !='1'])>0"> <xsl:choose> <xsl:when test="@nodeTypeAlias='SuDoc'"> <!-- But this is the Old Schema --> <ul> <xsl:value-of select="@nodeName"/> </ul> </xsl:when> <xsl:otherwise>
Can help out with this? here is my XSLT, it works fine but i need to get ride of extra
Tags "suCn". With the below code am getting 27 but only 6 should be displayed. This is a drop down menu navigation where the output should be something like
<xsl:for-eachselect="./* [@isDoc and string(umbracoNaviHide) !='1']"> <xsl:choose> <xsl:whentest="self::SuDoc"> <!-- Second Menu --> <liclass="disCn"> <ul> <xsl:call-templatename="DisCn"/> </ul> </li> <!-- End of Second Menu --> </xsl:when> <xsl:otherwise> <!-- First Menu --> <xsl:call-templatename="suCn"/> <!-- end of first menu --> </xsl:otherwise> </xsl:choose> </xsl:for-each> </ul> </xsl:if> </li> </xsl:for-each>
Checking Document Type
Hi all,
I have some issues while checking for a document type in my XSLT. What i need to do is check where am using a specific document type and if so i will will display the nodeName and all the child nodes from this documentType.
My Structure is something like
Default
Doc 1
--- Sub Doc1
--- Sub Doc 2
--- Sub Doc 3 (documentType 'SuDoc')
---- Sub Sub Doc 1
---- Sub Sub Doc 2
Any suggestion ??
Hi Fuji,
Use the self:: axis to test the name of an element (or if it's in a variable, the name() function):
or:
Also - no need to count when testing for e.g. childnodes:
/Chriztian
OK let me give this a try. I did test self: but didnt work.
OK - important to use two colons "::" for axes - just to be sure you got that. Otherwise you'll get an error about an undeclared "self" prefix.
/Chriztian
Yup it works i must have missed a colon. I even try the other one but this one is not working for me
Chriztian,
Can help out with this? here is my XSLT, it works fine but i need to get ride of extra
Got it working here was my mistake
<xsl:if test="*[@isDoc][not(umbracoNaviHide = 1)]">
<ul style="border:1px solid #f00;">
<li class="suCn"> <!-- Misplaced the Li Tag -->
</li>
</ul>
</xsl:template>
<xsl:template name="suCn">
<div class="suRs"><a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName" /></a></div>
</xsl:template>
<xsl:template name="DisCn">
<xsl:if test="*[@isDoc][not(umbracoNaviHide = 1)]">
<xsl:for-each select="./* [@isDoc and string(umbracoNaviHide) !='1']">
<li>
<a href="{umbraco.library:NiceUrl(@id)}" ><xsl:value-of select="@nodeName"/></a>
</li>
</xsl:for-each>
</xsl:if>
</xsl:template>
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.