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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

How can get results of xpath that is querying within the page to use in footer?

aadal
1-Newbie

How can get results of xpath that is querying within the page to use in footer?

Hello Everybody,

A footer page is defined on Generated Contents tab of Arbortext Styler. Footer should contain an attribute conten valuet within the page. By selecting "Insert> Attribute Content" within "Generated Content" window, I can select the value based on the occurrence (1st,2nd,..., last) of the element. That's good but not enough for the customer requirement. The footer should show the greatest value of attributes within the page.

So I write the statement: (//lep/@lep_date[not(. < //@lep_date)])[1]

The statement selects max value of lep_date attribute of lep elements within an xml document.

When I put this statement within ElementContentPage as shown on the image, the text could not be generated, and I don't see any error messages regarding it.

When I put this statement within XPathString all footers show the same max value of lep_date within whole document. I want the max value of lep_date only within the page, so every page footer will have different values regarding its page content.


You can find the sample xml file that I'm working on, and you can test the statement with.  Do you have any advice?


Thanks,

Andaç

Screen Shot 06-01-15 at 12.27 PM.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
ClayHelberg
17-Peridot
(To:aadal)

Hi Andaç--

I'm afraid what you are asking for can't be done with XPath. That's because in the header and footer sections, there is no context node available, so all XPaths must be resolved as absolute paths, i.e. in the context of the entire document. There isn't a way to limit the scope of the XPath search to the current page.

I don't know of a way to do this in pure Styler. You will likely have to make some source edits (APP or FOSI) to handle this type of thing.

--Clay

View solution in original post

2 REPLIES 2
ClayHelberg
17-Peridot
(To:aadal)

Hi Andaç--

I'm afraid what you are asking for can't be done with XPath. That's because in the header and footer sections, there is no context node available, so all XPaths must be resolved as absolute paths, i.e. in the context of the entire document. There isn't a way to limit the scope of the XPath search to the current page.

I don't know of a way to do this in pure Styler. You will likely have to make some source edits (APP or FOSI) to handle this type of thing.

--Clay

Clay is correct. The XPath function will simply search the entire document, not only what is visible on the page. There are running header/footer features but they won't support your logic (e.g. find highest @lep_date on page). In fact many years ago Arbortext wrote their own product called CPA "Change Page Application" to specifically support looseleaf workflows for defense industry applications.

If you are using APP you can support this @lep_date logic but it would have to be through edited source. For each page you can gather all @lep_dates into a variable then in the footer you can run a function to calculate the highest value of @lep_date and display that. It is too difficult to explain in a message though, unless you already know APP Javascript FOM.

P.S. you should never use the // XPath construct unless absolutely necessary. This will search the entire document and consequently slow your processing down a lot.

Top Tags