Results 1 to 4 of 4

Thread: XMl/XSLT/CSS Sitemap

  1. #1
    Join Date
    Mar 2005
    Posts
    163
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default XMl/XSLT/CSS Sitemap

    take a look at my sitemap example http://trustyle.shype.co.uk/sitemap.htm

    Its looks nifty, but take a look at the codeand its just piled with <img> tags. I know this could be done with XML & XSLT or CSS and reduce the code prettyrapidly, whilst keeping it SEo friendly too, but I don;t really know ow to start. I do know a basic amount of XML XSLT, but only enough to really read code, not write. If anybody has a quick second and knows how to, that would be great.

    Thanks!

  2. #2
    Join Date
    Oct 2005
    Posts
    256
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hints (this is off the top of my head so it's pseudo code):/

    Create a heirarchical XML document from your site structure i.e.

    <node url="/" title="test>
    <node url="/products" title="Products" />
    <node url="/services" title="Services">
    <node url="/services/stuff" title="Stuff" />
    </node>
    </node>

    Then create an XSLT document which basically just applies the same template a load of times (think of XSLT as a programming language rather than a markup):

    <xsl:template match="node">
    <!--display node here - basically and anchor inside an LI -->
    <xsl:element name="A">
    <xsl:attribute name="href" value="@url" />
    <xsl:value-of select="." />
    </xsl:element>
    <xsl:if test="(XPATH: are there any nodes below this level?)">
    <ul>
    <xsl:apply-templates /> <!-- this just calls any subroutines(templates) on any nodes that match -->
    </ul>
    </xsl:if>
    </xsl:template>

    <ul>
    <xsl:apply-templates />
    </ul>

    Then ... put the two together and hey presto. You'll get an unordered list out which you can style appropriately. Not only that, you have the site structure documented accurately so you can use different XSLTs to generate other navigation structures (including dynamically expanding based on where you are).

    Read through the tutorials at http://www.w3schools.com/ on XPath, XSLT and XML. It's all you ever need :-)

    Hope this helps.

    Reply here if you need any more help.

  3. #3
    Join Date
    Oct 2005
    Posts
    256
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sorry tabbing is screwed so it looks horrible!

  4. #4
    Join Date
    Mar 2005
    Posts
    163
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks!!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. XML/XSL date format
    By Rappie in forum XML
    Replies: 1
    Last Post: 27th July 2006, 01:10 PM
  2. Merge XML and XSL with ASP
    By Rappie in forum ASP (VBScript)
    Replies: 4
    Last Post: 28th June 2006, 12:57 AM
  3. CSS Guide/Tutorial
    By carpeni in forum Garble
    Replies: 7
    Last Post: 28th April 2006, 11:21 PM
  4. IE Tables Ignores CSS
    By JamesU2002 in forum General Technical Support
    Replies: 9
    Last Post: 25th April 2006, 05:53 AM
  5. Re: Catution when using XML for Logic
    By jaimalchohan in forum ASP.NET
    Replies: 3
    Last Post: 25th November 2005, 05:44 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •