Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 30th, 2006, 05:40 PM
Registered User
 
Join Date: Mar 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need XSLT Help! Umbraco CMS!!!

Hi. New to the board. I have a problem. I wrote a nice little CSS nav a while back and want to integrate it with Umbraco Open Source CMS (http//www.umbraco.org). First off, I want to apologize in advance, I have very little XSLT experience. That said, I was able to get the top
level nav working using an example I found.

So, here is an example of what I got the XSLT to display:
----------------------------------------------------
<DIV ID="topNav" CLASS="navBar">
    <DIV CLASS="collapsed">
       <DIV CLASS="navItem" onclick="goTo('1.html');">Level 1</DIV>
    </DIV>
</DIV>
----------------------------------------------------

So, here is what I need the XSLT to display (only if a child exists,
of course):
----------------------------------------------------
<DIV ID="topNav" CLASS="navBar">
    <DIV CLASS="collapsed">
    <DIV CLASS="navItem" onclick="goTo('1.aspx');">LEVEL 1</DIV>

        <DIV CLASS="dropContainer">
           <DIV CLASS="dropMenu">
              <DIV CLASS="dropItem"><A HREF="2.aspx">LEVEL 2</A></DIV>
           </DIV>
        </DIV>

    </DIV>
</DIV>
----------------------------------------------------

Here is my XSLT file.
----------------------------------------------------
<?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"
     exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>

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

<xsl:template match="/">

<div id="topNav" class="navBar">
<xsl:for-each select="$currentPage/ancestor-or-self::node
[@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']">
<div class="collapsed">
<div class="navItem" onclick="goTo('{umbraco.library:NiceUrl(@id)}');">
<xsl:if test="$currentPage/ancestor-or-self::node/@id =
current()/@id"></xsl:if>
<xsl:value-of select="@nodeName"/>
</div>
</div>
</xsl:for-each>
</div>
</xsl:template>
</xsl:stylesheet>
----------------------------------------------------

So, if I change the "1" values in this file to "2" it will
display the second level nav - I guess for a seperate nav somewhere
else on a page. What I need to do is display 1 and 2 using the same
XSLT file. As well as format the 2nd level to display like example above.

Any help would be huge! If anyone can help me get this working - I'll
send to the Umbraco folks - in case they want to make it available for
download or whatever. HUGE thanks in advance!

Jim


 
Old March 30th, 2006, 06:55 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Without knowing anything about your source document (or the content of the $currentPage parameter) it's not easy to offer you any useful advice.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old March 30th, 2006, 08:55 PM
Registered User
 
Join Date: Mar 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks! See, I told you I didn't know much about this stuff. :) Hey, is this the file?

<!DOCTYPE umbraco [
  <!ELEMENT nodes ANY>
  <!ELEMENT node ANY>
  <!ATTLIST node id ID #REQUIRED>
]>
<root id="-1"><node id="1045" version="fb4d69c2-544c-4c2a-ae77-b193ba840a35" parentID="-1" level="1" writerID="4" creatorID="0" nodeType="1043" template="1044" sortOrder="2" createDate="2006-03-28T19:10:37" updateDate="2006-03-29T15:30:16" nodeName="STANDARDS RULE" urlName="standards-rule" writerName="Harish" creatorName="umbraco_system" nodeTypeAlias="homepage" path="-1,1045"><data versionID="fb4d69c2-544c-4c2a-ae77-b193ba840a35" alias="meta_info"><![CDATA[<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<meta name="description" content=""></meta>
<meta name="keywords" content=""></meta>
<meta name="Robots" content="index,follow"></meta>
<meta name="GOOGLEBOT" content="INDEX,FOLLOW"></meta>]]></data><data versionID="fb4d69c2-544c-4c2a-ae77-b193ba840a35" alias="page_title">STANDARDS RULE</data><data versionID="fb4d69c2-544c-4c2a-ae77-b193ba840a35" alias="content_left_top"><![CDATA[<h3>W3C Compliant Design</h3>

<p><span class="black_text">Standards Rule creates W3C Standards Compliant websites that are an investment in the success of your organization.</span></p>

<h3>Accessibility 508 Compliance</h3>

<p><span class="black_text">Standards Rule produces Flash sites &amp; applications with db access, interactivity, advanced reporting &amp; exciting animation.</span></p>

<h3>Strategy &amp; Consulting</h3>

<p><span class="black_text">Standards Rule can tell you everything about how your Website visitors found you and how they interact with your site.</span></p>

]]></data><data versionID="fb4d69c2-544c-4c2a-ae77-b193ba840a35" alias="content_right_top"><![CDATA[<h3>Accessible eCommerce</h3>

<p><span class="black_text">Standards Rule specializes in relational database design, development and implementation for businesses.</span></p>

<h3>CSS Content Management System</h3>

<p><span class="black_text">Standards Rule offers ASP.net, VB.net, AJAX, Java, C, C++, C# &amp; Coldfusion programming for Web applications.</span></p>

<h3>Marketing &amp; Analytics</h3>

<p><span class="black_text">Standards Rule can help you achieve your revenue, market share &amp; customer loyalty objectives</span></p>

]]></data><data versionID="fb4d69c2-544c-4c2a-ae77-b193ba840a35" alias="sublogo"><![CDATA[<h2>Standards Compliant Design · Standards Based CMS · CSS eCommerce</h2>

]]></data><data versionID="fb4d69c2-544c-4c2a-ae77-b193ba840a35" alias="image_mid_l">/media/90/client1.jpg</data><data versionID="fb4d69c2-544c-4c2a-ae77-b193ba840a35" alias="image_mid_c">/media/105/client2.jpg</data><data versionID="fb4d69c2-544c-4c2a-ae77-b193ba840a35" alias="image_mid_r">/media/120/client3.jpg</data><data versionID="fb4d69c2-544c-4c2a-ae77-b193ba840a35" alias="gray_bar_l"><![CDATA[<span class="subhead2">Hewlett-Packard</span>
<p><span class="white_text">Standards Rule works with HP to increase overall customer satifaction and the online experience for their millions of customers.</span></p>

]]></data><data versionID="fb4d69c2-544c-4c2a-ae77-b193ba840a35" alias="gray_bar_c"><![CDATA[<span class="subhead2">Sempra Energy</span>
<p><span class="white_text">Sempra Energy turned to Standards Rule to develop an online web application that significantly improved their business process.</span></p>

]]></data><data versionID="fb4d69c2-544c-4c2a-ae77-b193ba840a35" alias="gray_bar_r"><![CDATA[<span class="subhead2">WiredRed</span>
<p><span class="white_text">WiredRed turned to Standards Rule to develop an online web application that significantly improved their business process.</span></p>

]]></data><node id="1084" version="6cbc54f1-66fb-4d5c-9dee-675397569ab3" parentID="1045" level="2" writerID="2" creatorID="2" nodeType="1074" template="1075" sortOrder="1" createDate="2006-03-29T11:41:06" updateDate="2006-03-29T11:41:19" nodeName="About Us" urlName="about-us" writerName="Jim McArthur" creatorName="Jim McArthur" nodeTypeAlias="subpage_main" path="-1,1045,1084"><data versionID="6cbc54f1-66fb-4d5c-9dee-675397569ab3" alias="meta_info"><![CDATA[<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<meta name="description" content=""></meta>
<meta name="keywords" content=""></meta>
<meta name="Robots" content="index,follow"></meta>
<meta name="GOOGLEBOT" content="INDEX,FOLLOW"></meta>]]></data><data versionID="6cbc54f1-66fb-4d5c-9dee-675397569ab3" alias="page_title">About Standards Rule</data><node id="1085" version="851cd927-a645-4404-a05b-ff6ddd40f46f" parentID="1084" level="3" writerID="2" creatorID="2" nodeType="1076" template="1077" sortOrder="1" createDate="2006-03-29T11:42:11" updateDate="2006-03-29T11:42:44" nodeName="Management" urlName="management" writerName="Jim McArthur" creatorName="Jim McArthur" nodeTypeAlias="subpage" path="-1,1045,1084,1085"><data versionID="851cd927-a645-4404-a05b-ff6ddd40f46f" alias="meta_info"><![CDATA[<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<meta name="description" content=""></meta>
<meta name="keywords" content=""></meta>
<meta name="Robots" content="index,follow"></meta>
<meta name="GOOGLEBOT" content="INDEX,FOLLOW"></meta>]]></data><data versionID="851cd927-a645-4404-a05b-ff6ddd40f46f" alias="page_title">Management</data><node id="1093" version="2810ded0-2dbb-468f-8043-d3cb8fdaa62f" parentID="1085" level="4" writerID="2" creatorID="2" nodeType="1076" template="1077" sortOrder="1" createDate="2006-03-29T14:21:37" updateDate="2006-03-29T14:21:48" nodeName="Ben Philyaw" urlName="ben-philyaw" writerName="Jim McArthur" creatorName="Jim McArthur" nodeTypeAlias="subpage" path="-1,1045,1084,1085,1093"><data versionID="2810ded0-2dbb-468f-8043-d3cb8fdaa62f" alias="meta_info"><![CDATA[]]></data><data versionID="2810ded0-2dbb-468f-8043-d3cb8fdaa62f" alias="page_title"></data></node><node id="1094" version="91463186-882b-47f3-82e3-2f3e348fe9a9" parentID="1085" level="4" writerID="2" creatorID="2" nodeType="1076" template="1077" sortOrder="2" createDate="2006-03-29T14:22:02" updateDate="2006-03-29T14:22:11" nodeName="Jim McArthur" urlName="jim-mcarthur" writerName="Jim McArthur" creatorName="Jim McArthur" nodeTypeAlias="subpage" path="-1,1045,1084,1085,1094"><data versionID="91463186-882b-47f3-82e3-2f3e348fe9a9" alias="meta_info"><![CDATA[]]></data><data versionID="91463186-882b-47f3-82e3-2f3e348fe9a9" alias="page_title"></data></node></node></node></node></root>


 
Old March 31st, 2006, 04:21 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Just as well I've got Stylus Studio installed, when you have to look at horrible XML like this!

Presumably - I'm guessing - the $currentPage parameter is a "node" element? (You really should document your parameters!)

But sorry: this question doesn't pass the two-minute test. If after two minutes I can't understand what problem you're having, I give up. Read the book, and tell me which bit you don't understand.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old February 4th, 2009, 04:37 PM
Registered User
 
Join Date: Sep 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi jmcarth

Umbraco is kind of hard to get started with.
Try to look at this page http://packages.maliciousthinktank.com/navdemo.aspx
There is an example shown that accomplishes what you want. The code is also explained.

cheers
kimtoft





Similar Threads
Thread Thread Starter Forum Replies Last Post
CMS abaso.jadhav01 ASP.NET 2.0 Basics 3 November 22nd, 2006 02:47 AM
CMS-Cant Login SoftMind BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 42 August 10th, 2006 03:23 PM
CMS easter BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 12 August 7th, 2006 04:15 PM
CMS Automation zubo01 XML 6 June 6th, 2006 09:05 AM
CMS anshul Pro PHP 2 May 30th, 2005 01:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.