Copied to clipboard

Flag this post as spam?

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


  • Terry Clancy 204 posts 944 karma points
    Jan 02, 2013 @ 03:25
    Terry Clancy
    0

    Presenting the same content in multiple menus

    Hi XSLTers,I am creating a web site to present artworks.I want to enter information and images for each artwork only once to create a single list of "Documents"  but then provide multiple Menu options to present that information.  For example>> Artworks by Artist>> Art Works by Art Type>> Artworks by Price Category>> Artworks for SaleI do not want to re-enter data to have artworks appear in multiple places.Could someone please recommend the best approach to accomplishing this ?Also are there any sample sites that do this or something similar ?Thanks very muchTerry Clancy

  • Nigel Wilson 945 posts 2077 karma points
    Jan 02, 2013 @ 05:07
    Nigel Wilson
    0

    Hi Terry

    You can definitely achieve your goal with Umbraco.

    With Umbraco you have the main "Home" node for the content pages.

    I would then create another tree outside of this main tree that "houses" all your artwork, maybe sorted alphabetically by artist. For each piece of artwork you can then have properties for each of the bits of information you want to store against the art.

    Then you can have pages (or a single super dooper search by anything page) under your home page that provides the means to locate artwork depending on criteria.

    In terms of a site that does something similar - sorry I have no idea, but in essence your scenario is a perfect example of the flexibility of Umbraco and solutions are only really limited by imagination.

    I hope this helps get you underway.

    Cheers, Nigel

  • Terry Clancy 204 posts 944 karma points
    Jan 02, 2013 @ 20:19
    Terry Clancy
    0

    Hi Nigel,

    Thanks very much that helps a lot, partiularly the idea that I should create another tree outside of this main "home" tree that "houses" all your artwork.

    I need to learm more about XSLT and XPath before I can create a "super dooper" search - but I am totally OK with that (let me know if you recommend any good books on the subject.

    Thanks again,

     

    Terry

  • Nigel Wilson 945 posts 2077 karma points
    Jan 02, 2013 @ 20:35
    Nigel Wilson
    0

    Hi Terry

    Sorry - don't know any good books, I have purely learnt all I know from this fantastic community.

    If you get stumped the best way to get help is by showing your code, explaining the problem and others will gladly assist.

    Also if you have a few $$ to spare a subscription to video tutorials will provide a good reference point. 

    Best wishes, Nigel

  • Terry Clancy 204 posts 944 karma points
    Jan 05, 2013 @ 20:26
    Terry Clancy
    0

    Thanks again Nigel and hi all,

    (Editing Post because Forum+Chrome removed indents and much of the include XSLT source code I have included. Hoping for better result this time)

    I am trying to implement Nigel's suggestion but having a problem.  I would apprieciate if you or anyone else could look at please.

     

    My Site Content Structure is 

     

    Content

         ICHomePage

              TestText

              Gallery

              ICGallery

         Data

              ArtWorks

                   TestArtWork1

                   TestArtWork2

     

    SUMMARY

    I created the following XSLT to naviagate to the "Data" node:

     

    <xsl:variable name="siteRootNode" select="$currentPage/ancestor-or-self::* [@level=1]"/> 

     

    <p>Value from Data node:<xsl:value-of select="$siteRootNode/Data/@nodeName"/></p>

     

    It does not work (Returns Nll Text for nodeName).

     

    Any help fixing this so I can navigate to the "Data"node would be appreciated.

     

    MORE DETAIL

    And here is the "beginning" of my XSLT file  which has several attempts with the results of those attempts in XML comments. Any help in understanding why those attempts failed would be appreciated:

     

    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>

    <xsl:stylesheet 

    version="1.0" 

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 

    xmlns:msxml="urn:schemas-microsoft-com:xslt"

    xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary" 

    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary ">

     

     

    <xsl:output method="xml" omit-xml-declaration="yes"/>

     

    <xsl:param name="currentPage"/>

     

        <!-- Input the documenttype you want here -->

        <xsl:variable name="level" select="1"/>

     

    <xsl:template match="/">

     

    <!-- start writing XSLT -->

     

    <xsl:variable name="siteRootNode" select="$currentPage/ancestor-or-self::* [@level=1]"/>

     

     

    <span style="color:black">

    <p>Value from $currentPage: <xsl:value-of select="$currentPage/@nodeName"/></p>

    <!-- RETURNS:  "Value from $currentPage: ICHomePage"  NOTE:  Works as expoected -->

    <p/>

    <p>Value from root node:<xsl:value-of select="$siteRootNode/@nodeName"/></p>

    <!-- RETURNS:  "Value from root node:ICHomePage"  NOTE: I expected that roont node wouyld be Content - not ICHomePage ???   -->

    <p/>

    <p>Value from Data node:<xsl:value-of select="$siteRootNode/Data/@nodeName"/></p>

    <!-- RETURNS:  "Value from Data node:"  NOTE: Returns Null (Exp;ected if Rootnode is ICHomePage rather than Content because Data is a child of Content not ICHomePage(But I thought Root node should be Content?)  -->

    <p/>

    <p>Value from root parent node:<xsl:value-of select="$siteRootNode/parent::node/@nodeName"/></p>

    <!-- RETURNS:  "Value from root parent node:"  NOTE: Returns Null  ???  -->

    <p/>

    <p>Value from Parent/Data node:<xsl:value-of select="$siteRootNode/parent::node/Data/@nodeName"/></p>

    <!-- RETURNS:  "Value from Parent/Data node:"  NOTE:  Returns Null  ???   -->

    <p/>

    <p>Value from Following-Sibling node:<xsl:value-of select="$siteRootNode/following-sibling::node/@nodeName"/></p>

    <!-- RETURNS:  "Value from Following-Sibling node:"  NOTE:  Returns Null  ???   -->

    </span>

     

    Thanks again,

    Terry Clancy

  • Nigel Wilson 945 posts 2077 karma points
    Jan 05, 2013 @ 20:37
    Nigel Wilson
    0

    Hi Terry

    I haven't read all of your post but the first question asked related to getting to the data node.

    So maybe try the following:

    <xsl:variablename="node"select="umbraco.library:GetXmlNodeById(-1)/Data"/>

    Cheers, Nigel

  • Terry Clancy 204 posts 944 karma points
    Jan 05, 2013 @ 21:06
    Terry Clancy
    0

    Hi Nigel,  

    Note that I have Edited my last post to correct errors and omissions (It seems that Umbraco + Chrome removed indents and much of the XLST source code I had included - any tips for avoiding that ?  For my first post I used IE and it removed all line breaks !!  What browser works best in the forums ??  )

    Please review my post now it should be readable as I have serveral questions in there (if would be so kind :-) ).

    Also I am reviewing and testing your last suggestion ....

    I am triing to understand your code and looking at http://our.umbraco.org/wiki/reference/umbracolibrary/getxmlnodebyid.   I see you have used a "Placeholder" of "-1".  Why -1 ?  Is that a special value reserved for the root ?

     

    In any case I tested your suggestion follows:

    <xsl:variable name="DataNode" select="umbraco.library:GetXmlNodeById(-1)/Data"/>

    <p/>

    <p>Value from using GetXmlNodeById:<xsl:value-of select="$DataNode/@nodeName"/></p>

     

    And I got the following result:  "Value from using GetXmlNodeById: "  

    NOTE: a Null result - no text returned by "value-of" statement

    So I am still battling to naviage to the Data node.

     

    Thanks again for your continued help

     

    Terry (In Seattle/Bellevue)

     

  • Nigel Wilson 945 posts 2077 karma points
    Jan 05, 2013 @ 21:43
    Nigel Wilson
    0

    Hi Terry

    Yes, the root node will always have a value of -1 - take a look at App_Data/umbraco.config - this is the XML cache for your content.

    Another option is discussed here -> http://our.umbraco.org/forum/developers/xslt/24626-Getting-the-website-root-in-xslt - the accepted solution uses GetXmlAll() method which you could also use (this avoids hardcoding the -1 value for the ID).

    In terms of getting the node name from the Data node:

    1. Is everything under /Data published in your content tree ?

    2. Is the alias of your "Data" document "Data" or "data" - your XSLT needs to be exactly the same.

    Before attacking other questions, lets get this bit sorted - other issues may magically disappear, or things might just fall into place.

    Cheers, Nigel

  • Terry Clancy 204 posts 944 karma points
    Jan 05, 2013 @ 23:01
    Terry Clancy
    0

    Thanks Nigel,

    Yes Everything in /Data is Published

    When I look at Content/Data  on the Properties tab  the "Name" is "Data"  I assume this means that the Alias is "Data";  in any case I tried "data" in my XSLT and there was no change in result.

    I tried your  ideas of using GetXmlAll() method but still got null return:

    <p/>

    <p>Value from using GetXmlAll()/Data:<xsl:for-each select="umbraco.library:GetXmlAll()//Data/@nodeName"/></p>

    <p/>

    <p>Value from using GetXmlAll()/data:<xsl:for-each select="umbraco.library:GetXmlAll()//data/@nodeName"/></p>

     

    Notw however that I looked in App_Data/umbraco.config - should this have all the nodes in it ??  I did a text search (non case sensitive) for "ArtWorks"  and found nothing even though it is in my content tree under Data.  I think the whole "Data" Branch is missing from that file - should it be there  ?  (Note that I recently moved this Umbraco Database and site from another machine prior to adding the Data branch).  Perhaps my installation is not correct ?

    Thanks for your continued support.

    Terry Clancy


  • Nigel Wilson 945 posts 2077 karma points
    Jan 05, 2013 @ 23:46
    Nigel Wilson
    0

    The Artworks folder should be in the umbraco.config file - it is a child of the root node so should be there.

    I would double check your database / database connections / etc to confirm your installation is correct.

    Cheers, Nigel

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Jan 06, 2013 @ 01:12
    Chriztian Steinmeier
    1

    Hi Terry,

    Here's a very simple XSLT file to help you understand how to get to your Data subtree (assuming it's actually in the XML cache):

    <?xml version="1.0" encoding="utf-8" ?>
    <xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:umb="urn:umbraco.library"
        exclude-result-prefixes="umb"
    >
    
        <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
    
        <xsl:param name="currentPage" />
        <xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[@level = 1]" />
    
        <!-- From the siteRoot, go to its parent and then select the Data node -->
        <xsl:variable name="dataNode" select="$siteRoot/../Data" />
    
        <xsl:template match="/">
            <h2>Site nodes</h2>
            <ul>
                <!-- Process all the children of $siteRoot -->
                <xsl:apply-templates select="$siteRoot/*[@isDoc]" />
            </ul>
    
            <h2>Data nodes</h2>
            <ul>
                <!-- Process children of $dataNode -->
                <xsl:apply-templates select="$dataNode/*[@isDoc]" />
            </ul>
        </xsl:template>
    
        <!-- Generic template for a document -->
        <xsl:template match="*[@isDoc]">
            <li>
                <xsl:value-of select="@nodeName" />
                <!-- Any childnodes (i.e. documents, not properties)? -->
                <xsl:if test="*[@isDoc]">
                    <ul>
                        <!-- Process them (using this same template!) -->
                        <xsl:apply-templates select="*[@isDoc]" />
                    </ul>
                </xsl:if>
            </li>
        </xsl:template>
    
    </xsl:stylesheet>

    A note about the GetXmlAll() extension – I recently updated the Wiki page for GetXmlAll() to clear out some confusion about its necessity...

    /Chriztian

     

  • Terry Clancy 204 posts 944 karma points
    Jan 07, 2013 @ 06:16
    Terry Clancy
    0

    Nigel,

    Sorry but I was looking at the wrong umbraco.config  file (E: drive insteak of C: drive).  In the umbraco.config in use does have all the nodes from the content tree as expected. Sorry for the mistake. So my Umbraco Installation is OK  ....  but I still have the problem (and it is starting to get annoying :-) ).

    I seems that the "RootNode" is the ICHomePage from that node down everything seens to work - but as you try to navigatge up to the "Content" node (ID = -1) and then down to any other node (such as "Data" in my case) using any of several appraoches (such as <xsl:value-of select="$siteRootNode/../Data/@nodeName"/> ) then somthing does not work and I can not yet determine what the issue is.

    I have tried many approaches as shown in the XSLT code below.  

    The output of this test is below the code:  

    XSLT

    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>

    <xsl:stylesheet 

    version="1.0" 

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 

    xmlns:msxml="urn:schemas-microsoft-com:xslt"

    xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon"xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath"xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary" 

    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressionsExslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary ">

    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

        <!-- Input the documenttype you want here -->

        <xsl:variable name="level" select="1"/>

    <xsl:template match="/">

    <!-- start writing XSLT -->

    <xsl:variable name="siteRootNode" select="$currentPage/ancestor-or-self::* [@level=1]"/>

    <xsl:variable name="GetXMLDataNode" select="umbraco.library:GetXmlNodeById(-1)/Data"/>

    <!-- From the siteRoot, go to its parent and then select the Data node -->

    <xsl:variable name="dataNode" select="$siteRootNode/../Data" />

    <span style="color:black">

    <p>Value from $currentPage: <xsl:value-of select="$currentPage/@nodeName"/></p>

    <p/>

    <p>Value from root node:<xsl:value-of select="$siteRootNode/@nodeName"/></p>

    <p/>

    <p>Value from Data node:<xsl:value-of select="$siteRootNode/Data/@nodeName"/></p>

    <p/>

    <p>Value from root parent node:<xsl:value-of select="$siteRootNode/parent::node/@nodeName"/></p>

    <p/>

    <p>Value from Parent/Data node:<xsl:value-of select="$siteRootNode/parent::node/Data/@nodeName"/></p>

    <p/>

    <p>Value from Following-Sibling node:<xsl:value-of select="$siteRootNode/following-sibling::node/@nodeName"/></p>

    <p/>

    <p>Value from using GetXmlNodeById:<xsl:value-of select="$GetXMLDataNode/@nodeName"/></p>

    <p/>

    <p>Value from using GetXmlAll()/Data:<xsl:for-each select="umbraco.library:GetXmlAll()//Data/@nodeName"/></p>

    <p/>

    <p>Value from using GetXmlAll()/data:<xsl:for-each select="umbraco.library:GetXmlAll()//data/@nodeName"/></p>

    <p/>

    <p>Value $siteRootNode:<xsl:value-of select="$siteRootNode/@nodeName"/></p>

    <p>Value Parent of $siteRootNode:<xsl:value-of select="$siteRootNode/../@nodeName"/></p>

    <p>Value from ICHomePage using Parent of $siteRootNode:<xsl:value-of select="$siteRootNode/../ICHomePage/@nodeName"/></p>

    <p>Value from TestHP using Parent of $siteRootNode:<xsl:value-of select="$siteRootNode/../TestHP/@nodeName"/></p>

    <p>Value from Data using Parent of $siteRootNode:<xsl:value-of select="$siteRootNode/../Data/@nodeName"/></p>

    <p>Value from Data using Parent of $siteRootNode:<xsl:value-of select="$dataNode/@nodeName"/></p>

    </span>

     

    Results of XSLT Above:

     

    Value from $currentPage: ICHomePage

     

    Value from root node:ICHomePage

     

    Value from Data node:        <<<<  Note null text returned from xsl:value-of select  statement

     

    Value from root parent node:        <<<<  Note null text returned from xsl:value-of select  statement

     

    Value from Parent/Data node:        <<<<  Note null text returned from xsl:value-of select  statement

     

    Value from Following-Sibling node:        <<<<  Note null text returned from xsl:value-of select  statement

     

    Value from using GetXmlNodeById:        <<<<  Note null text returned from xsl:value-of select  statement

     

    Value from using GetXmlAll()/Data:        <<<<  Note null text returned from xsl:value-of select  statement

     

    Value from using GetXmlAll()/data:        <<<<  Note null text returned from xsl:value-of select  statement

     

    Value $siteRootNode:ICHomePage

    Value Parent of $siteRootNode:        <<<<  Note null text returned from xsl:value-of select  statement

    Value from ICHomePage using Parent of $siteRootNode:ICHomePage

    Value from TestHP using Parent of $siteRootNode:        <<<<  Note null text returned from xsl:value-of select  statement

    Value from Data using Parent of $siteRootNode:        <<<<  Note null text returned from xsl:value-of select  statement

    Value from Data using Parent of $siteRootNode:        <<<<  Note null text returned from xsl:value-of select  statement

    Any help to overcome this would be appreciated.

    Terry Clancy

  • Terry Clancy 204 posts 944 karma points
    Jan 07, 2013 @ 06:32
    Terry Clancy
    0

    Chriztian,

    I tried the XSLT file you provided an obtained the result below.  You will note that the "Site Nodes" section works fine but that the "Data Nodes"  section does not.  This is consistent with the ongoing problem I am having.

    I seems that the "RootNode" is the ICHomePage from that node down everything seens to work - but as you try to navigatge up from the Home Page  to the "Content" node (ID = -1) and then down to any other node (such as "Data" in my case) using any of several appraoches (such as <xsl:value-of select="$siteRootNode/../Data/@nodeName"/> ) then somthing does not work and I can not yet determine what the issue is.  See my last post to Nigel which shows the various approaches I have tried.

    Any help to overcome this would be appreciated.

    Terry Clancy

    Results from your XSLT file:

     

    Site nodes 

    • TestText....
    • Gallery
      • Abstract Art
        • Grid
        • Red Abstract
        • Yellow Abstract
        • Red Green Abstract
        • Triangle Circle Abstract
        • Walking Ladies
      • Sketched Art
        • SketchChair
        • FlowerPot
        • Jug
        • WomanSketching
        • WomenOnCouch
        • Assorted
        • BrokenSelfPortrait
        • DragonFire
        • Dragon
        • Girl Crouching
        • GirlFrontAndBack
        • GirlOnFloor
        • GirlOnStool
        • GirlStanding
        • LadyWithStaff
        • MansHead
        • ManStanding
        • Pear
        • Skull
      • Geometric Art
        • JoshuaGeometric1
        • JoshuaGeometric2
        • JoshuaGeometric3
      • Mural Art
    • ICGallery
      • Paintings
        • WA Landscape
        • Coffee Shop Love
        • Flower Pod
        • Flower Vase
        • Isle of Capri
        • Joshua and Luke
        • Lake View
        • Girl on Chair
        • Girl on Couch
        • Girl with Pole
        • Paper Airplane
        • Play Tree
        • Joshua Self Portrait
    • ArtistsMenu
    • Test1

    Data nodes

     

     

     


  • Nigel Wilson 945 posts 2077 karma points
    Jan 07, 2013 @ 10:02
    Nigel Wilson
    0

    Hi Terry

    Can you try right clicking on the "Content" node and republishing the entire site.

    The next alternative would be to try and output a specific node within the Data sub tree - get the node ID from the Data node and try the following to see what is output:

    <xsl:value-of select="umbraco.library:GetXmlNodeById(Data Node ID)/@nodeName"/>

    This will help to determine if the node is in the xml cache or not.

    Cheers, Nigel

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Jan 07, 2013 @ 10:13
    Chriztian Steinmeier
    0

    Hi Terry,

    If the "Data nodes" part doesn't show anything, you should double-check the doctype alias (element name in Umbraco.config) of the node called "Data" and substitute that in the XPath that starts that selects that node, so change this:

     <xsl:variable name="dataNode" select="$siteRoot/../Data" />

    To this:

    <xsl:variable name="dataNode" select="$siteRoot/../REAL_ALIAS_HERE" />

    Alternatively you can select it by ID (as Nigel suggests):

    <xsl:variable name="dataNode" select="$siteRoot/../*[@id = ID_HERE]" />

    /Chriztian

  • Terry Clancy 204 posts 944 karma points
    Jan 08, 2013 @ 09:01
    Terry Clancy
    0

    Nigel and Chriztian,

    Thank you both for your suggestions. both your emails resulted in significant progress  and I think I am now there - thanks.

     

    Note that I have now changed the name of my data node from "Data" to "AZData" to avoid any possible conflict with special words (but that was not the problem)....

     

    Nigel,  I  republished the entire site. But it had no effect.  However getting the ID of AZData from umbraco.config  (it was 1176) and using as follows was successful:

    <p>Value of mbraco.library:GetXmlNodeById(1176)/@nodeName    :<xsl:value-of select="umbraco.library:GetXmlNodeById(1176)/@nodeName"/> </p>

    That line returned:    Value of mbraco.library:GetXmlNodeById(1176)/@nodeName :AZData

     

    Chriztian,  The entry for  AZData in umbraco.config  is as follows

    <DataFolder id="1176" parentID="-1" level="1" writerID="0" creatorID="0" nodeType="1174" template="1175" sortOrder="3" createDate="2013-01-03T22:34:04" updateDate="2013-01-07T00:39:07" nodeName="AZData" urlName="azdata" writerName="admin" creatorName="admin" path="-1,1176" isDoc=""> 

    I assume from this that the DocType is "DataFolder"  I tried this as the alias in the XPath and was suprized and pleaseed that it works, here is the code I used:

    <xsl:variable name="dataNode" select="$siteRootNode/../DataFolder" />

    <p>Value of $dataNode/@nodeName                              :<xsl:value-of select="$dataNode/@nodeName"/></p>

    That line returned:    Value of $dataNode/@nodeName :AZData

    I am very pleased to have this working (thanks) .

    My MAIN ERROR was to use the  nodeName attribute in the XPath path rather then the XML Element name.

    I assume that in this case because the XML Element Name represents the DocType then you could concievably have several XML Elements with the same DocType in which case you would need to use an XPath [Predicate] to filter our the desired name based on the nodeName Attribute.  It is also worth noting that I was also confused becuase in some of my other nodes I had set the nodeName to the same as the DocType and so misintepresed success in those cases.

    Thanks to both of you for you help in solving this problem

    I have listed my working test code below for anyone who is interested.

    Terry

     

    My working code:


    <span style="color:black">

    <p>  Getting the Current Page  </p> 

    <p>  ------------------------  </p>

    <p>Value of $currentPage/@nodeName   : <xsl:value-of select="$currentPage/@nodeName"/></p>

    <p/>

    <p>  Getting the Home Page / siteRootNode </p> 

    <p>  ---------------------------------------  </p>

    <xsl:variable name="siteRootNode" select="$currentPage/ancestor-or-self::* [@level=1]"/>

    <p>Value of $siteRootNode/@nodeName   : <xsl:value-of select="$siteRootNode/@nodeName"/></p>

    <p/>

    <p>  Getting the Content Root  </p>

    <p>  ------------------------  </p>

    <p>  NOTE that to test this I hard coded umbraco.config to add a nodeName Paramater to the Content Root node ie: LT root id="-1" nodeName="AZRoot" GT </p>

    <p>  Method 1: </p>

    <xsl:variable name="ContentRootNode" select="$currentPage/ancestor::root" />

    <p>----Value of $ContentRootNode/@nodeName                : <xsl:value-of select="$ContentRootNode/@nodeName"/></p>

    <p/>

    <p>  Method 2 (Only works if youi are on the home page) : </p>

    <xsl:variable name="ContentRootNode2" select="$currentPage/.."/>

    <p>Value of $ContentRootNode2/@nodeName                          : <xsl:value-of select="$ContentRootNode2/@nodeName"/></p>

    <p/>

    <p>  Using GetXmlNodeById  </p>

    <p>  --------------------  </p>

    <p>  NOTE GetXMLRootNode  Does not seem to work for the Content Root ( ID = -1 ) : </p>

    <xsl:variable name="GetXMLRootNode" select="umbraco.library:GetXmlNodeById('-1')"/>

    <p>----Value of $GetXMLRootNode/@nodeName                        : <xsl:value-of select="$GetXMLRootNode/@nodeName"/></p>

    <p/>

    <p>  NOTE GetXMLRootNode  Does work for the Home Page and Data Nodes : </p>

    <xsl:variable name="GetHomePage1094Node" select="umbraco.library:GetXmlNodeById('1094')"/>

    <p>----Value of $GetHomePageNode/@nodeName  : <xsl:value-of select="$GetHomePage1094Node/@nodeName"/></p>

    <p/>

    <xsl:variable name="GetAZData1176Node" select="umbraco.library:GetXmlNodeById('1176')"/>

    <p>----Value of $GetAZDataNode/@nodeName                        : <xsl:value-of select="$GetAZData1176Node/@nodeName"/></p>

    <p/>


     <p>  Getting my Data Node - DataFolder AZData  (Note [Predicate/Filter] needed incase there are several elements with DocType DataFolder)  </p>

    <p>  ----------------------------------------  </p>       

    <!-- From the siteRoot, go to its parent and then select the Data node -->

    <xsl:variable name="AZDataNode" select="$ContentRootNode/DataFolder[@nodeName='AZData']" />

    <p>Value of $AZDataNode/@nodeName                              : <xsl:value-of select="$AZDataNode/@nodeName"/></p>

    <p/>


     <p>  Other Approaches  </p>

    <p>  ----------------  </p>  

     

    <p>Value of $siteRootNode/../DataFolder/@nodeName                     : <xsl:value-of select="$siteRootNode/../DataFolder/@nodeName"/></p>

    <p/>

    <p>Value of $siteRootNode/parent::node()/@nodeName           : <xsl:value-of select="$siteRootNode/parent::node()/@nodeName"/></p>

    <p/>

    <p>Value of $siteRootNode/parent::node()/DataFolder/@nodeName      : <xsl:value-of select="$siteRootNode/parent::node()/DataFolder/@nodeName"/></p>

    <p/>

    <p>Value of $siteRootNode/following-sibling::node()/@nodeName: <xsl:value-of select="$siteRootNode/following-sibling::node()/@nodeName"/></p>

    <p/>

    <p>Value of $siteRootNode/following::node()/@nodeName           : <xsl:value-of select="$siteRootNode/following::node()/@nodeName"/></p>

    <p/>

    <p>Value of $siteRootNode/following-sibling::*/@nodeName[@nodeName='AZData']/text() : <xsl:value-of select="$siteRootNode/following::*[@nodeName='AZData']/@nodeName "/></p>



    <p/>

    <p>Value of $siteRootNode/@nodeName                          : <xsl:value-of select="$siteRootNode/@nodeName"/></p>

    <p/>

    <p>Value of $siteRootNode/../@nodeName                       : <xsl:value-of select="$siteRootNode/../@nodeName"/></p>

    <p/>

    <p>Value of $siteRootNode/../ICHomePage/@nodeName            : <xsl:value-of select="$siteRootNode/../ICHomePage/@nodeName"/></p>

    <p/>

    <p>Value of $siteRootNode/../ICHomePage[@nodeName='TestHP']/@nodeName : <xsl:value-of select="$siteRootNode/../ICHomePage[@nodeName='TestHP']/@nodeName"/></p>

    <p/>

    <p>Value of $siteRootNode/../AZData/@nodeName                : <xsl:value-of select="$siteRootNode/../DataFolder/@nodeName"/></p>

    <p/>

    <p>Value of mbraco.library:GetXmlNodeById(1176)/@nodeName    : <xsl:value-of select="umbraco.library:GetXmlNodeById(1176)/@nodeName"/> </p>

    <p/>

    <p>Value of "$siteRootNode/../* [@id=1176]    :<xsl:variable name="Node1176" select="$siteRootNode/../* [@id=1176]" /> <xsl:value-of select="$Node1176/@nodeName" /> </p>

    <p/>

    <p> Could note get the following to work  </p>

    <p> ------------------------------------  </p>

    <p/>

    <p>Value of umbraco.library:GetXmlAll()//DataFolder/@nodeName      : <xsl:for-each select="umbraco.library:GetXmlAll()//DataFolder/@nodeName"/></p>

     

    </span>

     

     

     

     

     

Please Sign in or register to post replies

Write your reply to:

Draft