[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Absolute-path/index challenge

Subject: Re: Absolute-path/index challenge
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 21 Jan 2000 12:57:56 -0500
absolute path website
At 00/01/20 12:58 -0600, Thomas E Enebo wrote:
As an extension of the position() of parent question from digest 480,
I have a challenge.  How can a template be created, such that it will
print out the complete path of current node from the root?  As an
example:

<A>
  <B>
    <C/>
  </B>
  <B>
    <C/>
    <C/> <--- calling a template with current() here...
  </B>
  <B>
  </B>
</A>

will yield

A:1.B:2.C:2

The following is the output for the above (with the comment repaired) from the SHOWTREE diagnostic stylesheet available through the free resources page on our web site:


1  Element 'A' ():
1.1  Text (A): {
  }
1.2  Element 'B' (A):
1.2.1  Text (A,B): {
    }
1.2.2  Element 'C' (A,B): (no child nodes or attributes)
1.2.3  Text (A,B): {
  }
1.3  Text (A): {
  }
1.4  Element 'B' (A):
1.4.1  Text (A,B): {
    }
1.4.2  Element 'C' (A,B): (no child nodes or attributes)
1.4.3  Text (A,B): {
    }
1.4.4  Element 'C' (A,B): (no child nodes or attributes)
1.4.5  Text (A,B): { }
1.4.6  Comment (A,B): {- calling a template with current() here...}
1.4.7  Text (A,B): {
  }
1.5  Text (A): {
  }
1.6  Element 'B' (A):
1.6.1  Text (A,B): {
  }
1.7  Text (A): {
}

The numbers above correspond to *all* nodes, so text nodes are included in the count as well.

I hope you find it useful in figuring out the detail of precisely what you need.

............... Ken


-- G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995) Web site: XSL/XML/DSSSL/SGML services, training, libraries, products. Practical Transformation Using XSLT and XPath ISBN 1-894049-03-9 Next instructor-led training: 2000-02-27/28,2000-05-11/12,2000-05-15


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.