Copied to clipboard

Flag this post as spam?

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


  • vaibhav 119 posts 139 karma points
    May 13, 2011 @ 14:13
    vaibhav
    0

    how get the document type

    hello,

    I want to know the document type of the node using xslt ....

    how to do it ?

  • Kim Andersen 1447 posts 2196 karma points MVP
    May 13, 2011 @ 15:09
    Kim Andersen
    0

    You can do like this:

    <xsl:value-of select="name($currentPage)" />

    This will return the name of the current page, which is named after the document type alias.

    /Kim A

  • vaibhav 119 posts 139 karma points
    May 16, 2011 @ 13:01
    vaibhav
    0

    Hi,

    It is not working.

    It is not returning anything.

    Can u say any other method.

  • Rich Green 2246 posts 4008 karma points
    May 16, 2011 @ 13:13
    Rich Green
    0

    Try this 

    <xsl:value-of select="local-name($currentPage)"/>

    Rich

  • vaibhav 119 posts 139 karma points
    May 16, 2011 @ 13:22
    vaibhav
    0

    Hi,

    I just have the @nodeName ....from that i want to find the document type ...how to do that ?

  • Rich Green 2246 posts 4008 karma points
    May 16, 2011 @ 13:25
    Rich Green
    0

    The code 'local-name($currentPage)' returns the alias of the DocType, what is it you're looking for?

    What version of Umbraco are you using?

    Rich

  • Rich Green 2246 posts 4008 karma points
    May 16, 2011 @ 13:27
    Rich Green
    0

    Sorry, are you saying that you are not trying to find the DocType of the currentPage?

    If so, maybe post your XSLT, how are you getting the nodeName?

    Rich

  • vaibhav 119 posts 139 karma points
    May 17, 2011 @ 07:28
    vaibhav
    0
    
    
    

    This is my xslt....


    <
    xsl:param name="parent"/>

                <xsl:if test="umbraco.library:IsProtected($parent/@id,
    $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id,
    $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)"
    >
                        <ul>
                            <xsl:for-each select="$parent/*[string(./data [@alias='umbracoNaviHide']) != '1' and @level &lt;= $maxLevelForSitemap]">
                              <li>
                                <xsl:if test="count(./*[string(./data [@alias='umbracoNaviHide']) != '1' and @level &lt;= $maxLevelForSitemap]) &lt; 1">
                                   <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>
                                </xsl:if>
                                    <xsl:if test="count(./*[string(./data [@alias='umbracoNaviHide']) != '1' and @level &lt;= $maxLevelForSitemap]) &gt; 0">
     
    <!-- Here i want to check wether page document type is "PublicationsPage" -->
                                <xsl:if test="@nodeName= 'Publications'">
                                        <a href="{umbraco.library:NiceUrl(@id)}">
                                          <xsl:value-of select="@nodeName"/>
                                        </a>
                                      </xsl:if>
                                     <xsl:if test="@nodeName != 'Publications'">
                                          <a href="{umbraco.library:NiceUrl(@id)}">
                                              <xsl:value-of select="@nodeName"/> >>
                                           </a>
                                        <ul>
                                            <xsl:call-template name="drawNodes3">
                                                <xsl:with-param name="parent" select="."/>
                                            </xsl:call-template>
                                        </ul>
                                        </xsl:if>
                                    </xsl:if>
                                </li>
                            </xsl:for-each>
                        </ul>
             
            </xsl:if>

     

  • vaibhav 119 posts 139 karma points
    May 17, 2011 @ 07:37
    vaibhav
    0
    
    
    

    This is my xslt....


    <
    xsl:param name="parent"/>

                <xsl:if test="umbraco.library:IsProtected($parent/@id,
    $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id,
    $parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)"
    >
                        <ul>
                            <xsl:for-each select="$parent/*[string(./data [@alias='umbracoNaviHide']) != '1' and @level &lt;= $maxLevelForSitemap]">
                              <li>
                                <xsl:if test="count(./*[string(./data [@alias='umbracoNaviHide']) != '1' and @level &lt;= $maxLevelForSitemap]) &lt; 1">
                                   <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>
                                </xsl:if>
                                    <xsl:if test="count(./*[string(./data [@alias='umbracoNaviHide']) != '1' and @level &lt;= $maxLevelForSitemap]) &gt; 0">
     
    <!-- Here i want to check wether page document type is "PublicationsPage" -->
                                <xsl:if test="@nodeName= 'Publications'">
                                        <a href="{umbraco.library:NiceUrl(@id)}">
                                          <xsl:value-of select="@nodeName"/>
                                        </a>
                                      </xsl:if>
                                     <xsl:if test="@nodeName != 'Publications'">
                                          <a href="{umbraco.library:NiceUrl(@id)}">
                                              <xsl:value-of select="@nodeName"/> >>
                                           </a>
                                        <ul>
                                            <xsl:call-template name="drawNodes3">
                                                <xsl:with-param name="parent" select="."/>
                                            </xsl:call-template>
                                        </ul>
                                        </xsl:if>
                                    </xsl:if>
                                </li>
                            </xsl:for-each>
                        </ul>
             
            </xsl:if>

     

  • Kim Andersen 1447 posts 2196 karma points MVP
    May 17, 2011 @ 08:19
    Kim Andersen
    1

    Okay, so you are running with the legacy XML schema I can see. If you want to check for the document type you must use the @nodeTypeAlias instead of the @nodeName, so this must be changed:

    <!-- Here i want to check wether page document type is "PublicationsPage" -->
    <xsl:if test="@nodeName= 'Publications'">      
           <a href="{umbraco.library:NiceUrl(@id)}">
              <xsl:value-of select="@nodeName"/>
           </a>
    </xsl:if>
    <xsl:if test="@nodeName= 'Publications'">
           <a href="{umbraco.library:NiceUrl(@id)}">
               <xsl:value-of select="@nodeName"/> >>
           </a>
           <ul>
              <xsl:call-template name="drawNodes3">
                   <xsl:with-param name="parent" select="."/>
               </xsl:call-template>
           </ul>
    </xsl:if>

    to this:

    <!-- Here i want to check wether page document type is "PublicationsPage" -->
    <xsl:if test="@nodeTypeAlias= 'PublicationsPage'">      
           <a href="{umbraco.library:NiceUrl(@id)}">
              <xsl:value-of select="@nodeName"/>
           </a>
    </xsl:if>
    <xsl:if test="@nodeTypeAlias!= 'PublicationsPage'">
           <a href="{umbraco.library:NiceUrl(@id)}">
               <xsl:value-of select="@nodeName"/> >>
           </a>
           <ul>
              <xsl:call-template name="drawNodes3">
                   <xsl:with-param name="parent" select="."/>
               </xsl:call-template>
           </ul>
    </xsl:if>

    /Kim A

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    May 17, 2011 @ 08:19
    Chriztian Steinmeier
    0

    Hi vaibhav,

    That looks like the old XML Schema, so you will have use @nodeTypeAlias for that:

    <xsl:if test="@nodeTypeAlias = 'PublicationsPage'">

    You can read more about the differences here: http://our.umbraco.org/wiki/reference/xslt/45-xml-schema ;

    /Chriztian 

  • vaibhav 119 posts 139 karma points
    May 18, 2011 @ 12:46
    vaibhav
    0

    Hi,

    <xsl:if test="@nodeTypeAlias= 'PublicationsPage'"> 

    this is not working....

    even if i do like this ....

    <xsl:value-of select="@nodeTypeAlias"/>

    it returns nothing....is there any problem with my code?

  • Rich Green 2246 posts 4008 karma points
    May 18, 2011 @ 12:55
    Rich Green
    0

    Hey,

    Are you saying 

     <xsl:value-of select="@nodeName"/>

    returns something, but

    <xsl:value-of select="@nodeTypeAlias"/>

    Doesn't return anything?

    Rich

  • vaibhav 119 posts 139 karma points
    May 18, 2011 @ 13:33
    vaibhav
    0

    Yes ...

     <xsl:value-of select="@nodeName"/>

    returns node name but...

    <xsl:value-of select="@nodeTypeAlias"/>

    returns nothing....

    what could be the problem ?

  • Peter Holmsgaard 69 posts 106 karma points
    May 18, 2011 @ 13:38
    Peter Holmsgaard
    0

    What version of Umbraco are you running?

    With the new xml schema, you can do it like this:

    <xsl:value-of select="name($currentPage)"/>
  • vaibhav 119 posts 139 karma points
    May 18, 2011 @ 13:51
    vaibhav
    0

    Hi,

    I dont want to know the document type of the curret page .....

    please refer the code which i have posted above.....

    i m using Umbraco 4.6.1

  • Peter Holmsgaard 69 posts 106 karma points
    May 18, 2011 @ 14:08
    Peter Holmsgaard
    0

    Oh, if you're in a for-each loop, you can use

    <xsl:value-of select="name(.)"/>

    Same principal..

    /Peter

  • vaibhav 119 posts 139 karma points
    May 18, 2011 @ 14:16
    vaibhav
    0

    Thanx Peter & all who tried to help me ....

Please Sign in or register to post replies

Write your reply to:

Draft