Area is a subpage of the main site, areas sub pages of the Area page and the sites are sub folders of the areas, each site (ie site1,site2..) has it's own domain pointing at it. I want to list all the sites under and area on the area1/area2.. page but instead of the link being Areas/Area1/site1 I want it to point at the domain I have set for the site.
Ok, I have almost done it, but when I try adding the namespace to the xslt file I get
Error occured
System.Xml.XmlException: 'urn' is an unexpected token. Expecting white space. Line 12, position 25. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.Throw(String res, String arg) at System.Xml.XmlTextReaderImpl.ParseAttributes() at System.Xml.XmlTextReaderImpl.ParseElement() at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.Xsl.Xslt.XsltInput.ReadNextSiblingHelper() at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling() at System.Xml.Xsl.Xslt.XsltInput.MoveToNextSibling() at System.Xml.Xsl.Xslt.XsltInput.Start() at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument() at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)
Get SubPages from CurrentPage, but show link as the domain link
Hello
I seem to be missing something here.
I have a site that is as follows:
Main page
--Areas
-------Area 1
-------------Site1
-------------Site2
-------Area 2
-------------Site1
-------------Site2
Area is a subpage of the main site, areas sub pages of the Area page and the sites are sub folders of the areas, each site (ie site1,site2..) has it's own domain pointing at it.
I want to list all the sites under and area on the area1/area2.. page but instead of the link being Areas/Area1/site1 I want it to point at the domain I have set for the site.
Is there a way of getting at the domain in XSLT?
Thanks
Bex
Umbraco library defines:
public static Domain[] GetCurrentDomains(int NodeId)
this may be of help?
Can I use that in XSLT?
Something like:
<xsl:for-each select="umbraco.library:GetCurrentDomains($nodeId)"> ....
Hi Bex (+ Darren),
The GetCurrentDomains method unfortunately can't be used in XSLT (the return type doesn't comply with anything XSLT can handle).
I'd probably put a domain property on the Document Type for the Site nodes and use that when rendering those links.
/Chriztian
Ah yeah, it returns an array. You could easily wrap it up to return a nodeset though I guess.
Bex, do you have any experience writing XSL extension functions?
Hello!
Darren, No I haven't writte any XSL extension functions..
Do you have any examples of how I would acheive what I am trying to do?
Becky
See:
http://en.wikibooks.org/wiki/Umbraco/Create_xslt_exstension_like_umbraco.Library_in_C
You'd need to wrap the existing umbraco library function to return a node set or similar.
To do this would I just create a function like so:
public static string getDomain(Domains) {
return Domains[0]
}
were domains is umbraco.library:GetCurrentDomains($nodeId), or would I pass in the nodeId and then do the work off the document Id?
Not completely sure I understand! Very new to xslt stuff and the umbraco way of doing things!
Becky
Ok, I have almost done it, but when I try adding the namespace to the xslt file I get
Error occured
System.Xml.XmlException: 'urn' is an unexpected token. Expecting white space. Line 12, position 25.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.Xsl.Xslt.XsltInput.ReadNextSiblingHelper()
at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling()
at System.Xml.Xsl.Xslt.XsltInput.MoveToNextSibling()
at System.Xml.Xsl.Xslt.XsltInput.Start()
at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument()
at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)
my Xslt is as follows:
Can you see anything wrong?
Bex
I can't edit the above message, it goes all wonky.. but my actual xslt doesn't have two of these:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
at the top
Ok, such a misleading error mesage. it was because I had not put thereference in correctly in the config file.
is working on a reply...