Results 1 to 3 of 3

Thread: Stepping throught XML [XSLT/Xpath]

  1. #1
    Member
    Join Date
    Aug 2003
    Location
    Glasgow
    Posts
    132
    Thanks
    0
    Thanked
    0 times in 0 posts

    Question Stepping throught XML [XSLT/Xpath]

    Firstly let me say I hate XSLT, sometimes it easy then other times its just plain confusing!!
    Heres my problem.
    I have an xml doc(navigation.xml), which is the basis for naviagtion between pages in our site. Im adding various types of additional navigation up,home etc as options which can be turned on/off.
    Iv been asked to add a linear heirarchical navigation option (Back & Forward)

    Im passing in the current page id (tcm attribute) then I need to find the current page check if its published and also order the page nodes (order attribute), so it needs to be able to navigate siblings and parents aswell and check when it reaches the start/end etc..

    Any help would be appreciated

    A sample of the xml is included below:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <webstructure pagecount="10" lastmodified="19/01/2005 15:07:52">
    	<page title="tcm:4-148994-64" tcm="Home" channel="10" att4="/lts/testbed/index.asp" att5="Yes" att6="Young people" att7="" att8="True">
    		<page tcm="tcm:4-148994-64" title="Home" order="10" filename="/lts/testbed/index.asp" leftmenu="Yes" titleattribute="Young people" accesskey="" published="True"/>
    		<page tcm="tcm:4-148843-64" title="level1" order="0" filename="/lts/testbed/level1/index.asp" leftmenu="Yes" titleattribute="" accesskey="" published="True">
    			<page tcm="tcm:4-148844-64" title="page1" order="1" filename="/lts/testbed/level1/page1.asp" leftmenu="Yes" titleattribute="" accesskey="" published="True"/>
    			<page tcm="tcm:4-148845-64" title="page2" order="2" filename="/lts/testbed/level1/page2.asp" leftmenu="Yes" titleattribute="" accesskey="" published="True"/>
    			<page tcm="tcm:4-148846-64" title="page3" order="3" filename="/lts/testbed/level1/page3.asp" leftmenu="Yes" titleattribute="" accesskey="" published="True"/>
    		</page>
    		<page tcm="tcm:4-148847-64" title="level2" order="0" filename="/lts/testbed/level2/index.asp" leftmenu="Yes" titleattribute="" accesskey="" published="True">
    			<page tcm="tcm:4-148848-64" title="page1" order="1" filename="/lts/testbed/level2/page1.asp" leftmenu="Yes" titleattribute="" accesskey="" published="True"/>
    			<page tcm="tcm:4-148849-64" title="page2" order="2" filename="/lts/testbed/level2/page2.asp" leftmenu="Yes" titleattribute="" accesskey="" published="True"/>
    			<page tcm="tcm:4-148850-64" title="page3" order="3" filename="/lts/testbed/level2/page3.asp" leftmenu="Yes" titleattribute="" accesskey="" published="True"/>
    		</page>
    	</page>
    </webstructure>

  2. #2
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts
    I never knew explaining page hierarchy in plain English was so damn confusing!

    What exactly is your problem? You've just told us what you have, tags for order and published, all i dont see is a tag to check for begin/end.
    To err is human. To really foul things up ... you need a computer.

  3. #3
    Member
    Join Date
    Aug 2003
    Location
    Glasgow
    Posts
    132
    Thanks
    0
    Thanked
    0 times in 0 posts
    Ok Heres a better explanation of my problem(hopefully):

    I have a list of pages/sub pages and from ASP im passing the variable
    'PageTCM' (the current page identifier) to the XSLT transformation.

    I then need the XSLT to
    1. Order the pages in the XML - using the 'order' attribute.
    2. Find the current page in the ordered list.
    3. Return the Next Page's filename and title attributes. - checking
    that it is published first
    4. Return the Previous Page's filename and title attributes. -
    checking that it is published first.

    NB. Being a XSLT novice I should point out that Im not sure that the
    above is the most efficient order of events (should I find the current
    page first then order only the pages in its group as opposed to
    ordering all pages).

    Thanks and Regards
    Paul
    ----------------------------------------------------------------------------
    Example
    Inputs:
    1. strCurrentPage = "tcm:Info"

    Outputs:
    1. strNextPagePath = "company/sales.asp"
    2. strNextPageTitle = "Sales"
    3. strPreviousPagePath = "company/index.asp"
    4. strPreviousPageTitle = "Our Company"
    ----------------------------------------------------------------------------
    <?xml version="1.0" encoding="UTF-8"?>
    <webstructure pagecount="10">
    <page title="tcm:Home0" tcm="Home" channel="10" att4="index.asp" att8="True">
    <page tcm="tcm:Home" title="Home" order="10" filename="index.asp"published="True"/>
    <page tcm="tcm:Company" title="Our Company" order="0"filename="company/index.asp" published="True">
    <page tcm="tcm:Sales" title="Sales" order="2"filename="company/sales.asp" published="True"/>
    <page tcm="tcm:Info" title="Info" order="1"filename="company/info.asp" published="True"/>
    <page tcm="tcm:Contact" title="Contact" order="3"filename="company/contact.asp" published="True"/>
    </page>
    <page tcm="tcm:Prods" title="Our Products" order="0"filename="products/index.asp" published="True">
    <page tcm="tcm:Goods" title="Goods" order="1"filename="products/goods.asp" published="True"/>
    <page tcm="tcm:Services" title="Services" order="2"filename="products/services.asp" published="True"/>
    </page>
    </page>
    </webstructure>
    ----------------------------------------------------------------------------

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. More info needed before buying an AMD 2500+ withe AQXEA stepping
    By firefox in forum PC Hardware and Components
    Replies: 12
    Last Post: 02-03-2004, 06:51 PM
  2. Iqyha Barton stepping?
    By Wurzel in forum PC Hardware and Components
    Replies: 15
    Last Post: 01-03-2004, 11:55 PM

Posting Permissions

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