cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

XPATH question

cleccese
6-Contributor

XPATH question

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 5

Hi Caroline,

Maybe something like this would work:

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

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)


cleccese
6-Contributor
(To:cleccese)

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!

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-----

Right Lynn, XPath wouldn't grab generated text produced from the
stylesheet, it only pulls information from the XML.

Announcements