Using uCommerce 2, umbraco 4.7.
I have a category side nav showing the categories using:
<a>
<xsl:attribute name="href">
<xsl:value-of select="CommerceLibrary:GetNiceUrlForCategory($catalogueName, #id)"/>
</xsl:attribute>
<xsl:value-of select="#displayName"/>
</a>
First of all, when hovering over the links it still shows an old catalogue name, even though I've renamed the catalogue and also hardcoded the catalogue name into:
<xsl:variable name="catalogueName" select="'MyCatalogue'"/>
When I click on the link generated by GetNiceUrlForCategory I get the standard template that comes with uCommerce started site. I've tried deleting the whole started site, but I just can't get it to link to a template I did for the category.
I still don't quite understand how ucommerce knows which template to use for a category link.
Soren? :)
Cheers,
Matt
Found answer: Change in UrlRewriting.config ... simpelz
Related
I use Altova XMLSpy and Saxon. Saxon adds a lot of tabs and Newlines in the result file. So I added the templates (found here on stackoverflow):
<xsl:template match="*/text()[normalize-space()]">
<xsl:value-of select="normalize-space()"/>
</xsl:template>
<xsl:template match="*/text()[not(normalize-space())]" />
to the stylesheet, which neatly removed all extra white space. However, it also removed the space before and after the <i>....</i> and <q>....</q> inside a <p>:
<p>this is <i>italic</i> text</p>
So both Altova and Saxon gave me:
<p>this is<i>italic</i>text</p>
How can I solve this problem?
Use the xsl:output element to control indentation of the output. Use xsl:strip-space and xsl:preserve-space to control whitespace handling of your input.
Use templates like the two you show only as a last resort. Here, the first template is the one causing the loss of whitepace adjacent to your i elements, because the processors are doing what you told them to do, instead of what you meant to tell them to do.
I want to put check boxes on my page, corresponding to certain tags.
Then I want the user to be able to filter out articles depending on what checkboxes are ticked.
For example: The user wants to read about apples and oranges and therefore ticks both "apples" and "oranges", The result should be articles where both are tagged, but not only apples or only oranges.
Any idea how I can do this in Umbraco?
I'm using umbraco 4.7
There are several ways you can do this. The easiest (but not most scalable) would be to create a checkbox datatype called "fruit". This would be added to all Document types you wanted to be able to filter.
You could then use XLST/XPATH to filter the document types to those with selected fruits.
Edit:
The XSLT you would need to access and display the selected fruit tags for a specific article would be something like:
<xsl:variable name="items" select="umbraco.library:Split($fruit,',')" />
<xsl:for-each select="$items//value">
<xsl:value-of select="umbraco.library:GetPreValueAsString(current())"/>
</xsl:for-each>
In the context of filtering a collection of articles, you could use adapt this code to be something like:
<xsl:for-each select="$currentPage//Article [umbraco.library:Split(./fruit,',')//value = 'orange']">
<xsl:value-of select="./#nodeName"/>
</xsl:for-each>
This will find all Article nodes under the current page that have a fruit tag set as 'orange', and then display each Article's title.
I need to support a site made using umbraco. am a total newbie in umbraco. let me explain my scenario. I have left have menu which is used to navigate to different pages. Now i need to change one menu item to navigate to a different page. How is this posible?
It is using macro to create the main menu. The master page shows it has macro DisplayMainMenu. This macro uses XSLT file DisplayMainMenu. Am attaching the xslt code herewith:
<div id="main_navigation" class="jqueryslidemenu unitPng">
<ul>
<li>Home</li>
<xsl:for-each select="$pagesNodeSet">
<xsl:sort select="./#sortOrder" data-type="text" order="ascending"/>
<li>
<xsl:value-of select="./title"/>
<xsl:if test="count(./*[#isDoc and string(umbracoNaviHide) != '1' and string(includeInMainNavigation) = '1']) > 0">
<ul class="sub-menu">
<xsl:for-each select="./*[#isDoc and string(umbracoNaviHide) != '1' and string(includeInMainNavigation) = '1']">
<xsl:sort select="./#sortOrder" data-type="text" order="ascending"/>
<li><xsl:value-of select="./title"/></li>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</div>
Some code part couldnot be included due to some issues with formatting.
Your xslt is dynamically creating the menu based on your site layout as defined in the content section of the umbraco dashboard. Therefore you can't "change a menu item to point to a different page" as such. What you can do is change you site structure to reflect what you want by adding new pages, moving existing pages or removing unwanted pages.
If you want to add a static page link you can do this by adding it to your xslt above (in the same way the 'Home' link has been added) but you will need to ensure that is sits outside the xslt:for-each loop unless you want to get into some complex xslt coding.
Essentially, what the above code is doing is creating an unorderd list with the first list item statically added for the home page. It is then looping each of the child pages and adding a link. Then for each child page ,if it has visible child pages (by ensuring they are not supposed to be hidden and should be included in the main navigation using their umbracoNaviHide and includeInMainNavigation properties), it is looping over each of them and displaying a link.
I have 2-3 HTML files created per week that will be uploaded via FTP to a folder on the web server. The files are just plain HTML having results from my local Bridge Club.
Before I go ahead and spending time creating a "fancy" solution in .Net for this I better ask if there is any built in support for this in Umbraco.
Basically I want to have a main menu item called Results, and that page should have a secondary menu with links to each .HTML file in a specific folder
Any ideas?
Cheers,
Stefan
First, make sure you put the path that the html files are being uploaded to within the umbracoReservedPaths app setting in the web.config.
Next I would create an XSLT extension (or custom function that returns an XPathNodeIterator containing each HTML file name. The method will need to build an XmlDocument that looks something like:
<files>
<file>/htmlfiles/file1.html</file>
<file>/htmlfiles/file2.html</file>
<file>/htmlfiles/file3.html</file>
</files>
Then call CreateNavigator() on the XmlDocument and return that from the XSLT extension method. Use Directory.GetFiles to get the list of HTML file names and convert them to a web ready URL like /htmlfiles/file1.html.
Then display it all with a simple XSLT macro that iterates the result of your XSLT extension in a for-each. That would look something like:
<xsl:for-each select="customExtensions:GetFiles()//file">
<a>
<xsl:attribute name="href">
<xsl:value-of select="." />
</xsl:attribute>
<xsl:text>File #</xsl:text>
<xsl:value-of select="position()" />
</a>
</xsl:for-each>
This would generate a list like
File #1
File #2
File #3
all linking to their respective value in the xml.
A good example of an extension method is here
When testing with ..
/xsl/sample rendering.xslt
..which is a simple rendering provided out of the box by Sitecore, I notice that, in the loop that outputs the item's children, all children are included, regardless of whether those items have a version in the current language.
Is this normal? ... And is there a way to force/check the language to ensure only the items we want appear?
Sitecore items will always coexist across language barriers. This has to do (atleast I believe this is one of the reasons) with the fact that they all inherit from Standard Template, and this template has some fields that are marked "Shared", i.e. implicitly available to any language.
What the item does not have however, is a Version in the current language. Field values will return null.
You can test this yourself by modifying the Sample Rendering.xsl to this:
<xsl:for-each select="item">
<xsl:value-of select="#name" /> ( <sc:text field="title" /> )
<br />
</xsl:for-each>
I ran a quick test, and this was my result. Sample Item 3 is created in non-context language.
Sitecore Welcome to Sitecore
Sample Item 1 ( Sample Item 1 )
Sample Item 2 ( Sample Item 2 )
Sample Item 3 ( )