Skip to main content
1-Visitor
November 18, 2013
Question

XPATH question

  • November 18, 2013
  • 5 replies
  • 1454 views

Hi All,


This is my markup:
<sim>
</sim>


I am only interested in capturing the text "some text here", ie all text that comes before any of the children of <sim>


I think <titlepg> is always the first child so I can have it stop there


Can this be done in XPATH?

    5 replies

    10-Marble
    November 18, 2013
    Hi Caroline,

    Maybe something like this would work:

    /sim/text()[not(preceding-sibling::*)]

    1-Visitor
    November 19, 2013
    Caroline,



    That looks like the supporting information chapter from 40051. If that is
    the case, I'm not sure what you are putting between the <sim> and <titlep>.
    The first child of <sim> is <titlepg>.

    The style sheet might put some generic information (chapter number and
    SUPPORTING INFORMATION) there, but I can't think of anything else that would
    be there, content wise at least.



    Richard, would your XPATH capture system generated text? I don't think so.
    I guess it would depend on when the expression is called. During editing,
    other than comments, there is nothing allowed.





    Lynn
    (the LEH in the DTD)


    cleccese1-VisitorAuthor
    1-Visitor
    November 19, 2013

    Lynn, you're right, I just wanted to capture the Chapter Title and "SUPPORTING INFORMATION" so I could check the length for PDF bookmarks because there seems to be a character limit on the bookmarks and some of the titles are too long. (Actually I should have been testing a <mim>, the <sim> length is OK.) You're also right it's generated text so XPATh doesn't work. Oh well!

    1-Visitor
    November 19, 2013
    Caroline,

    You might be able to capture the FO output during the post processing and check string length through that.

    Another possibility is to populate an array with the chapter type and maintenance level information and then based on the parent element (e.g., <mim> or <sim>) and the maintenance level attribute you could build a pseudo title.

    The chapter title page FO file has the information you'd need for this.


    Lynn
    ---- Caroline Leccese <caroline@thecodesource.net> wrote:
    > Lynn, you're right, I just wanted to capture the Chapter Title and "SUPPORTING INFORMATION" so I could check the length for PDF bookmarks because there seems to be a character limit on the bookmarks and some of the titles are too long. (Actually I should have been testing a <mim>, the <sim> length is OK.) You're also right it's generated text so XPATh doesn't work. Oh well!
    >
    >
    > -----End Original Message-----
    10-Marble
    November 19, 2013
    Right Lynn, XPath wouldn't grab generated text produced from the
    stylesheet, it only pulls information from the XML.