I guess that you mean that you have one Umbraco application which has multiple web sites in it using several root level nodes each bound to a different site?
Thanks for your helpful suggestions, and yes I'm trying to traverse a site that is parallel to the one I'm working on, so I can source the latest news items from multiple sites for good SEO.
List child nodes from other sites
Hi,
I've been banging my head against a wall for a bit on this.
What's the best way to list child nodes from other websites in umbraco?
Using legacy XSLT, how can I traverse down another websites node tree?
I think I've seen this done before.
Example
Content
Site 1 (@id='4901') (XSLT is running from this node)
Site 2
News (@id='2304') (I want to get the children of News)
News item 1
News item 2
News item 3
Any help is greatly appreciated!
Cheers
Adam
Hi Adam,
Am not sure of what you are asking here, are you trying to view the Child nodes of another website or Site 2 is a content folder ?
If such you can try to create an XSLT Changeable Source.
I guess that you mean that you have one Umbraco application which has multiple web sites in it using several root level nodes each bound to a different site?
If that's the case you could use the Umbraco library GetXmlNodeById http://our.umbraco.org/wiki/reference/umbracolibrary/getxmlnodebyid-(1)
Hi Fuji and John,
Thanks for your helpful suggestions, and yes I'm trying to traverse a site that is parallel to the one I'm working on, so I can source the latest news items from multiple sites for good SEO.
I tried GetXMLNodeById http://our.umbraco.org/wiki/reference/umbracolibrary/getxmlnodebyid-(1) and it worked a treat.
Cheers
Adam
Code below
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]> <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" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets "> <xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:param name="currentPage"/> <xsl:variable name="SortOrder" select="$currentPage/ancestor-or-self::node/data [@alias = 'brandSortOrder']" /> <xsl:variable name="SortBy" select="$currentPage/ancestor-or-self::node/data [@alias = 'brandSortBy']" /> <xsl:variable name="NumberofItemsToDisplay" select="$currentPage/ancestor-or-self::node/data [@alias = 'numberBrandArticlesFatFooter']" /> <xsl:variable name="news-articles1" select="3949" /> <xsl:variable name="news-articles2" select="4569" /> <xsl:variable name="news-articles3" select="2599" /> <xsl:variable name="news-articles4" select="2451" /> <!-- We need to set data-type to number or text depending on what sortby equals --> <xsl:variable name="DataType"> <xsl:choose> <xsl:when test="$SortBy='sortOrder'"> <xsl:value-of select="'number'" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="'text'" /> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:template match="/"> <div id="fat-footer"> <ul class="fixedwidthcentered nolist clearfix" id="brands"> <li><a href="{$currentPage/ancestor-or-self::node/descendant-or-self::data[@alias='footerBrand1URL']}" title="{$currentPage/ancestor-or-self::node/descendant-or-self::data[@alias='footerBrand1LCaption']}"><img src="{$currentPage/ancestor-or-self::node/descendant-or-self::data[@alias='footerBrand1Logo']}" alt="{$currentPage/ancestor-or-self::node/descendant-or-self::data[@alias='footerBrand1Caption']}" /></a></li> <li><a href="{$currentPage/ancestor-or-self::node/descendant-or-self::data[@alias='footerBrand2URL']}" title="{$currentPage/ancestor-or-self::node/descendant-or-self::data[@alias='footerBrand2LCaption']}"><img src="{$currentPage/ancestor-or-self::node/descendant-or-self::data[@alias='footerBrand2Logo']}" alt="{$currentPage/ancestor-or-self::node/descendant-or-self::data[@alias='footerBrand2Caption']}" /></a></li> <li><a href="{$currentPage/ancestor-or-self::node/descendant-or-self::data[@alias='footerBrand3URL']}" title="{$currentPage/ancestor-or-self::node/descendant-or-self::data[@alias='footerBrand3LCaption']}"><img src="{$currentPage/ancestor-or-self::node/descendant-or-self::data[@alias='footerBrand3Logo']}" alt="{$currentPage/ancestor-or-self::node/descendant-or-self::data[@alias='footerBrand3Caption']}" /></a></li> <li><a href="{$currentPage/ancestor-or-self::node/descendant-or-self::data[@alias='footerBrand4URL']}" title="{$currentPage/ancestor-or-self::node/descendant-or-self::data[@alias='footerBrand4LCaption']}"><img src="{$currentPage/ancestor-or-self::node/descendant-or-self::data[@alias='footerBrand4Logo']}" alt="{$currentPage/ancestor-or-self::node/descendant-or-self::data[@alias='footerBrand4Caption']}" /></a></li> </ul> <ul class="fixedwidthcentered nolist" id="brands-data"> <li class="col" id="col1"> <ul> <xsl:for-each select="umbraco.library:GetXmlNodeById($news-articles1)/node[string(data [@alias='umbracoNaviHide']) != '1']"> <!--order="{$SortOrder}" --> <xsl:if test="position()<= $NumberofItemsToDisplay"> <li class="ffitem"> <a href="{umbraco.library:NiceUrl(@id)}" title="{./data [@alias = 'PageTitle']}"> <xsl:value-of select="concat(substring(umbraco.library:StripHtml(./data[@alias = 'PageTitle']),1,25),'...')" /> </a> </li> </xsl:if> </xsl:for-each> </ul> </li> <li class="col" id="col2"> <ul> <xsl:for-each select="umbraco.library:GetXmlNodeById($news-articles2)/node[string(data [@alias='umbracoNaviHide']) != '1']"> <!--order="{$SortOrder}" --> <xsl:if test="position()<= $NumberofItemsToDisplay"> <li class="ffitem"> <a href="{umbraco.library:NiceUrl(@id)}" title="{./data [@alias = 'PageTitle']}"> <xsl:value-of select="concat(substring(umbraco.library:StripHtml(./data[@alias = 'PageTitle']),1,25),'...')" /> </a> </li> </xsl:if> </xsl:for-each> </ul> </li> <li class="col" id="col3"> <ul> <xsl:for-each select="umbraco.library:GetXmlNodeById($news-articles3)/node[string(data [@alias='umbracoNaviHide']) != '1']"> <!--order="{$SortOrder}" --> <xsl:if test="position()<= $NumberofItemsToDisplay"> <li class="ffitem"> <a href="{umbraco.library:NiceUrl(@id)}" title="{./data [@alias = 'PageTitle']}"> <xsl:value-of select="concat(substring(umbraco.library:StripHtml(./data[@alias = 'PageTitle']),1,25),'...')" /> </a> </li> </xsl:if> </xsl:for-each> </ul> </li> <li class="col nomarr" id="col4"> <ul> <xsl:for-each select="umbraco.library:GetXmlNodeById($news-articles4)/node[string(data [@alias='umbracoNaviHide']) != '1']"> <!--order="{$SortOrder}" --> <xsl:if test="position()<= $NumberofItemsToDisplay"> <li class="ffitem"> <a href="{umbraco.library:NiceUrl(@id)}" title="{./data [@alias = 'PageTitle']}"> <xsl:value-of select="concat(substring(umbraco.library:StripHtml(./data[@alias = 'PageTitle']),1,25),'...')" /> </a> </li> </xsl:if> </xsl:for-each> </ul> </li> </ul> </div> </xsl:template> </xsl:stylesheet>Hi Adam,
Nice work if you got it working.
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.