Copied to clipboard

Flag this post as spam?

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


  • Jim Lesinski 32 posts 54 karma points
    Aug 31, 2010 @ 23:26
    Jim Lesinski
    0

    How do I check the current pages docTypeAlias in 4.5?

    Using this example:

     

    <xsl:for-each select="$currentPage/*[not(self::NewsItem)]">
    </xsl:for-each>

    I can see how to check the current pages child document type aliases. 

    How do I get the current pages document type alias? I want to use this in an xsl:if like this:

    <xsl:if test="$currentPage/@nodeName = 'whatever'>
    </xsl:if>

    That works for node name but I can't seem to figure out how to get the document type alias. 

     

  • Hendrik Jan 71 posts 137 karma points
    Sep 01, 2010 @ 00:52
    Hendrik Jan
    0

    Hey Jim,

     

    try using the function "name()", it gives the element name of the curren node. Wich is the document type alias

    so that would be:

    <xsl:if test="name($currentPage) = 'whatever'">
    </xsl:if>

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Sep 01, 2010 @ 09:07
    Chriztian Steinmeier
    0

    Hi Jim,

    Since you reference an example using the self:: axis, here's an explanation of how to use that for $currentPage:

    <xsl: if test="$currentPage/self::whatever">...</xsl:test>

    Note that when you use the name() function you have to supply a string, but using the self:: axis you can't (just omit the apostrophes).

    - That said, you'll need to use the name() function if you're testing against a value in a variable.

    /Chriztian

  • Jim Lesinski 32 posts 54 karma points
    Sep 01, 2010 @ 19:31
    Jim Lesinski
    0

    Thanks guys! The name() function is exactly what I needed.

Please Sign in or register to post replies

Write your reply to:

Draft