[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] XSL Previous Node


Subject: [xsl] XSL Previous Node
From: c p <bugs75il@xxxxxxxxx>
Date: Wed, 16 Mar 2005 09:14:50 -0800 (PST)

Hello,

I have an xml file that could look something like
below.  Say I have a node called "servertype" that
could occur at any level.  In my XSLT, when I am on a
certain "servertype", I want to get find out exactly
where in the xml was the previous and next instance of
"servertype" node.  Key point is that "servertype"
could occur at any level with the XML structure so I
do not think preceding-sibling asex would work.  If I
use ancestor axes then it ignores any previous
instance of the "servertype" node at the same level.

How do I fix this?

Below is the XML.  Given that my content node is
"servertype" (with id="2222"), I want to output
something like this:

Previous servertype id is: 1111
Next servertype id is: 3333
------------------------------------------------------
<root>
  <servertype id="1111"/>
  <somenode>
    <othernode>
        <servertype id="2222"/>
    </othernode>
  </somenode>
  <yetanothernode>
      <servertype id="3333"/>
  </yetanothernode>
</root>



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 


Current Thread
Keywords