[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How to get page range within a group
J.S.,
At 01:38 AM 9/12/2008, you wrote: Hi All, ... <xsl:if test="//doc//pb[position()=1]"> ... This isn't working for you since the expression //doc//pb[position()=1] does not return what you think it does. It may appear it should return the first 'pb' element appearing inside each 'doc' element in the document, but this isn't so. The semantics of "//" is not (as it is commonly glossed) "all the nodes (or elements) all the way down the tree". It is an abbreviation for "/descendant-or-self::node()/", which in itself is not a complete XPath expression, but must be completed by adding an axis and node test. In particular, when you say "//pb" you are implicitly adding the child:: axis (as always when no axis is given explicitly) along with the "pb" node test. That is, "//pb" is short for "/descendant-or-self::node()/child::pb". This is crucial since it means that //pb[1] does not mean "the first 'pb' descendant" but "the first pb child of any descendant". If you actually want the first descendant, the easiest way to get that is (in your case) "//doc/descendant::pb[1]". You may have other problems (I haven't shaken the code out completely), but nothing will work right as long as this isn't correct. I hope that helps, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|