Loading ...
Sorry, an error occurred while loading the content.

Re: [XSL-FO] XPath Query Problem

Expand Messages
  • G. Ken Holman
    ... Actually, that happens to be invalid XPath syntax ... you would want a two-step path as follows: parent::*/following-sibling::BODY or, more simply:
    Message 1 of 4 , Nov 26, 2003
    View Source
    • 0 Attachment
      At 2003-11-26 09:39 +0000, Chris Bowditch wrote:
      >sguy_chennai wrote:
      >
      ><snip/>
      >
      > > i tried the below but it is not working
      > >
      > > <xsl:for-each select="MAIN/FIRST/COLUMN">
      > > <xsl:if test="following = 'BODY'">
      >
      >Inside the for-each, the node context will be COLUMN, so what you need
      >to look for is whether the following sibling of the parent is a BODY
      >element. I believe the below does this:
      >
      ><xsl:if test="parent::following-sibling::BODY">

      Actually, that happens to be invalid XPath syntax ... you would want a
      two-step path as follows:

      parent::*/following-sibling::BODY

      or, more simply:

      ../following-sibling::BODY

      But that will check to see if there are *any* following siblings named
      BODY. If you want to see if only the very next sibling is named BODY, you
      would use:

      ../following-sibling::*[1][self::BODY]

      which means:

      - go to my parent regardless of name
      - look at all following siblings regardless of name
      - filter to only look at the closest following sibling
      - filter to only keep that sibling if it is a BODY element

      I hope this helps.

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


      --
      Next public European delivery: 3-day XSLT/2-day XSL-FO 2004-01-??
      Instructor-led on-site corporate, government & user group training
      for XSLT and XSL-FO world-wide: please contact us for the details

      G. Ken Holman mailto:gkholman@...
      Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
      Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
      ISBN 0-13-065196-6 Definitive XSLT and XPath
      ISBN 0-13-140374-5 Definitive XSL-FO
      ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
      ISBN 1-894049-11-X Practical Formatting Using XSL-FO
      Member of the XML Guild of Practitioners: http://XMLGuild.info
      Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
    Your message has been successfully submitted and would be delivered to recipients shortly.